Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/event/event_listener.cc @ 9869

Last change on this file since 9869 was 9869, checked in by bensch, 18 years ago

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

File size: 1.8 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11   ### File Specific:
12   main-programmer: Patrick Boenzli
13   co-programmer: ...
14*/
15
16#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_EVENT
17
18#include "event_listener.h"
19#include "event_handler.h"
20
21ObjectListDefinition(EventListener);
22/**
23 * @brief standard constructor
24 */
25EventListener::EventListener ()
26{
27  this->registerObject(this, EventListener::_objectList);
28}
29
30
31/**
32 * @brief standard deconstructor
33 *
34 * Unsubscribes all Subscribed Events, of this EventListener.
35 */
36EventListener::~EventListener ()
37{
38  /* unsubscribes itself from the event listener */
39  EventHandler::getInstance()->unsubscribe(this, ES_ALL);
40}
41
42bool EventListener::isEventSubscribed(elState state, int eventType) const
43{
44  return EventHandler::getInstance()->isSubscribed(state, eventType);
45}
46
47
48/**
49 * @brief Subscribes an Events to this EventListener.
50 * @param state the state to subscribe to.
51 * @param eventType the Type of Event to subscribe.
52 */
53void EventListener::subscribeEvent(elState state, int eventType)
54{
55  EventHandler::getInstance()->subscribe(this, state, eventType);
56}
57
58
59/**
60 * @brief Unubscribes an Event from this EventListener.
61 * @param state the state to unsubscribe from.
62 * @param eventType the Type of Event to unsubscribe.
63 */
64void EventListener::unsubscribeEvent(elState state, int eventType)
65{
66  EventHandler::getInstance()->unsubscribe(this, state, eventType);
67}
68
69void EventListener::unsubscribeEvents(elState state)
70{
71  EventHandler::getInstance()->unsubscribe(this, state);
72}
73
Note: See TracBrowser for help on using the repository browser.