00001 /* 00002 * Copyright (C) 2003-2009 Olivier Boudeville 00003 * 00004 * This file is part of the OSDL library. 00005 * 00006 * The OSDL library is free software: you can redistribute it and/or modify 00007 * it under the terms of either the GNU Lesser General Public License or 00008 * the GNU General Public License, as they are published by the Free Software 00009 * Foundation, either version 3 of these Licenses, or (at your option) 00010 * any later version. 00011 * 00012 * The OSDL 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 00015 * GNU Lesser General Public License and the GNU General Public License 00016 * for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License and of the GNU General Public License along with the OSDL library. 00020 * If not, see <http://www.gnu.org/licenses/>. 00021 * 00022 * Author: Olivier Boudeville (olivier.boudeville@esperide.com) 00023 * 00024 */ 00025 00026 00027 #ifndef OSDL_EVENTS_COMMON_H_ 00028 #define OSDL_EVENTS_COMMON_H_ 00029 00030 00031 00032 /* 00033 * Typedef cannot be forward-declared apparently, they therefore have to 00034 * be gathered separately. 00035 * 00036 * @note These are SDL-related typedefs, and there is also 00037 * EventsException defined here. 00038 * 00039 */ 00040 00041 00042 #include "OSDLException.h" // for OSDL::Exception 00043 00044 #include "Ceylan.h" // for string operators 00045 00046 #include <string> 00047 00048 #if ! defined(OSDL_USES_SDL) || OSDL_USES_SDL 00049 #include "SDL.h" // for SDL events 00050 #endif // OSDL_USES_SDL 00051 00052 00053 00054 #if ! defined(OSDL_USES_SDL) || OSDL_USES_SDL 00055 00056 00057 namespace OSDL 00058 { 00059 00060 namespace Events 00061 { 00062 00063 00064 00066 typedef union SDL_Event BasicEvent ; 00067 00068 00070 typedef struct SDL_ActiveEvent FocusEvent ; 00071 00072 00074 typedef struct SDL_KeyboardEvent KeyboardEvent ; 00075 00076 00078 typedef struct SDL_MouseMotionEvent MouseMotionEvent ; 00079 00080 00082 typedef struct SDL_MouseButtonEvent MouseButtonEvent ; 00083 00084 00086 typedef struct SDL_JoyAxisEvent JoystickAxisEvent ; 00087 00088 00090 typedef struct SDL_JoyBallEvent JoystickTrackballEvent ; 00091 00092 00094 typedef struct SDL_JoyHatEvent JoystickHatEvent ; 00095 00096 00098 typedef struct SDL_JoyButtonEvent JoystickButtonEvent ; 00099 00100 00102 typedef struct SDL_QuitEvent UserRequestedQuitEvent ; 00103 00104 00106 typedef struct SDL_SysWMEvent SystemSpecificWindowManagerEvent ; 00107 00108 00109 00115 typedef struct SDL_ResizeEvent WindowResizedEvent ; 00116 00117 00118 00120 typedef struct SDL_ExposeEvent ScreenExposedEvent ; 00121 00122 00123 00125 typedef struct SDL_UserEvent UserEvent ; 00126 00127 00128 00129 #else // OSDL_USES_SDL 00130 00131 00133 typedef union BasicEvent {} ; 00134 00135 00137 typedef struct FocusEvent {} ; 00138 00139 00141 typedef struct KeyboardEvent {} ; 00142 00143 00145 typedef struct MouseMotionEvent {} ; 00146 00147 00149 typedef struct MouseButtonEvent {} ; 00150 00151 00153 typedef struct JoystickAxisEvent {} ; 00154 00155 00157 typedef struct JoystickTrackballEvent {} ; 00158 00159 00161 typedef struct JoystickHatEvent {} ; 00162 00163 00165 typedef struct JoystickButtonEvent {} ; 00166 00167 00169 typedef struct UserRequestedQuitEvent {} ; 00170 00171 00173 typedef struct SystemSpecificWindowManagerEvent {} ; 00174 00175 00176 00182 typedef struct WindowResizedEvent {} ; 00183 00184 00185 00187 typedef struct ScreenExposedEvent {} ; 00188 00189 00190 00192 typedef struct UserEvent {} ; 00193 00194 00195 #endif // OSDL_USES_SDL 00196 00197 00198 00199 00200 // Unicode values defined in Ceylan. 00201 00202 00203 00205 class OSDL_DLL EventsException: public OSDL::Exception 00206 { 00207 00208 public: 00209 00210 explicit EventsException( const std::string & reason ) : 00211 OSDL::Exception( "Event exception: " + reason ) 00212 { 00213 00214 } 00215 00216 00217 virtual ~EventsException() throw() 00218 { 00219 00220 } 00221 00222 00223 } ; 00224 00225 00226 } 00227 00228 00229 } 00230 00231 00232 #endif // OSDL_EVENTS_COMMON_H_ 00233