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
00080 class SoQtDirectionalLightEditor : public SoQtComponent {
00081
00082 Q_OBJECT
00083
00084 public:
00088 SoQtDirectionalLightEditor( QWidget* parent = qApp->activeWindow(),
00089 const char *name = NULL,
00090 SbBool buildInsideParent = TRUE);
00094 ~SoQtDirectionalLightEditor();
00095
00100 void attach(SoPath *pathToLight);
00104 void detach();
00108 SbBool isAttached() { return (dirLight != NULL); }
00109
00113 void setLight(const SoDirectionalLight &newLight);
00117 const SoDirectionalLight &getLight() const { return *dirLight; }
00118
00124 void addLightChangedCallback (SoQtDirectionalLightEditorCB *f,
00125 void *userData = NULL)
00126 { callbackList->addCallback((SoCallbackListCB *) f, userData); }
00130 inline void removeLightChangedCallback (SoQtDirectionalLightEditorCB *f,
00131 void *userData = NULL)
00132 { callbackList->removeCallback((SoCallbackListCB *) f, userData); }
00133
00134
00135
00136 virtual void show();
00137 virtual void hide();
00138
00139 private:
00140 QWidget* mgrWidget;
00141
00142
00143
00144
00145 SoEXTENDER
00146 SoQtDirectionalLightEditor( QWidget* parent,
00147 const char *name,
00148 SbBool buildInsideParent,
00149 SbBool buildNow);
00150
00151
00152 virtual SbString getDefaultWidgetName() const;
00153 virtual SbString getDefaultTitle() const;
00154 virtual SbString getDefaultIconTitle() const;
00155
00156
00157 SoDirectionalLight* dirLight;
00158 SoSeparator* root;
00159 SoSeparator* litStuff;
00160 SoPerspectiveCamera* myCamera;
00161 SoCamera* cameraToWatch;
00162 SoNodeSensor* lightSensor;
00163 SoNodeSensor* cameraSensor;
00164 SoDirectionalLightManip* dirLightManip;
00165 static char* geomBuffer;
00166
00167
00168 SoQtColorEditor *colorEditor;
00169 SoQtColorSlider* intensitySlider;
00170 SoQtRenderArea* renderArea;
00171
00172
00173
00174 SbBool ignoreCallback;
00175 SoCallbackList* callbackList;
00176
00177
00178 void copyLight(SoDirectionalLight *dst, const SoDirectionalLight *src);
00179 void updateLocalComponents();
00180
00181 private:
00182
00183
00184 void constructorCommon(SbBool buildNow);
00185 QWidget* buildWidget(QWidget* parent);
00186 void activate();
00187 void deactivate();
00188
00189
00190 static void colorEditorCloseCB(void *userData, SoQtComponent *comp) ;
00191 static void colorEditorCB(void *, const SbColor *);
00192 static void dirLightManipCB(void *, SoDragger *);
00193 static void intensitySliderCB(void*, float);
00194 static void cameraSensorCB(SoQtDirectionalLightEditor *, SoSensor *);
00195 static void lightSensorCB(SoQtDirectionalLightEditor *, SoSensor *);
00196 static void dialogCloseCB(void*, SoQtComponent*);
00197
00198
00199 QMenu* edit_menu;
00200 QAction* IDM_LEDT_COLOR_EDITOR;
00201
00202 private Q_SLOTS:
00203 void visibilityChangeCB(SbBool visible);
00204 void launchColorEditor();
00205 void copy();
00206 void paste();
00207 void showHelp();
00208 void keepOnTop();
00209 void slot_help();
00210 };
00211
00212 #endif // _SO_QT_DIRECTIONAL_LIGHT_EDITOR_
00213
00214