Coin Logo Coin3D is Free Software,
published under the BSD 3-clause license.
https://bitbucket.org/Coin3D/
http://www.kongsberg.com/kogt/
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SmPopupMenuKit.h
Go to the documentation of this file.
1 #ifndef SMALLCHANGE_SMPOPUPMENUKIT_H
2 #define SMALLCHANGE_SMPOPUPMENUKIT_H
3 
4 /**************************************************************************\
5  * Copyright (c) Kongsberg Oil & Gas Technologies AS
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are
10  * met:
11  *
12  * Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  *
15  * Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in the
17  * documentation and/or other materials provided with the distribution.
18  *
19  * Neither the name of the copyright holder nor the names of its
20  * contributors may be used to endorse or promote products derived from
21  * this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 \**************************************************************************/
35 
36 #include <Inventor/nodekits/SoSubKit.h>
37 #include <Inventor/nodekits/SoBaseKit.h>
38 #include <Inventor/fields/SoMFNode.h>
39 #include <Inventor/fields/SoSFBool.h>
40 #include <Inventor/fields/SoSFTime.h>
41 #include <Inventor/fields/SoSFInt32.h>
42 #include <Inventor/fields/SoSFFloat.h>
43 #include <Inventor/fields/SoSFVec2s.h>
44 #include <Inventor/fields/SoSFString.h>
45 #include <Inventor/fields/SoMFString.h>
46 #include <Inventor/fields/SoMFBool.h>
47 #include <SmallChange/basic.h>
48 
49 class SmPopupMenuKitP;
50 class SoSensor;
51 class SoPickedPoint;
52 class SbViewportRegion;
53 class SbVec2f;
54 
55 class SMALLCHANGE_DLL_API SmPopupMenuKit : public SoBaseKit {
56  typedef SoBaseKit inherited;
57 
58  SO_KIT_HEADER(SmPopupMenuKit);
59 
60  SO_KIT_CATALOG_ENTRY_HEADER(topSeparator);
61  SO_KIT_CATALOG_ENTRY_HEADER(resetTransform);
62  SO_KIT_CATALOG_ENTRY_HEADER(transparencyType);
63  SO_KIT_CATALOG_ENTRY_HEADER(position);
64  SO_KIT_CATALOG_ENTRY_HEADER(depthBuffer);
65  SO_KIT_CATALOG_ENTRY_HEADER(lightModel);
66  SO_KIT_CATALOG_ENTRY_HEADER(camera);
67  SO_KIT_CATALOG_ENTRY_HEADER(texture);
68  SO_KIT_CATALOG_ENTRY_HEADER(shapeHints);
69  SO_KIT_CATALOG_ENTRY_HEADER(pickStyle);
70  SO_KIT_CATALOG_ENTRY_HEADER(materialBinding);
71  SO_KIT_CATALOG_ENTRY_HEADER(backgroundMaterial);
72  SO_KIT_CATALOG_ENTRY_HEADER(backgroundTexture);
73  SO_KIT_CATALOG_ENTRY_HEADER(justification);
74  SO_KIT_CATALOG_ENTRY_HEADER(backgroundShape);
75  SO_KIT_CATALOG_ENTRY_HEADER(textSeparator);
76  SO_KIT_CATALOG_ENTRY_HEADER(textFont);
77  SO_KIT_CATALOG_ENTRY_HEADER(textColor);
78  SO_KIT_CATALOG_ENTRY_HEADER(textPickStyle);
79  SO_KIT_CATALOG_ENTRY_HEADER(itemSeparator);
80  SO_KIT_CATALOG_ENTRY_HEADER(activeMaterial);
81  SO_KIT_CATALOG_ENTRY_HEADER(activeShape);
82  SO_KIT_CATALOG_ENTRY_HEADER(borderShape);
83  SO_KIT_CATALOG_ENTRY_HEADER(titleSeparator);
84 
85 
86 public:
87  SmPopupMenuKit(void);
88  static void initClass(void);
89 
90  virtual void GLRender(SoGLRenderAction * action);
91  virtual void handleEvent(SoHandleEventAction * action);
92  virtual void getBoundingBox(SoGetBoundingBoxAction * action);
93  virtual void search(SoSearchAction * action);
94  virtual void callback(SoCallbackAction * action);
95  virtual void getMatrix(SoGetMatrixAction * action);
96  virtual void pick(SoPickAction * action);
97  virtual void rayPick(SoRayPickAction * action);
98  virtual void audioRender(SoAudioRenderAction * action);
99  virtual void getPrimitiveCount(SoGetPrimitiveCountAction * action);
100 
101  static void setSchemeEvalFunctions(int (*scriptcb)(const char *),
102  void (*filecb)(const char *));
103 
104 protected:
105  virtual ~SmPopupMenuKit();
106  virtual SbBool affectsState(void) const;
107 
108 public:
109 
110  void setTransparencies(float active, float inactive);
111  void setPickedPoint(const SoPickedPoint * pp, const SbViewportRegion & vp);
112  void setNormalizedPosition(const SbVec2f & npt);
113 
114  void setViewportRegion(const SbViewportRegion & vp);
115 
124 
125  // signal
127 
132 
133  void setParent(SmPopupMenuKit * kit);
134  void childFinished(SmPopupMenuKit * child);
135 
136 private:
137  void updateBackground(void);
138  void updateActiveItem(void);
139  void itemPicked(const int idx);
140 
141  static void items_changed_cb(void * closure, SoSensor * s);
142  static void oneshot_cb(void * closure, SoSensor * s);
143  static void trigger_cb(void * closure, SoSensor * s);
144  static void activeitemchanged_cb(void * closure, SoSensor * s);
145  static void opensub_cb(void * closure, SoSensor * s);
146  static void isactive_cb(void * closure, SoSensor * s);
147  friend class SmPopupMenuKitP;
148  SmPopupMenuKitP * pimpl;
149 };
150 
151 
152 #endif // SMALLCHANGE_SMPOPUPMENUKIT_H
virtual void search(SoSearchAction *action)
SoMFBool itemTagged
Definition: SmPopupMenuKit.h:119
SoMFString itemList
Definition: SmPopupMenuKit.h:116
SoSFFloat spacing
Definition: SmPopupMenuKit.h:130
virtual SbBool affectsState(void) const
SoSFBool visible
Definition: SmPopupMenuKit.h:122
SoSFInt32 frameSize
Definition: SmPopupMenuKit.h:128
virtual void handleEvent(SoHandleEventAction *action)
virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action)
SoSFBool closeParent
Definition: SmPopupMenuKit.h:131
SoSFInt32 pickedItem
Definition: SmPopupMenuKit.h:126
virtual void audioRender(SoAudioRenderAction *action)
virtual void getMatrix(SoGetMatrixAction *action)
SoMFBool itemDisabled
Definition: SmPopupMenuKit.h:120
SoSFVec2s offset
Definition: SmPopupMenuKit.h:129
virtual void GLRender(SoGLRenderAction *action)
SoSFString menuTitle
Definition: SmPopupMenuKit.h:121
virtual void pick(SoPickAction *action)
static void initClass(void)
The SmPopupMenuKit class...FIXME: doc.
Definition: SmPopupMenuKit.h:55
virtual void callback(SoCallbackAction *action)
virtual void getBoundingBox(SoGetBoundingBoxAction *action)
virtual void rayPick(SoRayPickAction *action)
SoMFNode itemData
Definition: SmPopupMenuKit.h:117
SoSFBool isActive
Definition: SmPopupMenuKit.h:123
SoMFString itemSchemeScript
Definition: SmPopupMenuKit.h:118