# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

events.h

Go to the documentation of this file.
00001 
00007 /* Copyright, 2000 Nevrax Ltd.
00008  *
00009  * This file is part of NEVRAX NEL.
00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2, or (at your option)
00013  * any later version.
00014 
00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00018  * General Public License for more details.
00019 
00020  * You should have received a copy of the GNU General Public License
00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00023  * MA 02111-1307, USA.
00024  */
00025 
00026 #ifndef NL_EVENTS_H
00027 #define NL_EVENTS_H
00028 
00029 #include "nel/misc/types_nl.h"
00030 #include "nel/misc/class_id.h"
00031 #include <map>
00032 #include <list>
00033 
00034 namespace NLMISC {
00035 
00036 /*===================================================================*/
00037 
00038 class IEventEmitter;
00039 
00044 class CEvent : public CClassId
00045 {
00046 public:
00048         IEventEmitter* Emitter;
00049 protected:
00054         CEvent (IEventEmitter* emitter, const CClassId& classId) : CClassId (classId)
00055         {
00056                 Emitter=emitter;
00057         }
00058 };
00059 
00060 // Key events
00061 const CClassId EventKeyDownId (0x3c2643da, 0x43f802a1);
00062 const CClassId EventKeyUpId (0x1e62e85, 0x68a35d46);
00063 const CClassId EventCharId (0x552255fe, 0x75a2373f);
00064 
00065 // Window events
00066 const CClassId EventActivateId (0x7da66b0a, 0x1ef74519);
00067 const CClassId EventSetFocusId (0x17650fac, 0x19f85dde);
00068 const CClassId EventDestroyWindowId (0x69be73fe, 0x4b07603b);
00069 
00070 // Mouse events
00071 const CClassId EventMouseMoveId (0x3dd12fdb, 0x472f548b);
00072 const CClassId EventMouseDownId (0x35b7878, 0x5d4a0f86);
00073 const CClassId EventMouseUpId (0xcce1f7e, 0x7ed344d7);
00074 const CClassId EventMouseDblClkId (0x55a94cb3, 0x3e641517);
00075 const CClassId EventMouseWheelId (0x73ac4321, 0x4c273150);
00076 
00077 
00078 enum TKey 
00079 {
00080         Key0                            ='0',
00081         Key1                            ='1',
00082         Key2                            ='2',
00083         Key3                            ='3',
00084         Key4                            ='4',
00085         Key5                            ='5',
00086         Key6                            ='6',
00087         Key7                            ='7',
00088         Key8                            ='8',
00089         Key9                            ='9',
00090         KeyA                            ='A',
00091         KeyB                            ='B',
00092         KeyC                            ='C',
00093         KeyD                            ='D',
00094         KeyE                            ='E',
00095         KeyF                            ='F',
00096         KeyG                            ='G',
00097         KeyH                            ='H',
00098         KeyI                            ='I',
00099         KeyJ                            ='J',
00100         KeyK                            ='K',
00101         KeyL                            ='L',
00102         KeyM                            ='M',
00103         KeyN                            ='N',
00104         KeyO                            ='O',
00105         KeyP                            ='P',
00106         KeyQ                            ='Q',
00107         KeyR                            ='R',
00108         KeyS                            ='S',
00109         KeyT                            ='T',
00110         KeyU                            ='U',
00111         KeyV                            ='V',
00112         KeyW                            ='W',
00113         KeyX                            ='X',
00114         KeyY                            ='Y',
00115         KeyZ                            ='Z',
00116         KeyLBUTTON        =0x01,
00117         KeyRBUTTON        =0x02,
00118         KeyCANCEL         =0x03,
00119         KeyMBUTTON        =0x04,
00120         KeyBACK           =0x08,
00121         KeyTAB            =0x09,
00122         KeyCLEAR          =0x0C,
00123         KeyRETURN         =0x0D,
00124         KeySHIFT          =0x10,
00125         KeyCONTROL        =0x11,
00126         KeyMENU           =0x12,
00127         KeyPAUSE          =0x13,
00128         KeyCAPITAL        =0x14,
00129         KeyKANA           =0x15,
00130         KeyHANGEUL        =0x15,
00131         KeyHANGUL         =0x15,
00132         KeyJUNJA          =0x17,
00133         KeyFINAL          =0x18,
00134         KeyHANJA          =0x19,
00135         KeyKANJI          =0x19,
00136         KeyESCAPE         =0x1B,
00137         KeyCONVERT        =0x1C,
00138         KeyNONCONVERT     =0x1D,
00139         KeyACCEPT         =0x1E,
00140         KeyMODECHANGE     =0x1F,
00141         KeySPACE          =0x20,
00142         KeyPRIOR          =0x21,
00143         KeyNEXT           =0x22,
00144         KeyEND            =0x23,
00145         KeyHOME           =0x24,
00146         KeyLEFT           =0x25,
00147         KeyUP             =0x26,
00148         KeyRIGHT          =0x27,
00149         KeyDOWN           =0x28,
00150         KeySELECT         =0x29,
00151         KeyPRINT          =0x2A,
00152         KeyEXECUTE        =0x2B,
00153         KeySNAPSHOT       =0x2C,
00154         KeyINSERT         =0x2D,
00155         KeyDELETE         =0x2E,
00156         KeyHELP           =0x2F,
00157         KeyLWIN           =0x5B,
00158         KeyRWIN           =0x5C,
00159         KeyAPPS           =0x5D,
00160         KeyNUMPAD0        =0x60,
00161         KeyNUMPAD1        =0x61,
00162         KeyNUMPAD2        =0x62,
00163         KeyNUMPAD3        =0x63,
00164         KeyNUMPAD4        =0x64,
00165         KeyNUMPAD5        =0x65,
00166         KeyNUMPAD6        =0x66,
00167         KeyNUMPAD7        =0x67,
00168         KeyNUMPAD8        =0x68,
00169         KeyNUMPAD9        =0x69,
00170         KeyMULTIPLY       =0x6A,
00171         KeyADD            =0x6B,
00172         KeySEPARATOR      =0x6C,
00173         KeySUBTRACT       =0x6D,
00174         KeyDECIMAL        =0x6E,
00175         KeyDIVIDE         =0x6F,
00176         KeyF1             =0x70,
00177         KeyF2             =0x71,
00178         KeyF3             =0x72,
00179         KeyF4             =0x73,
00180         KeyF5             =0x74,
00181         KeyF6             =0x75,
00182         KeyF7             =0x76,
00183         KeyF8             =0x77,
00184         KeyF9             =0x78,
00185         KeyF10            =0x79,
00186         KeyF11            =0x7A,
00187         KeyF12            =0x7B,
00188         KeyF13            =0x7C,
00189         KeyF14            =0x7D,
00190         KeyF15            =0x7E,
00191         KeyF16            =0x7F,
00192         KeyF17            =0x80,
00193         KeyF18            =0x81,
00194         KeyF19            =0x82,
00195         KeyF20            =0x83,
00196         KeyF21            =0x84,
00197         KeyF22            =0x85,
00198         KeyF23            =0x86,
00199         KeyF24            =0x87,
00200         KeyNUMLOCK        =0x90,
00201         KeySCROLL         =0x91,
00202         KeyLSHIFT         =0xA0,
00203         KeyRSHIFT         =0xA1,
00204         KeyLCONTROL       =0xA2,
00205         KeyRCONTROL       =0xA3,
00206         KeyLMENU          =0xA4,
00207         KeyRMENU          =0xA5,
00208         KeyPROCESSKEY     =0xE5,
00209         KeyATTN           =0xF6,
00210         KeyCRSEL          =0xF7,
00211         KeyEXSEL          =0xF8,
00212         KeyEREOF          =0xF9,
00213         KeyPLAY           =0xFA,
00214         KeyZOOM           =0xFB,
00215         KeyNONAME         =0xFC,
00216         KeyPA1            =0xFD,
00217         KeyOEM_CLEAR      =0xFE,
00218         KeyCount          =0xFF
00219 };
00220 
00221 enum TMouseButton
00222 {
00223         noButton                =0x0,
00224         leftButton              =0x1,
00225         middleButton    =0x2,
00226         rightButton             =0x4,
00227         ctrlButton              =0x8,
00228         shiftButton             =0x10,
00229         altButton               =0x20
00230 };
00231 
00232 enum TKeyButton
00233 {
00234         noKeyButton                     =0x0,
00235         ctrlKeyButton           =0x8,
00236         shiftKeyButton          =0x10,
00237         altKeyButton            =0x20
00238 };
00239 
00243 class CEventKey : public CEvent
00244 {
00245 public:
00246         CEventKey (TKeyButton button, IEventEmitter* emitter, const CClassId& classId) : CEvent (emitter, classId)
00247         {
00248                 Button=button;
00249         }
00250         TKeyButton Button;
00251 };
00252 
00257 class CEventKeyDown : public CEventKey
00258 {
00259 public:
00260         CEventKeyDown (TKey key, TKeyButton button, bool bFirstTime, IEventEmitter* emitter) : CEventKey (button, emitter, EventKeyDownId)
00261         {
00262                 Key=key;
00263                 FirstTime=bFirstTime;
00264         }
00265         TKey Key;
00266         bool FirstTime;
00267 };
00268 
00272 class CEventKeyUp : public CEventKey
00273 {
00274 public:
00275         CEventKeyUp (TKey key, TKeyButton button, IEventEmitter* emitter) : CEventKey (button, emitter, EventKeyUpId)
00276         {
00277                 Key=key;
00278         }
00279         TKey Key;
00280 };
00281 
00285 class CEventChar : public CEventKey
00286 {
00287 public:
00288         CEventChar (ucchar c, TKeyButton button, IEventEmitter* emitter) : CEventKey (button, emitter, EventCharId)
00289         {
00290                 Char=c;
00291         }
00292         ucchar Char;
00293 };
00294 
00295 
00300 class CEventMouse : public CEvent
00301 {
00302 public:
00303         float X,Y;
00304         TMouseButton Button;
00305 
00306         CEventMouse (float x, float y, TMouseButton button, IEventEmitter* emitter, const CClassId& classId) : CEvent (emitter, classId)
00307         {
00308                 X = x;
00309                 Y = y;
00310                 Button = button;
00311         }
00312 };
00313 
00314 
00320 class CEventMouseDown : public CEventMouse
00321 {
00322 public:
00323         CEventMouseDown (float x, float y, TMouseButton button, IEventEmitter* emitter) : CEventMouse (x, y, button, emitter, EventMouseDownId)
00324         {}
00325 };
00326 
00327 
00333 class CEventMouseUp : public CEventMouse
00334 {
00335 public:
00336         CEventMouseUp (float x, float y, TMouseButton button, IEventEmitter* emitter) : CEventMouse (x, y, button, emitter, EventMouseUpId)
00337         {}      
00338 };
00339 
00340 
00346 class CEventMouseMove : public CEventMouse
00347 {
00348 public:
00349         CEventMouseMove (float x, float y, TMouseButton button, IEventEmitter* emitter) : CEventMouse (x, y, button, emitter, EventMouseMoveId)
00350         {}      
00351 };
00352 
00353 
00359 class CEventMouseDblClk : public CEventMouse
00360 {
00361 public:
00362         CEventMouseDblClk (float x, float y, TMouseButton button, IEventEmitter* emitter) : CEventMouse (x, y, button, emitter, EventMouseDblClkId)
00363         {}      
00364 };
00365 
00366 
00374 class CEventMouseWheel : public CEventMouse
00375 {
00376 public:
00377         bool    Direction;
00378         CEventMouseWheel (float x, float y, TMouseButton button, bool direction, IEventEmitter* emitter) : CEventMouse (x, y, button, emitter, EventMouseWheelId)
00379         {
00380                 Direction=direction;
00381         }
00382 };
00383 
00384 
00388 class CEventActivate : public CEvent
00389 {
00390 public:
00394         bool Activate;
00395 
00400         CEventActivate (bool activate, IEventEmitter* emitter) : CEvent (emitter, EventActivateId)
00401         {
00402                 Activate = activate;
00403         }
00404 };
00405 
00406 
00410 class CEventSetFocus : public CEvent
00411 {
00412 public:
00416         bool Get;
00417 
00422         CEventSetFocus (bool get, IEventEmitter* emitter) : CEvent (emitter, EventSetFocusId)
00423         {
00424                 Get = get;
00425         }
00426 };
00427 
00428 
00432 class CEventDestroyWindow : public CEvent
00433 {
00434 public:
00435         CEventDestroyWindow (IEventEmitter* emitter) : CEvent (emitter, EventDestroyWindowId)
00436         {
00437         }
00438 };
00439 
00440 
00441 } // NLMISC
00442 
00443 
00444 #endif // NL_EVENTS_H
00445 
00446 /* End of events.h */