gui/auxiliary/widget_definition/text_box.cpp

Go to the documentation of this file.
00001 /* $Id: text_box.cpp 52533 2012-01-07 02:35:17Z shadowmaster $ */
00002 /*
00003    Copyright (C) 2007 - 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/widget_definition/text_box.hpp"
00019 
00020 #include "gui/auxiliary/log.hpp"
00021 
00022 namespace gui2 {
00023 
00024 ttext_box_definition::ttext_box_definition(const config& cfg)
00025     : tcontrol_definition(cfg)
00026 {
00027     DBG_GUI_P << "Parsing text_box " << id << '\n';
00028 
00029     load_resolutions<tresolution>(cfg);
00030 }
00031 
00032 ttext_box_definition::tresolution::tresolution(const config& cfg)
00033     : tresolution_definition_(cfg)
00034     , text_x_offset(cfg["text_x_offset"])
00035     , text_y_offset(cfg["text_y_offset"])
00036 {
00037 /*WIKI
00038  * @page = GUIWidgetDefinitionWML
00039  * @order = 1_text_box
00040  *
00041  * == Text box ==
00042  *
00043  * The definition of a text box.
00044  *
00045  * @begin{parent}{name="gui/"}
00046  * @begin{tag}{name="text_box_definition"}{min=0}{max=-1}{super="generic/widget_definition"}
00047  * The resolution for a text box also contains the following keys:
00048  * @begin{tag}{name="resolution"}{min=0}{max=-1}{super=generic/widget_definition/resolution}
00049  * @begin{table}{config}
00050  *     text_x_offset & f_unsigned & "" & The x offset of the text in the text
00051  *                                     box. This is needed for the code to
00052  *                                     determine where in the text the mouse
00053  *                                     clicks, so it can set the cursor
00054  *                                     properly. $
00055  *     text_y_offset & f_unsigned & "" & The y offset of the text in the text
00056  *                                     box. $
00057  * @end{table}
00058  *
00059  * The following states exist:
00060  * * state_enabled, the text box is enabled.
00061  * * state_disabled, the text box is disabled.
00062  * * state_focussed, the text box has the focus of the keyboard.
00063  * @begin{tag}{name="state_enabled"}{min=0}{max=1}{super="generic/state"}
00064  * @end{tag}{name="state_enabled"}
00065  * @begin{tag}{name="state_disabled"}{min=0}{max=1}{super="generic/state"}
00066  * @end{tag}{name="state_disabled"}
00067  * @begin{tag}{name="state_focussed"}{min=0}{max=1}{super="generic/state"}
00068  * @end{tag}{name="state_focussed"}
00069  * @end{tag}{name="resolution"}
00070  * @end{tag}{name="text_box_definition"}
00071  * @end{parent}{name="gui/"}
00072  */
00073     // Note the order should be the same as the enum tstate in text_box.hpp.
00074     state.push_back(tstate_definition(cfg.child("state_enabled")));
00075     state.push_back(tstate_definition(cfg.child("state_disabled")));
00076     state.push_back(tstate_definition(cfg.child("state_focussed")));
00077 }
00078 
00079 } // namespace gui2
00080 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Wed May 23 2012 01:02:42 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs