Open Inventor Reference
SoHandleEventAction.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * Further, this software is distributed without any warranty that it is
16  * free of the rightful claim of any third person regarding infringement
17  * or the like. Any license provided herein, whether implied or
18  * otherwise, applies only to this software file. Patent licenses, if
19  * any, provided herein do not apply to combinations of this program with
20  * other software, or any other product whatsoever.
21  *
22  * You should have received a copy of the GNU Lesser General Public
23  * License along with this library; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25  *
26  * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
27  * Mountain View, CA 94043, or:
28  *
29  * http://www.sgi.com
30  *
31  * For further information regarding this notice, see:
32  *
33  * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
34  *
35  */
36 
37 
38 /*
39  * Copyright (C) 1990,91 Silicon Graphics, Inc.
40  *
41  _______________________________________________________________________
42  ______________ S I L I C O N G R A P H I C S I N C . ____________
43  |
44  | $Revision: 1.1.1.1 $
45  |
46  | Description:
47  | Defines the SoHandleEventAction class
48  |
49  | Author(s) : Paul S. Strauss
50  |
51  ______________ S I L I C O N G R A P H I C S I N C . ____________
52  _______________________________________________________________________
53  */
54 
55 #ifndef _SO_HANDLE_EVENT_ACTION_
56 #define _SO_HANDLE_EVENT_ACTION_
57 
62 
63 class SoEvent;
64 
65 
68 
93 
95 
97 
98  public:
99 
102  SoHandleEventAction(const SbViewportRegion &viewportRegion);
103 
106 
108  void setViewportRegion(const SbViewportRegion &newRegion);
109 
111  const SbViewportRegion &getViewportRegion() const { return vpRegion; }
112 
114  void setEvent(const SoEvent *ev) { event = ev; }
116  const SoEvent * getEvent() const { return event; }
117 
121  bool isHandled() const { return hasTerminated(); }
122 
125  void setGrabber(SoNode *node);
127  void releaseGrabber() { setGrabber(NULL); }
129  SoNode * getGrabber() const { return eventGrabber; }
130 
133  void setPickRoot(SoNode *node);
136  SoNode * getPickRoot() const { return pickRoot; }
137 
144  void setPickRadius(float radiusInPixels)
145  { pickAct->setRadius(radiusInPixels); }
146 
155 
159 
160  SoINTERNAL public:
161  static void initClass();
162 
163  protected:
165  virtual void beginTraversal(SoNode *node);
166 
167  private:
168  const SoEvent *event;
169  SoNode *pickRoot;
170  SoPickedPoint *pickedPoint;
171  bool pickValid;
172  bool usedPickAll;
173  SoRayPickAction *pickAct;
174  SoNode *eventGrabber;
175  SbViewportRegion vpRegion;
176 };
177 
178 #endif /* _SO_HANDLE_EVENT_ACTION_ */
#define TRUE
Definition: SbBasic.h:76
#define SoINTERNAL
Definition: SbBasic.h:155
#define INVENTOR_API
Disable some annoying warnings on MSVC 6.
Definition: SbSystem.h:81
#define SO_ACTION_HEADER(className)
Macros to be called within the class definition header for an action subclass:
Definition: SoSubAction.h:87
Class for representing a viewport.
Abstract base class for all actions.
Definition: SoAction.h:179
bool hasTerminated() const
Returns TRUE if the traversal has reached a termination condition.
Definition: SoAction.h:287
void setTerminated(bool flag)
Allows subclass instance to indicate that traversal has reached a termination condition.
Definition: SoAction.h:353
Base class for all events.
Definition: SoEvent.h:84
Allows nodes in a graph to receive input events.
virtual ~SoHandleEventAction()
Destructor.
const SoEvent * getEvent() const
Sets/returns the event being handled.
void setHandled()
Sets/returns whether any node has yet handled the event.
const SoPickedPointList & getPickedPointList()
Returns a list of objects intersected by a picking operation, sorted from nearest to farthest.
bool isHandled() const
Sets/returns whether any node has yet handled the event.
void setGrabber(SoNode *node)
Initiates grabbing of future events.
SoNode * getPickRoot() const
Sets/returns the root node used for initiating a pick action for those nodes that want to know what i...
virtual void beginTraversal(SoNode *node)
Initiates action on graph.
void setPickRadius(float radiusInPixels)
Set the radius (in pixels) around the viewport-space point through which the ray passes when doing ra...
SoNode * getGrabber() const
Returns the node that is currently grabbing events, or NULL if there is none.
const SbViewportRegion & getViewportRegion() const
Sets/returns current viewport region to use for action.
SoHandleEventAction(const SbViewportRegion &viewportRegion)
Constructor takes viewport region to use; this is needed to perform a pick operation when requested.
void setViewportRegion(const SbViewportRegion &newRegion)
Sets/returns current viewport region to use for action.
const SoPickedPoint * getPickedPoint()
Returns the frontmost object hit (as an SoPickedPoint) by performing a pick based on the mouse locati...
void setPickRoot(SoNode *node)
Sets/returns the root node used for initiating a pick action for those nodes that want to know what i...
void setEvent(const SoEvent *ev)
Sets/returns the event being handled.
static void initClass()
void releaseGrabber()
Releases the grab.
Abstract base class for all database nodes.
Definition: SoNode.h:103
Maintains a list of pointers to SoPickedPoint instances.
Definition: SoLists.h:383
Represents point on surface of picked object.
Definition: SoPickedPoint.h:89
Intersects objects with a ray cast into scene.