Crazy Eddies GUI System: CEGUIEventSet.h Source File

Crazy Eddies GUI System 0.7.6

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

CEGUIEventSet.h

    00001 /***********************************************************************
    00002         filename:       CEGUIEventSet.h
    00003         created:        21/2/2004
    00004         author:         Paul D Turner
    00005
    00006         purpose:        Defines class for a named collection of Event objects
    00007 *************************************************************************/
    00008 /***************************************************************************
    00009  *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
    00010  *
    00011  *   Permission is hereby granted, free of charge, to any person obtaining
    00012  *   a copy of this software and associated documentation files (the
    00013  *   "Software"), to deal in the Software without restriction, including
    00014  *   without limitation the rights to use, copy, modify, merge, publish,
    00015  *   distribute, sublicense, and/or sell copies of the Software, and to
    00016  *   permit persons to whom the Software is furnished to do so, subject to
    00017  *   the following conditions:
    00018  *
    00019  *   The above copyright notice and this permission notice shall be
    00020  *   included in all copies or substantial portions of the Software.
    00021  *
    00022  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    00023  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    00024  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
    00025  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
    00026  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
    00027  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
    00028  *   OTHER DEALINGS IN THE SOFTWARE.
    00029  ***************************************************************************/
    00030 #ifndef _CEGUIEventSet_h_
    00031 #define _CEGUIEventSet_h_
    00032
    00033 #include "CEGUIBase.h"
    00034 #include "CEGUIString.h"
    00035 #include "CEGUIEvent.h"
    00036 #include "CEGUIIteratorBase.h"
    00037 #include <map>
    00038
    00039 #if defined (_MSC_VER)
    00040 #       pragma warning(push)
    00041 #       pragma warning(disable : 4251)
    00042 #endif
    00043
    00044
    00045 // Start of CEGUI namespace section
    00046 namespace CEGUI
    00047 {
    00066 class CEGUIEXPORT EventSet
    00067 {
    00068 public:
    00073         EventSet();
    00074
    00075
    00080         virtual ~EventSet(void);
    00081
    00082
    00095         void    addEvent(const String& name);
    00096
    00097
    00108         void    removeEvent(const String& name);
    00109
    00110
    00118         void    removeAllEvents(void);
    00119
    00120
    00128         bool    isEventPresent(const String& name);
    00129
    00130
    00146     virtual Event::Connection subscribeEvent(const String& name, Event::Subscriber subscriber);
    00147
    00148
    00168     virtual Event::Connection subscribeEvent(const String& name, Event::Group group, Event::Subscriber subscriber);
    00169
    00170
    00186     virtual Event::Connection subscribeScriptedEvent(const String& name, const String& subscriber_name);
    00187
    00188
    00208     virtual Event::Connection subscribeScriptedEvent(const String& name, Event::Group group, const String& subscriber_name);
    00209
    00210
    00232     virtual void fireEvent(const String& name, EventArgs& args, const String& eventNamespace = "");
    00233
    00234
    00243         bool    isMuted(void) const;
    00244
    00245
    00257         void    setMutedState(bool setting);
    00258
    00259
    00260 protected:
    00280     Event* getEventObject(const String& name, bool autoAdd = false);
    00281
    00286     void fireEvent_impl(const String& name, EventArgs& args);
    00287
    00288
    00289         // Do not allow copying, assignment, or any other usage than simple creation.
    00290         EventSet(EventSet&) {}
    00291         EventSet& operator=(EventSet&) {return *this;}
    00292
    00293         typedef std::map<String, Event*, String::FastLessCompare>       EventMap;
    00294         EventMap        d_events;
    00295
    00296         bool    d_muted;
    00297
    00298 public:
    00299         /*************************************************************************
    00300                 Iterator stuff
    00301         *************************************************************************/
    00302     typedef     ConstBaseIterator<EventMap> Iterator;
    00303
    00309     Iterator getIterator(void) const;
    00310 };
    00311
    00312 } // End of  CEGUI namespace section
    00313
    00314
    00315 #if defined(_MSC_VER)
    00316 #       pragma warning(pop)
    00317 #endif
    00318
    00319 #endif  // end of guard _CEGUIEventSet_h_