The Battle for Wesnoth  1.19.6+dev
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
events::menu_handler Class Reference

#include <menu_events.hpp>

Inheritance diagram for events::menu_handler:

Public Member Functions

 menu_handler (game_display *gui, play_controller &pc)
 
virtual ~menu_handler ()
 
gui::floating_textboxget_textbox ()
 
void set_gui (game_display *gui)
 
void objectives ()
 
void show_statistics (int side_num)
 
void unit_list ()
 
void status_table ()
 
void save_map ()
 
void preferences ()
 
void show_chat_log ()
 
void show_help ()
 
void speak ()
 
void whisper ()
 
void shout ()
 
void recruit (int side_num, const map_location &last_hex)
 
void repeat_recruit (int side_num, const map_location &last_hex)
 
void recall (int side_num, const map_location &last_hex)
 
void show_enemy_moves (bool ignore_units, int side_num)
 
void toggle_shroud_updates (int side_num)
 
void update_shroud_now (int side_num)
 
bool end_turn (int side_num)
 
void goto_leader (int side_num)
 
void unit_description ()
 
void terrain_description (mouse_handler &mousehandler)
 
void rename_unit ()
 
void create_unit (mouse_handler &mousehandler)
 Creates a unit (in debug mode via hotkey or context menu). More...
 
void change_side (mouse_handler &mousehandler)
 
void kill_unit (mouse_handler &mousehandler)
 
void label_terrain (mouse_handler &mousehandler, bool team_only)
 
void clear_labels ()
 
void label_settings ()
 
void continue_move (mouse_handler &mousehandler, int side_num)
 
void execute_gotos (mouse_handler &mousehandler, int side_num)
 
void toggle_ellipses ()
 
void toggle_grid ()
 
void unit_hold_position (mouse_handler &mousehandler, int side_num)
 
void end_unit_turn (mouse_handler &mousehandler, int side_num)
 
void search ()
 
void request_control_change (int side_num, const std::string &player)
 
void user_command ()
 
void custom_command ()
 
void ai_formula ()
 
virtual void clear_messages () override
 
std::vector< std::string > get_commands_list ()
 
unit_map::iterator current_unit ()
 
unit_map::const_iterator current_unit () const
 
void move_unit_to_loc (const unit_map::iterator &ui, const map_location &target, bool continue_move, int side_num, mouse_handler &mousehandler)
 
t_string can_recruit (const std::string &name, int side_num, map_location &target_hex, map_location &recruited_from)
 
bool do_recruit (const std::string &name, int side_num, map_location &target_hex)
 
void do_speak ()
 
void do_search (const std::string &new_search)
 
void do_command (const std::string &str)
 
void do_ai_formula (const std::string &str, int side_num, mouse_handler &mousehandler)
 
void send_to_server (const config &cfg) override
 
game_stategamestate () const
 
game_datagamedata ()
 
game_boardboard () const
 

Protected Member Functions

void add_chat_message (const std::time_t &time, const std::string &speaker, int side, const std::string &message, events::chat_handler::MESSAGE_TYPE type=events::chat_handler::MESSAGE_PRIVATE) override
 
void send_chat_message (const std::string &message, bool allies_only=false) override
 

Private Member Functions

bool has_friends () const
 
- Private Member Functions inherited from events::chat_handler
 chat_handler ()
 
virtual ~chat_handler ()
 
void send_command (const std::string &cmd, const std::string &args="")
 
void do_speak (const std::string &message, bool allies_only=false)
 
virtual void send_whisper (const std::string &receiver, const std::string &message)
 
virtual void add_whisper_sent (const std::string &receiver, const std::string &message)
 
virtual void add_whisper_received (const std::string &sender, const std::string &message)
 
virtual void send_chat_room_message (const std::string &room, const std::string &message)
 
virtual void add_chat_room_message_sent (const std::string &room, const std::string &message)
 
virtual void add_chat_room_message_received (const std::string &room, const std::string &speaker, const std::string &message)
 
virtual void user_relation_changed (const std::string &name)
 Called when a processed command results in a relation (friend/ignore) change for a user whose name is passed as the 'name' arg. More...
 
void change_logging (const std::string &data)
 Change the log level of a log domain. More...
 

Private Attributes

game_displaygui_
 
play_controllerpc_
 
const game_config_viewgame_config_
 
gui::floating_textbox textbox_info_
 
std::string last_search_
 
map_location last_search_hit_
 

Friends

class console_handler
 

Additional Inherited Members

- Private Types inherited from events::chat_handler
enum  MESSAGE_TYPE { MESSAGE_PUBLIC , MESSAGE_PRIVATE }
 

Detailed Description

Definition at line 50 of file menu_events.hpp.

Constructor & Destructor Documentation

◆ menu_handler()

events::menu_handler::menu_handler ( game_display gui,
play_controller pc 
)

Definition at line 88 of file menu_events.cpp.

◆ ~menu_handler()

events::menu_handler::~menu_handler ( )
virtual

Definition at line 98 of file menu_events.cpp.

Member Function Documentation

◆ add_chat_message()

void events::menu_handler::add_chat_message ( const std::time_t &  time,
const std::string &  speaker,
int  side,
const std::string &  message,
events::chat_handler::MESSAGE_TYPE  type = events::chat_handler::MESSAGE_PRIVATE 
)
overrideprotectedvirtual

◆ ai_formula()

void events::menu_handler::ai_formula ( )

◆ board()

game_board & events::menu_handler::board ( ) const

◆ can_recruit()

t_string events::menu_handler::can_recruit ( const std::string &  name,
int  side_num,
map_location target_hex,
map_location recruited_from 
)
Returns
If the recruit is possible, an empty string and set recruited_from; otherwise, return an error message string.

Definition at line 297 of file menu_events.cpp.

References _(), utils::contains(), unit_type::cost(), unit_type_data::find(), actions::find_recruit_location(), actions::get_recruits(), team::gold(), team::last_recruit(), loc, wfl::msg(), unit_type::type_name(), unit_types, and VGETTEXT.

Referenced by recruit().

◆ change_side()

void events::menu_handler::change_side ( mouse_handler mousehandler)

◆ clear_labels()

void events::menu_handler::clear_labels ( )

◆ clear_messages()

void events::menu_handler::clear_messages ( )
overridevirtual

◆ continue_move()

void events::menu_handler::continue_move ( mouse_handler mousehandler,
int  side_num 
)

◆ create_unit()

void events::menu_handler::create_unit ( mouse_handler mousehandler)

Creates a unit (in debug mode via hotkey or context menu).

Definition at line 752 of file menu_events.cpp.

References events::mouse_handler::get_last_hex().

Referenced by playsingle_controller::hotkey_handler::create_unit().

◆ current_unit() [1/2]

unit_map::iterator events::menu_handler::current_unit ( )

◆ current_unit() [2/2]

unit_map::const_iterator events::menu_handler::current_unit ( ) const
inline

Definition at line 105 of file menu_events.hpp.

References current_unit().

◆ custom_command()

void events::menu_handler::custom_command ( )

◆ do_ai_formula()

void events::menu_handler::do_ai_formula ( const std::string &  str,
int  side_num,
mouse_handler mousehandler 
)

◆ do_command()

void events::menu_handler::do_command ( const std::string &  str)

◆ do_recruit()

bool events::menu_handler::do_recruit ( const std::string &  name,
int  side_num,
map_location target_hex 
)

◆ do_search()

void events::menu_handler::do_search ( const std::string &  new_search)

◆ do_speak()

void events::menu_handler::do_speak ( )

Definition at line 1045 of file menu_events.cpp.

Referenced by play_controller::enter_textbox().

◆ end_turn()

bool events::menu_handler::end_turn ( int  side_num)

◆ end_unit_turn()

void events::menu_handler::end_unit_turn ( mouse_handler mousehandler,
int  side_num 
)

◆ execute_gotos()

void events::menu_handler::execute_gotos ( mouse_handler mousehandler,
int  side_num 
)

◆ gamedata()

game_data & events::menu_handler::gamedata ( )

Definition at line 107 of file menu_events.cpp.

References game_state::gamedata_, and gamestate().

◆ gamestate()

game_state & events::menu_handler::gamestate ( ) const

Definition at line 102 of file menu_events.cpp.

References play_controller::gamestate(), and pc_.

Referenced by board(), gamedata(), and objectives().

◆ get_commands_list()

std::vector< std::string > events::menu_handler::get_commands_list ( )

◆ get_textbox()

gui::floating_textbox & events::menu_handler::get_textbox ( )

◆ goto_leader()

void events::menu_handler::goto_leader ( int  side_num)

Definition at line 616 of file menu_events.cpp.

References i, and display::WARP.

Referenced by play_controller::hotkey_handler::goto_leader().

◆ has_friends()

bool events::menu_handler::has_friends ( ) const
private

◆ kill_unit()

void events::menu_handler::kill_unit ( mouse_handler mousehandler)

◆ label_settings()

void events::menu_handler::label_settings ( )

◆ label_terrain()

void events::menu_handler::label_terrain ( mouse_handler mousehandler,
bool  team_only 
)

◆ move_unit_to_loc()

void events::menu_handler::move_unit_to_loc ( const unit_map::iterator ui,
const map_location target,
bool  continue_move,
int  side_num,
mouse_handler mousehandler 
)

◆ objectives()

void events::menu_handler::objectives ( )

◆ preferences()

void events::menu_handler::preferences ( )

Definition at line 177 of file menu_events.cpp.

References gui_, and display::queue_rerender().

Referenced by play_controller::hotkey_handler::preferences().

◆ recall()

void events::menu_handler::recall ( int  side_num,
const map_location last_hex 
)

◆ recruit()

void events::menu_handler::recruit ( int  side_num,
const map_location last_hex 
)

◆ rename_unit()

void events::menu_handler::rename_unit ( )

◆ repeat_recruit()

void events::menu_handler::repeat_recruit ( int  side_num,
const map_location last_hex 
)

◆ request_control_change()

void events::menu_handler::request_control_change ( int  side_num,
const std::string &  player 
)

Definition at line 2119 of file menu_events.cpp.

References prefs::get().

Referenced by gui2::dialogs::mp_change_control::post_show().

◆ save_map()

void events::menu_handler::save_map ( )

◆ search()

void events::menu_handler::search ( )

Definition at line 1034 of file menu_events.cpp.

References _(), wfl::msg(), and gui::TEXTBOX_SEARCH.

Referenced by play_controller::hotkey_handler::search().

◆ send_chat_message()

void events::menu_handler::send_chat_message ( const std::string &  message,
bool  allies_only = false 
)
overrideprotectedvirtual

◆ send_to_server()

void events::menu_handler::send_to_server ( const config cfg)
overridevirtual

Implements events::chat_handler.

Definition at line 2151 of file menu_events.cpp.

◆ set_gui()

void events::menu_handler::set_gui ( game_display gui)
inline

Definition at line 57 of file menu_events.hpp.

References gui_.

Referenced by play_controller::init().

◆ shout()

void events::menu_handler::shout ( )

◆ show_chat_log()

void events::menu_handler::show_chat_log ( )

Definition at line 184 of file menu_events.cpp.

References c, and resources::recorder.

Referenced by play_controller::hotkey_handler::show_chat_log().

◆ show_enemy_moves()

void events::menu_handler::show_enemy_moves ( bool  ignore_units,
int  side_num 
)

◆ show_help()

void events::menu_handler::show_help ( )

Definition at line 191 of file menu_events.cpp.

References help::show_help().

Referenced by play_controller::hotkey_handler::show_help().

◆ show_statistics()

void events::menu_handler::show_statistics ( int  side_num)

◆ speak()

void events::menu_handler::speak ( )

◆ status_table()

void events::menu_handler::status_table ( )

◆ terrain_description()

void events::menu_handler::terrain_description ( mouse_handler mousehandler)

◆ toggle_ellipses()

void events::menu_handler::toggle_ellipses ( )

Definition at line 986 of file menu_events.cpp.

References prefs::get().

Referenced by play_controller::hotkey_handler::toggle_ellipses().

◆ toggle_grid()

void events::menu_handler::toggle_grid ( )

Definition at line 992 of file menu_events.cpp.

References prefs::get().

Referenced by play_controller::hotkey_handler::toggle_grid().

◆ toggle_shroud_updates()

void events::menu_handler::toggle_shroud_updates ( int  side_num)

◆ unit_description()

void events::menu_handler::unit_description ( )

◆ unit_hold_position()

void events::menu_handler::unit_hold_position ( mouse_handler mousehandler,
int  side_num 
)

◆ unit_list()

void events::menu_handler::unit_list ( )

Definition at line 137 of file menu_events.cpp.

References gui_, and gui2::dialogs::show_unit_list().

Referenced by play_controller::hotkey_handler::unit_list().

◆ update_shroud_now()

void events::menu_handler::update_shroud_now ( int  side_num)

◆ user_command()

void events::menu_handler::user_command ( )

◆ whisper()

void events::menu_handler::whisper ( )

Friends And Related Function Documentation

◆ console_handler

friend class console_handler
friend

Definition at line 141 of file menu_events.hpp.

Member Data Documentation

◆ game_config_

const game_config_view& events::menu_handler::game_config_
private

Definition at line 149 of file menu_events.hpp.

◆ gui_

game_display* events::menu_handler::gui_
private

Definition at line 146 of file menu_events.hpp.

Referenced by has_friends(), preferences(), set_gui(), speak(), status_table(), and unit_list().

◆ last_search_

std::string events::menu_handler::last_search_
private

Definition at line 152 of file menu_events.hpp.

◆ last_search_hit_

map_location events::menu_handler::last_search_hit_
private

Definition at line 153 of file menu_events.hpp.

◆ pc_

play_controller& events::menu_handler::pc_
private

Definition at line 147 of file menu_events.hpp.

Referenced by gamestate(), has_friends(), objectives(), save_map(), and show_statistics().

◆ textbox_info_

gui::floating_textbox events::menu_handler::textbox_info_
private

Definition at line 151 of file menu_events.hpp.

Referenced by get_textbox(), and speak().


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