00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _SO_DIALOG_COMPONENT_
00024 #define _SO_DIALOG_COMPONENT_
00025
00026 #include <DialogViz/dialog/SoTopComponent.h>
00027 #include <Inventor/fields/SoSFEnum.h>
00028 #include <Inventor/fields/SoSFInt32.h>
00029
00030 class SoTransform ;
00031 class SoTranslation;
00032 class SoScale;
00033
00074 class SoDialogComponent : public SoTopComponent
00075 {
00076 SO_DG_HEADER(SoDialogComponent);
00077
00078 public:
00079
00085 SoSFInt32 width;
00086
00092 SoSFInt32 height;
00093
00098 SoSFBool fixedWidth;
00099
00104 SoSFBool fixedHeight;
00105
00110 SoSFInt32 minWidth;
00111
00116 SoSFInt32 maxWidth;
00117
00122 SoSFInt32 minHeight;
00123
00128 SoSFInt32 maxHeight;
00129
00130 enum EdgeStyle {
00132 NONE,
00134 SHADOW_IN,
00136 SHADOW_OUT
00137 };
00138
00142 SoSFEnum edgeStyle;
00143
00148 SoSFBool labelVisibility;
00149
00150
00151
00152 private:
00153
00154 static void initClass();
00155 static void exitClass();
00156 virtual void buildWidget(SoWidget parent, SbVec2i32 & rSize, SbVec2i32 & pos, SbBool isActive2d);
00157 virtual void destroyWidget();
00158 virtual SoWidget getLabelWidget();
00159 virtual void eventNotify(unsigned int event, uintptr_t param);
00160 virtual void updateFromSensor(SoSensor* sensor);
00161 virtual void setLabelSize(SbVec2i32& size);
00162 virtual void setComponentSize(SbVec2i32 &size);
00163 virtual SbVec2i32 getComponentInitSize();
00164 virtual SbVec2i32 getLabelInitSize();
00165 virtual void setFocus() {};
00166 virtual void changeWidgetEnable(SbBool state);
00167 virtual void resetSize();
00168 void getSize(SbVec2i32 &size, SbVec2i32 &min, SbVec2i32 &max);
00169 SoWidget getWidget();
00170 void get2DComponentSize(SbVec2i32& size, SbVec2i32 &pos);
00171 void get3DComponentSize(SbVec2i32& size, SbVec2i32 &pos);
00172 void* getLayout();
00173
00174 private:
00175
00176 SoWidget m_labelWidget;
00177 bool m_ownLabelWidget;
00178
00179 SoWidget m_componentWidget;
00180
00181 void * m_layout;
00182 void * m_spacer;
00183 SbVec2i32 m_componentSize;
00184 SbVec2i32 m_labelSize;
00185 SbVec2i32 m_componentInitSize;
00186 SbVec2i32 m_labelInitSize;
00187 SbVec2i32 m_olSize;
00188
00189 SoDialogComponent();
00190 virtual ~SoDialogComponent();
00191 virtual void getDefaultSize(SbVec2i32 &size, SbVec2i32 &min, SbVec2i32 &max);
00192 void getDefaultState(SbVec2i32 &size, SbVec2i32 &min, SbVec2i32 &max);
00193
00194 virtual void changeLabelVisibility() {};
00195 virtual void changeLabelAlignment();
00196 virtual void changeEdgeStyle();
00197 virtual void updateComponentWidget();
00198 virtual void changeEnable();
00199 virtual void changeWidth();
00200 virtual void changeHeight();
00201 virtual void changeMinMaxSize();
00202
00203 private:
00204
00205 SbVec2i32 m_pos;
00206 SbVec2i32 m_initSize;
00207 SbVec2i32 m_initMinSize;
00208 SbVec2i32 m_initMaxSize;
00209 SbBool m_isFirstBuild;
00210
00211 FIELD_SENSOR(edgeStyle);
00212 FIELD_SENSOR(labelVisibility);
00213 FIELD_SENSOR(width);
00214 FIELD_SENSOR(height);
00215 FIELD_SENSOR(minWidth);
00216 FIELD_SENSOR(minHeight);
00217 FIELD_SENSOR(maxWidth);
00218 FIELD_SENSOR(maxHeight);
00219
00220 void createComponentWidget(SoWidget parent);
00221 void setSize(int32_t sw, int32_t sh, int32_t smw, int32_t smh, int32_t smmw, int32_t smmh);
00222 void setDefaultState();
00223
00225
00226 private:
00227 static char* DialogComponent;
00228 static void change3DSkin();
00229 static SbBool isSkinLoaded();
00230 static void setSkinLoaded(SbBool loaded);
00231
00232 SO_DG_CATALOG_ENTRY_HEADER(mainCptSeparator);
00233 SO_DG_CATALOG_ENTRY_HEADER(edgeStyleSwitch);
00234 SO_DG_CATALOG_ENTRY_HEADER(edgeStyleNone);
00235 SO_DG_CATALOG_ENTRY_HEADER(edgeStyleShadowIn);
00236 SO_DG_CATALOG_ENTRY_HEADER(edgeStyleShadowOut);
00237
00238 SoTranslation *componentTranslation;
00239 SoTransform *componentTransform;
00240
00241 private:
00242
00243 SoScale* componentScale;
00244 float m_mComponentCachedDepth;
00245
00246 virtual void change3DLabelVisibility() {};
00247 virtual void change3DEdgeStyle();
00248
00249 private:
00250
00251 void update3DDialogComponent();
00252 void create3DDialogComponent();
00253
00254 static SbBool m_isSkinLoaded;
00255
00256 private:
00257 virtual void getBoundingBox(SoGetBoundingBoxAction* action);
00258
00260 };
00261
00262 #endif // _SO_DIALOG_COMPONENT_
00263
00264
00265