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