gui/dialogs/addon_connect.cpp

Go to the documentation of this file.
00001 /* $Id: addon_connect.cpp 53567 2012-03-20 07:41:59Z shadowmaster $ */
00002 /*
00003    Copyright (C) 2008 - 2012 by Mark de Wever <koraq@xs4all.nl>
00004    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2 of the License, or
00009    (at your option) any later version.
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY.
00012 
00013    See the COPYING file for more details.
00014 */
00015 
00016 #define GETTEXT_DOMAIN "wesnoth-lib"
00017 
00018 #include "gui/dialogs/addon_connect.hpp"
00019 
00020 #include "gui/widgets/button.hpp"
00021 #include "gui/widgets/window.hpp"
00022 #include "gui/widgets/settings.hpp"
00023 #include "gui/widgets/text_box.hpp"
00024 
00025 namespace gui2 {
00026 
00027 /*WIKI
00028  * @page = GUIWindowDefinitionWML
00029  * @order = 2_addon_connect
00030  *
00031  * == Addon connect ==
00032  *
00033  * This shows the dialog for managing addons and connecting to the addon server.
00034  *
00035  * @begin{table}{dialog_widgets}
00036  * hostname & & text_box & m &
00037  *         This text contains the name of the server to connect to. $
00038  *
00039  * & 2 & button & o &
00040  *         This button closes the dialog to display a dialog for removing installed add-ons. $
00041  *
00042  * @end{table}
00043  */
00044 
00045 REGISTER_DIALOG(addon_connect)
00046 
00047 taddon_connect::taddon_connect(std::string& host_name
00048         , const bool allow_updates
00049         , const bool allow_remove)
00050     : allow_updates_(allow_updates)
00051     , allow_remove_(allow_remove)
00052 {
00053     register_text("host_name", false, host_name, true);
00054 }
00055 
00056 void taddon_connect::pre_show(CVideo& /*video*/, twindow& window)
00057 {
00058     find_widget<tbutton>(&window, "remove_addons", false)
00059             .set_active(allow_remove_);
00060 }
00061 
00062 void taddon_connect::post_show(twindow& window)
00063 {
00064     if(get_retval() == twindow::OK) {
00065         ttext_box& host_widget =
00066                 find_widget<ttext_box>(&window, "host_name", false);
00067 
00068         host_widget.save_to_history();
00069     }
00070 }
00071 
00072 } // namespace gui2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Tue May 22 2012 01:03:50 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs