00001 /* $Id: panel.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/panel.hpp" 00019 00020 #include "config.hpp" 00021 #include "gettext.hpp" 00022 #include "gui/auxiliary/log.hpp" 00023 #include "gui/widgets/panel.hpp" 00024 #include "wml_exception.hpp" 00025 00026 namespace gui2 { 00027 00028 namespace implementation { 00029 00030 tbuilder_panel::tbuilder_panel(const config& cfg) 00031 : tbuilder_control(cfg) 00032 , grid(NULL) 00033 { 00034 const config &c = cfg.child("grid"); 00035 00036 VALIDATE(c, _("No grid defined.")); 00037 00038 grid = new tbuilder_grid(c); 00039 } 00040 00041 twidget* tbuilder_panel::build() const 00042 { 00043 tpanel* widget = new tpanel(); 00044 00045 init_control(widget); 00046 00047 DBG_GUI_G << "Window builder: placed panel '" 00048 << id << "' with definition '" 00049 << definition << "'.\n"; 00050 00051 widget->init_grid(grid); 00052 return widget; 00053 } 00054 00055 } // namespace implementation 00056 00057 } // namespace gui2 00058 00059 /*WIKI_MACRO 00060 * @begin{macro}{panel_description} 00061 * 00062 * A panel is an item which can hold other items. The difference 00063 * between a grid and a panel is that it's possible to define how a 00064 * panel looks. A grid in an invisible container to just hold the 00065 * items. 00066 * @end{macro} 00067 */ 00068 00069 /*WIKI 00070 * @page = GUIWidgetInstanceWML 00071 * @order = 2_panel 00072 * @begin{parent}{name="gui/window/resolution/grid/row/column/"} 00073 * @begin{tag}{name="panel"}{min="0"}{max="-1"}{super="generic/widget_instance"} 00074 * == Panel == 00075 * 00076 * @macro = panel_description 00077 * 00078 * @begin{table}{config} 00079 * grid & grid & & Defines the grid with the widgets to 00080 * place on the panel. $ 00081 * @end{table} 00082 * @allow{link}{name="gui/window/resolution/grid"} 00083 * @end{tag}{name="panel"} 00084 * @end{parent}{name="gui/window/resolution/grid/row/column/"} 00085 */ 00086
| Generated by doxygen 1.7.1 on Wed May 23 2012 01:02:42 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |