00001 /* $Id: text_box.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/text_box.hpp" 00019 00020 #include "config.hpp" 00021 #include "gui/auxiliary/log.hpp" 00022 #include "gui/widgets/text_box.hpp" 00023 00024 namespace gui2 { 00025 00026 namespace implementation { 00027 00028 tbuilder_text_box::tbuilder_text_box(const config& cfg) 00029 : tbuilder_control(cfg) 00030 , history(cfg["history"]) 00031 { 00032 } 00033 00034 twidget* tbuilder_text_box::build() const 00035 { 00036 ttext_box* widget = new ttext_box(); 00037 00038 init_control(widget); 00039 00040 // A textbox doesn't have a label but a text 00041 widget->set_value(label); 00042 00043 if (!history.empty()) { 00044 widget->set_history(history); 00045 } 00046 00047 DBG_GUI_G << "Window builder: placed text box '" 00048 << id << "' with definition '" 00049 << definition << "'.\n"; 00050 00051 return widget; 00052 } 00053 00054 } // namespace implementation 00055 00056 } // namespace gui2 00057 00058 /*WIKI 00059 * @page = GUIWidgetInstanceWML 00060 * @order = 2_text_box 00061 * 00062 * == Text box == 00063 * @begin{parent}{name="gui/window/resolution/grid/row/column/"} 00064 * @begin{tag}{name="text_box"}{min="0"}{max="-1"}{super="generic/widget_instance"} 00065 * @begin{table}{config} 00066 * label & t_string & "" & The initial text of the text box. $ 00067 * history & string & "" & The name of the history for the text 00068 * box. 00069 * A history saves the data entered in a 00070 * text box between the games. With the up 00071 * and down arrow it can be accessed. To 00072 * create a new history item just add a 00073 * new unique name for this field and the 00074 * engine will handle the rest. $ 00075 * @end{table} 00076 * @end{tag}{name="text_box"} 00077 * @end{parent}{name="gui/window/resolution/grid/row/column/"} 00078 */ 00079
| Generated by doxygen 1.7.1 on Wed May 23 2012 01:02:42 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |