00001 //--- < EVENT.H > --------------| ViewGraph - A Flexible Graph view Framework | 00002 // 00003 // Defines the base Event class and a few 00004 // preset events required by ViewGraph 00005 // 00006 // $Author: botik32 $ 00007 // $Revision: 1.2 $ 00008 // $Date: 2004/05/03 21:02:01 $ 00009 //-----------------------------------------------------------------------------/ 00010 00011 #ifndef EVENT_H 00012 #define EVENT_H 00013 00014 class Camera; 00015 class BaseSceneNode; 00016 00017 /// Event is the base class for all the events 00018 /// within cZUI. 00019 class Event{ 00020 protected: 00021 /// For input events, context is the camera to handle the event. 00022 Camera *context; 00023 /// msg is the kind of event, never to be used directly. See is_type(). 00024 const char *msg; 00025 /// X and Y screen position of the mouse at event time. 00026 int x, y; 00027 /// Translated scene coordinates. 00028 double scenex, sceney; 00029 /// handled_by is set by the node that accepted the event. 00030 BaseSceneNode *handled_by; 00031 public: 00032 Event( Event * ); 00033 Event( const char * ); 00034 Event( Camera *, const char * ); 00035 void assign_context( Camera * ); 00036 void assign_mousepos( int, int ); 00037 void assign_scenepos( double, double ); 00038 void set_handler( BaseSceneNode *hb ) 00039 { 00040 handled_by = hb; 00041 }; 00042 00043 Camera* get_context( void ); 00044 const char* get_msg( void ); 00045 BaseSceneNode* get_handler( void ) 00046 { 00047 return handled_by; 00048 }; 00049 int get_x( void ); 00050 int get_y( void ); 00051 double get_scenex( void ); 00052 double get_sceney( void ); 00053 00054 /// Use this as follows: is_type( MouseMoveEvent::type ) 00055 virtual bool is_type( const char * ); 00056 00057 virtual ~Event(){}; 00058 }; 00059 00060 #include "mouseevent.h" 00061 #include "cameraevent.h" 00062 00063 #endif 00064 00065 /// $Log: event.h,v $ 00066 /// Revision 1.2 2004/05/03 21:02:01 botik32 00067 /// Significant changes and many bugfixes. 00068 /// ScrollableView now has a background color used to 00069 /// tell SurfaceDriver to clear with. 00070 /// SurfaceDriver's clear() requires a color now 00071 /// Added SceneEvents for all node additions/removals 00072 /// in GroupNode and Camera. 00073 /// Added paint_selected and paint_selected_invalid 00074 /// to ActiveLeaf 00075 /// Modified ActiveLeaf's mouse_down and mouse_up 00076 /// handler signatures to accept an Event* instead of 00077 /// Camera* 00078 /// - Many more bugfixes 00079 /// 00080 /// Revision 1.1.1.1 2004/03/26 10:50:21 botik32 00081 /// Initial release 00082 /// 00083 /// Revision 1.1.1.1 2004/03/26 08:53:33 botik 00084 /// initial import 00085 /// 00086 /// 00087 /// Revision 1.10 2003/11/24 20:45:29 botik 00088 /// Merged four features from surfacecamera into camera. 00089 /// Modified ScrollableView to hold a width/height of 00090 /// the viewport and to report it to whoever asks. 00091 /// Added scenex, sceney fields to Event. 00092 /// Added coordinate transform for all messages, done 00093 /// at camera level. This should speed up drawability 00094 /// and mouseover checks. 00095 /// 00096 /// Repaint and mouse detection work now over arbitrary 00097 /// magnification. 00098 /// Borderlayer is broken and scrolling segfaults in 00099 /// a weird way. 00100 /// 00101 /// Revision 1.9 2003/11/20 18:40:48 botik 00102 /// Got borderlayer to work satisfactory. 00103 /// Changed xpsdl driver to check bounds 00104 /// on rect update and clear 00105 /// 00106 /// Revision 1.8 2003/11/04 14:33:44 botik 00107 /// Added button status for mouse events 00108 /// 00109 /// Revision 1.7 2003/10/30 13:47:31 botik 00110 /// Broke up event files into 3 categories 00111 /// 00112 /// Revision 1.6 2003/10/30 12:29:21 botik 00113 /// moved stdio.h include from event.h into event.cpp 00114 /// 00115 /// Revision 1.5 2003/10/29 19:55:05 botik 00116 /// Finished writing and testing the event hierarchy 00117 /// 00118 /// Revision 1.4 2003/10/29 10:47:39 botik 00119 /// Moved the x,y event position into the base class 00120 /// Added has_focus() method and blur/focus event 00121 /// handlers to Camera class. 00122 /// Added Makefile 00123 /// 00124 /// Revision 1.3 2003/10/28 15:43:55 botik 00125 /// More work on event framework and camera composition and 00126 /// z-ordering 00127 /// 00128 /// Revision 1.2 2003/10/24 16:29:10 botik 00129 /// Added more scene support: special scene nodes as well as a 00130 /// camera class that acts as glue between the graph master and the 00131 /// surface. 00132 /// 00133 /// Revision 1.1 2003/10/21 17:39:00 botik 00134 /// Added preliminary scene support 00135 ///