Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #define GETTEXT_DOMAIN "wesnoth-lib"
00017
00018 #include "gui/dialogs/mp_method_selection.hpp"
00019
00020 #include "game_preferences.hpp"
00021 #ifdef GUI2_EXPERIMENTAL_LISTBOX
00022 #include "gui/widgets/list.hpp"
00023 #else
00024 #include "gui/widgets/listbox.hpp"
00025 #endif
00026 #include "gui/widgets/window.hpp"
00027 #include "gui/widgets/settings.hpp"
00028 #include "gui/widgets/text_box.hpp"
00029 #include "gui/widgets/toggle_button.hpp"
00030 #include "multiplayer.hpp"
00031
00032 namespace gui2 {
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 REGISTER_DIALOG(mp_method_selection)
00055
00056 void tmp_method_selection::pre_show(CVideo& , twindow& window)
00057 {
00058 user_name_ = preferences::login();
00059 ttext_box* user_widget = find_widget<ttext_box>(
00060 &window, "user_name", false, true);
00061 user_widget->set_value(user_name_);
00062 user_widget->set_maximum_length(mp::max_login_size);
00063 window.keyboard_capture(user_widget);
00064
00065 tlistbox* list = find_widget<tlistbox>(&window, "method_list", false, true);
00066
00067 window.add_to_keyboard_chain(list);
00068 }
00069
00070 void tmp_method_selection::post_show(twindow& window)
00071 {
00072 if(get_retval() == twindow::OK) {
00073 ttext_box& user_widget = find_widget<ttext_box>(
00074 &window, "user_name", false);
00075 tlistbox& list = find_widget<tlistbox>(&window, "method_list", false);
00076
00077 choice_ = list.get_selected_row();
00078
00079 user_widget.save_to_history();
00080 user_name_ = user_widget.get_value();
00081 preferences::set_login(user_name_);
00082 }
00083 }
00084
00085 }