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
00138 class SoXtDirectionalLightEditor : public SoXtComponent {
00139 public:
00143 SoXtDirectionalLightEditor(
00144 SoWidget parent = NULL,
00145 const char *name = NULL,
00146 SbBool buildInsideParent = TRUE);
00150 ~SoXtDirectionalLightEditor();
00151
00156 void attach(SoPath *pathToLight);
00160 void detach();
00164 SbBool isAttached() { return (dirLight != NULL); }
00165
00169 void setLight(const SoDirectionalLight &newLight);
00173 const SoDirectionalLight &getLight() const { return *dirLight; }
00174
00180 inline void addLightChangedCallback(
00181 SoXtDirectionalLightEditorCB *f,
00182 void *userData = NULL);
00186 inline void removeLightChangedCallback(
00187 SoXtDirectionalLightEditorCB *f,
00188 void *userData = NULL);
00189
00190
00191
00192 virtual void show();
00193 virtual void hide();
00194
00195 private:
00196
00197
00198
00199
00200 SoEXTENDER
00201 SoXtDirectionalLightEditor(
00202 SoWidget parent,
00203 const char *name,
00204 SbBool buildInsideParent,
00205 SbBool buildNow);
00206
00207
00208 virtual SbString getDefaultWidgetName() const;
00209 virtual SbString getDefaultTitle() const;
00210 virtual SbString getDefaultIconTitle() const;
00211
00212 SoDirectionalLight *dirLight;
00213 SoSeparator *root;
00214 SoSeparator *litStuff;
00215
00216 SoPerspectiveCamera *myCamera;
00217 SoCamera *cameraToWatch;
00218
00219
00220 SoXtColorEditor *colorEditor;
00221 SoXtColorSlider *intensitySlider;
00222 SoXtRenderArea *renderArea;
00223 SoNodeSensor *lightSensor;
00224 SoNodeSensor *cameraSensor;
00225 SoDirectionalLightManip *dirLightManip;
00226 static char *geomBuffer;
00227 SbBool ignoreCallback;
00228 SoCallbackList *callbackList;
00229
00230
00231 SoXtClipboard *clipboard;
00232
00233
00234 void copyLight(SoDirectionalLight *dst,
00235 const SoDirectionalLight *src);
00236
00237 void updateLocalComponents();
00238
00239 private:
00240
00241 static void colorEditorCB(void *, const SbColor *);
00242 static void intensitySliderCB(void *, float);
00243 static void pasteDoneCB(void *, SoPathList *);
00244 static void dirLightManipCB(void *, SoDragger *);
00245
00246
00247 static void menuPick(SoWidget, int, XmAnyCallbackStruct *);
00248
00249
00250 static void cameraSensorCB(SoXtDirectionalLightEditor *, SoSensor *);
00251 static void lightSensorCB(SoXtDirectionalLightEditor *, SoSensor *);
00252
00253
00254 SoWidget buildWidget(SoWidget parent);
00255 SoWidget buildPulldownMenu(SoWidget parent);
00256
00257 static void visibilityChangeCB(void *pt, SbBool visible);
00258 void activate();
00259 void deactivate();
00260
00261
00262 void constructorCommon(SbBool buildNow);
00263
00264 };
00265
00266
00267 void
00268 SoXtDirectionalLightEditor::addLightChangedCallback(
00269 SoXtDirectionalLightEditorCB *f,
00270 void *userData)
00271 { callbackList->addCallback((SoCallbackListCB *) f, userData); }
00272
00273 void
00274 SoXtDirectionalLightEditor::removeLightChangedCallback(
00275 SoXtDirectionalLightEditorCB *f,
00276 void *userData)
00277 { callbackList->removeCallback((SoCallbackListCB *) f, userData); }
00278
00279 #endif // _SO_XT_DIRECTIONAL_LIGHT_EDITOR_
00280
00281 #endif // _WIN32
00282
00283
00284