00001 //--- < GRAPHWINDOW.H > ---------| ViewGraph - A Flexible Graph view Framework | 00002 // 00003 // GraphWindow binds together a scene and 00004 // a list of Cameras to provide graph 00005 // display. 00006 // 00007 // Uses a CameraFocusPolicy policy class 00008 // to define camera focus behaviour (similar 00009 // to window manager focus behaviour) 00010 // 00011 // Uses an UpdatePolicy class to decide when 00012 // to repaint the window. 00013 // 00014 // $Author: botik32 $ 00015 // $Revision: 1.3 $ 00016 // $Date: 2004/05/25 13:14:16 $ 00017 //-----------------------------------------------------------------------------/ 00018 00019 #ifndef GRAPHWINDOW_H 00020 #define GRAPHWINDOW_H 00021 00022 #include <cZUI/event.h> 00023 #include <cZUI/camerafocus.h> 00024 #include <cZUI/basegraphwindow.h> 00025 #include <cZUI/timedeventmanager.h> 00026 #include <cZUI/updatepolicy.h> 00027 00028 template <class CF, class UP, int delay> class GraphWindow : public BaseGraphWindow, 00029 public CF, public TimedEventManager, public UP 00030 { 00031 private: 00032 void handle_repaintrect( Event * ); 00033 void handle_invalidaterect( Event * ); 00034 protected: 00035 int lastxpos; 00036 int lastypos; 00037 // scene is ready and has to be rendered 00038 // onto the canvas 00039 void render_scene( void ); 00040 public: 00041 GraphWindow( Scene * ); 00042 00043 // tries to pass the event to the cameras in z-order, 00044 // applying shiftview() to the message with the first found 00045 // camera. Handles focus events by calling CF::focus_cameras() 00046 // first. 00047 // Note: focus_cameras() automatically assigns the 00048 // context camera for the event 00049 // 00050 // Note: Focus events come in the guise of mouse events, but 00051 // the code can send focus events too. 00052 bool handle_event( Event * ); 00053 bool handle_message( Message * ); 00054 CameraList* get_cameras( void ); 00055 00056 // Now that we added timed events, this function 00057 // should be called to process them 00058 void process_internal_events( void ); 00059 00060 // with the changed repaint policy, this function 00061 // should be called to repaint the window 00062 bool repaint( void ); 00063 00064 // This function is called by the scenenodes 00065 void enqueue_timed_event( int, Event * ); 00066 }; 00067 00068 #endif 00069 00070 00071 /// $Log: graphwindow.h,v $ 00072 /// Revision 1.3 2004/05/25 13:14:16 botik32 00073 /// Many bugfixes, including fix for no draw at load. 00074 /// Many fixes for ANSI compatibility (e.g. windows) 00075 /// 00076 /// Revision 1.2 2004/05/24 16:23:57 botik32 00077 /// Added missing destructor to GroupNode 00078 /// 00079 /// Revision 1.1.1.1 2004/03/26 10:50:22 botik32 00080 /// Initial release 00081 /// 00082 /// Revision 1.1.1.1 2004/03/26 08:53:33 botik 00083 /// initial import 00084 /// 00085 /// 00086 /// Revision 1.6 2004/03/15 19:31:53 botik 00087 /// Changed the structure of UpdatePolicy class so that 00088 /// it can compile under MSVC. (MSVC did not like my 00089 /// nested templates :() 00090 /// 00091 /// Revision 1.5 2004/03/15 18:06:25 botik 00092 /// Activeleaf.cpp: removed bug causing problems with memory 00093 /// Context.cpp: added include of assert.h 00094 /// Graphwindow.h, graphwindow.cpp: added update policy class, 00095 /// now a window has its own update policy, which can be 00096 /// always/ fixed rate. 00097 /// Timedeventmanager.cpp: fixed a bug causing memory corruption 00098 /// 00099 /// Revision 1.4 2003/12/02 14:39:37 botik 00100 /// Changed the repaint strategy to always repaint the scene 00101 /// Added Context class to handle context-related data for 00102 /// scene nodes 00103 /// Added get_surfacerect() to ScrollableView 00104 /// Camera, Scene and GraphWindow now inherit from Context 00105 /// Changed activeleaf to use Scene context to store hover 00106 /// status 00107 /// 00108 /// Revision 1.3 2003/11/20 18:40:48 botik 00109 /// Got borderlayer to work satisfactory. 00110 /// Changed xpsdl driver to check bounds 00111 /// on rect update and clear 00112 /// 00113 /// Revision 1.2 2003/11/19 16:14:52 botik 00114 /// Got repaint_rect to work right and changed ActiveLeaf 00115 /// accordingly. 00116 /// 00117 /// Revision 1.1 2003/11/17 23:38:45 botik 00118 /// Fixed the framework to work with multiple cameras on 00119 /// one window. There is a clear bug that does not clear 00120 /// the upper camera. 00121 /// Changed scrolling to remove flicker when multiple 00122 /// cameras are present on a window. 00123 /// Scrolling is still slow. 00124 /// 00125 /// Revision 1.9 2003/11/04 18:28:06 botik 00126 /// Added external and internal repaint events 00127 /// 00128 /// Revision 1.8 2003/10/28 15:43:55 botik 00129 /// More work on event framework and camera composition and 00130 /// z-ordering 00131 /// 00132 /// Revision 1.7 2003/10/24 17:50:56 botik 00133 /// Some changes to the graphdisplay concerning events 00134 /// 00135 /// Revision 1.6 2003/10/24 16:42:56 botik 00136 /// Modified graphdisplay to keep a list of Z-ordered cameras 00137 /// that match open screen surfaces. 00138 /// 00139 /// Revision 1.5 2003/10/24 16:38:12 botik 00140 /// Added an object camera definition 00141 /// 00142 /// Revision 1.4 2003/10/24 16:29:10 botik 00143 /// Added more scene support: special scene nodes as well as a 00144 /// camera class that acts as glue between the graph master and the 00145 /// surface. 00146 /// 00147 /// Revision 1.3 2003/10/15 11:58:05 botik 00148 /// With the addition of object display, graphdisplay has been 00149 /// modified. ObjectDisplay's interface has been coded. Some 00150 /// changes to scrollable view have been introduced that relate 00151 /// to the changes above. 00152 /// 00153 /// Revision 1.2 2003/10/13 16:41:35 botik 00154 /// Added Log keyword to the end of the files 00155 ///