28 typedef void (State::* ActionHandler)(Action*);
40 static const int NUM_BUTTONS = 7;
41 static const SDLKey SDLK_ANY;
42 Uint8 _buttonsPressed;
44 std::map<Uint8, ActionHandler> _click, _press, _release;
45 ActionHandler _in, _over, _out;
46 std::map<SDLKey, ActionHandler> _keyPress, _keyRelease;
47 bool _isHovered, _isFocused, _listButton;
71 void onMouseClick(ActionHandler handler, Uint8 button = SDL_BUTTON_LEFT);
73 void onMousePress(ActionHandler handler, Uint8 button = 0);
virtual void setFocus(bool focus)
Sets the focus of this surface.
Definition: InteractiveSurface.cpp:207
void onMouseRelease(ActionHandler handler, Uint8 button=0)
Hooks an action handler to a mouse release over the surface.
Definition: InteractiveSurface.cpp:443
void onMouseClick(ActionHandler handler, Uint8 button=SDL_BUTTON_LEFT)
Hooks an action handler to a mouse click on the surface.
Definition: InteractiveSurface.cpp:409
InteractiveSurface(int width, int height, int x=0, int y=0)
Creates a new interactive surface with the specified size and position.
Definition: InteractiveSurface.cpp:34
Container for all the information associated with a given user action, like mouse clicks...
Definition: Action.h:32
virtual bool isButtonHandled(Uint8 button=0)
Is this mouse button event handled?
Definition: InteractiveSurface.cpp:45
A game state that receives user input and reacts accordingly.
Definition: State.h:44
Surface that the user can interact with.
Definition: InteractiveSurface.h:37
virtual void mouseOver(Action *action, State *state)
Processes a mouse hover event.
Definition: InteractiveSurface.cpp:331
void onMouseIn(ActionHandler handler)
Hooks an action handler to moving the mouse into the surface.
Definition: InteractiveSurface.cpp:459
virtual void mouseIn(Action *action, State *state)
Processes a mouse hover in event.
Definition: InteractiveSurface.cpp:316
void setListButton()
Check this surface to see if it's a textlist button.
Definition: InteractiveSurface.cpp:519
virtual void handle(Action *action, State *state)
Processes any pending events.
Definition: InteractiveSurface.cpp:106
void setButtonPressed(Uint8 button, bool pressed)
Set a mouse button's internal state.
Definition: InteractiveSurface.cpp:71
void onKeyboardRelease(ActionHandler handler, SDLKey key=SDLK_ANY)
Hooks an action handler to releasing a key when the surface is focused.
Definition: InteractiveSurface.cpp:504
virtual void mouseOut(Action *action, State *state)
Processes a mouse hover out event.
Definition: InteractiveSurface.cpp:346
bool isButtonPressed(Uint8 button=0) const
Is this mouse button pressed?
Definition: InteractiveSurface.cpp:59
bool isFocused() const
Gets the focus of this surface.
Definition: InteractiveSurface.cpp:217
void onMouseOver(ActionHandler handler)
Hooks an action handler to moving the mouse over the surface.
Definition: InteractiveSurface.cpp:468
void onMousePress(ActionHandler handler, Uint8 button=0)
Hooks an action handler to a mouse press over the surface.
Definition: InteractiveSurface.cpp:426
Element that is blit (rendered) onto the screen.
Definition: Surface.h:38
virtual void mouseClick(Action *action, State *state)
Processes a mouse click event.
Definition: InteractiveSurface.cpp:293
void onMouseOut(ActionHandler handler)
Hooks an action handler to moving the mouse out of the surface.
Definition: InteractiveSurface.cpp:477
void onKeyboardPress(ActionHandler handler, SDLKey key=SDLK_ANY)
Hooks an action handler to pressing a key when the surface is focused.
Definition: InteractiveSurface.cpp:487
virtual void mousePress(Action *action, State *state)
Processes a mouse button press event.
Definition: InteractiveSurface.cpp:247
virtual void keyboardRelease(Action *action, State *state)
Processes a keyboard key release event.
Definition: InteractiveSurface.cpp:386
virtual void mouseRelease(Action *action, State *state)
Processes a mouse button release event.
Definition: InteractiveSurface.cpp:270
virtual ~InteractiveSurface()
Cleans up the interactive surface.
Definition: InteractiveSurface.cpp:41
virtual void keyboardPress(Action *action, State *state)
Processes a keyboard key press event.
Definition: InteractiveSurface.cpp:361
void setVisible(bool visible)
Sets the surface's visibility.
Definition: InteractiveSurface.cpp:88
Definition: BaseInfoState.cpp:40
virtual void unpress(State *state)
Unpresses the surface.
Definition: InteractiveSurface.cpp:227