17 #define GETTEXT_DOMAIN "wesnoth-lib" 69 void disable_widget_on_toggle(window& window, widget&
w,
const std::string&
id)
71 find_widget<W>(&window,
id,
false).set_active(dynamic_cast<selectable_item&>(w).get_value_bool());
75 void disable_widget_on_toggle_inverted(window& window, widget& w,
const std::string&
id)
77 find_widget<W>(&window,
id,
false).set_active(!dynamic_cast<selectable_item&>(w).get_value_bool());
82 int index_in_pager_range(
const int first,
const stacked_widget& pager)
84 return std::clamp<int>(first, 0, pager.get_layer_count() - 1);
88 template<
bool(*fptr)(
bool)>
89 void sound_toggle_on_change(window& window,
const std::string& id_to_toggle, widget& w)
91 std::invoke(fptr, dynamic_cast<selectable_item&>(w).get_value_bool());
94 disable_widget_on_toggle<slider>(window,
w, id_to_toggle);
98 template<
void(*fptr)(
int)>
99 void volume_setter_on_change(widget& w)
101 std::invoke(fptr, dynamic_cast<integer_selector&>(w).get_value());
114 , last_selected_item_(0)
115 , accl_speeds_({0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 3, 4, 8, 16})
123 cat_names_[name.first] =
t_string(name.second,
"wesnoth-lib");
134 for(
const point& res : resolutions_) {
138 const int div = std::gcd(res.x, res.y);
139 const int x_ratio = res.x / div;
140 const int y_ratio = res.y / div;
142 if(x_ratio <= 10 || y_ratio <= 10) {
143 option[
"details"] =
formatter() <<
"<span color='#777777'>(" << x_ratio <<
':' << y_ratio <<
")</span>";
146 options.push_back(std::move(option));
149 const unsigned current_res = std::distance(resolutions_.begin(), std::find(resolutions_.begin(), resolutions_.end(),
157 std::map<std::string, string_map> data;
160 std::string
image =
"friend.png";
161 std::string descriptor =
_(
"friend");
165 image =
"ignore.png";
166 descriptor =
_(
"ignored");
170 notes =
" <small>(" + entry.
get_notes() +
")</small>";
173 item[
"use_markup"] =
"true";
175 item[
"label"] =
"misc/status-" + image;
176 data.emplace(
"friend_icon", item);
178 item[
"label"] = entry.
get_nick() + notes;
179 data.emplace(
"friend_name", item);
181 item[
"label"] =
"<small>" + descriptor +
"</small>";
182 data.emplace(
"friend_status", item);
192 if(sel < 0 || sel >= num_friends) {
196 std::map<std::string, acquaintance>::const_iterator who =
get_acquaintances().begin();
197 std::advance(who, sel);
199 textbox.
set_value(who->second.get_nick() +
" " + who->second.get_notes());
210 find_widget<button>(get_window(),
"remove",
false).set_active(!list_empty);
212 find_widget<label>(get_window(),
"no_friends_notice",
false).set_visible(
218 std::string username = textbox.
text();
219 if(username.empty()) {
226 std::size_t pos = username.find_first_of(
' ');
227 if(pos != std::string::npos) {
228 reason = username.substr(pos + 1);
229 username = username.substr(0, pos);
232 auto [entry, added_new] =
add_acquaintance(username, (is_friend ?
"friend":
"ignore"), reason);
241 listbox& list = find_widget<listbox>(get_window(),
"friends_list",
false);
250 list.
add_row(get_friends_list_row_data(*entry));
255 if(find_widget<label>(row_grid,
"friend_name",
false).get_label() == entry->get_nick()) {
257 list.
add_row(get_friends_list_row_data(*entry),
i);
264 update_friends_list_controls(list);
271 std::map<std::string, acquaintance>::const_iterator who =
get_acquaintances().begin();
272 std::advance(who, selected_row);
274 const std::string to_remove = !textbox.
text().empty() ? textbox.
text() : who->second.get_nick();
276 if(to_remove.empty()) {
288 listbox& list = find_widget<listbox>(get_window(),
"friends_list",
false);
291 update_friends_list_controls(list);
294 template<
bool(*toggle_getter)(),
bool(*toggle_setter)(
bool),
int(*vol_getter)(),
void(*vol_setter)(
int)>
297 const std::string toggle_widget_id =
"sound_toggle_" + id_suffix;
298 const std::string volume_widget_id =
"sound_volume_" + id_suffix;
307 register_bool(toggle_widget_id,
true, toggle_getter, std::bind(toggle_setter, std::placeholders::_1),
308 std::bind(sound_toggle_on_change<toggle_setter>, std::ref(window), volume_widget_id, std::placeholders::_1),
true);
313 register_integer(volume_widget_id,
true, vol_getter, vol_setter);
317 std::bind(volume_setter_on_change<vol_setter>, std::placeholders::_1));
323 slider& ps_slider = find_widget<slider>(get_window(),
"pixel_scale_slider",
false);
328 find_widget<toggle_button>(get_window(),
"auto_pixel_scale",
false);
346 register_integer(
"scroll_speed",
true,
352 const auto accl_load = [
this]()->
int {
353 return std::distance(accl_speeds_.begin(), std::find(accl_speeds_.begin(), accl_speeds_.end(),
turbo_speed()));
356 const auto accl_save = [
this](
int i) {
360 register_integer(
"turbo_slider",
true,
361 accl_load, accl_save);
364 find_widget<slider>(&window,
"turbo_slider",
false).set_value_labels(
365 [
this](
int pos,
int )->t_string {
return lexical_cast<std::string>(accl_speeds_[pos]); }
369 register_bool(
"skip_ai_moves",
true,
373 register_bool(
"disable_auto_moves",
true,
377 register_bool(
"show_turn_dialog",
true,
381 register_bool(
"whiteboard_on_start",
true,
385 register_bool(
"whiteboard_hide_allies",
true,
389 register_bool(
"interrupt_move_when_ally_sighted",
true,
393 register_bool(
"save_replays",
true,
397 register_bool(
"delete_saves",
true,
401 register_integer(
"max_saves_slider",
true,
406 std::bind(&gui2::dialogs::game_cache_options::display<>));
414 find_widget<toggle_button>(&window,
"fullscreen",
false);
423 menu_button& res_list = find_widget<menu_button>(&window,
"resolution_set",
false);
428 set_resolution_list(res_list);
434 register_integer(
"pixel_scale_slider",
true,
438 find_widget<slider>(&window,
"pixel_scale_slider",
false);
443 register_bool(
"auto_pixel_scale",
true,
445 [&](
widget&
w) { disable_widget_on_toggle_inverted<slider>(window,
w,
"pixel_scale_slider"); },
true);
448 find_widget<toggle_button>(get_window(),
"auto_pixel_scale",
false);
453 register_bool(
"show_floating_labels",
true,
457 register_bool(
"show_ellipses",
true,
461 register_bool(
"show_grid",
true,
466 [&](
widget& w) { disable_widget_on_toggle<toggle_button>(window,
w,
"animate_water"); },
true);
469 register_bool(
"animate_water",
true,
473 register_bool(
"animate_units_standing",
true,
478 [&](
widget& w) { disable_widget_on_toggle<slider>(window,
w,
"idle_anim_frequency"); });
480 register_integer(
"idle_anim_frequency",
true,
488 register_bool(
"fps_limiter",
true,
499 find_widget<button>(&window,
"choose_theme",
false),
507 initialize_sound_option_group<sound_on, set_sound, sound_volume, set_sound_volume>(
"sfx");
510 initialize_sound_option_group<music_on, set_music, music_volume, set_music_volume>(
"music");
512 register_bool(
"sound_toggle_stop_music_in_background",
true,
516 initialize_sound_option_group<turn_bell, set_turn_bell, bell_volume, set_bell_volume>(
"bell");
519 initialize_sound_option_group<UI_sound_on, set_UI_sound, UI_volume, set_UI_volume>(
"uisfx");
526 register_integer(
"chat_lines",
true,
530 register_bool(
"chat_timestamps",
true,
534 register_bool(
"remember_password",
true,
538 register_bool(
"lobby_whisper_friends_only",
true,
542 lobby_joins_group.add_member(find_widget<toggle_button>(&window,
"lobby_joins_none",
false,
true), lobby_joins::show_none);
543 lobby_joins_group.add_member(find_widget<toggle_button>(&window,
"lobby_joins_friends",
false,
true), lobby_joins::show_friends);
544 lobby_joins_group.add_member(find_widget<toggle_button>(&window,
"lobby_joins_all",
false,
true), lobby_joins::show_all);
548 lobby_joins_group.set_callback_on_value_change([&](
widget&,
const lobby_joins val) {
553 listbox& friends_list = find_widget<listbox>(&window,
"friends_list",
false);
555 friends_list.
clear();
558 friends_list.
add_row(get_friends_list_row_data(entry.second));
561 update_friends_list_controls(friends_list);
563 text_box& textbox = find_widget<text_box>(&window,
"friend_name_box",
false);
566 find_widget<button>(&window,
"add_friend",
false), std::bind(
572 find_widget<button>(&window,
"add_ignored",
false), std::bind(
578 find_widget<button>(&window,
"remove",
false), std::bind(
581 std::ref(friends_list),
587 std::ref(friends_list),
592 find_widget<button>(&window,
"mp_alerts",
false),
593 std::bind(&gui2::dialogs::mp_alerts_options::display<>));
597 find_widget<button>(&window,
"mp_wesnothd",
false), std::bind(
605 listbox& advanced = find_widget<listbox>(&window,
"advanced_prefs",
false);
607 std::map<std::string, string_map> row_data;
609 for(
const auto& option : adv_preferences_) {
610 const std::string& pref_name = option.field;
612 row_data[
"pref_name"][
"label"] = option.name;
615 grid& details_grid = find_widget<grid>(main_grid,
"prefs_setter_grid",
false);
619 toggle_button& toggle_box = find_widget<toggle_button>(main_grid,
"value_toggle",
false);
622 if(!option.description.empty()) {
623 find_widget<styled_widget>(main_grid,
"description",
false).set_label(option.description);
626 switch(option.type) {
631 toggle_box.
set_value(
get(pref_name, option.cfg[
"default"].to_bool()));
639 gui2::bind_status_label<toggle_button>(
640 main_grid,
"value_toggle", default_status_value_getter<toggle_button>,
"value");
646 auto setter_widget = build_single_widget_instance<slider>(
config {
"definition",
"minimal"});
647 setter_widget->set_id(
"setter");
649 setter_widget->set_value_range(option.cfg[
"min"].to_int(), option.cfg[
"max"].to_int());
650 setter_widget->set_step_size(option.cfg[
"step"].to_int(1));
652 details_grid.
swap_child(
"setter", std::move(setter_widget),
true);
654 slider& slide = find_widget<slider>(&details_grid,
"setter",
false);
656 slide.
set_value(lexical_cast_default<int>(
get(pref_name), option.cfg[
"default"].to_int()));
661 [&, pref_name]() {
set(pref_name, slide.
get_value()); }
664 gui2::bind_status_label<slider>(main_grid,
"setter", default_status_value_getter<slider>,
"value");
670 std::vector<config> menu_data;
671 std::vector<std::string> option_ids;
675 menu_item[
"label"] = choice[
"name"];
676 if(choice.has_attribute(
"description")) {
677 menu_item[
"details"] = std::string(
"<span color='#777'>") + choice[
"description"] +
"</span>";
679 menu_data.push_back(menu_item);
680 option_ids.push_back(choice[
"id"]);
684 int selected = std::distance(option_ids.begin(), std::find(option_ids.begin(), option_ids.end(),
685 get(pref_name, option.cfg[
"default"].str())
689 if(selected < 0 || selected >= static_cast<int>(option_ids.size())) {
693 auto setter_widget = build_single_widget_instance<menu_button>();
694 setter_widget->set_id(
"setter");
696 details_grid.
swap_child(
"setter", std::move(setter_widget),
true);
698 menu_button& menu = find_widget<menu_button>(&details_grid,
"setter",
false);
706 std::bind([=](
widget& w) {
set(pref_name, option_ids[
dynamic_cast<menu_button&
>(
w).get_value()]); }, std::placeholders::_1));
708 gui2::bind_status_label<menu_button>(main_grid,
"setter", default_status_value_getter<menu_button>,
"value");
716 auto value_widget = build_single_widget_instance<image>();
717 value_widget->set_label(
"icons/arrows/arrows_blank_right_25.png~CROP(3,3,18,18)");
719 main_grid->swap_child(
"value", std::move(value_widget),
true);
729 std::ref(advanced)));
731 on_advanced_prefs_list_select(advanced);
737 std::vector<config> hotkey_category_entries;
738 for(
const auto& name : cat_names_) {
739 hotkey_category_entries.emplace_back(
"label", name.second,
"checkbox",
false);
742 multimenu_button& hotkey_menu = find_widget<multimenu_button>(&window,
"hotkey_category_menu",
false);
744 hotkey_menu.
set_values(hotkey_category_entries);
751 text_box& filter = find_widget<text_box>(&window,
"filter",
false);
768 find_widget<button>(&window,
"btn_add_hotkey",
false), std::bind(
771 std::ref(hotkey_list)));
774 find_widget<button>(&window,
"btn_clear_hotkey",
false), std::bind(
777 std::ref(hotkey_list)));
780 find_widget<button>(&window,
"btn_reset_hotkeys",
false), std::bind(
787 const std::string& default_icon =
"misc/empty.png~CROP(0,0,15,15)";
789 std::map<std::string, string_map> row_data;
791 t_string& row_icon = row_data[
"img_icon"][
"label"];
792 t_string& row_action = row_data[
"lbl_desc"][
"label"];
793 t_string& row_hotkey = row_data[
"lbl_hotkey"][
"label"];
795 t_string& row_is_g = row_data[
"lbl_is_game"][
"label"];
796 t_string& row_is_g_markup = row_data[
"lbl_is_game"][
"use_markup"];
797 t_string& row_is_e = row_data[
"lbl_is_editor"][
"label"];
798 t_string& row_is_e_markup = row_data[
"lbl_is_editor"][
"use_markup"];
799 t_string& row_is_m = row_data[
"lbl_is_mainmenu"][
"label"];
800 t_string& row_is_m_markup = row_data[
"lbl_is_mainmenu"][
"use_markup"];
805 visible_hotkeys_.clear();
808 std::string text_game_feature_on =
"<span color='#0f0'>" +
_(
"game_hotkeys^G") +
"</span>";
809 std::string text_editor_feature_on =
"<span color='#0f0'>" +
_(
"editor_hotkeys^E") +
"</span>";
810 std::string text_mainmenu_feature_on =
"<span color='#0f0'>" +
_(
"mainmenu_hotkeys^M") +
"</span>";
813 if(hotkey_item.hidden) {
816 visible_hotkeys_.push_back(&hotkey_item);
819 row_icon =
"icons/action/" + hotkey_item.command +
"_25.png~CROP(3,3,18,18)";
821 row_icon = default_icon;
824 row_action = hotkey_item.description;
828 row_is_g_markup =
"true";
830 row_is_e_markup =
"true";
832 row_is_m_markup =
"true";
857 if(newhk.get() ==
nullptr) {
862 if(!hk->is_disabled() && newhk->bindings_equal(hk)) {
870 if(oldhk && oldhk->get_command() == hotkey_item.
command) {
874 if(oldhk && oldhk->get_command() !=
"null") {
875 const std::string text =
VGETTEXT(
"“<b>$hotkey_sequence|</b>” is in use by “<b>$old_hotkey_action|</b>”.\nDo you wish to reassign it to “<b>$new_hotkey_action|</b>”?", {
876 {
"hotkey_sequence", oldhk->get_name()},
899 std::string(),
false,
false,
true);
907 find_widget<multimenu_button>(get_window(),
"hotkey_category_menu",
false).reset_toggle_states();
925 const multimenu_button& hotkey_menu = find_widget<const multimenu_button>(get_window(),
"hotkey_category_menu",
false);
926 const text_box& name_filter = find_widget<const text_box>(get_window(),
"filter",
false);
929 boost::dynamic_bitset<> res(visible_hotkeys_.size());
931 std::string text = name_filter.get_value();
933 if(toggle_states.none()) {
935 toggle_states = ~toggle_states;
938 for(std::size_t
h = 0;
h < visible_hotkeys_.size(); ++
h) {
941 const std::string description = visible_hotkeys_[
h]->description.str();
956 for(
const auto& name : cat_names_) {
957 if(visible_hotkeys_[
h]->category == name.first) {
964 if(index < toggle_states.size() && found) {
965 res[
h] = toggle_states[
index];
971 find_widget<listbox>(get_window(),
"list_hotkeys",
false).set_row_shown(res);
977 const auto& pref = adv_preferences_[selected_row];
980 if(pref.field ==
"logging") {
981 gui2::dialogs::log_settings::display();
982 }
else if(pref.field ==
"orb_color") {
983 gui2::dialogs::select_orb_colors::display();
985 WRN_GUI_L <<
"Invalid or unimplemented custom advanced prefs option: " << pref.field <<
"\n";
991 const bool has_description = !pref.description.empty();
994 find_widget<widget>(list.
get_row_grid(selected_row),
"prefs_setter_grid",
false)
998 if(last_selected_item_ != selected_row) {
999 find_widget<widget>(list.
get_row_grid(last_selected_item_),
"prefs_setter_grid",
false)
1002 last_selected_item_ = selected_row;
1017 set_always_save_fields(
true);
1027 gui2::bind_status_label<slider>(&window,
"max_saves_slider");
1028 gui2::bind_status_label<slider>(&window,
"turbo_slider");
1029 gui2::bind_status_label<slider>(&window,
"pixel_scale_slider");
1035 listbox& selector = find_widget<listbox>(&window,
"selector",
false);
1036 stacked_widget& pager = find_widget<stacked_widget>(&window,
"pager",
false);
1043 window.keyboard_capture(&selector);
1045 VALIDATE(selector.get_item_count() == pager.get_layer_count(),
1046 "The preferences pager and its selector listbox do not have the same number of items.");
1048 const int main_index = index_in_pager_range(initial_index_.first, pager);
1053 for(
unsigned int i = 0;
i < pager.get_layer_count(); ++
i) {
1054 listbox* tab_selector = find_widget<listbox>(
1055 pager.get_layer_grid(
i),
"tab_selector",
false,
false);
1058 pager.get_layer_grid(
i),
"tab_pager",
false,
false);
1060 if(tab_pager && tab_selector) {
1061 const int ii =
static_cast<int>(
i);
1062 const int tab_index = index_in_pager_range(initial_index_.second, *tab_pager);
1063 const int to_select = (ii == main_index ? tab_index : 0);
1066 initialize_tabs(*tab_selector);
1069 tab_pager->select_layer(to_select);
1074 selector.select_row(main_index);
1075 pager.select_layer(main_index);
1080 find_widget<stacked_widget>(get_window(), pager_id,
false).select_layer(page);
1086 const bool ison = find_widget<toggle_button>(get_window(),
"fullscreen",
false).get_value_bool();
1089 menu_button& res_list = find_widget<menu_button>(get_window(),
"resolution_set",
false);
1091 set_resolution_list(res_list);
1097 menu_button& res_list = find_widget<menu_button>(get_window(),
"resolution_set",
false);
1100 set_resolution_list(res_list);
1106 const int selected_row =
1107 std::max(0, find_widget<listbox>(get_window(),
"selector",
false).get_selected_row());
1108 set_visible_page(static_cast<unsigned int>(selected_row),
"pager");
1113 const int selected_row =
1114 std::max(0, find_widget<listbox>(get_window(),
"tab_selector",
false).get_selected_row());
1115 set_visible_page(static_cast<unsigned int>(selected_row),
"tab_pager");
bool disable_auto_moves()
void set_turbo(bool ison)
void set_active_sorting_option(const order_pair &sort_by, const bool select_first=false)
Sorts the listbox by a pre-set sorting option.
#define REGISTER_DIALOG(window_id)
Wrapper for REGISTER_DIALOG2.
void set_hide_whiteboard(bool value)
const advanced_pref_list & get_advanced_preferences()
Gets a list of the available advanced preferences.
void set_text_changed_callback(std::function< void(text_box_base *textbox, const std::string text)> cb)
Set the text_changed callback.
void show_message(const std::string &title, const std::string &msg, const std::string &button_caption, const bool auto_close, const bool message_use_markup, const bool title_use_markup)
Shows a message to the user.
point current_resolution()
void set_show_standing_animations(bool value)
void default_hotkey_callback()
void save_hotkeys(config &cfg)
Save the non-default hotkeys to the config.
void connect_signal_mouse_left_click(dispatcher &dispatcher, const signal &signal)
Connects a signal handler for a left mouse button click.
void set_remember_password(bool remember)
void set_show_floating_labels(bool value)
bool get_value_bool() const
New lexcical_cast header.
void show_wesnothd_server_search()
void set_scroll_speed(const int new_speed)
static bool file_exists(const bfs::path &fpath)
const std::map< std::string, acquaintance > & get_acquaintances()
void set_idle_anim_rate(const int rate)
child_itors child_range(config_key_type key)
void set_show_side_colors(bool value)
void show_transient_message(const std::string &title, const std::string &message, const std::string &image, const bool message_use_markup, const bool title_use_markup, const bool restore_background)
Shows a transient message to the user.
void clear_hotkeys(const std::string &command)
Unset the command bindings for all hotkeys matching the command.
void set_chat_lines(int lines)
Stores all information related to functions that can be bound to hotkeys.
void register_translatable_sorting_option(const int col, translatable_sorter_func_t f)
Registers a special sorting function specifically for translatable values.
hotkey::hotkey_ptr get_new_binding() const
static CVideo & get_singleton()
int get_selected_row() const
Returns the first selected row.
static std::string _(const char *str)
std::list< HOTKEY_COMMAND > get_hotkeys_by_category(HOTKEY_CATEGORY category)
Returns a list of all the hotkeys belonging to the given category.
To lexical_cast(From value)
Lexical cast converts one type to another.
bool show(const unsigned auto_close_time=0)
Shows the window.
bool remove_acquaintance(const std::string &nick)
void set_interrupt_when_ally_sighted(bool value)
void remove_friend_list_entry(listbox &friends_list, text_box &textbox)
void set_active_scopes(hk_scopes s)
bool whisper_friends_only()
bool select_row(const unsigned row, const bool select=true)
Selects a row.
Class for a single line text area.
const hotkey_list & get_hotkeys()
Returns the list of hotkeys.
bool set_resolution(const unsigned width, const unsigned height)
std::string get_names(const std::string &id)
Returns a comma-separated string of hotkey names.
void on_friends_list_select(listbox &list, text_box &textbox)
void set_turn_dialog(bool ison)
void set_save_replays(bool value)
bool is_friend(const std::string &nick)
#define VALIDATE(cond, message)
The macro to use for the validation of WML.
void connect_signal_mouse_left_release(dispatcher &dispatcher, const signal &signal)
Connects a signal handler for a left mouse button release.
This file contains the settings handling of the widget library.
const std::string & get_nick() const
void clear()
Removes all the rows in the listbox, clearing it.
void _set_lobby_joins(lobby_joins show)
std::pair< preferences::acquaintance *, bool > add_acquaintance(const std::string &nick, const std::string &mode, const std::string ¬es)
void set_enable_whiteboard_mode_on_start(bool value)
const std::string unicode_multiplication_sign
void set_vsync(bool ison)
std::map< std::string, string_map > get_friends_list_row_data(const preferences::acquaintance &entry)
Modify, read and display user preferences.
Shows a yes and no button.
unsigned get_item_count() const
Returns the number of items in the listbox.
void add_hotkey(const hotkey_ptr item)
Add a hotkey to the list of hotkeys.
void fullscreen_toggle_callback()
void add_friend_list_entry(const bool is_friend, text_box &textbox)
void initialize_tabs(listbox &selector)
Initializers.
void set_stop_music_in_background(bool ison)
bool show_standing_animations()
void set_idle_anim(const bool ison)
void set_animate_map(bool value)
std::vector< hotkey::hotkey_ptr > hotkey_list
hk_scopes scope
The visibility scope of the command.
void set_chat_timestamping(bool value)
void set_draw_delay(int value)
bool ci_search(const std::string &s1, const std::string &s2)
void update_friends_list_controls(listbox &list)
std::string id
Text to match against addon_info.tags()
void set_visible_page(unsigned int page, const std::string &pager_id)
const category_name_map_t & get_category_names()
Returns the map of hotkey categories and their display names.
const std::vector< hotkey_command > & get_hotkey_commands()
returns a container that contains all currently active hotkey_commands.
std::string command
The command is unique.
bool interrupt_when_ally_sighted()
void hotkey_filter_callback() const
bool stop_music_in_background()
void set_delete_saves(bool value)
void initialize_sound_option_group(const std::string &id_suffix)
void add_hotkey_callback(listbox &hotkeys)
void update_buffers()
Update buffers to match current resolution and pixel scale settings.
void set_fullscreen(bool ison)
grid & add_row(const string_map &item, const int index=-1)
When an item in the list is selected by the user we need to update the state.
void set_whisper_friends_only(bool v)
Declarations for File-IO.
void set_turbo_speed(const double speed)
std::shared_ptr< hotkey_base > hotkey_ptr
const std::string & get_status() const
std::size_t index(const std::string &str, const std::size_t index)
Codepoint index corresponding to the nth character in a UTF-8 string.
virtual int get_value() const override
Inherited from integer_selector.
const std::string & get_notes() const
const std::string & get_description(const std::string &command)
void set_autosavemax(int value)
const grid * get_row_grid(const unsigned row) const
Returns the grid of the wanted row.
static std::map< PREFERENCE_VIEW, std::pair< int, int > > pef_view_map
Map containing page mappings that can be used to set the initially displayed page of the dialog...
virtual void set_value(const std::string &text)
The set_value is virtual for the password_box class.
void show_transient_error_message(const std::string &message, const std::string &image, const bool message_use_markup)
Shows a transient error message to the user.
void handle_res_select()
Special callback functions.
bool show_floating_labels()
lobby_joins get_lobby_joins()
std::vector< std::string > split(const config_attribute_value &val)
const std::string & text() const
virtual void post_show(window &) override
Actions to be taken after the window has been shown.
A slider is a control that can select a value by moving a grip on a groove.
bool enable_whiteboard_mode_on_start()
Functions to load and save images from/to disk.
virtual void set_value(int value) override
Inherited from integer_selector.
void remove_row(const unsigned row, unsigned count=1)
Removes a row in the listbox.
std::unique_ptr< widget > swap_child(const std::string &id, std::unique_ptr< widget > w, const bool recurse, widget *new_parent=nullptr)
Exchanges a child in the grid.
Dialog was closed with the OK button.
void set_pixel_scale(const int scale)
void on_page_select()
Callback for selection changes.
void register_sorting_option(const int col, const Func &f)
A config object defines a single node in a WML file, with access to child nodes.
virtual void pre_show(window &window) override
Actions to be taken before showing the window.
void set_skip_ai_moves(bool value)
void set_animate_water(bool value)
void remove_hotkey_callback(listbox &hotkeys)
base class of top level items, the only item which needs to store the final canvases to draw on...
std::vector< point > get_available_resolutions(const bool include_current=false)
Returns the list of available screen resolutions.
listbox & setup_hotkey_list()
virtual void post_build(window &window) override
Sets up states and callbacks for each of the widgets.
void connect_signal_notify_modified(dispatcher &dispatcher, const signal_notification &signal)
Connects a signal handler for getting a notification upon modification.
std::pair< std::string, unsigned > item
void set_resolution_list(menu_button &res_list)
void on_advanced_prefs_list_select(listbox &tree)
void set_auto_pixel_scale(bool choice)
void set_disable_auto_moves(bool value)