Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages
event.h
Go to the documentation of this file.00001 /* 00002 Event system related helpers 00003 Copyright (C) 2003 by Jorrit Tyberghein 00004 (C) 2003 by Frank Richter 00005 (C) 2005 by Adam D. Bradley <artdodge@cs.bu.edu> 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Library General Public 00009 License as published by the Free Software Foundation; either 00010 version 2 of the License, or (at your option) any later version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Library General Public License for more details. 00016 00017 You should have received a copy of the GNU Library General Public 00018 License along with this library; if not, write to the Free 00019 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00020 */ 00021 00022 #ifndef __CS_CSUTIL_EVENT_H__ 00023 #define __CS_CSUTIL_EVENT_H__ 00024 00025 #include "csextern.h" 00026 #include "iutil/event.h" 00027 00040 class CS_CRYSTALSPACE_EXPORT csKeyEventHelper 00041 { 00042 public: 00044 CS_PURE_METHOD static utf32_char GetRawCode (const iEvent* event); 00046 CS_PURE_METHOD static utf32_char GetCookedCode (const iEvent* event); 00048 static void GetModifiers (const iEvent* event, csKeyModifiers& modifiers); 00050 CS_PURE_METHOD static csKeyEventType GetEventType (const iEvent* event); 00055 CS_PURE_METHOD static bool GetAutoRepeat (const iEvent* event); 00057 CS_PURE_METHOD static csKeyCharType GetCharacterType (const iEvent* event); 00059 static bool GetEventData (const iEvent* event, csKeyEventData& data); 00065 CS_CONST_METHOD static uint32 GetModifiersBits ( 00066 const csKeyModifiers& modifiers); 00071 CS_PURE_METHOD static uint32 GetModifiersBits (const iEvent* event); 00079 static void GetModifiers (uint32 mask, csKeyModifiers& modifiers); 00080 }; 00088 class CS_CRYSTALSPACE_EXPORT csMouseEventHelper 00089 { 00090 public: 00092 CS_PURE_METHOD static uint GetNumber(const iEvent *event); 00094 CS_PURE_METHOD static int GetX(const iEvent *event) 00095 { return csMouseEventHelper::GetAxis(event, 1); } 00097 CS_PURE_METHOD static int GetY(const iEvent *event) 00098 { return csMouseEventHelper::GetAxis(event, 2); } 00100 CS_PURE_METHOD static int GetAxis(const iEvent *event, uint axis); 00102 CS_PURE_METHOD static uint GetNumAxes(const iEvent *event); 00104 CS_PURE_METHOD static uint GetButton(const iEvent *event); 00106 CS_PURE_METHOD static void GetModifiers(const iEvent *event, 00107 csKeyModifiers& modifiers) 00108 { csKeyEventHelper::GetModifiers(event, modifiers); } 00110 CS_PURE_METHOD static uint32 GetModifiers(const iEvent *event) 00111 { 00112 csKeyModifiers modifiers; 00113 csKeyEventHelper::GetModifiers(event, modifiers); 00114 return csKeyEventHelper::GetModifiersBits(modifiers); 00115 } 00117 CS_PURE_METHOD static bool GetEventData (const iEvent* event, 00118 csMouseEventData& data); 00119 }; 00120 00128 class CS_CRYSTALSPACE_EXPORT csJoystickEventHelper 00129 { 00130 public: 00132 CS_PURE_METHOD static uint GetNumber(const iEvent *event); 00134 CS_PURE_METHOD CS_DEPRECATED_METHOD static int GetX(const iEvent *event) 00135 { return csJoystickEventHelper::GetAxis(event, 1); } 00137 CS_PURE_METHOD CS_DEPRECATED_METHOD static int GetY(const iEvent *event) 00138 { return csJoystickEventHelper::GetAxis(event, 2); } 00140 CS_PURE_METHOD static int GetAxis(const iEvent *event, uint); 00142 CS_PURE_METHOD static uint GetNumAxes(const iEvent *); 00144 CS_PURE_METHOD static uint GetButton(const iEvent *event); 00146 static void GetModifiers(const iEvent *event, csKeyModifiers& modifiers) 00147 { csKeyEventHelper::GetModifiers(event, modifiers); } 00149 CS_PURE_METHOD static uint32 GetModifiers(const iEvent *event) 00150 { 00151 csKeyModifiers modifiers; 00152 csKeyEventHelper::GetModifiers(event, modifiers); 00153 return csKeyEventHelper::GetModifiersBits(modifiers); 00154 } 00156 static bool GetEventData (const iEvent* event, csJoystickEventData& data); 00157 }; 00158 00166 class CS_CRYSTALSPACE_EXPORT csCommandEventHelper 00167 { 00168 public: 00170 CS_PURE_METHOD static uint GetCode(const iEvent *event); 00172 CS_PURE_METHOD static intptr_t GetInfo(const iEvent *event); 00174 static bool GetEventData (const iEvent* event, csCommandEventData& data); 00175 }; 00176 00181 #endif // __CS_CSUTIL_EVENT_H__
Generated for Crystal Space by doxygen 1.4.4