00001 00010 #ifndef PROPERTYCHANGEDNOTIFIER_H 00011 #define PROPERTYCHANGEDNOTIFIER_H 00012 00013 00014 // Gluebase includes 00015 #define OUTSIDE_GLUE_CORE 00016 #include <std/strings.H> 00017 #include <mlib/points.H> 00018 #include <std/typedobj.H> 00019 00020 class PropertyListener; 00021 class PropertyEvent; 00022 00023 class PropertyChangedNotifier{ 00024 public: 00025 PropertyChangedNotifier(); 00026 virtual ~PropertyChangedNotifier(); 00027 00028 virtual void addPropertyChangeListener(PropertyListener* pl); 00029 virtual void removePropertyChangeListener(PropertyListener *pl); 00030 virtual void firePropertyChangeEvent(PropertyEvent* pce); 00031 int getNumListeners(){return _pls.num();}; 00032 protected: 00033 ARRAY<PropertyListener*> _pls; 00034 }; 00035 00036 class PropertyListener{ 00037 public: 00038 virtual void propertyChanged(PropertyEvent* event)=0; 00039 }; 00040 00041 class PropertyEvent{ 00042 public: 00043 PropertyEvent(str_ptr name,str_ptr event,void* data=NULL); 00044 virtual ~PropertyEvent(); 00045 00046 virtual void setSource(void* ptr); 00047 virtual void* getSource(); 00048 00049 virtual str_ptr getName(); 00050 virtual str_ptr getEvent(); 00051 virtual void* getData(); 00052 protected: 00053 str_ptr _name; 00054 str_ptr _event; 00055 void* _data; 00056 void* _src; 00057 }; 00058 #endif