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_PUSH_BUTTON_
00024 #define _SO_DIALOG_PUSH_BUTTON_
00025
00026 #include <DialogViz/dialog/SoDialogComponent.h>
00027
00028 class SoDialogPushButtonAuditor;
00029
00108 class SoDialogPushButton : public SoDialogComponent
00109 {
00110 SO_DG_HEADER(SoDialogPushButton);
00111
00112 public:
00113
00117 SoSFString buttonLabel;
00118
00122 SoDialogPushButton();
00123
00127 void addAuditor(SoDialogPushButtonAuditor* auditor);
00128
00132 void removeAuditor(SoDialogPushButtonAuditor* auditor);
00133
00134
00135 private:
00136 static void initClass();
00137 static void exitClass();
00138 virtual void buildWidget(SoWidget parent, SbVec2i32 &rSize, SbVec2i32 & pos, SbBool isActive2d);
00139 virtual void destroyWidget();
00140 virtual SoWidget getLabelWidget();
00141 virtual void updateFromSensor(SoSensor* sensor);
00142 virtual void eventNotify(unsigned int event, uintptr_t param);
00143
00144 void activateButton();
00145 void updateLabelWidget();
00146 void updateButtonWidget();
00147 void applyDlgCptAuditor();
00148
00149 private:
00150 SoWidget m_buttonWidget;
00151
00152 virtual ~SoDialogPushButton();
00153
00154
00155 virtual void changeEdgeStyle();
00156 virtual void changeLabelVisibility();
00157 virtual void changeEnable();
00158 virtual void changeWidgetEnable(SbBool state);
00159 virtual void changeLabel();
00160 virtual void changeLabelAlignment();
00161 void changeButtonLabel();
00162 void changeButtonState(SbBool state);
00163
00164 private:
00165
00166 SbVec2i32 m_obSize;
00167
00168 FIELD_SENSOR(buttonLabel);
00169 void createLabelWidget();
00170 void createButtonWidget();
00171 virtual SbVec2i32 getComponentInitSize();
00172 virtual void getDefaultSize(SbVec2i32 &size, SbVec2i32 &min, SbVec2i32 &max);
00173
00175
00176 private:
00177 static char* DialogPushButton;
00178 static void change3DSkin();
00179 static SbBool isSkinLoaded();
00180 static void setSkinLoaded(SbBool loaded);
00181
00182 void set3DPressedGeometry(SoNode* node);
00183 void set3DReleasedGeometry(SoNode* node);
00184
00185 private:
00186 SO_DG_CATALOG_ENTRY_HEADER(labelSep);
00187 SO_DG_CATALOG_ENTRY_HEADER(labelSwitch);
00188 SO_DG_CATALOG_ENTRY_HEADER(labelProp);
00189 SO_DG_CATALOG_ENTRY_HEADER(frameSep);
00190 SO_DG_CATALOG_ENTRY_HEADER(frameSwitch);
00191 SO_DG_CATALOG_ENTRY_HEADER(released);
00192 SO_DG_CATALOG_ENTRY_HEADER(pressed);
00193 SO_DG_CATALOG_ENTRY_HEADER(buttonLabelSep);
00194 SO_DG_CATALOG_ENTRY_HEADER(buttonLabelProp);
00195
00196 SoText3 *pushButtonButtonLabel, *pushButtonLabel;
00197 SoTranslation *pushButtonLabelTranslation, *pushButtonFrameTranslation;
00198 SoTranslation *pushButtonButtonLabelTranslation;
00199 SoScale *pushButtonFrameScale;
00200 SoTransform *pushButtonFrameTransform;
00201
00202 private:
00203 SbBox3f m_buttonLabelCachedBBox;
00204 static SbBool m_isSkinLoaded;
00205
00206 void create3DDialogPushButton();
00207 void update3DButton();
00208 void update3DLabel();
00209
00210 void change3DButtonLabel();
00211 virtual void change3DLabelVisibility();
00212 virtual void change3DLabel();
00213 virtual void change3DLabelAlignment();
00214 void change3DButtonState(SbBool state);
00215
00216 static void startCB3D( void *, SoDragger *inDragger );
00217 static void finishCB3D( void *, SoDragger *inDragger );
00218 void draggerStartCallback3D();
00219 void draggerFinishCallback3D();
00220
00222 };
00223
00224 #endif // _SO_DIALOG_PUSH_BUTTON_
00225
00226
00227