AGXDynamics  2.31.1.0
EventListener.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2021. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #ifndef AGXSDK_EVENTLISTENER_H
18 #define AGXSDK_EVENTLISTENER_H
19 
20 #include <agxSDK/agxSDK.h>
21 #include <agx/Component.h>
22 
23 #include <agxStream/Serializable.h>
24 
25 namespace agxSDK
26 {
27 
28  class Simulation;
29 
32 
38  {
39  public:
40 
42  enum Type {
46  GUI_EVENT_LISTENER
47  };
48 
53  virtual void setMask(int f);
54 
56  int getMask() const;
57 
62  void setEnable( bool enable );
63 
67  bool isEnabled( ) const;
68 
72  Simulation* getSimulation();
73 
77  const Simulation* getSimulation() const;
78 
83  virtual void addNotification() {}
84 
88  virtual void removeNotification() {}
89 
91  Type getType() const;
92 
94  int getPriority() const;
95 
96 #ifndef SWIG
98 #endif
99 
100  private:
102  void setPriority( agx::UInt32 priority );
103 
104  protected:
109  EventListener( Type type = UNDEFINED_TYPE );
110 
111 
112  friend class Simulation;
113  friend class EventManager;
114 
116  void setSimulation( Simulation* simulation );
117 
119  virtual ~EventListener();
120 
122 
123  int m_mask;
124  bool m_enabled;
126  private:
127 
128  Simulation* m_simulation;
129  };
130 
131 }
132 
133 #endif
AGXCORE_EXPORT Type * getType(const agx::String &name)
Type
Type of EventListener.
Definition: EventListener.h:42
A component is an object containing other objects, enabling hierarchical structuring.
Definition: Component.h:38
virtual void removeNotification()
Called when this listener is removed from the simulation.
Definition: EventListener.h:88
#define AGXPHYSICS_EXPORT
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
virtual void addNotification()
Called when this listener is added to the simulation.
Definition: EventListener.h:83
Templated vector class.
Definition: Vector.h:52
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
Definition: Serializable.h:206
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:44
An EventListener can be associated to a Simulation and triggered upon various events.
Definition: EventListener.h:37
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:121
Of type ContactEventListener.
Definition: EventListener.h:45
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:30
agx::Vector< EventListener * > EventListenerPtrVector
Definition: EventListener.h:31
uint32_t UInt32
Definition: Integer.h:40
GLenum type
Definition: gl.h:5539