[1092] | 1 | /************************************************************************
|
---|
| 2 | filename: CEGUIGlobalEventSet.h
|
---|
| 3 | created: 16/1/2005
|
---|
| 4 | author: Paul D Turner
|
---|
| 5 | *************************************************************************/
|
---|
| 6 | /*************************************************************************
|
---|
| 7 | Crazy Eddie's GUI System (http:www.cegui.org.uk)
|
---|
| 8 | Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
|
---|
| 9 |
|
---|
| 10 | This library is free software; you can redistribute it and/or
|
---|
| 11 | modify it under the terms of the GNU Lesser General Public
|
---|
| 12 | License as published by the Free Software Foundation; either
|
---|
| 13 | version 2.1 of the License, or (at your option) any later version.
|
---|
| 14 |
|
---|
| 15 | This library is distributed in the hope that it will be useful,
|
---|
| 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 18 | Lesser General Public License for more details.
|
---|
| 19 |
|
---|
| 20 | You should have received a copy of the GNU Lesser General Public
|
---|
| 21 | License along with this library; if not, write to the Free Software
|
---|
| 22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
| 23 | *************************************************************************/
|
---|
| 24 | #ifndef _CEGUIGlobalEventSet_h_
|
---|
| 25 | #define _CEGUIGlobalEventSet_h_
|
---|
| 26 |
|
---|
| 27 | #include "CEGUIEventSet.h"
|
---|
| 28 | #include "CEGUISingleton.h"
|
---|
| 29 |
|
---|
| 30 |
|
---|
| 31 | // Start of CEGUI namespace section
|
---|
| 32 | namespace CEGUI
|
---|
| 33 | {
|
---|
| 34 |
|
---|
| 35 | class CEGUIEXPORT GlobalEventSet : public EventSet, public Singleton<GlobalEventSet>
|
---|
| 36 | {
|
---|
| 37 | public:
|
---|
| 38 | GlobalEventSet();
|
---|
| 39 | ~GlobalEventSet();
|
---|
| 40 |
|
---|
| 41 |
|
---|
| 42 | /*!
|
---|
| 43 | \brief
|
---|
| 44 | Return singleton System object
|
---|
| 45 |
|
---|
| 46 | \return
|
---|
| 47 | Singleton System object
|
---|
| 48 | */
|
---|
| 49 | static GlobalEventSet& getSingleton(void);
|
---|
| 50 |
|
---|
| 51 |
|
---|
| 52 | /*!
|
---|
| 53 | \brief
|
---|
| 54 | Return pointer to singleton System object
|
---|
| 55 |
|
---|
| 56 | \return
|
---|
| 57 | Pointer to singleton System object
|
---|
| 58 | */
|
---|
| 59 | static GlobalEventSet* getSingletonPtr(void);
|
---|
| 60 |
|
---|
| 61 |
|
---|
| 62 | /*!
|
---|
| 63 | \brief
|
---|
| 64 | Subscribes the the named Event.
|
---|
| 65 |
|
---|
| 66 | \note
|
---|
| 67 | If the named event does not exist it is added.
|
---|
| 68 |
|
---|
| 69 | \param name
|
---|
| 70 | String object containing the name of the Event to subscribe to.
|
---|
| 71 |
|
---|
| 72 | \param subscriber
|
---|
| 73 | Function or object that is to be subscribed to the Event.
|
---|
| 74 |
|
---|
| 75 | \return
|
---|
| 76 | Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.
|
---|
| 77 | */
|
---|
| 78 | virtual Event::Connection subscribeEvent(const String& name, Event::Subscriber subscriber);
|
---|
| 79 |
|
---|
| 80 |
|
---|
| 81 | /*!
|
---|
| 82 | \brief
|
---|
| 83 | Subscribes the the specified group of the named Event.
|
---|
| 84 |
|
---|
| 85 | /note
|
---|
| 86 | If the named event does not exist it is added.
|
---|
| 87 |
|
---|
| 88 | \param name
|
---|
| 89 | String object containing the name of the Event to subscribe to.
|
---|
| 90 |
|
---|
| 91 | \param group
|
---|
| 92 | Group which is to be subscribed to. Subscription groups are called in ascending order.
|
---|
| 93 |
|
---|
| 94 | \param subscriber
|
---|
| 95 | Function or object that is to be subscribed to the Event.
|
---|
| 96 |
|
---|
| 97 | \return
|
---|
| 98 | Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.
|
---|
| 99 | */
|
---|
| 100 | virtual Event::Connection subscribeEvent(const String& name, Event::Group group, Event::Subscriber subscriber);
|
---|
| 101 |
|
---|
| 102 |
|
---|
| 103 | /*!
|
---|
| 104 | \brief
|
---|
| 105 | Fires the named event passing the given EventArgs object.
|
---|
| 106 |
|
---|
| 107 | \param name
|
---|
| 108 | String object holding the name of the Event that is to be fired (triggered)
|
---|
| 109 |
|
---|
| 110 | \param args
|
---|
| 111 | The EventArgs (or derived) object that is to be bassed to each subscriber of the Event. Once all subscribers
|
---|
| 112 | have been called the 'handled' field of the event is updated appropriately.
|
---|
| 113 |
|
---|
| 114 | \param eventNamespace
|
---|
| 115 | String object describing the namespace prefix to use when firing the global event.
|
---|
| 116 |
|
---|
| 117 | \return
|
---|
| 118 | Nothing.
|
---|
| 119 | */
|
---|
| 120 | virtual void fireEvent(const String& name, EventArgs& args, const String& eventNamespace = "");
|
---|
| 121 | };
|
---|
| 122 |
|
---|
| 123 | } // End of CEGUI namespace section
|
---|
| 124 |
|
---|
| 125 |
|
---|
| 126 | #endif // end of guard _CEGUIGlobalEventSet_h_
|
---|