00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00033 #ifndef PG_MESSAGEOBJECT_H
00034 #define PG_MESSAGEOBJECT_H
00035
00036 #include "paragui.h"
00037 #include "pgsignals.h"
00038 #include <vector>
00039
00040 class PG_Widget;
00041
00050 class DECLSPEC PG_MessageObject : public virtual SigC::Object {
00051
00052 public:
00053
00057 template<class datatype = PG_Pointer>
00058 class SignalActive : public PG_Signal2<PG_MessageObject*, const SDL_ActiveEvent*, datatype> {}
00059 ;
00060 template<class datatype = PG_Pointer>
00061 class SignalKeyDown : public PG_Signal2<PG_MessageObject*, const SDL_KeyboardEvent*, datatype> {}
00062 ;
00063 template<class datatype = PG_Pointer>
00064 class SignalKeyUp : public PG_Signal2<PG_MessageObject*, const SDL_KeyboardEvent*, datatype> {}
00065 ;
00066 template<class datatype = PG_Pointer>
00067 class SignalMouseMotion : public PG_Signal2<PG_MessageObject*, const SDL_MouseMotionEvent*, datatype> {}
00068 ;
00069 template<class datatype = PG_Pointer>
00070 class SignalMouseButtonDown : public PG_Signal2<PG_MessageObject*, const SDL_MouseButtonEvent*, datatype> {}
00071 ;
00072 template<class datatype = PG_Pointer>
00073 class SignalMouseButtonUp : public PG_Signal2<PG_MessageObject*, const SDL_MouseButtonEvent*, datatype> {}
00074 ;
00075 template<class datatype = PG_Pointer>
00076 class SignalQuit : public PG_Signal1<PG_MessageObject*, datatype> {}
00077 ;
00078 template<class datatype = PG_Pointer>
00079 class SignalSysWM : public PG_Signal2<PG_MessageObject*, const SDL_SysWMEvent*, datatype> {}
00080 ;
00081 template<class datatype = PG_Pointer>
00082 class SignalVideoResize : public PG_Signal2<PG_MessageObject*, const SDL_ResizeEvent*, datatype> {}
00083 ;
00084
00085 template<class datatype = PG_Pointer>
00086 class SignalDelete : public PG_Signal1<const PG_MessageObject*, datatype> {}
00087 ;
00088
00092 PG_MessageObject();
00093
00097 virtual ~PG_MessageObject();
00098
00106 void EnableReceiver(bool enable);
00107
00112 PG_MessageObject* SetCapture();
00113
00117 void ReleaseCapture();
00118
00122 PG_MessageObject* GetCapture();
00123
00129 PG_MessageObject* SetInputFocus();
00130
00134 void ReleaseInputFocus();
00135
00141 bool IsEnabled();
00142
00144
00145
00153 virtual bool ProcessEvent(const SDL_Event* event);
00154
00155 SignalActive<> sigActive;
00156 SignalKeyDown<> sigKeyDown;
00157 SignalKeyUp<> sigKeyUp;
00158 SignalMouseMotion<> sigMouseMotion;
00159 SignalMouseButtonDown<> sigMouseButtonDown;
00160 SignalMouseButtonUp<> sigMouseButtonUp;
00161 SignalSysWM<> sigSysWM;
00162 SignalVideoResize<> sigVideoResize;
00163 SignalQuit<> sigQuit;
00164
00165 SignalDelete<> sigDelete;
00166 protected:
00167
00176 virtual bool eventActive(const SDL_ActiveEvent* active);
00177
00187 virtual bool eventKeyDown(const SDL_KeyboardEvent* key);
00188
00198 virtual bool eventKeyUp(const SDL_KeyboardEvent* key);
00199
00209 virtual bool eventMouseMotion(const SDL_MouseMotionEvent* motion);
00210
00220 virtual bool eventMouseButtonDown(const SDL_MouseButtonEvent* button);
00221
00231 virtual bool eventMouseButtonUp(const SDL_MouseButtonEvent* button);
00232
00243 virtual bool eventQuit(int id, PG_MessageObject* widget, unsigned long data);
00244
00255 virtual bool eventQuitModal(int id, PG_MessageObject* widget, unsigned long data);
00256
00265 virtual bool eventSysWM(const SDL_SysWMEvent* syswm);
00266
00275 virtual bool eventResize(const SDL_ResizeEvent* event);
00276
00285
00286
00288 virtual void eventInputFocusLost(PG_MessageObject* newfocus);
00289
00298 virtual bool AcceptEvent(const SDL_Event* event);
00299
00300 static PG_MessageObject* captureObject;
00301
00302 private:
00303
00304 PG_MessageObject(const PG_MessageObject&);
00305
00306 PG_MessageObject& operator=(const PG_MessageObject&);
00307
00308 static PG_MessageObject* inputFocusObject;
00309
00310 static PG_Widget* lastwidget;
00311
00312 PG_MessageObject* my_oldCapture;
00313
00314 PG_MessageObject* my_oldFocus;
00315
00316 bool my_canReceiveMessages;
00317
00318 friend class PG_Application;
00319 };
00320
00321 #endif // PG_MESSAGEOBJECT_H