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_TAB_DIALOG_
00024 #define _SO_TAB_DIALOG_
00025
00026 #include <DialogViz/dialog/SoDialogGroup.h>
00027 #include <DialogViz/SoDialogWidgetList.h>
00028 #include <Inventor/fields/SoMFVec2f.h>
00029
00030 class SoClipPlane;
00031 class SoNodeSensor;
00032 class SoTabDialogAuditor;
00033
00094 class SoTabDialog : public SoDialogGroup
00095 {
00096 SO_DG_HEADER(SoTabDialog);
00097
00098 public:
00099
00100 enum TabsLocation {
00102 TOP,
00106 BOTTOM,
00108 LEFT,
00110 RIGHT
00111 };
00112
00116 SoSFEnum tabsLocation;
00117
00121 SoSFInt32 selectedPage;
00122
00126 SoTabDialog();
00127
00131 void addAuditor(SoTabDialogAuditor* auditor);
00132
00136 void removeAuditor(SoTabDialogAuditor* auditor);
00137
00138
00139 private:
00140 virtual void buildWidget(SoWidget parent, SbVec2i32& rSize, SbVec2i32& pos, SbBool isActive2d);
00141 virtual void eventNotify(unsigned int event, uintptr_t param);
00142 virtual void getDefaultSize(SbVec2i32 &size, SbVec2i32 &min, SbVec2i32 &max);
00143 static void initClass();
00144 static void exitClass();
00145 virtual void updateFromSensor(SoSensor* sensor);
00146 virtual void destroyWidget();
00147
00148 SoDialogWidgetList m_tabPageWidgetsList;
00149 SoDialogWidgetList m_tabPageButtonsList;
00150
00151 void changeTabSelectedPage(SoWidget widg);
00152 void changeEnableChild(int index);
00153 void changePageLabel(int index);
00154 void updateSelectedPage();
00155 void updateTabPageWidget(int index);
00156 void updateTabWidget();
00157
00158
00159 virtual void addChild(SoDialogComponent *child);
00160 virtual void removeChild(int index);
00161 virtual void removeChild(SoDialogComponent *child) { removeChild(findChild(child)); }
00162 virtual void removeAllChildren();
00163 virtual void insertChild(SoDialogComponent *child, int newChildIndex);
00164 virtual void replaceChild(int index, SoDialogComponent *newChild);
00165 virtual void replaceChild(SoDialogComponent *oldChild, SoDialogComponent *newChild) { replaceChild(findChild(oldChild), newChild); }
00166 virtual void updateAfterSceneGraphChange();
00167
00168
00169 virtual void internalRemoveChild( int index ) { removeChild(index); }
00170 virtual void internalRemoveChild( SoNode *child ) { removeChild(findChild(dynamic_cast<SoDialogComponent*>(child))); }
00171 virtual void internalRemoveAllChildren() { removeAllChildren(); }
00172 virtual void internalAddChild( SoNode *child ) { SoDialogGroup::internalAddChild(child); }
00173 virtual int internalFindChild( const SoNode *child ) const { return SoDialogGroup::internalFindChild(child); }
00174 virtual void internalInsertChild( SoNode *child, int newChildIndex ) { SoDialogGroup::internalInsertChild(child, newChildIndex); }
00175 virtual SoNode *internalGetChild( int index) const { return getChild(index); }
00176 virtual void internalReplaceChild( int index, SoNode *newChild) { SoDialogGroup::internalReplaceChild(index, dynamic_cast<SoDialogComponent*>(newChild)); }
00177 virtual void internalReplaceChild( SoNode *oldChild, SoNode *newChild) { replaceChild(dynamic_cast<SoDialogComponent*>(oldChild),dynamic_cast<SoDialogComponent*>(newChild)); }
00178
00179 void* getLayout(int index);
00180
00181 private:
00182 virtual ~SoTabDialog();
00183 virtual void fixSizeWithBorder(SbVec2i32 &size, int revert = 1);
00184
00185 private:
00186 int m_numChildren;
00187 int m_firstPage;
00188 int m_previousSelected;
00189 SoWidget m_tabWidget;
00190 SoWidget m_arrowLeft;
00191 SoWidget m_arrowRight;
00192 SoWidget m_tabContainer;
00193 SoWidget m_maskLine;
00194
00195 void createTabWidget();
00196 void createTabPageWidget(int index);
00197 void changeArrowState();
00198 void updateMaskLine();
00199
00200 void drawItem(uintptr_t param);
00201
00202 virtual SbVec2i32 getComponentInitSize();
00203 virtual void setChildrenComponentSize();
00204 virtual void setChildrenLabelSize();
00205
00206 void changeFirstPageRight();
00207 void changeFirstPageLeft();
00208 virtual void changeSelectedPage();
00209 virtual void changeEnable();
00210 virtual void changeWidgetEnable(SbBool state);
00211
00212 static void childrenSensor(void *data, SoSensor *sensor);
00213
00214 FIELD_SENSOR(selectedPage);
00215
00216
00218
00219 private:
00220 static char* TabDialog;
00221 static void change3DSkin();
00222 static SbBool isSkinLoaded();
00223 static void setSkinLoaded(SbBool loaded);
00224 void change3DPages();
00225 void applyDlgCptAuditor();
00226
00227 private:
00228 SO_DG_CATALOG_ENTRY_HEADER( pagesSep );
00229 SO_DG_CATALOG_ENTRY_HEADER( pageSep );
00230 SO_DG_CATALOG_ENTRY_HEADER( pageSwitch );
00231 SO_DG_CATALOG_ENTRY_HEADER( labelSep );
00232 SO_DG_CATALOG_ENTRY_HEADER( labelSwitch );
00233 SO_DG_CATALOG_ENTRY_HEADER( selected );
00234 SO_DG_CATALOG_ENTRY_HEADER( unselected );
00235 SO_DG_CATALOG_ENTRY_HEADER( textSep );
00236 SO_DG_CATALOG_ENTRY_HEADER( textProp );
00237 SO_DG_CATALOG_ENTRY_HEADER( buttonsSep );
00238 SO_DG_CATALOG_ENTRY_HEADER( lButtonSep );
00239 SO_DG_CATALOG_ENTRY_HEADER( lButtonSwtch );
00240 SO_DG_CATALOG_ENTRY_HEADER( lButtonPressed );
00241 SO_DG_CATALOG_ENTRY_HEADER( lButtonReleased );
00242 SO_DG_CATALOG_ENTRY_HEADER( rButtonSep );
00243 SO_DG_CATALOG_ENTRY_HEADER( rButtonSwtch );
00244 SO_DG_CATALOG_ENTRY_HEADER( rButtonPressed );
00245 SO_DG_CATALOG_ENTRY_HEADER( rButtonReleased );
00246 SO_DG_CATALOG_ENTRY_HEADER( frameSep );
00247 SO_DG_CATALOG_ENTRY_HEADER( frame );
00248
00249 SoScale *tabFrameScale, *tabButtonsScale, *tabLabelFrameScale;
00250 SoText3 *tabText;
00251 SoTransform *tabLabelFrameTransform;
00252 SoTranslation *tabFrameTranslation, *tabButtonsTranslation, *tabPageTranslation, *tabTextTranslation;
00253 SoClipPlane *m_clipWidth, *m_clipHeight;
00254
00255 private:
00256 SoNodeList m_childSwitchList;
00257 SoNodeList m_labelSwitchList;
00258 SoNodeList m_labelSepList;
00259 SoNodeList m_labelTransfList;
00260 SoNodeList m_labelTranslList;
00261 SoNodeList m_tabTextList;
00262 SoNodeList m_tabLabelScaleList;
00263 SoNodeList m_tabTextTranslList;
00264
00265 SoMFVec2f m_labelDim;
00266 float m_mTabCacheDepth;
00267 int m_prevNumOfChildren;
00268 int m_frameLabelHeight;
00269 SbBool m_isUsedClipPlane;
00270 SbBool m_changeComeFromCB;
00271 static SbBool m_isSkinLoaded;
00272
00273 void create3DTabDialog();
00274 void update3DTabDialog();
00275 void change3DSelectedPage();
00276 void update3DTabDialogPage(int index);
00277 void change3DFirstPageRight();
00278 void change3DFirstPageLeft();
00279
00280 virtual void change3DPosition();
00281
00282 virtual void show3D(SbBool show);
00283 static void startCB3D( void *, SoDragger *inDragger );
00284 static void finishCB3D( void *, SoDragger *inDragger );
00285 void draggerStartCallback3D();
00286 void draggerFinishCallback3D();
00287
00288 SoNodeSensor* m_thisNodeSensor;
00289
00291
00292 };
00293
00294 #endif // _SO_TAB_DIALOG_
00295
00296
00297