Documentation


event.h

Go to the documentation of this file.
00001 
00002 //                            event.h                                   //
00004 
00005 #ifndef ANIMAL_EVENT_H
00006 #define ANIMAL_EVENT_H
00007 
00008 namespace animal{
00009 
00011 class Event{
00012 public:
00013   
00015   enum Type {
00016       /*
00017         If you get a strange compiler error on the line with None,
00018         it's probably because you're also including X11 headers,
00019         which #define the symbol None. Put the X11 includes after
00020         the animal includes to solve this problem.
00021       */
00022       None = 0,                               // invalid event
00023       MouseButtonPress = 2,                   // mouse button pressed
00024       MouseButtonRelease = 3,                 // mouse button released
00025       MouseButtonDblClick = 4,                // mouse button double click
00026       MouseMove = 5,                          // mouse move
00027       KeyPress = 6,                           // key pressed
00028       KeyRelease = 7,                         // key released
00029   };
00031   enum Key {
00032       Key_Escape = 0x1000,            // misc keys
00033       Key_Tab = 0x1001,
00034       Key_Backtab = 0x1002, Key_BackTab = Key_Backtab,
00035       Key_Backspace = 0x1003, Key_BackSpace = Key_Backspace,
00036       Key_Return = 0x1004,
00037       Key_Enter = 0x1005,
00038       Key_Insert = 0x1006,
00039       Key_Delete = 0x1007,
00040       Key_Pause = 0x1008,
00041       Key_Print = 0x1009,
00042       Key_SysReq = 0x100a,
00043       Key_Clear = 0x100b,
00044       Key_Home = 0x1010,              // cursor movement
00045       Key_End = 0x1011,
00046       Key_Left = 0x1012,
00047       Key_Up = 0x1013,
00048       Key_Right = 0x1014,
00049       Key_Down = 0x1015,
00050       Key_Prior = 0x1016, Key_PageUp = Key_Prior,
00051       Key_Next = 0x1017, Key_PageDown = Key_Next,
00052       Key_Shift = 0x1020,             // modifiers
00053       Key_Control = 0x1021,
00054       Key_Meta = 0x1022,
00055       Key_Alt = 0x1023,
00056       Key_CapsLock = 0x1024,
00057       Key_NumLock = 0x1025,
00058       Key_ScrollLock = 0x1026,
00059       Key_F1 = 0x1030,                // function keys
00060       Key_F2 = 0x1031,
00061       Key_F3 = 0x1032,
00062       Key_F4 = 0x1033,
00063       Key_F5 = 0x1034,
00064       Key_F6 = 0x1035,
00065       Key_F7 = 0x1036,
00066       Key_F8 = 0x1037,
00067       Key_F9 = 0x1038,
00068       Key_F10 = 0x1039,
00069       Key_F11 = 0x103a,
00070       Key_F12 = 0x103b,
00071       Key_F13 = 0x103c,
00072       Key_F14 = 0x103d,
00073       Key_F15 = 0x103e,
00074       Key_F16 = 0x103f,
00075       Key_F17 = 0x1040,
00076       Key_F18 = 0x1041,
00077       Key_F19 = 0x1042,
00078       Key_F20 = 0x1043,
00079       Key_F21 = 0x1044,
00080       Key_F22 = 0x1045,
00081       Key_F23 = 0x1046,
00082       Key_F24 = 0x1047,
00083       Key_F25 = 0x1048,               // F25 .. F35 only on X11
00084       Key_F26 = 0x1049,
00085       Key_F27 = 0x104a,
00086       Key_F28 = 0x104b,
00087       Key_F29 = 0x104c,
00088       Key_F30 = 0x104d,
00089       Key_F31 = 0x104e,
00090       Key_F32 = 0x104f,
00091       Key_F33 = 0x1050,
00092       Key_F34 = 0x1051,
00093       Key_F35 = 0x1052,
00094       Key_Super_L = 0x1053,           // extra keys
00095       Key_Super_R = 0x1054,
00096       Key_Menu = 0x1055,
00097       Key_Hyper_L = 0x1056,
00098       Key_Hyper_R = 0x1057,
00099       Key_Help = 0x1058,
00100       Key_Direction_L = 0x1059,
00101       Key_Direction_R = 0x1060,
00102       Key_Space = 0x20,               // 7 bit printable ASCII
00103       Key_Any = Key_Space,
00104       Key_Exclam = 0x21,
00105       Key_QuoteDbl = 0x22,
00106       Key_NumberSign = 0x23,
00107       Key_Dollar = 0x24,
00108       Key_Percent = 0x25,
00109       Key_Ampersand = 0x26,
00110       Key_Apostrophe = 0x27,
00111       Key_ParenLeft = 0x28,
00112       Key_ParenRight = 0x29,
00113       Key_Asterisk = 0x2a,
00114       Key_Plus = 0x2b,
00115       Key_Comma = 0x2c,
00116       Key_Minus = 0x2d,
00117       Key_Period = 0x2e,
00118       Key_Slash = 0x2f,
00119       Key_0 = 0x30,
00120       Key_1 = 0x31,
00121       Key_2 = 0x32,
00122       Key_3 = 0x33,
00123       Key_4 = 0x34,
00124       Key_5 = 0x35,
00125       Key_6 = 0x36,
00126       Key_7 = 0x37,
00127       Key_8 = 0x38,
00128       Key_9 = 0x39,
00129       Key_Colon = 0x3a,
00130       Key_Semicolon = 0x3b,
00131       Key_Less = 0x3c,
00132       Key_Equal = 0x3d,
00133       Key_Greater = 0x3e,
00134       Key_Question = 0x3f,
00135       Key_At = 0x40,
00136       Key_A = 0x41,
00137       Key_B = 0x42,
00138       Key_C = 0x43,
00139       Key_D = 0x44,
00140       Key_E = 0x45,
00141       Key_F = 0x46,
00142       Key_G = 0x47,
00143       Key_H = 0x48,
00144       Key_I = 0x49,
00145       Key_J = 0x4a,
00146       Key_K = 0x4b,
00147       Key_L = 0x4c,
00148       Key_M = 0x4d,
00149       Key_N = 0x4e,
00150       Key_O = 0x4f,
00151       Key_P = 0x50,
00152       Key_Q = 0x51,
00153       Key_R = 0x52,
00154       Key_S = 0x53,
00155       Key_T = 0x54,
00156       Key_U = 0x55,
00157       Key_V = 0x56,
00158       Key_W = 0x57,
00159       Key_X = 0x58,
00160       Key_Y = 0x59,
00161       Key_Z = 0x5a,
00162       Key_BracketLeft = 0x5b,
00163       Key_Backslash = 0x5c,
00164       Key_BracketRight = 0x5d,
00165       Key_AsciiCircum = 0x5e,
00166       Key_Underscore = 0x5f,
00167       Key_QuoteLeft = 0x60,
00168       Key_BraceLeft = 0x7b,
00169       Key_Bar = 0x7c,
00170       Key_BraceRight = 0x7d,
00171       Key_AsciiTilde = 0x7e,
00172 
00173       // Latin 1 codes adapted from X: keysymdef.h,v 1.21 94/08/28 16:17:06
00174 
00175       Key_nobreakspace = 0x0a0,
00176       Key_exclamdown = 0x0a1,
00177       Key_cent = 0x0a2,
00178       Key_sterling = 0x0a3,
00179       Key_currency = 0x0a4,
00180       Key_yen = 0x0a5,
00181       Key_brokenbar = 0x0a6,
00182       Key_section = 0x0a7,
00183       Key_diaeresis = 0x0a8,
00184       Key_copyright = 0x0a9,
00185       Key_ordfeminine = 0x0aa,
00186       Key_guillemotleft = 0x0ab,      // left angle quotation mark
00187       Key_notsign = 0x0ac,
00188       Key_hyphen = 0x0ad,
00189       Key_registered = 0x0ae,
00190       Key_macron = 0x0af,
00191       Key_degree = 0x0b0,
00192       Key_plusminus = 0x0b1,
00193       Key_twosuperior = 0x0b2,
00194       Key_threesuperior = 0x0b3,
00195       Key_acute = 0x0b4,
00196       Key_mu = 0x0b5,
00197       Key_paragraph = 0x0b6,
00198       Key_periodcentered = 0x0b7,
00199       Key_cedilla = 0x0b8,
00200       Key_onesuperior = 0x0b9,
00201       Key_masculine = 0x0ba,
00202       Key_guillemotright = 0x0bb,     // right angle quotation mark
00203       Key_onequarter = 0x0bc,
00204       Key_onehalf = 0x0bd,
00205       Key_threequarters = 0x0be,
00206       Key_questiondown = 0x0bf,
00207       Key_Agrave = 0x0c0,
00208       Key_Aacute = 0x0c1,
00209       Key_Acircumflex = 0x0c2,
00210       Key_Atilde = 0x0c3,
00211       Key_Adiaeresis = 0x0c4,
00212       Key_Aring = 0x0c5,
00213       Key_AE = 0x0c6,
00214       Key_Ccedilla = 0x0c7,
00215       Key_Egrave = 0x0c8,
00216       Key_Eacute = 0x0c9,
00217       Key_Ecircumflex = 0x0ca,
00218       Key_Ediaeresis = 0x0cb,
00219       Key_Igrave = 0x0cc,
00220       Key_Iacute = 0x0cd,
00221       Key_Icircumflex = 0x0ce,
00222       Key_Idiaeresis = 0x0cf,
00223       Key_ETH = 0x0d0,
00224       Key_Ntilde = 0x0d1,
00225       Key_Ograve = 0x0d2,
00226       Key_Oacute = 0x0d3,
00227       Key_Ocircumflex = 0x0d4,
00228       Key_Otilde = 0x0d5,
00229       Key_Odiaeresis = 0x0d6,
00230       Key_multiply = 0x0d7,
00231       Key_Ooblique = 0x0d8,
00232       Key_Ugrave = 0x0d9,
00233       Key_Uacute = 0x0da,
00234       Key_Ucircumflex = 0x0db,
00235       Key_Udiaeresis = 0x0dc,
00236       Key_Yacute = 0x0dd,
00237       Key_THORN = 0x0de,
00238       Key_ssharp = 0x0df,
00239       Key_agrave = 0x0e0,
00240       Key_aacute = 0x0e1,
00241       Key_acircumflex = 0x0e2,
00242       Key_atilde = 0x0e3,
00243       Key_adiaeresis = 0x0e4,
00244       Key_aring = 0x0e5,
00245       Key_ae = 0x0e6,
00246       Key_ccedilla = 0x0e7,
00247       Key_egrave = 0x0e8,
00248       Key_eacute = 0x0e9,
00249       Key_ecircumflex = 0x0ea,
00250       Key_ediaeresis = 0x0eb,
00251       Key_igrave = 0x0ec,
00252       Key_iacute = 0x0ed,
00253       Key_icircumflex = 0x0ee,
00254       Key_idiaeresis = 0x0ef,
00255       Key_eth = 0x0f0,
00256       Key_ntilde = 0x0f1,
00257       Key_ograve = 0x0f2,
00258       Key_oacute = 0x0f3,
00259       Key_ocircumflex = 0x0f4,
00260       Key_otilde = 0x0f5,
00261       Key_odiaeresis = 0x0f6,
00262       Key_division = 0x0f7,
00263       Key_oslash = 0x0f8,
00264       Key_ugrave = 0x0f9,
00265       Key_uacute = 0x0fa,
00266       Key_ucircumflex = 0x0fb,
00267       Key_udiaeresis = 0x0fc,
00268       Key_yacute = 0x0fd,
00269       Key_thorn = 0x0fe,
00270       Key_ydiaeresis = 0x0ff,
00271 
00272       // multimedia/internet keys - ignored by default - see QKeyEvent c'tor
00273 
00274       Key_Back  = 0x1061,
00275       Key_Forward  = 0x1062,
00276       Key_Stop  = 0x1063,
00277       Key_Refresh  = 0x1064,
00278 
00279       Key_VolumeDown = 0x1070,
00280       Key_VolumeMute  = 0x1071,
00281       Key_VolumeUp = 0x1072,
00282       Key_BassBoost = 0x1073,
00283       Key_BassUp = 0x1074,
00284       Key_BassDown = 0x1075,
00285       Key_TrebleUp = 0x1076,
00286       Key_TrebleDown = 0x1077,
00287 
00288       Key_MediaPlay  = 0x1080,
00289       Key_MediaStop  = 0x1081,
00290       Key_MediaPrev  = 0x1082,
00291       Key_MediaNext  = 0x1083,
00292       Key_MediaRecord = 0x1084,
00293 
00294       Key_HomePage  = 0x1090,
00295       Key_Favorites  = 0x1091,
00296       Key_Search  = 0x1092,
00297       Key_Standby = 0x1093,
00298       Key_OpenUrl = 0x1094,
00299 
00300       Key_LaunchMail  = 0x10a0,
00301       Key_LaunchMedia = 0x10a1,
00302       Key_Launch0  = 0x10a2,
00303       Key_Launch1  = 0x10a3,
00304       Key_Launch2  = 0x10a4,
00305       Key_Launch3  = 0x10a5,
00306       Key_Launch4  = 0x10a6,
00307       Key_Launch5  = 0x10a7,
00308       Key_Launch6  = 0x10a8,
00309       Key_Launch7  = 0x10a9,
00310       Key_Launch8  = 0x10aa,
00311       Key_Launch9  = 0x10ab,
00312       Key_LaunchA  = 0x10ac,
00313       Key_LaunchB  = 0x10ad,
00314       Key_LaunchC  = 0x10ae,
00315       Key_LaunchD  = 0x10af,
00316       Key_LaunchE  = 0x10b0,
00317       Key_LaunchF  = 0x10b1,
00318 
00319       Key_MediaLast = 0x1fff,
00320 
00321       Key_unknown = 0xffff
00322   };
00324   enum ButtonState {                          // mouse/keyboard state values
00325       NoButton        = 0x0000,
00326       LeftButton      = 0x0001,
00327       RightButton     = 0x0002,
00328       MidButton       = 0x0004,
00329       MouseButtonMask = 0x0007,
00330       ShiftButton     = 0x0100,
00331       ControlButton   = 0x0200,
00332       AltButton       = 0x0400,
00333       MetaButton      = 0x0800,
00334       KeyButtonMask   = 0x0f00,
00335       Keypad          = 0x4000
00336   };
00337   typedef int KeyInt;
00338   typedef int ButtonStateInt;
00339   typedef int TypeInt;
00340   
00342   Event(TypeInt type, ButtonStateInt state)
00343   : _type(type)
00344   , _state(state)
00345   {}
00347   virtual ~Event(){}
00349     TypeInt type() const{ return _type;}
00351   ButtonStateInt state() const { return _state; }
00352   
00353 protected :
00354   TypeInt _type;
00355   ButtonStateInt _state;
00356   
00357 };
00358 
00359 }// animal
00360 
00361 #endif

Generated on Thu Dec 23 13:52:24 2004 by doxygen 1.3.6