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