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 _SO_WIN_DIRECTIONAL_LIGHT_EDITOR_
00027 #define _SO_WIN_DIRECTIONAL_LIGHT_EDITOR_
00028
00029 #include <Inventor/Win/SoWinBeginStrict.h>
00030 #include <Inventor/sys/port.h>
00031 #include <Inventor/SbBasic.h>
00032 #include <Inventor/SbColor.h>
00033 #include <Inventor/misc/SoCallbackList.h>
00034 #include <Inventor/Win/SoWinComponent.h>
00035
00036
00037 class SoBase;
00038 class SoCamera;
00039 class SoDirectionalLight;
00040 class SoDirectionalLightManip;
00041 class SoDragger;
00042 class SoGroup;
00043 class SoNodeSensor;
00044 class SoPath;
00045 class SoPathList;
00046 class SoPerspectiveCamera;
00047 class SoSensor;
00048 class SoSeparator;
00049 class SoWinClipboard;
00050 class SoWinColorEditor;
00051 class SoWinColorSlider;
00052 class SoWinRenderArea;
00053
00054
00055
00059 typedef void SoWinDirectionalLightEditorCB(void *userData, const SoDirectionalLight *light);
00060
00062
00063
00064
00066
00095 class SoWinDirectionalLightEditor : public SoWinComponent {
00096 public:
00100 SoWinDirectionalLightEditor(
00101 SoWidget parent = NULL,
00102 const char *name = NULL,
00103 SbBool buildInsideParent = TRUE);
00107 ~SoWinDirectionalLightEditor();
00108
00113 void attach(SoPath *pathToLight);
00117 void detach();
00121 SbBool isAttached() { return (dirLight != NULL); }
00122
00126 void setLight(const SoDirectionalLight &newLight);
00130 const SoDirectionalLight &getLight() const { return *dirLight; }
00131
00138 inline void addLightChangedCallback(
00139 SoWinDirectionalLightEditorCB *f,
00140 void *userData = NULL);
00145 inline void removeLightChangedCallback(
00146 SoWinDirectionalLightEditorCB *f,
00147 void *userData = NULL);
00148
00149
00150
00151 virtual void show();
00152 virtual void hide();
00153
00154 SbBool alwaysOnTop;
00155 private:
00156
00157 SoWidget mgrWidget;
00158
00159
00160
00161
00162 SoEXTENDER
00163 SoWinDirectionalLightEditor(
00164 SoWidget parent,
00165 const char *name,
00166 SbBool buildInsideParent,
00167 SbBool buildNow);
00168
00169
00170 virtual SbString getDefaultWidgetName() const;
00171 virtual SbString getDefaultTitle() const;
00172 virtual SbString getDefaultIconTitle() const;
00173
00174 SoDirectionalLight *dirLight;
00175 SoSeparator *root;
00176 SoSeparator *litStuff;
00177
00178 SoPerspectiveCamera *myCamera;
00179 SoCamera *cameraToWatch;
00180
00181
00182 SoWinColorEditor *colorEditor;
00183 SoWinColorSlider *intensitySlider;
00184 SoWinRenderArea *renderArea;
00185 SoNodeSensor *lightSensor;
00186 SoNodeSensor *cameraSensor;
00187 SoDirectionalLightManip *dirLightManip;
00188 static char *geomBuffer;
00189 SbBool ignoreCallback;
00190 SoCallbackList *callbackList;
00191
00192
00193 SoWinClipboard *clipboard;
00194
00195
00196 void copyLight(SoDirectionalLight *dst,
00197 const SoDirectionalLight *src);
00198
00199 void updateLocalComponents();
00200
00201 private:
00202
00203 HMENU menubar ;
00204
00205 static WBOOL CALLBACK mgrDlgProc( Hwnd hdlg, UINT message,
00206 WPARAM wParam, LPARAM lParam );
00207 static void onCommand(
00208 Hwnd hdlg,
00209 int id,
00210 Hwnd hCtrl,
00211 UINT codeNotify ) ;
00212
00213 void handleEdit(
00214 int nSlider,
00215 Hwnd hEdit,
00216 UINT codeNotify) ;
00217
00218 void handleMenu(Hwnd hdlg,
00219 SoWinDirectionalLightEditor *p,
00220 int id ) ;
00221
00222 void initPlacement() ;
00223
00224 static void colorEditorCloseCB(void *userData, SoWinComponent *comp) ;
00225
00226
00227 static void colorEditorCB(void *, const SbColor *);
00228 static void intensitySliderCB(void *, float);
00229 static void pasteDoneCB(void *, SoPathList *);
00230 static void dirLightManipCB(void *, SoDragger *);
00231
00232
00233 static void menuPick(SoWidget, int, XmAnyCallbackStruct *);
00234
00235
00236 static void cameraSensorCB(SoWinDirectionalLightEditor *, SoSensor *);
00237 static void lightSensorCB(SoWinDirectionalLightEditor *, SoSensor *);
00238
00239
00240 SoWidget buildWidget(SoWidget parent);
00241 SoWidget buildPulldownMenu(SoWidget parent);
00242
00243 static void visibilityChangeCB(void *pt, SbBool visible);
00244 void activate();
00245 void deactivate();
00246
00247
00248 void constructorCommon(SbBool buildNow);
00249 SoNode *geom;
00250
00251 };
00252
00253
00254 void
00255 SoWinDirectionalLightEditor::addLightChangedCallback(
00256 SoWinDirectionalLightEditorCB *f,
00257 void *userData)
00258 { callbackList->addCallback((SoCallbackListCB *) f, userData); }
00259
00260 void
00261 SoWinDirectionalLightEditor::removeLightChangedCallback(
00262 SoWinDirectionalLightEditorCB *f,
00263 void *userData)
00264 { callbackList->removeCallback((SoCallbackListCB *) f, userData); }
00265
00266 #include <Inventor/Win/SoWinEndStrict.h>
00267
00268 #endif // _SO_WIN_DIRECTIONAL_LIGHT_EDITOR_
00269
00270