00001 //--- < EVENTHUB.H > ------------| ViewGraph - A Flexible Graph view Framework | 00002 // 00003 // Event hubs allow other objects to receive 00004 // events they are interested in. Derive your 00005 // class from EventHub to allow other objects 00006 // to attach event listeners to it. 00007 // 00008 // $Author: botik32 $ 00009 // $Revision: 1.3 $ 00010 // $Date: 2004/05/03 21:02:01 $ 00011 //-----------------------------------------------------------------------------/ 00012 00013 #ifndef EVENTHUB_H 00014 #define EVENTHUB_H 00015 00016 #include <set> 00017 #include <map> 00018 00019 class Event; 00020 class EventListener; 00021 00022 /// Event hubs allow other objects to receive 00023 /// events they are interested in. Derive your 00024 /// class from EventHub to allow other objects 00025 /// to attach event listeners to it. 00026 class EventHub 00027 { 00028 protected: 00029 // Register event listeners to directly receive 00030 // specific events even if the node not present 00031 // in the camera or not visible 00032 std::map< const char*, std::set<EventListener*>* > 00033 event_listeners; 00034 void send_event2listeners( Event * ); 00035 public: 00036 virtual void register_event_listener( const char *, 00037 EventListener * ); 00038 virtual void unregister_event_listener( const char *, 00039 EventListener * ); 00040 00041 virtual ~EventHub(); 00042 }; 00043 00044 #endif 00045 00046 /// $Log: eventhub.h,v $ 00047 /// Revision 1.3 2004/05/03 21:02:01 botik32 00048 /// Significant changes and many bugfixes. 00049 /// ScrollableView now has a background color used to 00050 /// tell SurfaceDriver to clear with. 00051 /// SurfaceDriver's clear() requires a color now 00052 /// Added SceneEvents for all node additions/removals 00053 /// in GroupNode and Camera. 00054 /// Added paint_selected and paint_selected_invalid 00055 /// to ActiveLeaf 00056 /// Modified ActiveLeaf's mouse_down and mouse_up 00057 /// handler signatures to accept an Event* instead of 00058 /// Camera* 00059 /// - Many more bugfixes 00060 /// 00061 /// Revision 1.2 2004/04/30 12:39:21 botik32 00062 /// Numerous changes related to making the SceneChangedEvents 00063 /// to work. 00064 /// - Moved listen_event() from BaseSceneNode to EventListener class 00065 /// - Made GroupNode listen to the added children's SceneChangedEvents 00066 /// - Changed Camera to listen to layers' SceneChangedEvents 00067 /// - Moved eventlistener list cleanup from Camera to EventHub class 00068 /// where it belonged in the first place 00069 /// 00070 /// Revision 1.1.1.1 2004/03/26 10:50:21 botik32 00071 /// Initial release 00072 /// 00073 /// Revision 1.1.1.1 2004/03/26 08:53:33 botik 00074 /// initial import 00075 /// 00076 /// 00077 /// Revision 1.1 2003/12/03 18:48:51 botik 00078 /// Split event listener functionality off camera into 00079 /// eventhub. 00080 ///