# 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     Crazy Eddie's GUI System (http://www.cegui.org.uk)
    00010     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
    00011
    00012     This library is free software; you can redistribute it and/or
    00013     modify it under the terms of the GNU Lesser General Public
    00014     License as published by the Free Software Foundation; either
    00015     version 2.1 of the License, or (at your option) any later version.
    00016
    00017     This library is distributed in the hope that it will be useful,
    00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00020     Lesser General Public License for more details.
    00021
    00022     You should have received a copy of the GNU Lesser General Public
    00023     License along with this library; if not, write to the Free Software
    00024     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    00025 *************************************************************************/
    00026 #ifndef _CEGUIEventSet_h_
    00027 #define _CEGUIEventSet_h_
    00028
    00029 #include "CEGUIBase.h"
    00030 #include "CEGUIString.h"
    00031 #include "CEGUIEvent.h"
    00032 #include "CEGUIIteratorBase.h"
    00033 #include <map>
    00034
    00035 #if defined (_MSC_VER)
    00036 #       pragma warning(push)
    00037 #       pragma warning(disable : 4251)
    00038 #endif
    00039
    00040
    00041 // Start of CEGUI namespace section
    00042 namespace CEGUI
    00043 {
    00051 class CEGUIEXPORT EventSet
    00052 {
    00053 public:
    00058         EventSet();
    00059
    00060
    00065         virtual ~EventSet(void);
    00066
    00067
    00080         void    addEvent(const String& name);
    00081
    00082
    00093         void    removeEvent(const String& name);
    00094
    00095
    00103         void    removeAllEvents(void);
    00104
    00105
    00113         bool    isEventPresent(const String& name);
    00114
    00115
    00131         virtual Event::Connection       subscribeEvent(const String& name, Event::Subscriber subscriber);
    00132
    00133
    00152         virtual Event::Connection       subscribeEvent(const String& name, Event::Group group, Event::Subscriber subscriber);
    00153
    00154
    00170         virtual Event::Connection       subscribeScriptedEvent(const String& name, const String& subscriber_name);
    00171
    00172
    00191         virtual Event::Connection       subscribeScriptedEvent(const String& name, Event::Group group, const String& subscriber_name);
    00192
    00193
    00213         virtual void    fireEvent(const String& name, EventArgs& args, const String& eventNamespace = "");
    00214
    00215
    00224         bool    isMuted(void) const;
    00225
    00226
    00238         void    setMutedState(bool setting);
    00239
    00240
    00241 protected:
    00242         // Do not allow copying, assignment, or any other usage than simple creation.
    00243         EventSet(EventSet& e) {}
    00244         EventSet& operator=(EventSet& e) {return *this;}
    00245
    00246         typedef std::map<String, Event*>        EventMap;
    00247         EventMap        d_events;
    00248
    00249         bool    d_muted;
    00250
    00251 public:
    00252         /*************************************************************************
    00253                 Iterator stuff
    00254         *************************************************************************/
    00255         typedef ConstBaseIterator<EventMap>     EventIterator;
    00256
    00261         EventIterator   getIterator(void) const;
    00262 };
    00263
    00264 } // End of  CEGUI namespace section
    00265
    00266
    00267 #if defined(_MSC_VER)
    00268 #       pragma warning(pop)
    00269 #endif
    00270
    00271 #endif  // end of guard _CEGUIEventSet_h_