00001 /* $Id: stacked_widget.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/stacked_widget.hpp" 00019 00020 #include "gettext.hpp" 00021 #include "gui/auxiliary/log.hpp" 00022 #include "wml_exception.hpp" 00023 00024 namespace gui2 { 00025 00026 tstacked_widget_definition::tstacked_widget_definition(const config& cfg) 00027 : tcontrol_definition(cfg) 00028 { 00029 DBG_GUI_P << "Parsing stacked widget " << id << '\n'; 00030 00031 load_resolutions<tresolution>(cfg); 00032 } 00033 00034 tstacked_widget_definition::tresolution::tresolution(const config& cfg) 00035 : tresolution_definition_(cfg) 00036 , grid(NULL) 00037 { 00038 /*WIKI 00039 * @page = GUIWidgetDefinitionWML 00040 * @order = 1_stacked_widget 00041 * 00042 * == Stacked widget == 00043 * 00044 * A stacked widget holds several widgets on top of eachother. This can be used 00045 * for various effects; add an optional overlay to an image, stack it with a 00046 * spacer to force a minimum size of a widget. The latter is handy to avoid 00047 * making a separate definition for a single instance with a fixed size. 00048 * 00049 * A stacked widget has no states. 00050 * @begin{parent}{name="gui/"} 00051 * @begin{tag}{name="stacked_widget_definition"}{min=0}{max=-1}{super="generic/widget_definition"} 00052 * @begin{tag}{name="resolution"}{min=0}{max=-1}{super="generic/widget_definition/resolution"} 00053 * @allow{link}{name="gui/window/resolution/grid"} 00054 * @end{tag}{name="resolution"} 00055 * @end{tag}{name="stacked_widget_definition"} 00056 * @end{parent}{name="gui/"} 00057 */ 00058 00059 // Add a dummy state since every widget needs a state. 00060 static config dummy ("draw"); 00061 state.push_back(tstate_definition(dummy)); 00062 00063 const config &child = cfg.child("grid"); 00064 VALIDATE(child, _("No grid defined.")); 00065 00066 grid = new tbuilder_grid(child); 00067 } 00068 00069 } // namespace gui2 00070
| Generated by doxygen 1.7.1 on Wed May 23 2012 01:02:42 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |