gui/auxiliary/widget_definition/toggle_button.cpp

Go to the documentation of this file.
00001 /* $Id: toggle_button.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_button.hpp"
00019 
00020 #include "gui/auxiliary/log.hpp"
00021 
00022 namespace gui2 {
00023 
00024 ttoggle_button_definition::ttoggle_button_definition(const config& cfg)
00025     : tcontrol_definition(cfg)
00026 {
00027     DBG_GUI_P << "Parsing toggle button " << id << '\n';
00028 
00029     load_resolutions<tresolution>(cfg);
00030 }
00031 
00032 ttoggle_button_definition::tresolution::tresolution(const config& cfg)
00033     : tresolution_definition_(cfg)
00034 {
00035 /*WIKI
00036  * @page = GUIWidgetDefinitionWML
00037  * @order = 1_toggle_button
00038  *
00039  * == Toggle button ==
00040  *
00041  * The definition of a toggle button.
00042  *
00043  * The following states exist:
00044  * * state_enabled, the button is enabled and not selected.
00045  * * state_disabled, the button is disabled and not selected.
00046  * * state_focussed, the mouse is over the button and not selected.
00047  *
00048  * * state_enabled_selected, the button is enabled and selected.
00049  * * state_disabled_selected, the button is disabled and selected.
00050  * * state_focussed_selected, the mouse is over the button and selected.
00051  * @begin{parent}{name="gui/"}
00052  * @begin{tag}{name="toggle_button_definition"}{min=0}{max=-1}{super="generic/widget_definition"}
00053  * @begin{tag}{name="resolution"}{min=0}{max=-1}{super="generic/widget_definition/resolution"}
00054  * @begin{tag}{name="state_enabled"}{min=0}{max=1}{super="generic/state"}
00055  * @end{tag}{name="state_enabled"}
00056  * @begin{tag}{name="state_disabled"}{min=0}{max=1}{super="generic/state"}
00057  * @end{tag}{name="state_disabled"}
00058  * @begin{tag}{name="state_focussed"}{min=0}{max=1}{super="generic/state"}
00059  * @end{tag}{name="state_focussed"}
00060  * @begin{tag}{name="state_enabled_selected"}{min=0}{max=1}{super="generic/state"}
00061  * @end{tag}{name="state_enabled_selected"}
00062  * @begin{tag}{name="state_disabled_selected"}{min=0}{max=1}{super="generic/state"}
00063  * @end{tag}{name="state_disabled_selected"}
00064  * @begin{tag}{name="state_focussed_selected"}{min=0}{max=1}{super="generic/state"}
00065  * @end{tag}{name="state_focussed_selected"}
00066  * @end{tag}{name="resolution"}
00067  * @end{tag}{name="toggle_button_definition"}
00068  * @end{parent}{name="gui/"}
00069  */
00070 
00071     // Note the order should be the same as the enum tstate in
00072     // toggle_button.hpp.
00073     state.push_back(tstate_definition(cfg.child("state_enabled")));
00074     state.push_back(tstate_definition(cfg.child("state_disabled")));
00075     state.push_back(tstate_definition(cfg.child("state_focussed")));
00076 
00077     state.push_back(tstate_definition(cfg.child("state_enabled_selected")));
00078     state.push_back(tstate_definition(cfg.child("state_disabled_selected")));
00079     state.push_back(tstate_definition(cfg.child("state_focussed_selected")));
00080 }
00081 
00082 } // namespace gui2
00083 
 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