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_POPUP_
00024 #define _SO_MENU_POPUP_
00025
00026 #include <DialogViz/dialog/SoMenuItem.h>
00027
00028 class SoDialogAuditor;
00029
00065 class SoMenuPopup : public SoMenuItem
00066 {
00067 SO_DG_HEADER(SoMenuPopup);
00068
00069 public:
00070
00074 SoMenuPopup();
00075
00079 void addAuditor(SoDialogAuditor* auditor);
00080
00084 void removeAuditor(SoDialogAuditor* auditor);
00085
00090 SoDialogViz* searchForAuditorId(SbString id);
00091
00095 virtual void addChild(SoMenuItem *child);
00096
00100 virtual void insertChild(SoMenuItem *child, int newChildIndex);
00101
00105 virtual SoNode *getChild(int index) const;
00106
00110 virtual int getNumChildren() const;
00111
00115 virtual int findChild(const SoMenuItem *child) const;
00116
00120 virtual void removeChild(int index);
00121
00125 virtual void removeChild(SoMenuItem *child);
00126
00130 virtual void removeAllChildren();
00131
00135 virtual void replaceChild(int index, SoMenuItem *newChild);
00136
00140 virtual void replaceChild(SoMenuItem *oldChild, SoMenuItem *newChild);
00141
00142
00143 private:
00144
00145 virtual SoChildList *getChildren() const;
00146
00147 virtual void buildMenu(void* parent, SbBool isActive2d, int index = -1);
00148 static void initClass();
00149 static void exitClass();
00150 virtual void updateFromSensor(SoSensor* sensor);
00151 virtual void destroyNoDeleteMenuItem();
00152 virtual SbVec2i32 getItemInitSize();
00153 virtual void updateAfterSceneGraphChange();
00154
00155
00156 virtual void internalRemoveChild( int index ) { removeChild(index); }
00157 virtual void internalRemoveChild( SoNode *child ) { removeChild(findChild(dynamic_cast<SoMenuItem*>(child))); }
00158 virtual void internalRemoveAllChildren() { removeAllChildren(); }
00159 virtual void internalAddChild( SoNode *child ) { addChild(dynamic_cast<SoMenuItem*>(child)); }
00160 virtual int internalFindChild( const SoNode *child ) const { return findChild(dynamic_cast<const SoMenuItem*>(child)); }
00161 virtual void internalInsertChild( SoNode *child, int newChildIndex ) { insertChild(dynamic_cast<SoMenuItem*>(child), newChildIndex); }
00162 virtual SoNode *internalGetChild( int index) const { return getChild(index); }
00163 virtual void internalReplaceChild( int index, SoNode *newChild) { replaceChild(index, dynamic_cast<SoMenuItem*>(newChild)); }
00164 virtual void internalReplaceChild( SoNode *oldChild, SoNode *newChild) { replaceChild(dynamic_cast<SoMenuItem*>(oldChild),dynamic_cast<SoMenuItem*>(newChild)); }
00165
00166 private:
00167
00168
00169 virtual SbBool readInstance(SoInput *in, unsigned short flags);
00170
00171
00172 virtual SbBool readChildren(SoInput *in);
00173
00174 virtual ~SoMenuPopup();
00175 virtual void changeLabel();
00176 virtual void changeEnable();
00177
00178 private:
00179 int m_numberOfChildren;
00180 void* m_menuPopupWin;
00181 SbBool m_firstBuild;
00182
00183
00184 void insertMenuItem(int index);
00185 void updateMenuItem();
00186
00187 virtual void applyAuditor(SoDialogViz* dlgCpt);
00188
00190
00191 private:
00192 static char* MenuPopup;
00193 static void change3DSkin();
00194 static SbBool isSkinLoaded();
00195 static void setSkinLoaded(SbBool loaded);
00196
00197 virtual void get3DDefaultSize(SbVec3f& size);
00198 void show3DChildren(SbBool show);
00199 virtual void change3DPosition();
00200 void update3DChildren();
00201 void update3DChildrenSize();
00202
00203 private:
00204 SO_DG_CATALOG_ENTRY_HEADER( frameSep );
00205 SO_DG_CATALOG_ENTRY_HEADER( frameSwitch );
00206 SO_DG_CATALOG_ENTRY_HEADER( released );
00207 SO_DG_CATALOG_ENTRY_HEADER( pressed );
00208 SO_DG_CATALOG_ENTRY_HEADER( shapeReleased );
00209 SO_DG_CATALOG_ENTRY_HEADER( shapePressed );
00210
00211 SoScale* menuPopupFrameScale;
00212 SoTranslation* menuPopupFrameTranslation;
00213 SoTransform* menuPopupFrameTransform;
00214
00215 virtual void set3DInactive();
00216
00217 private:
00218 SbBool m_isOpenPopup;
00219 float m_mPopupCachedDepth;
00220 float m_mChildrenCachedDepth;
00221 static SbBool m_isSkinLoaded;
00222
00223 void create3DPopup(int index);
00224 void update3DPopup();
00225
00226 static void startCB3D( void *, SoDragger *inDragger );
00227 virtual void draggerStartCallback3D();
00228
00229 private:
00230 virtual void getBoundingBox(SoGetBoundingBoxAction* action);
00231 virtual void rayPick(SoRayPickAction *action);
00232 virtual void search(SoSearchAction *action);
00233 virtual void write(SoWriteAction *action);
00234
00236
00237 };
00238
00239 #endif // _SO_MENU_POPUP_
00240
00241
00242