16 #define GETTEXT_DOMAIN "wesnoth-lib"
47 #ifdef GUI2_EXPERIMENTAL_LISTBOX
65 #include <boost/math/common_factor_rt.hpp>
69 struct advanced_preferences_sorter
71 bool operator()(
const config& lhs,
const config& rhs)
const
73 return lhs[
"name"].t_str().str() < rhs[
"name"].t_str().str();
76 template<hotkey::scope scope,
bool reverse>
77 struct hotkey_sort_by_type
80 bool operator()(
int lhs,
int rhs)
const
82 return reverse ? (*hotkey_commands_)[lhs]->scope[
scope] < (*hotkey_commands_)[rhs]->scope[
scope]
83 : (*hotkey_commands_)[lhs]->scope[
scope] > (*hotkey_commands_)[rhs]->scope[
scope];
87 template<
bool reverse>
88 struct hotkey_sort_by_desc
91 bool operator()(
int lhs,
int rhs)
const
93 return reverse ? (*hotkey_commands_)[lhs]->description.str() < (*hotkey_commands_)[rhs]->description.str()
94 : (*hotkey_commands_)[lhs]->description.str() > (*hotkey_commands_)[rhs]->description.str();
100 return value ?
_(
"yes") :
_(
"no");
113 : resolutions_(video.get_available_resolutions(true))
114 , adv_preferences_cfg_()
116 , last_selected_item_(0)
120 {
"0.25",
"0.5",
"0.75",
"1",
"1.25",
"1.5",
"1.75",
"2",
"3",
"4",
"8",
"16" })
126 adv_preferences_cfg_.push_back(adv);
129 std::sort(adv_preferences_cfg_.begin(), adv_preferences_cfg_.end(),
130 advanced_preferences_sorter());
158 label =
_(
"infinite");
171 std::vector<std::string>
options;
172 for(
const auto&
res : resolutions)
174 std::ostringstream
option;
177 const int div = boost::math::gcd(
res.first,
res.second);
178 const int ratio[2] = {
res.first/div,
res.second/div};
179 if (ratio[0] <= 10 || ratio[1] <= 10) {
180 option <<
" <span color='#777777'>("
181 << ratio[0] <<
':' << ratio[1] <<
")</span>";
184 options.push_back(option.str());
187 const unsigned current_res =
std::find(resolutions.begin(), resolutions.end(),
195 const bool start_value,
196 std::function<
void(
bool)> callback,
201 find_widget<ttoggle_button>(&find_in, widget_id,
false);
207 this,
std::ref(widget), callback, inverted));
213 const bool toggle_start_value,
214 const int slider_state_value,
215 std::function<
void(
bool)> toggle_callback,
216 std::function<
void(
int)> slider_callback,
220 find_widget<ttoggle_button>(&find_in, toggle_widget,
false);
222 find_widget<tslider>(&find_in, slider_widget,
false);
225 slider.set_value(slider_state_value);
226 slider.set_active(toggle_start_value);
241 const int start_value,
242 std::function<
void(
int)> slider_callback,
245 tslider& widget = find_widget<tslider>(&find_in, widget_id,
false);
257 const unsigned start_value,
262 find_widget<tcombobox>(&find_in, widget_id,
false);
265 widget.
set_values(options.first, start_value);
270 callback, options.second));
273 template <
typename T>
277 const int start_value,
279 std::function<
void(
int)> callback,
282 ttoggle_button& button = find_widget<ttoggle_button>(&window, toggle_id,
false);
284 button.
set_value(enum_value == start_value);
289 &tpreferences::toggle_radio_callback<T>,
290 this, group, callback));
293 template <
typename T>
297 tcontrol& label = find_widget<tcontrol>(&find_in, label_id,
false);
300 parent.set_callback_state_change(std::bind(
301 &tpreferences::status_label_callback<T>,
308 tcontrol& label = find_widget<tcontrol>(&find_in, label_id,
false);
312 &tpreferences::status_label_callback<tslider>,
318 tlistbox& friends_list = find_widget<tlistbox>(&window,
"friends_list",
false);
322 std::map<std::string, string_map>
data;
324 find_widget<tbutton>(&window,
"remove",
false).set_active(!acquaintances.empty());
326 friends_list.
clear();
327 friend_names_.clear();
329 if (acquaintances.empty()) {
330 data[
"friend_icon"][
"label"] =
"misc/status-neutral.png";
331 data[
"friend_name"][
"label"] =
_(
"Empty list");
337 for(
const auto& acquaintence : acquaintances)
343 if(acquaintence.second.get_status() ==
"ignore") {
344 image =
"ignore.png";
345 descriptor =
_(
"ignored");
348 if(!acquaintence.second.get_notes().empty()) {
349 notes =
" <small>(" + acquaintence.second.get_notes() +
")</small>";
352 data[
"friend_icon"][
"label"] =
"misc/status-" +
image;
354 data[
"friend_name"][
"label"] = acquaintence.second.get_nick() + notes;
355 data[
"friend_name"][
"use_markup"] =
"true";
357 data[
"friend_status"][
"label"] =
"<small>" + descriptor +
"</small>";
358 data[
"friend_status"][
"use_markup"] =
"true";
361 friend_names_.push_back(acquaintence.first);
370 size_t pos = username.find_first_of(
' ');
372 if (pos != std::string::npos) {
373 reason = username.substr(pos + 1);
374 username = username.substr(0, pos);
377 const bool added_sucessfully = is_friend ?
381 if (!added_sucessfully) {
388 setup_friends_list(window);
396 if(sel < 0 || sel >= num_available) {
399 std::map<std::string, acquaintance>::const_iterator who =
get_acquaintances().begin();
400 std::advance(who, sel);
401 textbox.
set_value(who->second.get_nick() +
" " + who->second.get_notes());
409 if (to_remove.empty()) {
411 to_remove = friend_names_[selected_row];
420 setup_friends_list(window);
427 return dynamic_cast<tgrid*
>(
441 setup_single_slider(
"scroll_speed",
446 find_widget<ttoggle_button>(&window,
"turbo_toggle",
false);
448 find_widget<tslider>(&window,
"turbo_slider",
false);
452 - (accl_speeds_.begin());
454 accl_slider.set_value_labels(accl_speeds_);
456 const bool is_turbo =
turbo();
459 accl_slider.set_value(selected_speed + 1);
460 accl_slider.set_active(is_turbo);
472 bind_status_label(accl_slider,
"turbo_value", window);
475 setup_single_toggle(
"skip_ai_moves",
479 setup_single_toggle(
"disable_auto_moves",
483 setup_single_toggle(
"show_turn_dialog",
487 setup_single_toggle(
"whiteboard_on_start",
491 setup_single_toggle(
"whiteboard_hide_allies",
495 setup_single_toggle(
"interrupt_move_when_ally_sighted",
499 setup_single_toggle(
"save_replays",
503 setup_single_toggle(
"delete_saves",
507 tslider& autosaves_slider = find_widget<tslider>(&window,
"max_saves_slider",
false);
508 tcontrol& autosaves_label = find_widget<tcontrol>(&window,
"max_saves_value",
false);
513 autosaves_label.set_use_markup(
true);
530 find_widget<ttoggle_button>(&window,
"fullscreen",
false);
540 tcombobox& res_list = find_widget<tcombobox>(&window,
"resolution_set",
false);
551 setup_single_toggle(
"show_floating_labels",
555 setup_single_toggle(
"show_halos",
559 setup_single_toggle(
"show_ellipses",
563 setup_single_toggle(
"show_grid",
568 find_widget<ttoggle_button>(&window,
"animate_terrains",
false);
571 find_widget<ttoggle_button>(&window,
"animate_water",
false);
574 animate_water_toggle.set_active(animate_map_toggle.
get_value_bool());
581 setup_single_toggle(
"animate_water",
585 setup_single_toggle(
"animate_units_standing",
589 setup_toggle_slider_pair(
"animate_units_idle",
"idle_anim_frequency",
594 tslider& scale_slider = find_widget<tslider>(&window,
"scaling_slider",
false);
602 bind_status_label(scale_slider,
"scaling_value", window,
"%");
606 find_widget<tbutton>(&window,
"choose_theme",
false),
616 setup_toggle_slider_pair(
"sound_toggle_sfx",
"sound_volume_sfx",
621 setup_toggle_slider_pair(
"sound_toggle_music",
"sound_volume_music",
626 setup_toggle_slider_pair(
"sound_toggle_bell",
"sound_volume_bell",
631 setup_toggle_slider_pair(
"sound_toggle_uisfx",
"sound_volume_uisfx",
641 setup_single_slider(
"chat_lines",
645 setup_single_toggle(
"chat_timestamps",
649 setup_single_toggle(
"remember_password",
653 setup_single_toggle(
"lobby_sort_players",
657 setup_single_toggle(
"lobby_player_icons",
661 setup_single_toggle(
"lobby_whisper_friends_only",
665 setup_radio_toggle(
"lobby_joins_none",
SHOW_NONE,
669 setup_radio_toggle(
"lobby_joins_all",
SHOW_ALL,
673 setup_friends_list(window);
675 ttext_box& textbox = find_widget<ttext_box>(&window,
"friend_name_box",
false);
676 tlistbox& friend_list = find_widget<tlistbox>(&window,
"friends_list",
false);
679 find_widget<tbutton>(&window,
"add_friend",
false), std::bind(
686 find_widget<tbutton>(&window,
"add_ignored",
false), std::bind(
693 find_widget<tbutton>(&window,
"remove",
false), std::bind(
700 friend_list.set_callback_value_change(std::bind(
706 friend_list.select_row(0);
710 find_widget<tbutton>(&window,
"mp_alerts",
false),
716 find_widget<tbutton>(&window,
"mp_wesnothd",
false), std::bind(
725 tlistbox& advanced = find_widget<tlistbox>(&window,
"advanced_prefs",
false);
727 std::map<std::string, string_map> row_data;
732 const ADVANCED_PREF_TYPE& pref_type = ADVANCED_PREF_TYPE::string_to_enum(
736 row_data[
"pref_name"][
"label"] =
option[
"name"];
737 advanced.add_row(row_data);
739 const int this_row = advanced.get_item_count() - 1;
745 tgrid* details_grid = &find_widget<tgrid>(main_grid,
"prefs_setter_grid",
false);
749 ttoggle_button& toggle_box = find_widget<ttoggle_button>(main_grid,
"value_toggle",
false);
752 if(!
option[
"description"].empty()) {
753 find_widget<tcontrol>(main_grid,
"description",
false).
set_label(
option[
"description"]);
756 switch (pref_type.v) {
757 case ADVANCED_PREF_TYPE::TOGGLE: {
766 setup_single_toggle(
"value_toggle",
767 get(pref_name,
option[
"default"].to_bool()),
768 std::bind(set_ptr, pref_name, _1),
771 bind_status_label(toggle_box,
"value", *main_grid);
776 case ADVANCED_PREF_TYPE::SLIDER: {
779 setter_widget->
set_id(
"setter");
786 delete details_grid->
swap_child(
"setter", setter_widget,
true);
792 setup_single_slider(
"setter",
793 lexical_cast_default<int>(
get(pref_name),
option[
"default"].to_int()),
794 std::bind(set_ptr, pref_name, _1),
797 bind_status_label(*setter_widget,
"value", *main_grid);
802 case ADVANCED_PREF_TYPE::COMBO: {
807 combo_options.first.push_back(choice[
"name"]);
808 combo_options.second.push_back(choice[
"id"]);
812 combo_options.second.begin(), combo_options.second.end(),
813 get(pref_name,
option[
"default"].str())) - combo_options.second.begin();
817 setter_widget->
set_id(
"setter");
819 delete details_grid->
swap_child(
"setter", setter_widget,
true);
825 setup_combobox(
"setter",
826 combo_options, selected,
827 std::bind(set_ptr, pref_name, _1),
830 bind_status_label(*setter_widget,
"value", *main_grid);
835 case ADVANCED_PREF_TYPE::SPECIAL: {
838 timage* value_widget =
new timage;
839 value_widget->set_definition(
"default");
840 value_widget->set_label(
"icons/arrows/arrows_blank_right_25.png~CROP(3,3,18,18)");
842 delete main_grid->swap_child(
"value", value_widget,
true);
849 #ifdef GUI2_EXPERIMENTAL_LISTBOX
864 advanced.select_row(0);
872 setup_hotkey_list(window);
876 std::vector<tgenerator_::torder_func> order_funcs(2);
878 order_funcs[0] = hotkey_sort_by_desc<false>(visible_hotkeys_);
879 order_funcs[1] = hotkey_sort_by_desc<true>(visible_hotkeys_);
884 order_funcs[0] = hotkey_sort_by_type<hotkey::SCOPE_GAME, false>(visible_hotkeys_);
885 order_funcs[1] = hotkey_sort_by_type<hotkey::SCOPE_GAME, true>(visible_hotkeys_);
888 order_funcs[0] = hotkey_sort_by_type<hotkey::SCOPE_EDITOR, false>(visible_hotkeys_);
889 order_funcs[1] = hotkey_sort_by_type<hotkey::SCOPE_EDITOR, true>(visible_hotkeys_);
892 order_funcs[0] = hotkey_sort_by_type<hotkey::SCOPE_MAIN_MENU, false>(visible_hotkeys_);
893 order_funcs[1] = hotkey_sort_by_type<hotkey::SCOPE_MAIN_MENU, true>(visible_hotkeys_);
897 find_widget<tbutton>(&window,
"btn_add_hotkey",
false), std::bind(
903 find_widget<tbutton>(&window,
"btn_clear_hotkey",
false), std::bind(
909 find_widget<tbutton>(&window,
"btn_reset_hotkeys",
false), std::bind(
917 const std::string& default_icon =
"misc/empty.png~CROP(0,0,15,15)";
919 std::map<std::string, string_map> row_data;
921 t_string& row_icon = row_data[
"img_icon"][
"label"];
922 t_string& row_action = row_data[
"lbl_desc"][
"label"];
923 t_string& row_hotkey = row_data[
"lbl_hotkey"][
"label"];
925 t_string& row_is_g = row_data[
"lbl_is_game"][
"label"];
926 t_string& row_is_g_markup = row_data[
"lbl_is_game"][
"use_markup"];
927 t_string& row_is_e = row_data[
"lbl_is_editor"][
"label"];
928 t_string& row_is_e_markup = row_data[
"lbl_is_editor"][
"use_markup"];
929 t_string& row_is_t = row_data[
"lbl_is_titlescreen"][
"label"];
930 t_string& row_is_t_markup = row_data[
"lbl_is_titlescreen"][
"use_markup"];
935 visible_hotkeys_.clear();
937 std::string text_feature_on =
"<span color='#0f0'>" +
_(
"●") +
"</span>";
941 if (hotkey_item.hidden) {
944 visible_hotkeys_.push_back(&hotkey_item);
947 row_icon =
"icons/action/" + hotkey_item.command +
"_25.png~CROP(3,3,18,18)";
949 row_icon = default_icon;
952 row_action = hotkey_item.description;
956 row_is_g_markup =
"true";
958 row_is_e_markup =
"true";
960 row_is_t_markup =
"true";
975 if (newhk.get() ==
nullptr) {
980 if(!hk->is_disabled() && newhk->bindings_equal(hk)) {
988 if(oldhk && oldhk->get_command() == hotkey_item.
command) {
994 symbols[
"hotkey_sequence"] = oldhk->get_name();
998 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>”?", symbols);
1020 setup_hotkey_list(window);
1035 const ADVANCED_PREF_TYPE& selected_type = ADVANCED_PREF_TYPE::string_to_enum(
1036 adv_preferences_cfg_[selected_row][
"type"].str());
1038 const std::string& selected_field = adv_preferences_cfg_[selected_row][
"field"].str();
1040 if(selected_type == ADVANCED_PREF_TYPE::SPECIAL) {
1041 if (selected_field ==
"advanced_graphic_options") {
1043 }
else if (selected_field ==
"logging") {
1045 }
else if (selected_field ==
"orb_color") {
1048 WRN_GUI_L <<
"Invalid or unimplemented custom advanced prefs option: " << selected_field <<
"\n";
1054 const bool has_description = !adv_preferences_cfg_[selected_row][
"description"].empty();
1056 if(has_description || (selected_type != ADVANCED_PREF_TYPE::SPECIAL && selected_type != ADVANCED_PREF_TYPE::TOGGLE)) {
1061 if(last_selected_item_ != selected_row) {
1065 last_selected_item_ = selected_row;
1071 std::map<std::string, string_map>
data;
1072 data[
"icon"][
"label"] =
"icons/icon-" + icon;
1073 data[
"label"][
"label"] = label;
1079 std::map<std::string, string_map>
data;
1080 data[
"tab_label"][
"label"] = label;
1091 add_tab(selector,
_(
"Prefs tab^General"));
1092 add_tab(selector,
_(
"Prefs tab^Friends"));
1095 #ifdef GUI2_EXPERIMENTAL_LISTBOX
1110 return std::min<int>(std::max(0, first), pager.
get_layer_count() - 1);
1115 tlistbox& selector = find_widget<tlistbox>(&window,
"selector",
false);
1116 tstacked_widget& pager = find_widget<tstacked_widget>(&window,
"pager",
false);
1118 #ifdef GUI2_EXPERIMENTAL_LISTBOX
1127 window.keyboard_capture(&selector);
1129 add_pager_row(selector,
"general.png",
_(
"Prefs section^General"));
1130 add_pager_row(selector,
"hotkeys.png",
_(
"Prefs section^Hotkeys"));
1131 add_pager_row(selector,
"display.png",
_(
"Prefs section^Display"));
1132 add_pager_row(selector,
"music.png",
_(
"Prefs section^Sound"));
1133 add_pager_row(selector,
"multiplayer.png",
_(
"Prefs section^Multiplayer"));
1134 add_pager_row(selector,
"advanced.png",
_(
"Prefs section^Advanced"));
1139 initialize_members(window);
1148 for(
unsigned int i = 0;
i < pager.get_layer_count(); ++
i) {
1149 tlistbox* tab_selector = find_widget<tlistbox>(
1150 pager.get_layer_grid(
i),
"tab_selector",
false,
false);
1153 pager.get_layer_grid(
i),
"tab_pager",
false,
false);
1155 if(tab_pager && tab_selector) {
1156 const int ii =
static_cast<int>(
i);
1158 const int to_select = (ii == main_index ? tab_index : 0);
1161 initialize_tabs(window, *tab_selector, ii);
1164 tab_pager->select_layer(to_select);
1170 pager.select_layer(main_index);
1175 find_widget<tstacked_widget>(&window, pager_id,
false).select_layer(page);
1179 std::function<
void(
bool)> setter,
1180 const bool inverted)
1186 tslider& slider_widget, std::function<
void(
bool)> setter)
1195 std::function<
void(
int)> setter)
1201 std::function<
void(
std::string)> setter, std::vector<std::string>& vec)
1207 template <
typename T>
1218 find_widget<ttoggle_button>(&window,
"fullscreen",
false).get_value_bool();
1219 window.video().set_fullscreen(ison);
1221 tcombobox& res_list = find_widget<tcombobox>(&window,
"resolution_set",
false);
1228 tcombobox& res_list = find_widget<tcombobox>(&window,
"resolution_set",
false);
1229 const int choice = res_list.
get_value();
1231 if (resolutions_[static_cast<size_t>(choice)] == window.video().current_resolution()) {
1235 window.video().set_resolution(resolutions_[static_cast<size_t>(choice)]);
1267 template <
typename T>
1270 std::function<
void(
int)> setter)
1277 const int selected_row =
1278 std::max(0, find_widget<tlistbox>(&window,
"selector",
false).get_selected_row());
1279 set_visible_page(window, static_cast<unsigned int>(selected_row),
"pager");
1284 const int selected_row =
1285 std::max(0, find_widget<tlistbox>(&window,
"tab_selector",
false).get_selected_row());
1286 set_visible_page(window, static_cast<unsigned int>(selected_row),
"tab_pager");
bool disable_auto_moves()
void set_turbo(bool ison)
void raise_resize_event()
child_itors child_range(const std::string &key)
bool set_sound(bool ison)
std::vector< const hotkey::hotkey_command * > t_visible_hotkeys
void set_hide_whiteboard(bool value)
void setup_toggle_slider_pair(const std::string &toggle_widget, const std::string &slider_widget, const bool toggle_start_value, const int slider_state_value, std::function< void(bool)> toggle_callback, std::function< void(int)> slider_callback, twidget &find_in)
Sets the initial state and callback for a bool-state toggle button/slider pair.
void setup_combobox(const std::string &widget_id, const combo_data &options, const unsigned start_value, std::function< void(std::string)> callback, twidget &find_in)
Sets the initial state and callback for a combobox.
void simple_combobox_callback(const tcombobox &widget, std::function< void(std::string)> setter, std::vector< std::string > &vec)
void show_wesnothd_server_search(CVideo &video)
void set_show_haloes(bool value)
GLvoid **typedef void(GLAPIENTRY *PFNGLGETVERTEXATTRIBDVPROC)(GLuint
void set_show_standing_animations(bool value)
void default_hotkey_callback(twindow &window)
void accl_speed_slider_callback(tslider &slider)
static std::string disambiguate_widget_value(const ttoggle_button &parent_widget)
std::pair< int, int > current_resolution()
void save_hotkeys(config &cfg)
Save the non-default hotkeys to the config.
void _set_sort_list(bool sort)
std::pair< std::vector< std::string >, std::vector< std::string > > combo_data
scope
Available hotkey scopes.
void set_remember_password(bool remember)
void set_show_floating_labels(bool value)
void fullscreen_toggle_callback(twindow &window)
void set_scroll_speed(const int new_speed)
void connect_signal_notify_modified(tdispatcher &dispatcher, const tsignal_notification_function &signal)
Connects a signal handler for getting a notification upon modification.
void show_transient_error_message(CVideo &video, const std::string &message, const std::string &image, const bool message_use_markup)
Shows a transient error message to the user.
const std::map< std::string, acquaintance > & get_acquaintances()
const int INFINITE_AUTO_SAVES
void set_show_side_colors(bool value)
std::function< void(twidget &)> make_dialog_callback(dialog_member_func_type func)
bool select_row(const unsigned row, const bool select=true)
Selectes a row.
REGISTER_DIALOG(label_settings)
virtual unsigned get_value() const override
Inherited from tselectable_.
void initialize_members(twindow &window)
Initializers.
void set_minimum_value(const int minimum_value)
Inherited from tinteger_selector_.
GLenum GLsizei GLenum GLenum const GLvoid * image
void clear_hotkeys(const std::string &command)
Unset the command bindings for all hotkeys matching the command.
void _set_lobby_joins(int show)
virtual void set_label(const t_string &label)
void set_chat_lines(int lines)
hotkey_ptr show_binding_dialog(CVideo &video, const std::string &id)
Stores all information related to functions that can be bound to hotkeys.
std::vector< std::pair< int, int > > get_available_resolutions(const bool include_current=false)
Returns the list of available screen resolutions.
void setup_friends_list(twindow &window)
void connect_signal_mouse_left_click(tdispatcher &dispatcher, const tsignal_function &signal)
Connects a signal handler for a left mouse button click.
void set_visible_page(twindow &window, unsigned int page, const std::string &pager_id)
void set(const std::string &key, bool value)
void show_transient_message(CVideo &video, 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 set_maximum_value(const int maximum_value)
Inherited from tinteger_selector_.
void remove_friend_list_entry(tlistbox &friends_list, ttext_box &textbox, twindow &window)
void on_tab_select(twindow &window)
const std::string unicode_multiplication_sign
void set_value(const int value)
Inherited from tinteger_selector_.
Class for a single line text area.
void toggle_radio_callback(tgroup< T > &group, std::function< void(int)> setter)
void set_sound_volume(int vol)
t_string get_value_label() const
Returns the label shown for the current value.
GLint GLenum GLsizei GLint GLsizei const GLvoid * data
bool show_theme_dialog(CVideo &video)
To lexical_cast(From value)
Lexical cast converts one type to another.
static tgrid * get_advanced_row_grid(tlistbox &list, const int selected_row)
bool remove_acquaintance(const std::string &nick)
void set_interrupt_when_ally_sighted(bool value)
virtual void set_value(const std::string &text)
The set_value is virtual for the tpassword_box class.
void bind_status_label(T &parent, const std::string &label_id, twidget &find_in)
Sets up a label that always displays the value of another widget.
void set_active_scopes(hk_scopes s)
void add_friend_list_entry(const bool is_friend, ttext_box &textbox, twindow &window)
void add_hotkey_callback(tlistbox &hotkeys)
bool whisper_friends_only()
void post_show(twindow &)
Actions to be taken after the window has been shown.
void setup_single_toggle(const std::string &widget_id, const bool start_value, std::function< void(bool)> callback, twidget &find_in, const bool inverted=false)
Sets the initial state and callback for a simple bool-state toggle button In the callback, the bool value of the widget is passeed to the setter.
base class of top level items, the only item which needs to store the final canvases to draw on ...
void setup_single_slider(const std::string &widget_id, const int start_value, std::function< void(int)> slider_callback, twidget &find_in)
Sets the initial state and callback for a standalone slider In the callback, int value of the widget ...
A class inherited from ttext_box that displays its input as stars.
const hotkey_list & get_hotkeys()
Returns the list of hotkeys.
void single_toggle_callback(const ttoggle_button &widget, std::function< void(bool)> setter, const bool inverted)
virtual void set_use_markup(bool use_markup)
static void display(CVideo &video)
The display function.
void set_turn_dialog(bool ison)
static UNUSEDNOWARN std::string _(const char *str)
Dialog is closed with ok button.
auto bind_void(F fcn, P...bindings) -> decltype(boost::bind(detail::make_apply(std::function< typename detail::function_base< F >::type >(fcn)), bindings...))
std::map< std::string, t_string > string_map
static void display(CVideo &video)
The display function.
void set_save_replays(bool value)
bool is_friend(const std::string &nick)
void set_idle_anim_rate(int rate)
unsigned get_item_count() const
Returns the number of items in the listbox.
void 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 remove_hotkey_callback(tlistbox &hotkeys)
int get_value() const
Inherited from tinteger_selector_.
bool get_value_bool() const
GLsizei const GLfloat * value
void set_enable_whiteboard_mode_on_start(bool value)
void set_turbo_speed(double speed)
void set_font_scaling(int scale)
void edit_friend_list_entry(tlistbox &friends, ttext_box &textbox)
const boost::ptr_vector< hotkey_command > & get_hotkey_commands()
returns a container that contains all currently active hotkey_commands.
void show_message(CVideo &video, const std::string &title, const std::string &message, const std::string &button_caption, const bool auto_close, const bool message_use_markup)
Shows a message to the user.
void set_music_volume(int vol)
virtual void set_active(const bool active) override
See tcontrol::set_active.
void set_idle_anim(bool ison)
void set_column_order(unsigned col, const std::vector< tgenerator_::torder_func > &func)
Modify, read and display user preferences.
void add_hotkey(const hotkey_ptr item)
Add a hotkey to the list of hotkeys.
void handle_res_select(twindow &window)
Special callback functions.
void single_slider_callback(const tslider &widget, std::function< void(int)> setter)
void set_bell_volume(int vol)
void status_label_callback(T &parent_widget, tcontrol &label_widget, const std::string &suffix="")
bool show_standing_animations()
const hotkey::hk_scopes scope
The visibility scope of the command.
void font_scaling_slider_callback(tslider &slider)
void set_animate_map(bool value)
typedef int(WINAPI *PFNWGLRELEASEPBUFFERDCARBPROC)(HPBUFFERARB hPbuffer
Templates and utility-routines for strings and numbers.
std::vector< hotkey::hotkey_ptr > hotkey_list
static void display(CVideo &video)
The display function.
std::string get_value_string() const
Returns the value of the selected row.
static std::string get_max_autosaves_status_label(const tslider &slider)
void set_chat_timestamping(bool value)
void connect_click_handler(const event::tsignal_function &signal)
Inherited from tclickable.
bool add_friend(const std::string &nick, const std::string ¬es)
bool add_ignore(const std::string &nick, const std::string &reason)
void set_UI_volume(int vol)
void animate_map_toggle_callback(ttoggle_button &toggle, ttoggle_button &toggle_water)
static bool fullscreen(CVideo &video)
bool interrupt_when_ally_sighted()
void set_values(const std::vector< std::string > &values, int selected=0)
const std::string command
The command is unique.
void set_delete_saves(bool value)
void on_advanced_prefs_list_select(tlistbox &tree, twindow &window)
T get_active_member_value()
Returns the value paired with the currently activiely toggled member of the group.
twidget * swap_child(const std::string &id, twidget *widget, const bool recurse, twidget *new_parent=nullptr)
Exchanges a child in the grid.
bool set_UI_sound(bool ison)
void set_whisper_friends_only(bool v)
Declarations for File-IO.
std::string get_names(std::string id)
Returns a comma-separated string of hotkey names.
static int sort(lua_State *L)
static int index_in_pager_range(const int &first, const tstacked_widget &pager)
const std::string & get_description(const std::string &command)
void initialize_tabs(twindow &window, tlistbox &selector, const int index)
Base class for all visible items.
void set_autosavemax(int value)
bool show_floating_labels()
void max_autosaves_slider_callback(tslider &slider, tcontrol &status_label)
void setup_hotkey_list(twindow &window)
void toggle_slider_pair_callback(const ttoggle_button &toggle_widget, tslider &slider_widget, std::function< void(bool)> setter)
void add_tab(tlistbox &tab_bar, const std::string &label)
bool find(E event, F functor)
Tests whether an event handler is available.
bool enable_whiteboard_mode_on_start()
this module manages the cache of images.
bool set_music(bool ison)
void setup_radio_toggle(const std::string &toggle_id, const T &enum_value, const int start_value, tgroup< T > &group, std::function< void(int)> callback, twindow &window)
bool set_turn_bell(bool ison)
void set_show_ai_moves(bool value)
void set_callback_value_change(const std::function< void(twidget &)> &callback)
static void set_label(twindow &window, const std::string &id, const std::string &label)
void add_pager_row(tlistbox &selector, const std::string &icon, const std::string &label)
twidget * find(const std::string &id, const bool must_be_active) override
See twidget::find.
void add_member(tselectable_ *widget, const T &value)
Adds a widget/value pair to the group vector.
void on_page_select(twindow &window)
Callback for selection changes.
void set_definition(const std::string &definition)
Sets the definition.
const std::string & text() const
A config object defines a single node in a WML file, with access to child nodes.
int get_selected_row() const
Returns the first selected row.
void set_animate_water(bool value)
bool file_exists(const std::string &name)
Returns true if a file or directory with such name already exists.
static void set_resolution_list(tcombobox &res_list, CVideo &video)
GLsizei const GLcharARB ** string
static void display(CVideo &video)
The display function.
void dialog_callback(twidget &caller)
Template for dialog callbacks.
void pre_show(twindow &window)
Inherited from tdialog.
Shows a yes and no button.
void clear()
Removes all the rows in the listbox, clearing it.
const tgrid * get_row_grid(const unsigned row) const
Returns the grid of the wanted row.
void invalidate_layout()
Updates the size of the window.
void set_disable_auto_moves(bool value)
static void display(CVideo &video)
The display function.
void _set_iconize_list(bool sort)