Crazy Eddies GUI System  0.7.7
CEGUIEventSet.h
1 /***********************************************************************
2  filename: CEGUIEventSet.h
3  created: 21/2/2004
4  author: Paul D Turner
5 
6  purpose: Defines class for a named collection of Event objects
7 *************************************************************************/
8 /***************************************************************************
9  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining
12  * a copy of this software and associated documentation files (the
13  * "Software"), to deal in the Software without restriction, including
14  * without limitation the rights to use, copy, modify, merge, publish,
15  * distribute, sublicense, and/or sell copies of the Software, and to
16  * permit persons to whom the Software is furnished to do so, subject to
17  * the following conditions:
18  *
19  * The above copyright notice and this permission notice shall be
20  * included in all copies or substantial portions of the Software.
21  *
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
26  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
27  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28  * OTHER DEALINGS IN THE SOFTWARE.
29  ***************************************************************************/
30 #ifndef _CEGUIEventSet_h_
31 #define _CEGUIEventSet_h_
32 
33 #include "CEGUIBase.h"
34 #include "CEGUIString.h"
35 #include "CEGUIEvent.h"
36 #include "CEGUIIteratorBase.h"
37 #include <map>
38 
39 #if defined (_MSC_VER)
40 # pragma warning(push)
41 # pragma warning(disable : 4251)
42 #endif
43 
44 
45 // Start of CEGUI namespace section
46 namespace CEGUI
47 {
66 class CEGUIEXPORT EventSet
67 {
68 public:
73  EventSet();
74 
75 
80  virtual ~EventSet(void);
81 
82 
95  void addEvent(const String& name);
96 
97 
108  void removeEvent(const String& name);
109 
110 
118  void removeAllEvents(void);
119 
120 
128  bool isEventPresent(const String& name);
129 
130 
146  virtual Event::Connection subscribeEvent(const String& name, Event::Subscriber subscriber);
147 
148 
168  virtual Event::Connection subscribeEvent(const String& name, Event::Group group, Event::Subscriber subscriber);
169 
170 
186  virtual Event::Connection subscribeScriptedEvent(const String& name, const String& subscriber_name);
187 
188 
208  virtual Event::Connection subscribeScriptedEvent(const String& name, Event::Group group, const String& subscriber_name);
209 
210 
232  virtual void fireEvent(const String& name, EventArgs& args, const String& eventNamespace = "");
233 
234 
243  bool isMuted(void) const;
244 
245 
257  void setMutedState(bool setting);
258 
259 
260 protected:
280  Event* getEventObject(const String& name, bool autoAdd = false);
281 
286  void fireEvent_impl(const String& name, EventArgs& args);
287 
288 
289  // Do not allow copying, assignment, or any other usage than simple creation.
290  EventSet(EventSet&) {}
291  EventSet& operator=(EventSet&) {return *this;}
292 
293  typedef std::map<String, Event*, String::FastLessCompare> EventMap;
294  EventMap d_events;
295 
296  bool d_muted;
297 
298 public:
299  /*************************************************************************
300  Iterator stuff
301  *************************************************************************/
303 
309  Iterator getIterator(void) const;
310 };
311 
312 } // End of CEGUI namespace section
313 
314 
315 #if defined(_MSC_VER)
316 # pragma warning(pop)
317 #endif
318 
319 #endif // end of guard _CEGUIEventSet_h_