Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

pgmessageobject.h

Go to the documentation of this file.
00001 /*
00002     ParaGUI - crossplatform widgetset
00003     Copyright (C) 2000,2001,2002  Alexander Pipelka
00004  
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009  
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014  
00015     You should have received a copy of the GNU Library General Public
00016     License along with this library; if not, write to the Free
00017     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  
00019     Alexander Pipelka
00020     pipelka@teleweb.at
00021  
00022     Last Update:      $Author: mbickel $
00023     Update Date:      $Date: 2007-04-13 16:15:56 $
00024     Source File:      $Source: /home/cvspsrv/cvsroot/games/asc/source/libs/paragui/include/pgmessageobject.h,v $
00025     CVS/RCS Revision: $Revision: 1.2 $
00026     Status:           $State: Exp $
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         //static SDL_Event WaitEvent(Uint32 delay=0);
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         //virtual bool eventMessage(MSG_MESSAGE* msg);
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

Generated on Tue Jun 24 01:27:48 2008 for Advanced Strategic Command by  doxygen 1.4.2