The Battle for Wesnoth  1.15.2+dev
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
controller_base Class Referenceabstract

#include <controller_base.hpp>

Inheritance diagram for controller_base:
Inheritance graph

Classes

class  keyup_listener
 

Public Member Functions

 controller_base ()
 
virtual ~controller_base ()
 
virtual 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)
 
virtual hotkey::command_executorget_hotkey_command_executor ()
 Optionally get a command executor to handle context menu events. More...
 
- 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 ()
 
virtual bool has_joined ()
 
virtual bool has_joined_global ()
 
sdl_handleroperator= (sdl_handler &&)=delete
 Moving would require two instances' context membership to be handled, it's simpler to delete these and require the two instances to be separately constructed / destructed. More...
 
 sdl_handler (sdl_handler &&)=delete
 
- Public Member Functions inherited from events::pump_monitor
 pump_monitor ()
 
virtual ~pump_monitor ()
 

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_baseget_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 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::string > additional_actions_pressed ()
 
bool handle_scroll (int mousex, int mousey, int mouse_flags)
 Handle scrolling by keyboard, joystick and moving mouse near map edges. More...
 
void handle_event (const SDL_Event &event) override
 Process mouse- and keypress-events from SDL. More...
 
void handle_window_event (const SDL_Event &) override
 
virtual void process_focus_keydown_event (const SDL_Event &)
 Process keydown (only when the general map display does not have focus). More...
 
virtual void process (events::pump_info &) override
 
virtual void process_keydown_event (const SDL_Event &)
 Process keydown (always). More...
 
virtual void process_keyup_event (const SDL_Event &)
 Process keyup (always). More...
 
virtual void show_menu (const std::vector< config > &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
 
void long_touch_callback (int x, int y)
 
- 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)
 
 sdl_handler (const sdl_handler &)
 
sdl_handleroperator= (const sdl_handler &)
 
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_
 

Private Attributes

keyup_listener key_release_listener_
 
bool last_mouse_is_touch_
 
size_t long_touch_timer_
 Context menu timer. More...
 

Detailed Description

Definition at line 62 of file controller_base.hpp.

Constructor & Destructor Documentation

◆ controller_base()

controller_base::controller_base ( )

Definition at line 37 of file controller_base.cpp.

◆ ~controller_base()

controller_base::~controller_base ( )
virtual

Definition at line 51 of file controller_base.cpp.

References long_touch_timer_, and gui2::remove_timer().

Member Function Documentation

◆ additional_actions_pressed()

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

Reimplemented in editor::editor_controller.

Definition at line 132 of file controller_base.hpp.

Referenced by play_slice().

◆ apply_keyboard_scroll()

void controller_base::apply_keyboard_scroll ( int  x,
int  y 
)

◆ execute_action()

void controller_base::execute_action ( const std::vector< std::string > &  items_arg,
int  xloc,
int  yloc,
bool  context_menu 
)
protectedvirtual

◆ get_display()

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(), long_touch_callback(), and play_slice().

◆ get_hotkey_command_executor()

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

Optionally get a command executor to handle context menu events.

Reimplemented in play_controller, and editor::editor_controller.

Definition at line 95 of file controller_base.hpp.

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

◆ get_mouse_handler_base()

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(), long_touch_callback(), and play_slice().

◆ get_plugins_context()

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 119 of file controller_base.hpp.

Referenced by play_slice().

◆ get_soundsource_man()

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 113 of file controller_base.hpp.

Referenced by play_slice().

◆ get_theme()

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

◆ handle_event()

void controller_base::handle_event ( const SDL_Event &  event)
overrideprotectedvirtual

◆ handle_scroll()

bool controller_base::handle_scroll ( int  mousex,
int  mousey,
int  mouse_flags 
)
protected

◆ handle_window_event()

void controller_base::handle_window_event ( const SDL_Event &  )
inlineoverrideprotectedvirtual

Implements events::sdl_handler.

Definition at line 151 of file controller_base.hpp.

◆ have_keyboard_focus()

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 263 of file controller_base.cpp.

Referenced by handle_event().

◆ in_context_menu()

bool controller_base::in_context_menu ( hotkey::HOTKEY_COMMAND  command) const
protectedvirtual

Definition at line 451 of file controller_base.cpp.

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

◆ is_browsing()

virtual bool controller_base::is_browsing ( ) const
inlineprotectedvirtual

Reimplemented in play_controller.

Definition at line 101 of file controller_base.hpp.

Referenced by handle_event(), and play_slice().

◆ long_touch_callback()

void controller_base::long_touch_callback ( int  x,
int  y 
)
protected

◆ play_slice()

void controller_base::play_slice ( bool  is_delay_enabled = true)
virtual

◆ process()

void controller_base::process ( events::pump_info )
overrideprotectedvirtual

◆ process_focus_keydown_event()

virtual void controller_base::process_focus_keydown_event ( const SDL_Event &  )
inlineprotectedvirtual

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

Reimplemented in play_controller.

Definition at line 157 of file controller_base.hpp.

References tooltips::process().

Referenced by handle_event().

◆ process_keydown_event()

virtual void controller_base::process_keydown_event ( const SDL_Event &  )
inlineprotectedvirtual

Process keydown (always).

Overridden in derived classes

Reimplemented in play_controller.

Definition at line 165 of file controller_base.hpp.

Referenced by handle_event().

◆ process_keyup_event()

virtual void controller_base::process_keyup_event ( const SDL_Event &  )
inlineprotectedvirtual

Process keyup (always).

  • Overridden in derived classes

Reimplemented in play_controller, and editor::editor_controller.

Definition at line 171 of file controller_base.hpp.

References lua_gui2::show_menu().

Referenced by handle_event().

◆ set_scroll_down()

void controller_base::set_scroll_down ( bool  on)
inline

◆ set_scroll_left()

void controller_base::set_scroll_left ( bool  on)
inline

◆ set_scroll_right()

void controller_base::set_scroll_right ( bool  on)
inline

◆ set_scroll_up()

void controller_base::set_scroll_up ( bool  on)
inline

◆ show_menu()

void controller_base::show_menu ( const std::vector< config > &  items_arg,
int  xloc,
int  yloc,
bool  context_menu,
display disp 
)
protectedvirtual

Member Data Documentation

◆ game_config_

const config& controller_base::game_config_
protected

◆ key_

CKey controller_base::key_
protected

Definition at line 185 of file controller_base.hpp.

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

◆ key_release_listener_

keyup_listener controller_base::key_release_listener_
private

Definition at line 214 of file controller_base.hpp.

◆ last_mouse_is_touch_

bool controller_base::last_mouse_is_touch_
private

Definition at line 216 of file controller_base.hpp.

Referenced by handle_event().

◆ long_touch_timer_

size_t controller_base::long_touch_timer_
private

Context menu timer.

Definition at line 218 of file controller_base.hpp.

Referenced by handle_event(), long_touch_callback(), and ~controller_base().

◆ scroll_down_

bool controller_base::scroll_down_
protected

Definition at line 189 of file controller_base.hpp.

Referenced by handle_scroll().

◆ scroll_left_

bool controller_base::scroll_left_
protected

Definition at line 190 of file controller_base.hpp.

Referenced by handle_scroll().

◆ scroll_right_

bool controller_base::scroll_right_
protected

Definition at line 191 of file controller_base.hpp.

Referenced by handle_scroll().

◆ scroll_up_

bool controller_base::scroll_up_
protected

Definition at line 188 of file controller_base.hpp.

Referenced by handle_scroll().

◆ scrolling_

bool controller_base::scrolling_
protected

Definition at line 187 of file controller_base.hpp.

Referenced by play_slice().


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