The Battle for Wesnoth  1.19.5+dev
Namespaces | Macros | Functions | Variables
hotkey_item.cpp File Reference
#include "hotkey/hotkey_item.hpp"
#include "config.hpp"
#include "game_config_view.hpp"
#include "hotkey/hotkey_command.hpp"
#include "key.hpp"
#include "log.hpp"
#include "sdl/input.hpp"
#include "serialization/unicode.hpp"
#include "utils/general.hpp"
#include <boost/algorithm/string.hpp>
#include <functional>
Include dependency graph for hotkey_item.cpp:

Go to the source code of this file.

Namespaces

 hotkey
 Keyboard shortcuts for game actions.
 

Macros

#define GETTEXT_DOMAIN   "wesnoth-lib"
 
#define ERR_G   LOG_STREAM(err, lg::general())
 
#define LOG_G   LOG_STREAM(info, lg::general())
 
#define DBG_G   LOG_STREAM(debug, lg::general())
 
#define ERR_CF   LOG_STREAM(err, log_config)
 

Functions

hotkey_ptr hotkey::create_hotkey (const std::string &id, const SDL_Event &event)
 Create a new hotkey item for a command from an SDL_Event. More...
 
hotkey_ptr hotkey::load_from_config (const config &cfg)
 Create and instantiate a hotkey from a config element. More...
 
bool hotkey::has_hotkey_item (const std::string &command)
 
void hotkey::del_hotkey (const hotkey_ptr item)
 Remove a hotkey from the list of hotkeys. More...
 
void hotkey::add_hotkey (hotkey_ptr item)
 Add a hotkey to the list of hotkeys. More...
 
void hotkey::clear_hotkeys (const std::string &command)
 Unset the command bindings for all hotkeys matching the command. More...
 
void hotkey::clear_hotkeys ()
 Unset the bindings for all hotkeys. More...
 
const hotkey_ptr hotkey::get_hotkey (const SDL_Event &event)
 Iterate through the list of hotkeys and return a hotkey that matches the SDL_Event and the current keyboard modifier state. More...
 
void hotkey::load_default_hotkeys (const game_config_view &cfg)
 Registers all hotkeys present in this config. More...
 
void hotkey::load_custom_hotkeys (const game_config_view &cfg)
 Registers all hotkeys present in this config, overwriting any matching default hotkeys. More...
 
void hotkey::reset_default_hotkeys ()
 Reset all hotkeys to the defaults. More...
 
const hotkey_list & hotkey::get_hotkeys ()
 Returns the list of hotkeys. More...
 
void hotkey::save_hotkeys (config &cfg)
 Save the non-default hotkeys to the config. More...
 
std::string hotkey::get_names (const std::string &id)
 Returns a comma-separated string of hotkey names. More...
 
bool hotkey::is_hotkeyable_event (const SDL_Event &event)
 

Variables

static lg::log_domain log_config ("config")
 

Macro Definition Documentation

◆ DBG_G

#define DBG_G   LOG_STREAM(debug, lg::general())

Definition at line 36 of file hotkey_item.cpp.

◆ ERR_CF

#define ERR_CF   LOG_STREAM(err, log_config)

Definition at line 37 of file hotkey_item.cpp.

◆ ERR_G

#define ERR_G   LOG_STREAM(err, lg::general())

Definition at line 34 of file hotkey_item.cpp.

◆ GETTEXT_DOMAIN

#define GETTEXT_DOMAIN   "wesnoth-lib"

Definition at line 16 of file hotkey_item.cpp.

◆ LOG_G

#define LOG_G   LOG_STREAM(info, lg::general())

Definition at line 35 of file hotkey_item.cpp.

Variable Documentation

◆ log_config

lg::log_domain log_config("config") ( "config"  )
static