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