00001 //--- < CAMERAMVEVENT.H > -------| ViewGraph - A Flexible Graph view Framework | 00002 // 00003 // Defines events that move camera position 00004 // (zoom,scroll). These events cause the optimized 00005 // group nodes to recompute their active node lists. 00006 // 00007 // Derive your event from CameraMovementEvent to 00008 // register an event that moves camera position. 00009 // 00010 // $Author: botik32 $ 00011 // $Revision: 1.2 $ 00012 // $Date: 2004/05/19 16:40:36 $ 00013 //-----------------------------------------------------------------------------/ 00014 00015 #ifndef CAMERAMVEVENT_H 00016 #define CAMERAMVEVENT_H 00017 00018 #include <cZUI/event.h> 00019 00020 /// CameraMovementEvents cause the camera to change 00021 /// its position and/or zoom. 00022 class CameraMovementEvent : public Event 00023 { 00024 public: 00025 CameraMovementEvent( Camera *, const char * ); 00026 static const char *type; 00027 bool is_type( const char * ); 00028 }; 00029 00030 /// Tells the camera to scroll. 00031 class CameraScrollEvent : public CameraMovementEvent 00032 { 00033 public: 00034 static const char *type; 00035 double xmov, ymov; 00036 CameraScrollEvent( Camera *, double, double ); 00037 }; 00038 00039 /// Tells the camera to zoom. 00040 class CameraZoomEvent : public CameraMovementEvent 00041 { 00042 public: 00043 static const char *type; 00044 double zoomlevel; 00045 CameraZoomEvent( Camera *, double abszoom ); 00046 }; 00047 00048 /// Tells the camera to center. 00049 class CameraCenterEvent : public CameraMovementEvent 00050 { 00051 public: 00052 static const char *type; 00053 double xpos, ypos; 00054 CameraCenterEvent( Camera *, double, double ); 00055 }; 00056 00057 /// Changes camera position and zoom. 00058 class CameraSetEvent : public CameraMovementEvent 00059 { 00060 public: 00061 static const char *type; 00062 double xp1, yp1, xp2, yp2; 00063 CameraSetEvent( Camera *, double, double, 00064 double, double ); 00065 }; 00066 00067 #endif 00068 00069 /// $Log: cameramvevent.h,v $ 00070 /// Revision 1.2 2004/05/19 16:40:36 botik32 00071 /// Bugfixes and enhancements: 00072 /// Added repaint_due() and brepaint_due to ScrollableView 00073 /// Fixed repaint decisions in GraphWindow to work for multiple-window 00074 /// scenes 00075 /// Fixed ScrollableView to call surfacedriver->clear() in constructor 00076 /// Changed mapchooser to use a smaller resolution world map 00077 /// 00078 /// Revision 1.1.1.1 2004/03/26 10:50:21 botik32 00079 /// Initial release 00080 /// 00081 /// Revision 1.1.1.1 2004/03/26 08:53:33 botik 00082 /// initial import 00083 /// 00084 /// 00085 /// Revision 1.5 2004/03/17 13:16:19 botik 00086 /// Fixed the HUDGroup to treat CameraCenter events properly 00087 /// 00088 /// Revision 1.4 2003/11/25 13:01:03 botik 00089 /// Changed the flawed way scene node's requests were 00090 /// handled in ZoomableSurfaceView. This fixes a bad bug 00091 /// with HUD nodes moving all over the place. 00092 /// Added CameraZoomedMessage and CameraScrolledMessage 00093 /// Replaced the TranslateNodeMEssage with 00094 /// CameraScrolledMessage in HUDGroupNode. This fixed 00095 /// a HUD flicker bug. 00096 /// Simplified repaint and clear handling in GraphWindow. 00097 /// This fixed a few bugs in repainting. 00098 /// Added rect bounds checking in ScrollableView's 00099 /// clear_rect and repaint_rect. This fixed cameras to only 00100 /// clear their rectangle even if the view holds a larger 00101 /// area. 00102 /// Changed ActiveLeaf to use default paint function if 00103 /// the payload of CameraRepaintLeafMessage is empty. This 00104 /// will allow repaints of moved nodes. 00105 /// Changed LayerNode to allow CameraMovement events even 00106 /// if the layer is inactive. This will update existing HUD 00107 /// controls' position on inactive layers so they do not move 00108 /// astray during scrolls. 00109 /// This is an intermediate change; mouseover checks do not work. 00110 /// 00111 /// Revision 1.3 2003/11/24 20:45:29 botik 00112 /// Merged four features from surfacecamera into camera. 00113 /// Modified ScrollableView to hold a width/height of 00114 /// the viewport and to report it to whoever asks. 00115 /// Added scenex, sceney fields to Event. 00116 /// Added coordinate transform for all messages, done 00117 /// at camera level. This should speed up drawability 00118 /// and mouseover checks. 00119 /// 00120 /// Repaint and mouse detection work now over arbitrary 00121 /// magnification. 00122 /// Borderlayer is broken and scrolling segfaults in 00123 /// a weird way. 00124 /// 00125 /// Revision 1.2 2003/11/12 00:47:31 botik 00126 /// Further work on getting repaints to work, tested with 00127 /// scrolling 00128 /// 00129 /// Revision 1.1 2003/11/06 13:51:05 botik 00130 /// Added camera move events that cause the camera to 00131 /// move its position (zoom and scroll events) 00132 ///