Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 10184 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
RevLine 
[4817]1/*
[4329]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:
[4346]12   main-programmer: Patrick Boenzli
[4329]13   co-programmer: ...
14*/
15
[4346]16#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_EVENT
[4329]17
[4346]18#include "event_listener.h"
[4817]19#include "event_handler.h"
[4329]20
[9869]21ObjectListDefinition(EventListener);
[4329]22/**
[7868]23 * @brief standard constructor
24 */
[4817]25EventListener::EventListener ()
[4329]26{
[9869]27  this->registerObject(this, EventListener::_objectList);
[4329]28}
29
30
31/**
[7868]32 * @brief standard deconstructor
33 *
34 * Unsubscribes all Subscribed Events, of this EventListener.
35 */
[4817]36EventListener::~EventListener ()
37{
38  /* unsubscribes itself from the event listener */
[4866]39  EventHandler::getInstance()->unsubscribe(this, ES_ALL);
[4817]40}
[7868]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.