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