Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
SoMenuPopup.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2014 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : Nicolas DAGUISE (Oct 2002)
22**=======================================================================*/
23#ifndef _SO_MENU_POPUP_
24#define _SO_MENU_POPUP_
25
26#include <DialogViz/dialog/SoMenuItem.h>
27
28class SoDialogAuditor;
29
64class SoMenuPopup : public SoMenuItem
65{
66 SO_DG_HEADER(SoMenuPopup);
67
68 public:
69
74
79
84
90
94 virtual void addChild(SoMenuItem *child);
95
99 virtual void insertChild(SoMenuItem *child, int newChildIndex);
100
104 virtual SoNode *getChild(int index) const;
105
109 virtual int getNumChildren() const;
110
114 virtual int findChild(const SoMenuItem *child) const;
115
119 virtual void removeChild(int index);
120
124 virtual void removeChild(SoMenuItem *child);
125
129 virtual void removeAllChildren();
130
134 virtual void replaceChild(int index, SoMenuItem *newChild);
135
139 virtual void replaceChild(SoMenuItem *oldChild, SoMenuItem *newChild);
140
141 /*==============================================================================*/
142 private:
143 // Returns pointer to children
144 virtual SoChildList *getChildren() const;
145
146 virtual void buildMenu(void* parent, SbBool isActive2d, int index = -1);
147 static void initClass();
148 static void exitClass();
149 virtual void updateFromSensor(SoSensor* sensor);
150 virtual void destroyNoDeleteMenuItem();
151 virtual SbVec2i32 getItemInitSize();
152 virtual void updateAfterSceneGraphChange();
153
154 // Internal child management following inheritance of classes.
155 virtual void internalRemoveChild( int index ) { removeChild(index); }
156 virtual void internalRemoveChild( SoNode *child ) { removeChild(findChild(dynamic_cast<SoMenuItem*>(child))); }
157 virtual void internalRemoveAllChildren() { removeAllChildren(); }
158 virtual void internalAddChild( SoNode *child ) { addChild(dynamic_cast<SoMenuItem*>(child)); }
159 virtual int internalFindChild( const SoNode *child ) const { return findChild(dynamic_cast<const SoMenuItem*>(child)); }
160 virtual void internalInsertChild( SoNode *child, int newChildIndex ) { insertChild(dynamic_cast<SoMenuItem*>(child), newChildIndex); }
161 virtual SoNode *internalGetChild( int index) const { return getChild(index); }
162 virtual void internalReplaceChild( int index, SoNode *newChild) { replaceChild(index, dynamic_cast<SoMenuItem*>(newChild)); }
163 virtual void internalReplaceChild( SoNode *oldChild, SoNode *newChild) { replaceChild(dynamic_cast<SoMenuItem*>(oldChild),dynamic_cast<SoMenuItem*>(newChild)); }
164
165 private:
166
167 // Reads stuff into instance of SoGroup. Returns FALSE on error
168 virtual SbBool readInstance(SoInput *in, unsigned short flags);
169
170 // Reads just the children into instance of SoGroup. Returns FALSE on error
171 virtual SbBool readChildren(SoInput *in);
172
173 virtual ~SoMenuPopup();
174 virtual void changeLabel();
175 virtual void changeEnable();
176
177 private:
178 int m_numberOfChildren;
179 void* m_menuPopupWin;
180 SbBool m_firstBuild;
181
182
183 void insertMenuItem(int index);
184 void updateMenuItem();
185
186 virtual void applyAuditor(SoDialogViz* dlgCpt);
187
189// 3D methods
190private:
191 static char* MenuPopup; //Internal default skin.
192 static void change3DSkin();
193 static SbBool isSkinLoaded();
194 static void setSkinLoaded(SbBool loaded);
195
196 virtual void get3DDefaultSize(SbVec3f& size);
197 void show3DChildren(SbBool show);
198 virtual void change3DPosition();
199 void update3DChildren();
200 void update3DChildrenSize();
201
202private:
203 SO_DG_CATALOG_ENTRY_HEADER( frameSep );
204 SO_DG_CATALOG_ENTRY_HEADER( frameSwitch );
205 SO_DG_CATALOG_ENTRY_HEADER( released );
206 SO_DG_CATALOG_ENTRY_HEADER( pressed );
207 SO_DG_CATALOG_ENTRY_HEADER( shapeReleased );
208 SO_DG_CATALOG_ENTRY_HEADER( shapePressed );
209
210 SoScale* menuPopupFrameScale;
211 SoTranslation* menuPopupFrameTranslation;
212 SoTransform* menuPopupFrameTransform;
213
214 virtual void set3DInactive();
215
216private:
217 SbBool m_isOpenPopup;
218 float m_mPopupCachedDepth;
219 float m_mChildrenCachedDepth;
220 static SbBool m_isSkinLoaded;
221
222 void create3DPopup(int index);
223 void update3DPopup();
224
225 static void startCB3D( void *, SoDragger *inDragger );
226 virtual void draggerStartCallback3D();
227
228private:
229 virtual void getBoundingBox(SoGetBoundingBoxAction* action);
230 virtual void rayPick(SoRayPickAction *action);
231 virtual void search(SoSearchAction *action);
232 virtual void write(SoWriteAction *action);
233
235
236};
237
238#endif // _SO_MENU_POPUP_
239
240
Class for smart character strings.
Definition SbString.h:202
2D vector class.
Definition SbVec.h:517
3D vector class.
Definition SbVec.h:932
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Dialog auditor
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Abstract base cl...
Base class for nodekits that move in response to click-drag-release mouse events.
Definition SoDragger.h:537
Computes bounding box of a scene.
Used to read Open Inventor data files.
Definition SoInput.h:363
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Abstract class f...
Definition SoMenuItem.h:79
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Menu Popup node.
Definition SoMenuPopup.h:65
virtual void replaceChild(int index, SoMenuItem *newChild)
Replaces child with given index with new child.
virtual void removeChild(SoMenuItem *child)
Removes first instance of given child from group.
virtual SoNode * getChild(int index) const
Returns pointer to child node with the given index.
SoMenuPopup()
Constructor.
void removeAuditor(SoDialogAuditor *auditor)
Remove the defined DialogAuditor from the auditor list.
virtual void addChild(SoMenuItem *child)
Adds a child as last one in group.
virtual void insertChild(SoMenuItem *child, int newChildIndex)
Adds a child so that it becomes the one with the given index.
virtual void removeAllChildren()
Removes all children from group.
void addAuditor(SoDialogAuditor *auditor)
Add a dialogAuditor to current menuPopup component.
virtual int getNumChildren() const
Returns number of children.
virtual int findChild(const SoMenuItem *child) const
Finds index of given child within group.
SoDialogViz * searchForAuditorId(SbString id)
Retrieves the DialogViz object from the specified auditorID field in an SoMenuPopup structure.
virtual void replaceChild(SoMenuItem *oldChild, SoMenuItem *newChild)
Replaces first instance of given child with new child.
virtual void removeChild(int index)
Removes child with given index from group.
Abstract base class for all database nodes.
Definition SoNode.h:145
friend class SoChildList
Definition SoNode.h:473
Intersects objects with a ray cast into scene.
Node representing a 3D geometric scaling.
Definition SoScale.h:96
Searches for nodes in a scene graph.
Abstract base class for Open Inventor sensors.
Definition SoSensor.h:100
General 3D geometric transformation node.
Node representing a 3D translation.
Writes a scene graph to a file.
int SbBool
Boolean type.
Definition SbBase.h:87