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_MENU_BAR_
00024 #define _SO_MENU_BAR_
00025
00026 #include <DialogViz/dialog/SoTopComponent.h>
00027 #include <DialogViz/dialog/SoMenuPopup.h>
00028
00029 class SoDialogAuditor;
00030
00077 class SoMenuBar : public SoTopComponent
00078 {
00079 SO_DG_HEADER(SoMenuBar);
00080
00081 public:
00082
00086 SoMenuBar();
00087
00091 void addAuditor(SoDialogAuditor* auditor);
00092
00096 void removeAuditor(SoDialogAuditor* auditor);
00097
00102 SoDialogViz* searchForAuditorId(SbString id);
00103
00107 virtual void addChild(SoMenuPopup *child);
00108
00112 virtual void insertChild(SoMenuPopup *child, int newChildIndex);
00113
00117 virtual SoNode *getChild(int index) const;
00118
00122 virtual int getNumChildren() const;
00123
00127 virtual int findChild(const SoMenuPopup *child) const;
00128
00132 virtual void removeChild(int index);
00133
00137 virtual void removeChild(SoMenuPopup *child);
00138
00142 virtual void removeAllChildren();
00143
00147 virtual void replaceChild(int index, SoMenuPopup *newChild);
00148
00152 virtual void replaceChild(SoMenuPopup *oldChild, SoMenuPopup *newChild);
00153
00154
00155 private:
00156 virtual SoChildList *getChildren() const;
00157
00158 virtual void buildWidget(SoWidget parent, SbVec2i32 &, SbVec2i32 & pos, SbBool isActive2d);
00159 virtual void destroyWidget();
00160 static void initClass();
00161 static void exitClass();
00162 virtual void updateFromSensor(SoSensor* sensor);
00163 void* getMenu(void* parent);
00164 void destroyNoDeleteMenuItems();
00165 void updateChildren();
00166 virtual void updateAfterSceneGraphChange();
00167
00168
00169 virtual void internalRemoveChild( int index ) { removeChild(index); }
00170 virtual void internalRemoveChild( SoNode *child ) { removeChild(findChild(dynamic_cast<SoMenuPopup*>(child))); }
00171 virtual void internalRemoveAllChildren() { removeAllChildren(); }
00172 virtual void internalAddChild( SoNode *child ) { addChild(dynamic_cast<SoMenuPopup*>(child)); }
00173 virtual int internalFindChild( const SoNode *child ) const { return findChild(dynamic_cast<const SoMenuPopup*>(child)); }
00174 virtual void internalInsertChild( SoNode *child, int newChildIndex ) { insertChild(dynamic_cast<SoMenuPopup*>(child), newChildIndex); }
00175 virtual SoNode *internalGetChild( int index) const { return getChild(index); }
00176 virtual void internalReplaceChild( int index, SoNode *newChild) { replaceChild(index, dynamic_cast<SoMenuPopup*>(newChild)); }
00177 virtual void internalReplaceChild( SoNode *oldChild, SoNode *newChild) { replaceChild(dynamic_cast<SoMenuPopup*>(oldChild),dynamic_cast<SoMenuPopup*>(newChild)); }
00178
00179 private:
00180
00181
00182 virtual SbBool readInstance(SoInput *in, unsigned short flags);
00183
00184
00185 virtual SbBool readChildren(SoInput *in);
00186
00187 virtual ~SoMenuBar();
00188 virtual void getSize(SbVec2i32 &size, SbVec2i32 &min, SbVec2i32 &max);
00189
00190 private:
00191 int m_numberOfChildren;
00192 void* m_menuBarWin;
00193 SbBool m_firstBuild;
00194
00195 void createMenuBar(SoWidget parent);
00196 SbBool existMenuBar();
00197 void updateMenuBar();
00198 virtual void changeEnable();
00199 virtual void applyAuditor(SoDialogViz* dlgCpt);
00200
00202
00203 private:
00204 static char* MenuBar;
00205 static void change3DSkin();
00206 static SbBool isSkinLoaded();
00207 static void setSkinLoaded(SbBool loaded);
00208
00209 virtual void show3D(SbBool show);
00210 void show3DChildren(SbBool show);
00211 virtual void set3DParentTranslation(SbVec3f& tsl);
00212 void update3DChildrenSize();
00213
00214 private:
00215 SO_DG_CATALOG_ENTRY_HEADER( frameSep );
00216 SO_DG_CATALOG_ENTRY_HEADER( frame );
00217
00218 SoScale* menuBarFrameScale;
00219 SoTranslation* menuBarFrameTranslation;
00220 SoTransform* menuBarFrameTransform;
00221
00222 private:
00223 static SbBool m_isSkinLoaded;
00224 float m_mBarCachedDepth;
00225
00226 void create3DBar();
00227 void update3DBar();
00228 void update3DChildren();
00229 virtual void change3DPosition();
00230
00231 private:
00232 virtual void getBoundingBox(SoGetBoundingBoxAction* action);
00233 virtual void rayPick(SoRayPickAction *action);
00234 virtual void search(SoSearchAction *action);
00235 virtual void write(SoWriteAction *action);
00236
00238
00239 };
00240
00241 #endif // _SO_MENU_BAR_
00242
00243
00244