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
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 #ifdef SOQT
00051 # include <Inventor/Qt/SoQtDirectionalLightEditor.h>
00052 #elif defined _WIN32
00053 # include <Inventor/Win/SoWinDirectionalLightEditor.h>
00054 #else // _WIN32
00055
00056 #ifndef _SO_XT_DIRECTIONAL_LIGHT_EDITOR_
00057 #define _SO_XT_DIRECTIONAL_LIGHT_EDITOR_
00058
00059 #include <X11/Intrinsic.h>
00060 #include <Xm/Xm.h>
00061 #include <Inventor/SbBasic.h>
00062 #include <Inventor/SbColor.h>
00063 #include <Inventor/misc/SoCallbackList.h>
00064 #include <Inventor/Xt/SoXtComponent.h>
00065
00066
00067 class SoBase;
00068 class SoCamera;
00069 class SoDirectionalLight;
00070 class SoDirectionalLightManip;
00071 class SoDragger;
00072 class SoGroup;
00073 class SoNodeSensor;
00074 class SoPath;
00075 class SoPathList;
00076 class SoPerspectiveCamera;
00077 class SoSensor;
00078 class SoSeparator;
00079 class SoXtClipboard;
00080 class SoXtColorEditor;
00081 class SoXtColorSlider;
00082 class SoXtRenderArea;
00083
00084
00085
00086 typedef void SoXtDirectionalLightEditorCB(void *userData, const SoDirectionalLight *light);
00087
00089
00090
00091
00093
00137 class SoXtDirectionalLightEditor : public SoXtComponent {
00138 public:
00142 SoXtDirectionalLightEditor(
00143 SoWidget parent = NULL,
00144 const char *name = NULL,
00145 SbBool buildInsideParent = TRUE);
00149 ~SoXtDirectionalLightEditor();
00150
00155 void attach(SoPath *pathToLight);
00159 void detach();
00163 SbBool isAttached() { return (dirLight != NULL); }
00164
00168 void setLight(const SoDirectionalLight &newLight);
00172 const SoDirectionalLight &getLight() const { return *dirLight; }
00173
00179 inline void addLightChangedCallback(
00180 SoXtDirectionalLightEditorCB *f,
00181 void *userData = NULL);
00185 inline void removeLightChangedCallback(
00186 SoXtDirectionalLightEditorCB *f,
00187 void *userData = NULL);
00188
00189
00190
00191 virtual void show();
00192 virtual void hide();
00193
00194 private:
00195
00196
00197
00198
00199 SoEXTENDER
00200 SoXtDirectionalLightEditor(
00201 SoWidget parent,
00202 const char *name,
00203 SbBool buildInsideParent,
00204 SbBool buildNow);
00205
00206
00207 virtual SbString getDefaultWidgetName() const;
00208 virtual SbString getDefaultTitle() const;
00209 virtual SbString getDefaultIconTitle() const;
00210
00211 SoDirectionalLight *dirLight;
00212 SoSeparator *root;
00213 SoSeparator *litStuff;
00214
00215 SoPerspectiveCamera *myCamera;
00216 SoCamera *cameraToWatch;
00217
00218
00219 SoXtColorEditor *colorEditor;
00220 SoXtColorSlider *intensitySlider;
00221 SoXtRenderArea *renderArea;
00222 SoNodeSensor *lightSensor;
00223 SoNodeSensor *cameraSensor;
00224 SoDirectionalLightManip *dirLightManip;
00225 static char *geomBuffer;
00226 SbBool ignoreCallback;
00227 SoCallbackList *callbackList;
00228
00229
00230 SoXtClipboard *clipboard;
00231
00232
00233 void copyLight(SoDirectionalLight *dst,
00234 const SoDirectionalLight *src);
00235
00236 void updateLocalComponents();
00237
00238 private:
00239
00240 static void colorEditorCB(void *, const SbColor *);
00241 static void intensitySliderCB(void *, float);
00242 static void pasteDoneCB(void *, SoPathList *);
00243 static void dirLightManipCB(void *, SoDragger *);
00244
00245
00246 static void menuPick(SoWidget, int, XmAnyCallbackStruct *);
00247
00248
00249 static void cameraSensorCB(SoXtDirectionalLightEditor *, SoSensor *);
00250 static void lightSensorCB(SoXtDirectionalLightEditor *, SoSensor *);
00251
00252
00253 SoWidget buildWidget(SoWidget parent);
00254 SoWidget buildPulldownMenu(SoWidget parent);
00255
00256 static void visibilityChangeCB(void *pt, SbBool visible);
00257 void activate();
00258 void deactivate();
00259
00260
00261 void constructorCommon(SbBool buildNow);
00262
00263 };
00264
00265
00266 void
00267 SoXtDirectionalLightEditor::addLightChangedCallback(
00268 SoXtDirectionalLightEditorCB *f,
00269 void *userData)
00270 { callbackList->addCallback((SoCallbackListCB *) f, userData); }
00271
00272 void
00273 SoXtDirectionalLightEditor::removeLightChangedCallback(
00274 SoXtDirectionalLightEditorCB *f,
00275 void *userData)
00276 { callbackList->removeCallback((SoCallbackListCB *) f, userData); }
00277
00278 #endif // _SO_XT_DIRECTIONAL_LIGHT_EDITOR_
00279
00280 #endif // _WIN32
00281
00282
00283