14 #ifndef _HEVENTLISTENER_H 15 #define _HEVENTLISTENER_H 32 #define HLISTENER_PASS_EVENT 0 33 #define HLISTENER_CONSUME_EVENT 999 36 #define HLISTENER_PRIORITY_NORMAL 5 38 #define HLISTENER_PRIORITY_HIGH 10 40 #define HLISTENER_PRIORITY_LOW 0 56 #ifndef DOXYGEN_SHOULD_SKIP_THIS 58 #define HLISTENER_EVENT(ListenerType, manager, callback) \ 60 ListenerType * listener = (ListenerType *)manager->GetEventListenerManager(ListenerType::GetType()); \ 62 (listener->callback); \ 65 #define HLISTENER_EVENT_STRING(ListenerType, manager, callback) \ 67 ListenerType * listener = (ListenerType *)manager->GetEventListenerManager(ListenerType::GetStringType()); \ 69 (listener->callback); \ 72 #define HLISTENER_FUNCTION_0(Class, Method) \ 73 virtual int Method() { \ 74 if (!m_pEventListenerManager) \ 76 m_pEventListenerManager->StartQuery(); \ 78 while ((listener = (Class *)m_pEventListenerManager->GetEventListener()) != 0) \ 79 if (listener->Method() == HLISTENER_CONSUME_EVENT) \ 84 #define HLISTENER_FUNCTION_1(Class, Method, ParamType_1, param1) \ 85 virtual int Method(ParamType_1 param_1) { \ 86 if (!m_pEventListenerManager) \ 88 m_pEventListenerManager->StartQuery(); \ 90 while ((listener = (Class *)m_pEventListenerManager->GetEventListener()) != 0) \ 91 if (listener->Method(param_1) == HLISTENER_CONSUME_EVENT) \ 96 #define HLISTENER_FUNCTION_2(Class, Method, ParamType_1, param_1, ParamType_2, param_2) \ 97 virtual int Method(ParamType_1 param_1, ParamType_2 param_2) { \ 98 if (!m_pEventListenerManager) \ 100 m_pEventListenerManager->StartQuery(); \ 102 while ((listener = (Class *)m_pEventListenerManager->GetEventListener()) != 0) \ 103 if (listener->Method(param_1, param_2) == HLISTENER_CONSUME_EVENT) \ 108 #define HLISTENER_FUNCTION_3(Class, Method, ParamType_1, param_1, ParamType_2, param_2, ParamType_3, param_3) \ 109 virtual int Method(ParamType_1 param_1, ParamType_2 param_2, ParamType_3 param_3) { \ 110 if (!m_pEventListenerManager) \ 112 m_pEventListenerManager->StartQuery(); \ 114 while ((listener = (Class *)m_pEventListenerManager->GetEventListener()) != 0) \ 115 if (listener->Method(param_1, param_2, param_3) == HLISTENER_CONSUME_EVENT) \ 120 #define HLISTENER_SETUP_FUNCTIONS(ListenerType) \ 121 static HEventListenerType GetType() \ 123 return ListenerType##Type; \ 125 virtual HEventListener * CreateListenerManager() \ 127 HEventListener * listener = (HEventListener *)new ListenerType(); \ 128 listener->ConvertToManager(); \ 132 #define HLISTENER_SETUP_FUNCTIONS_STRING(ListenerType, string_type) \ 133 static HEventListenerType GetType() { return HUserdefinerListenerType; } \ 134 static const char * GetStringType() { return string_type; } \ 135 virtual HEventListener * CreateListenerManager() \ 137 HEventListener * temp = (HEventListener *)new ListenerType(); \ 138 temp->ConvertToManager(); \ 142 #endif //DOXYGEN_SHOULD_SKIP_THIS 146 class HMouseListenerManager;
147 class HUpdateListenerManager;
168 void AddEventListener(
HEventListener * eventlistener,
int priority);
219 if (m_pEventListenerManager)
220 delete m_pEventListenerManager;
227 if (m_pEventListenerManager == 0)
260 #ifndef DOXYGEN_SHOULD_SKIP_THIS 270 HLISTENER_SETUP_FUNCTIONS(HUpdateListener);
271 HLISTENER_FUNCTION_1(HUpdateListener, CameraChangedEvent,
HBaseView *, view);
272 HLISTENER_FUNCTION_2(HUpdateListener, UpdateEvent,
bool, antialias,
bool, forceUpdate);
273 HLISTENER_FUNCTION_1(HUpdateListener, ViewDestroyedEvent,
HBaseView *, view);
274 HLISTENER_FUNCTION_1(HUpdateListener, SmoothTransitionFinishedEvent,
HBaseView *, view);
284 HLISTENER_SETUP_FUNCTIONS(HFitWorldListener);
285 HLISTENER_FUNCTION_1(HFitWorldListener, PreFitWorldEvent,
HBaseView *, view);
286 HLISTENER_FUNCTION_1(HFitWorldListener, PostFitWorldEvent,
HBaseView *, view);
296 HLISTENER_SETUP_FUNCTIONS(HObjectManipulationListener);
297 HLISTENER_FUNCTION_3(HObjectManipulationListener, SetupHandlesEvent,
HBaseView *, view, HC_KEY, key,
bool, complex);
298 HLISTENER_FUNCTION_3(HObjectManipulationListener, ObjectBeforeMoveEvent,
HBaseView *, view, HC_KEY, key,
HPoint *, p);
299 HLISTENER_FUNCTION_3(HObjectManipulationListener, ObjectMovedEvent,
HBaseView *, view, HC_KEY, key,
HPoint *, p);
300 HLISTENER_FUNCTION_3(HObjectManipulationListener, ObjectScaledEvent,
HBaseView *, view, HC_KEY, key,
HPoint &, p);
311 HLISTENER_SETUP_FUNCTIONS(HAnimationListener);
313 HLISTENER_FUNCTION_1(HAnimationListener, AnimationFinishedEvent,
HBhvAnimation *, ainst);
314 HLISTENER_FUNCTION_1(HAnimationListener, KeyframeEditorExistsQuery,
bool &, res);
315 HLISTENER_FUNCTION_0(HAnimationListener, KeyframeAddedEvent);
316 HLISTENER_FUNCTION_1(HAnimationListener, ObjectCollisionEvent,
HBhvTargetObject *, tob);
317 HLISTENER_FUNCTION_1(HAnimationListener, ObjectNoCollisionEvent,
HBhvTargetObject *, tob);
328 HLISTENER_SETUP_FUNCTIONS(HSensorListener);
329 HLISTENER_FUNCTION_1(HSensorListener, SensorActivatedEvent,
HBhvSensor *, sensor);
330 HLISTENER_FUNCTION_1(HSensorListener, SensorActionEvent,
const char *, action);
342 HLISTENER_SETUP_FUNCTIONS(HMouseListener);
344 HLISTENER_FUNCTION_1(HMouseListener, OnLButtonDown,
HEventInfo &, hevent);
345 HLISTENER_FUNCTION_1(HMouseListener, OnMouseMove,
HEventInfo &, hevent);
346 HLISTENER_FUNCTION_1(HMouseListener, OnLButtonUp,
HEventInfo &, hevent);
347 HLISTENER_FUNCTION_1(HMouseListener, OnLButtonDblClk,
HEventInfo &, hevent);
348 HLISTENER_FUNCTION_1(HMouseListener, OnMButtonDown,
HEventInfo &, hevent);
349 HLISTENER_FUNCTION_1(HMouseListener, OnMButtonUp,
HEventInfo &, hevent);
350 HLISTENER_FUNCTION_1(HMouseListener, OnMButtonDblClk,
HEventInfo &, hevent);
351 HLISTENER_FUNCTION_1(HMouseListener, OnRButtonDown,
HEventInfo &, hevent);
352 HLISTENER_FUNCTION_1(HMouseListener, OnRButtonUp,
HEventInfo &, hevent);
353 HLISTENER_FUNCTION_1(HMouseListener, OnRButtonDblClk,
HEventInfo &, hevent);
354 HLISTENER_FUNCTION_1(HMouseListener, OnMouseWheel,
HEventInfo &, hevent);
355 HLISTENER_FUNCTION_1(HMouseListener, OnKeyDown,
HEventInfo &, hevent);
356 HLISTENER_FUNCTION_1(HMouseListener, OnKeyUp,
HEventInfo &, hevent);
357 HLISTENER_FUNCTION_1(HMouseListener, OnTouchesDown,
HEventInfo &, hevent);
358 HLISTENER_FUNCTION_1(HMouseListener, OnTouchesMove,
HEventInfo &, hevent);
359 HLISTENER_FUNCTION_1(HMouseListener, OnTouchesUp,
HEventInfo &, hevent);
369 HLISTENER_SETUP_FUNCTIONS(HJoyStickListener);
371 HLISTENER_FUNCTION_1(HJoyStickListener, OnJoyStickRotation,
HEventInfo &, hevent);
372 HLISTENER_FUNCTION_1(HJoyStickListener, OnJoyStickTranslation,
HEventInfo &, hevent);
373 HLISTENER_FUNCTION_1(HJoyStickListener, OnJoyStickButton,
HEventInfo &, hevent);
376 #endif //DOXYGEN_SHOULD_SKIP_THIS void ConvertToManager()
Definition: HEventListener.h:226
self-explanatory
Definition: HEventListener.h:46
bool m_bQueryInProgress
Definition: HEventListener.h:198
virtual HEventListener * CreateListenerManager()
Definition: HEventListener.h:235
int m_RequestedPriority
Definition: HEventListener.h:255
HEventListenerManager * m_pEventListenerManager
Definition: HEventListener.h:254
HEventListener()
Definition: HEventListener.h:216
The HEventListener class is the base class for all event types.
Definition: HEventListener.h:210
The HBhvTargetObject class encapsulates various target types for animations and sensors.
Definition: HBhvBehaviorManager.h:82
Listens for mouse events like mouse moves and double clicks.
Definition: HEventListener.h:48
The HBhvSensor class encapsulates an animation sensor.
Definition: HBhvSensor.h:33
Listens when sensors are activated.
Definition: HEventListener.h:50
The HPoint class is the data type of a three-dimensional point.
Definition: HGlobals.h:121
The HBaseView class defines and manages a view of model information.
Definition: HBaseView.h:332
int GetRequestedPriority()
Definition: HEventListener.h:251
Listens for animation events like when key frames are added or when objects collide.
Definition: HEventListener.h:49
HEventListenerType
Definition: HEventListener.h:45
The HBhvAnimation class defines an animation.
Definition: HBhvAnimation.h:43
void SetRequestedPriority(int v)
Definition: HEventListener.h:246
HEventListenerManager * GetEventListenerManager()
Definition: HEventListener.h:240
The HEventInfo class stores and manages event information.
Definition: HEventInfo.h:207
Listens for 3DMouse/Joystick translation and rotation events.
Definition: HEventListener.h:53
The HEventListenerManager class is used to dispatch event for a specific type.
Definition: HEventListener.h:152
Listens for when fit world event will happen.
Definition: HEventListener.h:51
Listens for object manipulation events like when objects are moved or scaled.
Definition: HEventListener.h:52
Listens for update events like camera changed or view destroyed.
Definition: HEventListener.h:47
Interface of the HEventInfo class.
struct vlist_s * m_pEventListenerList
Definition: HEventListener.h:197