00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef SOQT_RENDERAREA_H
00027 #define SOQT_RENDERAREA_H
00028
00029 #include <Inventor/SbColor.h>
00030 #include <Inventor/SbViewportRegion.h>
00031 #include <Inventor/actions/SoGLRenderAction.h>
00032 #include <Inventor/SoSceneManager.h>
00033
00034 #include <Inventor/Qt/SoQtGLWidget.h>
00035
00036 class SbColor;
00037 class SoNode;
00038 class SoSelection;
00039
00040 class SoQtDevice;
00041
00042
00043
00044 class SoQtRenderAreaP;
00045
00046 typedef SbBool SoQtRenderAreaEventCB(void * closure, QEvent * event);
00047
00048
00049
00050 class SOQT_DLL_API SoQtRenderArea : public SoQtGLWidget {
00051 SOQT_OBJECT_HEADER(SoQtRenderArea, SoQtGLWidget);
00052
00053 public:
00054 SoQtRenderArea(QWidget * parent = NULL,
00055 const char * name = NULL,
00056 SbBool embed = TRUE,
00057 SbBool mouseInput = TRUE,
00058 SbBool keyboardInput = TRUE);
00059 ~SoQtRenderArea();
00060
00061 virtual void setSceneGraph(SoNode * scene);
00062 virtual SoNode * getSceneGraph(void);
00063 void setOverlaySceneGraph(SoNode * scene);
00064 SoNode * getOverlaySceneGraph(void);
00065
00066 void setBackgroundColor(const SbColor & color);
00067 const SbColor & getBackgroundColor(void) const;
00068 void setBackgroundIndex(int idx);
00069 int getBackgroundIndex(void) const;
00070 void setOverlayBackgroundIndex(int idx);
00071 int getOverlayBackgroundIndex(void) const;
00072 void setColorMap(int start, int num, const SbColor * colors);
00073 void setOverlayColorMap(int start, int num, const SbColor * colors);
00074 void setViewportRegion(const SbViewportRegion & newRegion);
00075 const SbViewportRegion & getViewportRegion(void) const;
00076 void setTransparencyType(SoGLRenderAction::TransparencyType type);
00077 SoGLRenderAction::TransparencyType getTransparencyType(void) const;
00078 void setAntialiasing(SbBool smoothing, int numPasses);
00079 void getAntialiasing(SbBool & smoothing, int & numPasses) const;
00080 void setClearBeforeRender(SbBool enable, SbBool zbEnable = TRUE);
00081 SbBool isClearBeforeRender(void) const;
00082 SbBool isClearZBufferBeforeRender(void) const;
00083 void setClearBeforeOverlayRender(SbBool enable);
00084 SbBool isClearBeforeOverlayRender(void) const;
00085 void setAutoRedraw(SbBool enable);
00086 SbBool isAutoRedraw(void) const;
00087 void setRedrawPriority(uint32_t priority);
00088 uint32_t getRedrawPriority(void) const;
00089 static uint32_t getDefaultRedrawPriority(void);
00090 void render(void);
00091 void renderOverlay(void);
00092 void scheduleRedraw(void);
00093 void scheduleOverlayRedraw(void);
00094 void redrawOnSelectionChange(SoSelection * selection);
00095 void redrawOverlayOnSelectionChange(SoSelection * selection);
00096 void setEventCallback(SoQtRenderAreaEventCB * func, void * user = NULL);
00097 void setSceneManager(SoSceneManager * manager);
00098 SoSceneManager * getSceneManager(void) const;
00099 void setOverlaySceneManager(SoSceneManager * manager);
00100 SoSceneManager * getOverlaySceneManager(void) const;
00101 void setGLRenderAction(SoGLRenderAction * action);
00102 SoGLRenderAction * getGLRenderAction(void) const;
00103 void setOverlayGLRenderAction(SoGLRenderAction * action);
00104 SoGLRenderAction * getOverlayGLRenderAction(void) const;
00105
00106 SbBool sendSoEvent(const SoEvent * event);
00107
00108 void registerDevice(SoQtDevice * device);
00109 void unregisterDevice(SoQtDevice * device);
00110
00111
00112 protected:
00113 SoQtRenderArea(QWidget * parent,
00114 const char * name,
00115 SbBool embed,
00116 SbBool mouseInput,
00117 SbBool keyboardInput,
00118 SbBool build);
00119
00120 virtual void redraw(void);
00121 virtual void actualRedraw(void);
00122 virtual void redrawOverlay(void);
00123 virtual void actualOverlayRedraw(void);
00124
00125 virtual SbBool processSoEvent(const SoEvent * const event);
00126 virtual void processEvent(QEvent * event);
00127 virtual void initGraphic(void);
00128 virtual void initOverlayGraphic(void);
00129 virtual void sizeChanged(const SbVec2s & size);
00130 virtual void widgetChanged(QWidget * widget);
00131 virtual void afterRealizeHook(void);
00132
00133 QWidget * buildWidget(QWidget * parent);
00134
00135 virtual const char * getDefaultWidgetName(void) const;
00136 virtual const char * getDefaultTitle(void) const;
00137 virtual const char * getDefaultIconTitle(void) const;
00138
00139 virtual SbBool glScheduleRedraw(void);
00140
00141 private:
00142 class SoQtRenderAreaP * pimpl;
00143 friend class SoQtRenderAreaP;
00144 };
00145
00146
00147
00148 #endif // ! SOQT_RENDERAREA_H