00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _SO_QT_DIRECTIONAL_LIGHT_EDITOR_
00025 #define _SO_QT_DIRECTIONAL_LIGHT_EDITOR_
00026 #include <Inventor/Qt/OivQtCompat.h>
00027 #include <Inventor/Qt/SoQtComponent.h>
00028 #include <Inventor/misc/SoCallbackList.h>
00029
00030 class SbColor;
00031 class SoDirectionalLight;
00032 class SoSeparator;
00033 class SoDirectionalLightManip;
00034 class SoDragger;
00035 class SoQtColorEditor;
00036 class SoQtColorSlider;
00037 class SoQtRenderArea;
00038 class SoNodeSensor;
00039 class QMenu;
00040 class QAction;
00041 class SoSensor;
00042 class SoCamera;
00043 class SoPerspectiveCamera;
00044 class SoPath;
00045
00046
00047 typedef void SoQtDirectionalLightEditorCB(void *userData, const SoDirectionalLight *light);
00048
00049
00051
00052
00081 class SoQtDirectionalLightEditor : public SoQtComponent {
00082
00083 Q_OBJECT
00084
00085 public:
00089 SoQtDirectionalLightEditor( QWidget* parent = qApp->activeWindow(),
00090 const char *name = NULL,
00091 SbBool buildInsideParent = TRUE);
00095 ~SoQtDirectionalLightEditor();
00096
00101 void attach(SoPath *pathToLight);
00105 void detach();
00109 SbBool isAttached() { return (dirLight != NULL); }
00110
00114 void setLight(const SoDirectionalLight &newLight);
00118 const SoDirectionalLight &getLight() const { return *dirLight; }
00119
00125 void addLightChangedCallback (SoQtDirectionalLightEditorCB *f,
00126 void *userData = NULL)
00127 { callbackList->addCallback((SoCallbackListCB *) f, userData); }
00131 inline void removeLightChangedCallback (SoQtDirectionalLightEditorCB *f,
00132 void *userData = NULL)
00133 { callbackList->removeCallback((SoCallbackListCB *) f, userData); }
00134
00135
00136
00137 virtual void show();
00138 virtual void hide();
00139
00140 private:
00141 QWidget* mgrWidget;
00142
00143
00144
00145
00146 SoEXTENDER
00147 SoQtDirectionalLightEditor( QWidget* parent,
00148 const char *name,
00149 SbBool buildInsideParent,
00150 SbBool buildNow);
00151
00152
00153 virtual SbString getDefaultWidgetName() const;
00154 virtual SbString getDefaultTitle() const;
00155 virtual SbString getDefaultIconTitle() const;
00156
00157
00158 SoDirectionalLight* dirLight;
00159 SoSeparator* root;
00160 SoSeparator* litStuff;
00161 SoPerspectiveCamera* myCamera;
00162 SoCamera* cameraToWatch;
00163 SoNodeSensor* lightSensor;
00164 SoNodeSensor* cameraSensor;
00165 SoDirectionalLightManip* dirLightManip;
00166 static char* geomBuffer;
00167
00168
00169 SoQtColorEditor *colorEditor;
00170 SoQtColorSlider* intensitySlider;
00171 SoQtRenderArea* renderArea;
00172
00173
00174
00175 SbBool ignoreCallback;
00176 SoCallbackList* callbackList;
00177
00178
00179 void copyLight(SoDirectionalLight *dst, const SoDirectionalLight *src);
00180 void updateLocalComponents();
00181
00182 private:
00183
00184
00185 void constructorCommon(SbBool buildNow);
00186 QWidget* buildWidget(QWidget* parent);
00187 void activate();
00188 void deactivate();
00189
00190
00191 static void colorEditorCloseCB(void *userData, SoQtComponent *comp) ;
00192 static void colorEditorCB(void *, const SbColor *);
00193 static void dirLightManipCB(void *, SoDragger *);
00194 static void intensitySliderCB(void*, float);
00195 static void cameraSensorCB(SoQtDirectionalLightEditor *, SoSensor *);
00196 static void lightSensorCB(SoQtDirectionalLightEditor *, SoSensor *);
00197 static void dialogCloseCB(void*, SoQtComponent*);
00198
00199
00200 QMenu* edit_menu;
00201 QAction* IDM_LEDT_COLOR_EDITOR;
00202
00203 private Q_SLOTS:
00204 void visibilityChangeCB(SbBool visible);
00205 void launchColorEditor();
00206 void copy();
00207 void paste();
00208 void showHelp();
00209 void keepOnTop();
00210 void slot_help();
00211 };
00212
00213 #endif // _SO_QT_DIRECTIONAL_LIGHT_EDITOR_
00214
00215