view include/EventHandler.h @ 16:bdfe3327f4ce

Saving progress
author Eris Caffee <discordia@eldalin.com>
date Wed, 24 Nov 2010 21:34:11 -0600
parents 104dff305563
children
line source
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Fracter - A simple Mandelbrot Set viewer.
4 //
5 // Copyright (C) 2010 Sarah Eris Horsley Caffee
6 //
7 // This file is part of Fracter.
8 //
9 // Fracter is free software: you can redistribute it and/or modify
10 // it under the terms of the GNU General Public License as published by
11 // the Free Software Foundation, either version 3 of the License, or
12 // (at your option) any later version.
13 //
14 // This program is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU General Public License for more details.
18 //
19 // You should have received a copy of the GNU General Public License
20 // along with this program. If not, see <http://www.gnu.org/licenses/>.
21 //
22 //
23 // EventHandler.h
24 // EventHandler class definition. This is a virtual class that is meant to be
25 // an interface implemented by an application class. It does, though, provide
26 // default implementations of it's methods so that unused events can be quietly
27 // ignored.
28 //
29 ////////////////////////////////////////////////////////////////////////////////
31 #ifndef EVENTHANDLER_H
32 #define EVENTHANDLER_H
34 // Use SDL 1.3 only!
35 #ifndef SDL_NO_COMPAT
36 #define SDL_NO_COMPAT
37 #endif
39 #include "SDL.h"
41 class EventHandler
42 {
43 public:
45 EventHandler();
46 virtual ~EventHandler() = 0;
48 virtual void on_Event(SDL_Event * event);
50 // SDL_WindowEvent subtypes
51 virtual void on_Show();
52 virtual void on_Hide();
53 virtual void on_Expose();
54 virtual void on_Move(SDL_WindowEvent window);
55 virtual void on_Resize(SDL_WindowEvent window);
56 virtual void on_Minimize();
57 virtual void on_Maximize();
58 virtual void on_Restore();
59 virtual void on_MouseFocus();
60 virtual void on_MouseBlur();
61 virtual void on_KeyboardFocus();
62 virtual void on_KeyboardBlur();
63 // Note: on_Close() will call on_Quit() by default.
64 virtual void on_Close();
66 // Keyboard events
67 virtual void on_KeyDown(SDL_KeyboardEvent key);
68 virtual void on_KeyUp(SDL_KeyboardEvent key);
69 virtual void on_TextInput(SDL_TextInputEvent text);
70 virtual void on_TextEdit(SDL_TextEditingEvent edit);
72 // Mouse events
73 virtual void on_MouseMove(SDL_MouseMotionEvent motion);
74 virtual void on_LButtonDown(SDL_MouseButtonEvent button);
75 virtual void on_LButtonUp(SDL_MouseButtonEvent button);
76 virtual void on_RButtonDown(SDL_MouseButtonEvent button);
77 virtual void on_RButtonUp(SDL_MouseButtonEvent button);
78 virtual void on_MButtonDown(SDL_MouseButtonEvent button);
79 virtual void on_MButtonUp(SDL_MouseButtonEvent button);
80 virtual void on_MouseWheel(SDL_MouseWheelEvent wheel);
82 // Joystick events
83 virtual void on_JoyAxis(SDL_JoyAxisEvent jaxis);
84 virtual void on_JoyBall(SDL_JoyBallEvent jball);
85 virtual void on_JoyHat(SDL_JoyHatEvent jhat);
86 virtual void on_JoyButtonDown(SDL_JoyButtonEvent jbutton);
87 virtual void on_JoyButtonUp(SDL_JoyButtonEvent jbutton);
89 // Misc events
90 virtual void on_Quit();
91 virtual void on_User(SDL_UserEvent user);
92 virtual void on_SysWMEvent(SDL_SysWMEvent syswm);
94 // There's still a lot of new stuff not yet implemented here.
96 };
98 #endif