00001 /* $Id: toggle_button.cpp 52533 2012-01-07 02:35:17Z 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/auxiliary/window_builder/toggle_button.hpp" 00019 00020 #include "config.hpp" 00021 #include "gui/auxiliary/log.hpp" 00022 #include "gui/auxiliary/window_builder/helper.hpp" 00023 #include "gui/widgets/toggle_button.hpp" 00024 00025 namespace gui2 { 00026 00027 namespace implementation { 00028 00029 tbuilder_toggle_button::tbuilder_toggle_button(const config& cfg) 00030 : tbuilder_control(cfg) 00031 , icon_name_(cfg["icon"]) 00032 , retval_id_(cfg["return_value_id"]) 00033 , retval_(cfg["return_value"]) 00034 { 00035 } 00036 00037 twidget* tbuilder_toggle_button::build() const 00038 { 00039 ttoggle_button *widget = new ttoggle_button(); 00040 00041 init_control(widget); 00042 00043 widget->set_icon_name(icon_name_); 00044 widget->set_retval(get_retval(retval_id_, retval_, id)); 00045 00046 DBG_GUI_G << "Window builder: placed toggle button '" 00047 << id << "' with definition '" 00048 << definition << "'.\n"; 00049 00050 return widget; 00051 } 00052 00053 } // namespace implementation 00054 00055 } // namespace gui2 00056 00057 /*WIKI 00058 * @page = GUIToolkitWML 00059 * @order = 2_toggle_button 00060 * @begin{parent}{name="gui/window/resolution/grid/row/column/"} 00061 * @begin{tag}{name="toggle_button"}{min=0}{max=-1}{super="generic/widget_instance"} 00062 * == Toggle button == 00063 * 00064 * @begin{table}{config} 00065 * icon & f_string & "" & The name of the icon file to show. $ 00066 * return_value_id & string & "" & The return value id, see 00067 * [[GUIToolkitWML#Button]] for more 00068 * information. $ 00069 * return_value & int & 0 & The return value, see 00070 * [[GUIToolkitWML#Button]] for more 00071 * information. $ 00072 * @end{table} 00073 * @end{tag}{name="toggle_button"} 00074 * @end{parent}{name="gui/window/resolution/grid/row/column/"} 00075 */ 00076
| Generated by doxygen 1.7.1 on Wed May 23 2012 01:02:42 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |