The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
controller_base Class Referenceabstract

#include <controller_base.hpp>

Inheritance diagram for controller_base:
Inheritance graph

Public Member Functions

 controller_base (const config &game_config, CVideo &video)
 
virtual ~controller_base ()
 
void play_slice (bool is_delay_enabled=true)
 
void apply_keyboard_scroll (int x, int y)
 
void set_scroll_up (bool on)
 
void set_scroll_down (bool on)
 
void set_scroll_left (bool on)
 
void set_scroll_right (bool on)
 
- Public Member Functions inherited from events::sdl_handler
virtual void process_event ()
 
virtual void draw ()
 
virtual void volatile_draw ()
 
virtual void volatile_undraw ()
 
virtual bool requires_event_focus (const SDL_Event *=nullptr) const
 
virtual void process_help_string (int, int)
 
virtual void process_tooltip_string (int, int)
 
virtual void join ()
 
virtual void join (context &c)
 
virtual void join_same (sdl_handler *parent)
 
virtual void leave ()
 
virtual void join_global ()
 
virtual void leave_global ()
 

Static Public Member Functions

static const configget_theme (const config &game_config, std::string theme_name)
 

Protected Member Functions

virtual bool is_browsing () const
 
virtual
events::mouse_handler_base
get_mouse_handler_base ()=0
 Get a reference to a mouse handler member a derived class uses. More...
 
virtual displayget_display ()=0
 Get a reference to a display member a derived class uses. More...
 
virtual soundsource::managerget_soundsource_man ()
 Get (optionally) a soundsources manager a derived class uses. More...
 
virtual plugins_contextget_plugins_context ()
 Get (optionally) a plugins context a derived class uses. More...
 
virtual hotkey::command_executorget_hotkey_command_executor ()
 Get (optionally) a command executor to handle context menu events. More...
 
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. More...
 
virtual std::vector< std::stringadditional_actions_pressed ()
 
bool handle_scroll (int mousex, int mousey, int mouse_flags, double joystickx, double joysticky)
 Handle scrolling by keyboard, joystick and moving mouse near map edges. More...
 
void handle_event (const SDL_Event &event)
 Process mouse- and keypress-events from SDL. More...
 
void handle_window_event (const SDL_Event &)
 
virtual void process_focus_keydown_event (const SDL_Event &event)
 Process keydown (only when the general map display does not have focus). More...
 
virtual void process_keydown_event (const SDL_Event &event)
 Process keydown (always). More...
 
virtual void process_keyup_event (const SDL_Event &event)
 Process keyup (always). More...
 
virtual void show_menu (const std::vector< std::string > &items_arg, int xloc, int yloc, bool context_menu, display &disp)
 
virtual void execute_action (const std::vector< std::string > &items_arg, int xloc, int yloc, bool context_menu)
 
virtual bool in_context_menu (hotkey::HOTKEY_COMMAND command) const
 
- Protected Member Functions inherited from video2::draw_layering
 draw_layering (const bool auto_join=true)
 
virtual ~draw_layering ()
 
- Protected Member Functions inherited from events::sdl_handler
 sdl_handler (const bool auto_join=true)
 
virtual ~sdl_handler ()
 
virtual std::vector
< sdl_handler * > 
handler_members ()
 

Protected Attributes

const configgame_config_
 
CKey key_
 
bool scrolling_
 
bool scroll_up_
 
bool scroll_down_
 
bool scroll_left_
 
bool scroll_right_
 
joystick_manager joystick_manager_
 

Detailed Description

Definition at line 58 of file controller_base.hpp.

Constructor & Destructor Documentation

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

Definition at line 32 of file controller_base.cpp.

controller_base::~controller_base ( )
virtual

Definition at line 45 of file controller_base.cpp.

Member Function Documentation

virtual std::vector<std::string> controller_base::additional_actions_pressed ( )
inlineprotectedvirtual

Reimplemented in editor::editor_controller.

Definition at line 108 of file controller_base.hpp.

Referenced by play_slice().

void controller_base::apply_keyboard_scroll ( int  x,
int  y 
)
void controller_base::execute_action ( const std::vector< std::string > &  items_arg,
int  xloc,
int  yloc,
bool  context_menu 
)
protectedvirtual
virtual display& controller_base::get_display ( )
protectedpure virtual

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

Implemented in play_controller, and editor::editor_controller.

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

virtual hotkey::command_executor* controller_base::get_hotkey_command_executor ( )
inlineprotectedvirtual

Get (optionally) a command executor to handle context menu events.

Reimplemented in play_controller, and editor::editor_controller.

Definition at line 98 of file controller_base.hpp.

Referenced by execute_action(), handle_event(), and show_menu().

virtual events::mouse_handler_base& controller_base::get_mouse_handler_base ( )
protectedpure virtual

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

Implemented in play_controller, and editor::editor_controller.

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

virtual plugins_context* controller_base::get_plugins_context ( )
inlineprotectedvirtual

Get (optionally) a plugins context a derived class uses.

Reimplemented in play_controller.

Definition at line 93 of file controller_base.hpp.

Referenced by play_slice().

virtual soundsource::manager* controller_base::get_soundsource_man ( )
inlineprotectedvirtual

Get (optionally) a soundsources manager a derived class uses.

Reimplemented in play_controller.

Definition at line 88 of file controller_base.hpp.

Referenced by play_slice().

const config & controller_base::get_theme ( const config game_config,
std::string  theme_name 
)
static
void controller_base::handle_event ( const SDL_Event &  event)
protectedvirtual
bool controller_base::handle_scroll ( int  mousex,
int  mousey,
int  mouse_flags,
double  joystickx,
double  joysticky 
)
protected
void controller_base::handle_window_event ( const SDL_Event &  )
inlineprotectedvirtual

Implements events::sdl_handler.

Definition at line 125 of file controller_base.hpp.

bool controller_base::have_keyboard_focus ( )
protectedvirtual

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

Reimplemented in play_controller.

Definition at line 119 of file controller_base.cpp.

Referenced by handle_event().

bool controller_base::in_context_menu ( hotkey::HOTKEY_COMMAND  command) const
protectedvirtual
virtual bool controller_base::is_browsing ( ) const
inlineprotectedvirtual

Reimplemented in play_controller.

Definition at line 74 of file controller_base.hpp.

Referenced by handle_event(), and play_slice().

void controller_base::play_slice ( bool  is_delay_enabled = true)
void controller_base::process_focus_keydown_event ( const SDL_Event &  event)
protectedvirtual

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

Reimplemented in play_controller.

Definition at line 124 of file controller_base.cpp.

Referenced by handle_event().

void controller_base::process_keydown_event ( const SDL_Event &  event)
protectedvirtual

Process keydown (always).

Overridden in derived classes

Reimplemented in play_controller.

Definition at line 128 of file controller_base.cpp.

Referenced by handle_event().

void controller_base::process_keyup_event ( const SDL_Event &  event)
protectedvirtual

Process keyup (always).

Overridden in derived classes

Reimplemented in play_controller, and editor::editor_controller.

Definition at line 132 of file controller_base.cpp.

Referenced by handle_event().

void controller_base::set_scroll_down ( bool  on)
void controller_base::set_scroll_left ( bool  on)
void controller_base::set_scroll_right ( bool  on)
void controller_base::set_scroll_up ( bool  on)
void controller_base::show_menu ( const std::vector< std::string > &  items_arg,
int  xloc,
int  yloc,
bool  context_menu,
display disp 
)
protectedvirtual

Member Data Documentation

const config& controller_base::game_config_
protected
joystick_manager controller_base::joystick_manager_
protected

Definition at line 156 of file controller_base.hpp.

Referenced by play_slice().

CKey controller_base::key_
protected

Definition at line 150 of file controller_base.hpp.

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

bool controller_base::scroll_down_
protected

Definition at line 153 of file controller_base.hpp.

Referenced by handle_scroll(), and set_scroll_down().

bool controller_base::scroll_left_
protected

Definition at line 154 of file controller_base.hpp.

Referenced by handle_scroll(), and set_scroll_left().

bool controller_base::scroll_right_
protected

Definition at line 155 of file controller_base.hpp.

Referenced by handle_scroll(), and set_scroll_right().

bool controller_base::scroll_up_
protected

Definition at line 152 of file controller_base.hpp.

Referenced by handle_scroll(), and set_scroll_up().

bool controller_base::scrolling_
protected

Definition at line 151 of file controller_base.hpp.

Referenced by play_slice().


The documentation for this class was generated from the following files: