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