00001
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
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
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196 #endif
00197