00001 /* $Id: 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/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/button.hpp" 00024 00025 namespace gui2 { 00026 00027 namespace implementation { 00028 00029 tbuilder_button::tbuilder_button(const config& cfg) 00030 : tbuilder_control(cfg) 00031 , retval_id_(cfg["return_value_id"]) 00032 , retval_(cfg["return_value"]) 00033 { 00034 } 00035 00036 twidget* tbuilder_button::build() const 00037 { 00038 tbutton* widget = new tbutton(); 00039 00040 init_control(widget); 00041 00042 widget->set_retval(get_retval(retval_id_, retval_, id)); 00043 00044 DBG_GUI_G << "Window builder: placed button '" 00045 << id << "' with definition '" 00046 << definition << "'.\n"; 00047 00048 return widget; 00049 } 00050 00051 } // namespace implementation 00052 00053 } // namespace gui2 00054 00055 /*WIKI_MACRO 00056 * @begin{macro}{button_description} 00057 * 00058 * A button is a control that can be pushed to start an action or close 00059 * a dialog. 00060 * @end{macro} 00061 */ 00062 00063 /*WIKI 00064 * @page = GUIWidgetInstanceWML 00065 * @order = 2_button 00066 * @begin{parent}{name="gui/window/resolution/grid/row/column/"} 00067 * @begin{tag}{name="button"}{min=0}{max=-1}{super="generic/widget_instance"} 00068 * == Button == 00069 * 00070 * @macro = button_description 00071 * 00072 * Instance of a button. When a button has a return value it sets the 00073 * return value for the window. Normally this closes the window and returns 00074 * this value to the caller. The return value can either be defined by the 00075 * user or determined from the id of the button. The return value has a 00076 * higher precedence as the one defined by the id. (Of course it's weird to 00077 * give a button an id and then override its return value.) 00078 * 00079 * When the button doesn't have a standard id, but you still want to use the 00080 * return value of that id, use return_value_id instead. This has a higher 00081 * precedence as return_value. 00082 * 00083 * List with the button specific variables: 00084 * @begin{table}{config} 00085 * return_value_id & string & "" & The return value id. $ 00086 * return_value & int & 0 & The return value. $ 00087 * 00088 * @end{table} 00089 * @end{tag}{name="button"} 00090 * @end{parent}{name="gui/window/resolution/grid/row/column/"} 00091 */ 00092
| Generated by doxygen 1.7.1 on Fri May 25 2012 01:02:54 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |