gui/auxiliary/widget_definition/toggle_panel.cpp

Go to the documentation of this file.
00001 /* $Id: toggle_panel.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/toggle_panel.hpp"
00019 
00020 #include "gui/auxiliary/log.hpp"
00021 
00022 namespace gui2 {
00023 
00024 ttoggle_panel_definition::ttoggle_panel_definition(const config& cfg)
00025     : tcontrol_definition(cfg)
00026 {
00027     DBG_GUI_P << "Parsing toggle panel " << id << '\n';
00028 
00029     load_resolutions<tresolution>(cfg);
00030 }
00031 
00032 ttoggle_panel_definition::tresolution::tresolution(const config& cfg)
00033     : tresolution_definition_(cfg)
00034     , top_border(cfg["top_border"])
00035     , bottom_border(cfg["bottom_border"])
00036     , left_border(cfg["left_border"])
00037     , right_border(cfg["right_border"])
00038 {
00039 /*WIKI
00040  * @page = GUIWidgetDefinitionWML
00041  * @order = 1_toggle_panel
00042  *
00043  * == Toggle panel ==
00044  *
00045  * @begin{parent}{name="gui/"}
00046  * @begin{tag}{name="toggle_panel_definition"}{min=0}{max=-1}{super="generic/widget_definition"}
00047  * The definition of a toggle panel. A toggle panel is like a toggle button, but
00048  * instead of being a button it's a panel. This means it can hold multiple child
00049  * items.
00050  *
00051  * @begin{tag}{name="resolution"}{min=0}{max=-1}{super=generic/widget_definition/resolution}
00052  * The resolution for a toggle panel also contains the following keys:
00053  * @begin{table}{config}
00054  *     top_border & unsigned & 0 &     The size which isn't used for the client
00055  *                                   area. $
00056  *     bottom_border & unsigned & 0 &  The size which isn't used for the client
00057  *                                   area. $
00058  *     left_border & unsigned & 0 &    The size which isn't used for the client
00059  *                                   area. $
00060  *     right_border & unsigned & 0 &   The size which isn't used for the client
00061  *                                   area. $
00062  * @end{table}
00063  *
00064  * The following states exist:
00065  * * state_enabled, the panel is enabled and not selected.
00066  * * state_disabled, the panel is disabled and not selected.
00067  * * state_focussed, the mouse is over the panel and not selected.
00068  *
00069  * * state_enabled_selected, the panel is enabled and selected.
00070  * * state_disabled_selected, the panel is disabled and selected.
00071  * * state_focussed_selected, the mouse is over the panel and selected.
00072  * @begin{tag}{name="state_enabled"}{min=0}{max=1}{super="generic/state"}
00073  * @end{tag}{name="state_enabled"}
00074  * @begin{tag}{name="state_disabled"}{min=0}{max=1}{super="generic/state"}
00075  * @end{tag}{name="state_disabled"}
00076  * @begin{tag}{name="state_focussed"}{min=0}{max=1}{super="generic/state"}
00077  * @end{tag}{name="state_focussed"}
00078  * @begin{tag}{name="state_enabled_selected"}{min=0}{max=1}{super="generic/state"}
00079  * @end{tag}{name="state_enabled_selected"}
00080  * @begin{tag}{name="state_disabled_selected"}{min=0}{max=1}{super="generic/state"}
00081  * @end{tag}{name="state_disabled_selected"}
00082  * @begin{tag}{name="state_focussed_selected"}{min=0}{max=1}{super="generic/state"}
00083  * @end{tag}{name="state_focussed_selected"}
00084  * @end{tag}{name="resolution"}
00085  * @end{tag}{name="toggle_panel_definition"}
00086  * @end{parent}{name="gui/"}
00087  */
00088     // Note the order should be the same as the enum tstate in toggle_panel.hpp.
00089     state.push_back(tstate_definition(cfg.child("state_enabled")));
00090     state.push_back(tstate_definition(cfg.child("state_disabled")));
00091     state.push_back(tstate_definition(cfg.child("state_focussed")));
00092 
00093     state.push_back(tstate_definition(cfg.child("state_enabled_selected")));
00094     state.push_back(tstate_definition(cfg.child("state_disabled_selected")));
00095     state.push_back(tstate_definition(cfg.child("state_focussed_selected")));
00096 }
00097 
00098 } // namespace gui2
00099 
 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