The Battle for Wesnoth  1.15.1+dev
Namespaces | Macros | Functions | Variables
hotkey_item.cpp File Reference
#include "log.hpp"
#include "hotkey/hotkey_item.hpp"
#include "hotkey/hotkey_command.hpp"
#include "config.hpp"
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string.hpp>
#include "utils/functional.hpp"
#include <SDL2/SDL.h>
#include <key.hpp>
#include <serialization/unicode.hpp>
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

static unsigned int hotkey::sdl_get_mods ()
 
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 (const 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_hotkeys (const config &cfg, bool set_as_default=false)
 Iterates through all hotkeys present in the config struct and creates and adds them to the hotkey list. 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")
 
hotkey_list hotkey::hotkeys_
 
config hotkey::default_hotkey_cfg_
 

Macro Definition Documentation

◆ DBG_G

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

Definition at line 35 of file hotkey_item.cpp.

◆ ERR_CF

#define ERR_CF   LOG_STREAM(err, log_config)

Definition at line 36 of file hotkey_item.cpp.

◆ ERR_G

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

◆ GETTEXT_DOMAIN

#define GETTEXT_DOMAIN   "wesnoth-lib"

Definition at line 21 of file hotkey_item.cpp.

◆ LOG_G

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

Definition at line 34 of file hotkey_item.cpp.

Variable Documentation

◆ log_config

lg::log_domain log_config("config")
static