Public Member Functions | Protected Member Functions | Protected Attributes

controller_base Class Reference

#include <controller_base.hpp>

Inheritance diagram for controller_base:
Inheritance graph
[legend]
Collaboration diagram for controller_base:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 controller_base (int ticks, const config &game_config, CVideo &video)
virtual ~controller_base ()
void play_slice (bool is_delay_enabled=true)
int get_ticks ()

Protected Member Functions

virtual void slice_before_scroll ()
 Called by play_slice after events:: calls, but before processing scroll and other things like menu.
virtual void slice_end ()
 Called at the very end of play_slice.
virtual
events::mouse_handler_base
get_mouse_handler_base ()=0
 Get a reference to a mouse handler member a derived class uses.
virtual displayget_display ()=0
 Get a reference to a display member a derived class uses.
virtual bool have_keyboard_focus ()
 Derived classes should override this to return false when arrow keys should not scroll the map, hotkeys not processed etc, for example when a textbox is active.
bool handle_scroll (CKey &key, int mousex, int mousey, int mouse_flags, double joystickx, double joysticky)
 Handle scrolling by keyboard, joystick and moving mouse near map edges.
void handle_event (const SDL_Event &event)
 Process mouse- and keypress-events from SDL.
virtual void process_focus_keydown_event (const SDL_Event &event)
 Process keydown (only when the general map display does not have focus).
virtual void process_keydown_event (const SDL_Event &event)
 Process keydown (always).
virtual void process_keyup_event (const SDL_Event &event)
 Process keyup (always).
virtual void post_mouse_press (const SDL_Event &event)
 Called after processing a mouse button up or down event Overridden in derived classes.
virtual void show_menu (const std::vector< std::string > &items_arg, int xloc, int yloc, bool context_menu)
virtual bool in_context_menu (hotkey::HOTKEY_COMMAND command) const
const configget_theme (const config &game_config, std::string theme_name)

Protected Attributes

const configgame_config_
const int ticks_
CKey key_
bool browse_
bool scrolling_
joystick_manager joystick_manager_

Detailed Description

Definition at line 35 of file controller_base.hpp.


Constructor & Destructor Documentation

controller_base::controller_base ( int  ticks,
const config game_config,
CVideo video 
)

Definition at line 29 of file controller_base.cpp.

controller_base::~controller_base (  )  [virtual]

Definition at line 40 of file controller_base.cpp.


Member Function Documentation

virtual display& controller_base::get_display (  )  [protected, pure virtual]

Get a reference to a display member a derived class uses.

Referenced by handle_event(), handle_scroll(), play_slice(), and show_menu().

Here is the caller graph for this function:

virtual events::mouse_handler_base& controller_base::get_mouse_handler_base (  )  [protected, pure virtual]

Get a reference to a mouse handler member a derived class uses.

Referenced by handle_event(), and play_slice().

Here is the caller graph for this function:

const config & controller_base::get_theme ( const config game_config,
std::string  theme_name 
) [protected]

Definition at line 296 of file controller_base.cpp.

References ERR_DP, config::find_child(), and preferences::theme().

Referenced by handle_event(), play_controller::init(), and replay_controller::rebuild_replay_theme().

Here is the call graph for this function:

Here is the caller graph for this function:

int controller_base::get_ticks (  ) 

Definition at line 44 of file controller_base.cpp.

References ticks_.

void controller_base::handle_event ( const SDL_Event &  event  )  [protected, virtual]

Process mouse- and keypress-events from SDL.

Not virtual but calls various virtual function to allow specialized behaviour of derived classes.

Implements events::handler.

Definition at line 48 of file controller_base.cpp.

References browse_, hotkey::button_event(), get_display(), get_mouse_handler_base(), get_theme(), hotkey::hat_event(), have_keyboard_focus(), gui::in_dialog(), hotkey::key_event(), events::mouse_handler_base::mouse_motion_event(), events::mouse_handler_base::mouse_press(), post_mouse_press(), process_focus_keydown_event(), process_keydown_event(), process_keyup_event(), and show_menu().

Here is the call graph for this function:

bool controller_base::handle_scroll ( CKey key,
int  mousex,
int  mousey,
int  mouse_flags,
double  joystickx,
double  joysticky 
) [protected]

Handle scrolling by keyboard, joystick and moving mouse near map edges.

See also:
is_keyboard_scroll_active
Returns:
true when there was any scrolling, false otherwise

Definition at line 138 of file controller_base.cpp.

References preferences::get(), get_display(), theme::object::get_location(), display::get_theme(), display::h(), have_keyboard_focus(), display::map_outside_area(), theme::menus(), preferences::middle_click_scrolls(), preferences::mouse_scroll_enabled(), preferences::mouse_scroll_threshold(), point_in_rect(), round_double(), display::scroll(), preferences::scroll_speed(), and display::w().

Referenced by play_slice().

Here is the call graph for this function:

Here is the caller graph for this function:

bool controller_base::have_keyboard_focus (  )  [protected, virtual]

Derived classes should override this to return false when arrow keys should not scroll the map, hotkeys not processed etc, for example when a textbox is active.

Returns:
true when arrow keys should scroll the map, false otherwise

Definition at line 117 of file controller_base.cpp.

Referenced by handle_event(), and handle_scroll().

Here is the caller graph for this function:

bool controller_base::in_context_menu ( hotkey::HOTKEY_COMMAND  command  )  const [protected, virtual]

Definition at line 291 of file controller_base.cpp.

Referenced by editor::editor_controller::show_menu(), and show_menu().

Here is the caller graph for this function:

void controller_base::play_slice ( bool  is_delay_enabled = true  ) 
void controller_base::post_mouse_press ( const SDL_Event &  event  )  [protected, virtual]

Called after processing a mouse button up or down event Overridden in derived classes.

Definition at line 134 of file controller_base.cpp.

Referenced by handle_event().

Here is the caller graph for this function:

void controller_base::process_focus_keydown_event ( const SDL_Event &  event  )  [protected, virtual]

Process keydown (only when the general map display does not have focus).

Definition at line 122 of file controller_base.cpp.

Referenced by handle_event().

Here is the caller graph for this function:

void controller_base::process_keydown_event ( const SDL_Event &  event  )  [protected, virtual]

Process keydown (always).

Overridden in derived classes

Definition at line 126 of file controller_base.cpp.

Referenced by handle_event().

Here is the caller graph for this function:

void controller_base::process_keyup_event ( const SDL_Event &  event  )  [protected, virtual]

Process keyup (always).

Overridden in derived classes

Definition at line 130 of file controller_base.cpp.

Referenced by handle_event().

Here is the caller graph for this function:

void controller_base::show_menu ( const std::vector< std::string > &  items_arg,
int  xloc,
int  yloc,
bool  context_menu 
) [protected, virtual]

Definition at line 272 of file controller_base.cpp.

References hotkey::command_executor::can_execute_command(), get_display(), hotkey::get_hotkey(), and in_context_menu().

Referenced by handle_event(), and play_slice().

Here is the call graph for this function:

Here is the caller graph for this function:

void controller_base::slice_before_scroll (  )  [protected, virtual]

Called by play_slice after events:: calls, but before processing scroll and other things like menu.

Definition at line 262 of file controller_base.cpp.

Referenced by play_slice().

Here is the caller graph for this function:

void controller_base::slice_end (  )  [protected, virtual]

Called at the very end of play_slice.

Definition at line 267 of file controller_base.cpp.

Referenced by play_slice().

Here is the caller graph for this function:


Member Data Documentation

bool controller_base::browse_ [protected]

Definition at line 123 of file controller_base.hpp.

Referenced by play_slice().

Definition at line 120 of file controller_base.hpp.

Referenced by editor::editor_controller::editor_controller().

bool controller_base::scrolling_ [protected]

Definition at line 122 of file controller_base.hpp.

Referenced by play_slice().

const int controller_base::ticks_ [protected]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Thu May 24 2012 01:13:29 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs