00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef SDLMM_EVENTHANDLER_H
00022 #define SDLMM_EVENTHANDLER_H
00023
00024 namespace SDLmm {
00026
00035 class DECLSPEC EventHandler {
00036 public:
00037 virtual ~EventHandler() { }
00038
00040
00041
00042
00057 virtual bool HandleKeyboardEvent(const SDL_keysym &keysym, bool pressed) {
00058 return false;
00059 }
00060
00062
00078 virtual bool HandleKeyPressEvent(const SDL_keysym &keysym) {
00079 return HandleKeyboardEvent(keysym, true);
00080 }
00081
00083
00097 virtual bool HandleKeyReleaseEvent(const SDL_keysym &keysym) {
00098 return HandleKeyboardEvent(keysym, false);
00099 }
00101
00103
00104
00105
00129 virtual bool HandleMouseMotionEvent(Uint8 state, Uint16 x, Uint16 y,
00130 Sint16 xrel, Sint16 yrel) {
00131 return false;
00132 }
00133
00135
00157 virtual bool HandleMouseButtonEvent(Uint8 button, Uint16 x, Uint16 y,
00158 bool pressed) {
00159 return false;
00160 }
00161
00163
00183 virtual bool HandleMouseButtonPressEvent(Uint8 button,
00184 Uint16 x, Uint16 y) {
00185 return HandleMouseButtonEvent(button, x, y, true);
00186 }
00187
00189
00209 virtual bool HandleMouseButtonReleaseEvent(Uint8 button,
00210 Uint16 x, Uint16 y) {
00211 return HandleMouseButtonEvent(button, x, y, false);
00212 }
00214
00216
00217
00218
00232 virtual bool HandleJoyAxisEvent(Uint8 joystick, Uint8 axis,
00233 Sint16 value) {
00234 return false;
00235 }
00236
00238
00259 virtual bool HandleJoyButtonEvent(Uint8 joystick, Uint8 button,
00260 bool pressed) {
00261 return false;
00262 }
00263
00265
00285 virtual bool HandleJoyButtonPressEvent(Uint8 joystick, Uint8 button) {
00286 return HandleJoyButtonEvent(joystick, button, true);
00287 }
00288
00290
00310 virtual bool HandleJoyButtonReleaseEvent(Uint8 joystick, Uint8 button) {
00311 return HandleJoyButtonEvent(joystick, button, false);
00312 }
00313
00315
00346 virtual bool HandleJoyHatEvent(Uint8 joystick, Uint8 hat, Uint8 value) {
00347 return false;
00348 }
00349
00351
00371 virtual bool HandleJoyBallEvent(Uint8 joystick, Uint8 ball,
00372 Sint16 xrel, Sint16 yrel) {
00373 return false;
00374 }
00375
00377
00379
00380
00381
00404 virtual bool HandleActiveEvent(bool gain, Uint8 state) {
00405 return false;
00406 }
00407
00409
00426 virtual bool HandleResizeEvent(int w, int h) {
00427 return false;
00428 }
00429
00431
00453 virtual bool HandleSysWMEvent() {
00454 return false;
00455 }
00456
00458
00475
00477
00478 virtual bool HandleUserEvent(Uint8 type, int code,
00479 void *data1, void *data2) {
00480 return false;
00481 }
00482
00484
00501 virtual bool HandleQuitEvent() {
00502 return false;
00503 }
00505
00507
00519 virtual bool HandleEvent(const SDL_Event &event) {
00520 return false;
00521 }
00522
00523 };
00524 }
00525
00526 #endif // SDLMM_EVENTHANDLER_H
00527