vdk 2.4.0
|
00001 /* -*- c++ -*- */ 00002 #ifndef _sigc_events_h_ 00003 #define _sigc_events_h_ 00004 #include <gdk/gdk.h> 00005 #include <vdk/vdkstring.h> 00006 class VDKObject; 00007 00009 class VDKAnyEvent 00010 { 00011 protected: 00012 VDKObject* _obj; 00013 GdkEventType _type; 00014 VDKAnyEvent(const GdkEvent* ,VDKObject*); 00015 public: 00016 virtual ~VDKAnyEvent(){} 00017 VDKObject* Sender() const; 00018 GdkEventType GDKType() const{return _type;} 00019 }; 00020 00026 class VDKFocusEvent 00027 { 00028 protected: 00029 VDKFocusEvent(bool focus) 00030 : Focus(focus){} 00031 public: 00033 const bool Focus; 00034 bool hasFocus()const{return Focus;} 00035 }; 00036 00040 class VDKKeyEvent : public VDKAnyEvent 00041 { 00042 private: 00043 unsigned int _state; 00044 guint _keyval; 00045 gchar* _string; 00046 public: 00047 VDKKeyEvent(const GdkEventKey* , VDKObject*); 00048 VDKKeyEvent(VDKKeyEvent const&); 00049 ~VDKKeyEvent(); 00050 VDKKeyEvent& operator=(VDKKeyEvent const&); 00060 unsigned int Key() const; 00065 unsigned int Modifier() const; 00068 VDKString String() const; 00070 const char* CString() const; 00071 }; 00072 00078 class VDKMouseEvent : public VDKAnyEvent 00079 { 00080 protected: 00081 VDKPoint _pos; 00082 unsigned int _state; 00083 guint _button; 00084 GdkWindow* _gwin; 00085 // to bring the (non) gdk-hierachy in this hierachy ... 00086 VDKMouseEvent(const GdkEventCrossing *, VDKObject*); 00087 public: 00088 VDKMouseEvent(const GdkEventButton *, VDKObject*); 00089 VDKMouseEvent(const GdkEventMotion *, VDKObject*); 00091 VDKPoint const& Position() const; 00093 VDKPoint AbsPosition() const; 00095 unsigned int Button() const; 00097 unsigned int Modifier() const; 00098 }; 00099 00105 class VDKMouseFocusEvent : public VDKMouseEvent, 00106 public VDKFocusEvent 00107 { 00108 public: 00109 VDKMouseFocusEvent(const GdkEventCrossing * eve, VDKObject* obj) 00110 : VDKMouseEvent(eve,obj) 00111 , VDKFocusEvent(eve->focus) {} 00112 }; 00113 00117 class VDKKeyFocusEvent : public VDKAnyEvent, public VDKFocusEvent 00118 { 00119 public: 00120 VDKKeyFocusEvent(const GdkEventFocus* eve, VDKObject* obj) 00121 : VDKAnyEvent((const GdkEvent*) eve,obj) 00122 , VDKFocusEvent((eve->in==TRUE) ? true : false){} 00123 }; 00124 00131 class VDKPaintEvent : public VDKAnyEvent 00132 { 00133 VDKRect _area; 00134 public: 00135 VDKPaintEvent(const GdkEventExpose* eve, VDKObject* sender) 00136 : VDKAnyEvent((const GdkEvent*) eve,sender) 00137 , _area(eve->area.x, eve->area.y, 00138 eve->area.width, eve->area.height){} 00140 const VDKRect& Area() const{return _area;} 00141 }; 00142 00146 class VDKGeometryEvent : public VDKAnyEvent 00147 { 00148 VDKRect _area; 00149 public: 00150 VDKGeometryEvent(const GdkEventConfigure* eve, VDKObject* sender) 00151 : VDKAnyEvent((const GdkEvent*) eve,sender) 00152 , _area(eve->x, eve->y,eve->width, eve->height){} 00153 const VDKRect& Area() const{return _area;} 00154 }; 00155 00157 typedef enum { 00158 FULLY_VISIBLE, 00159 PARTIAL_VISIBLE, 00160 NOT_VISIBLE 00161 } VDKMapState; 00162 00166 class VDKMapEvent : public VDKAnyEvent 00167 { 00168 VDKMapState _state; 00169 public: 00170 VDKMapEvent(const GdkEventVisibility* eve, VDKObject* sender); 00171 VDKMapState State() const{return _state;} 00172 }; 00173 00175 // class VDKSelectionEvent : public VDKAnyEvent 00176 // { 00177 // GdkAtom _id_sel; 00178 // GdkAtom _id_prop; 00179 // VDKString* _str_sel; // perform lookup only when needed 00180 // VDKString* _str_prop; 00181 // public: 00182 // VDKSelectionEvent(const GdkEventSelection* sel, VDKObject* sender) 00183 // : VDKAnyEvent(eve,sender), _id_sel(eve->selection) 00184 // , _id_prop(eve->property), _str_sel(NULL), _str_prop(NULL) {} 00185 // ~VDKSelectionEvent(); 00186 // VDKString Selection() const; 00187 // const char* CSelection() const; 00188 // VDKString Property() const; 00189 // const char* CProperty() const; 00190 // }; 00191 00192 // class VDKDnDEvent : public VDKAnyEvent 00193 // { 00194 // }; 00195 00196 #endif /* !_sigc_events_h_ */ 00197