00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef CEYLAN_EVENT_SOURCE_H_
00028 #define CEYLAN_EVENT_SOURCE_H_
00029
00030
00031 #include "CeylanEvent.h"
00032 #include "CeylanTextDisplayable.h"
00033
00034
00035 #include <string>
00036 #include <list>
00037
00038
00039
00040 namespace Ceylan
00041 {
00042
00043
00044 class Event ;
00045
00046
00047 class EventListener ;
00048
00049 }
00050
00051
00052
00053 namespace Ceylan
00054 {
00055
00056
00057
00077 class CEYLAN_DLL EventSource : public TextDisplayable
00078 {
00079
00080
00081 public:
00082
00083
00084
00086 EventSource() ;
00087
00088
00089
00095 explicit EventSource( EventListener & listener ) ;
00096
00097
00098
00100 virtual ~EventSource() throw() ;
00101
00102
00103
00112 virtual void add( EventListener & listener ) ;
00113
00114
00115
00131 virtual void remove( const EventListener & listener ) ;
00132
00133
00134
00148 virtual void removeAllListeners() ;
00149
00150
00151
00164 virtual const std::string toString(
00165 Ceylan::VerbosityLevels level = Ceylan::high ) const ;
00166
00167
00168
00169
00170 protected:
00171
00172
00179 virtual void notifyAllListeners( const Event & newEvent ) ;
00180
00181
00187 virtual bool isRegistered( const EventListener & listener ) ;
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197 #pragma warning( push )
00198 #pragma warning( disable : 4251 )
00199
00204 std::list<EventListener *> _listeners ;
00205
00206 #pragma warning( pop )
00207
00208
00209
00210 private:
00211
00212
00222 EventSource( const EventSource & source ) ;
00223
00224
00233 EventSource & operator = ( const EventSource & source ) ;
00234
00235
00236 } ;
00237
00238 }
00239
00240
00241
00242 #endif // CEYLAN_EVENT_SOURCE_H_
00243