00001 /* $Id: slider.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/slider.hpp" 00019 00020 #include "gui/auxiliary/log.hpp" 00021 #include "wml_exception.hpp" 00022 00023 namespace gui2 { 00024 00025 tslider_definition::tslider_definition(const config& cfg) 00026 : tcontrol_definition(cfg) 00027 { 00028 DBG_GUI_P << "Parsing slider " << id << '\n'; 00029 00030 load_resolutions<tresolution>(cfg); 00031 } 00032 00033 tslider_definition::tresolution::tresolution(const config& cfg) 00034 : tresolution_definition_(cfg) 00035 , minimum_positioner_length(cfg["minimum_positioner_length"]) 00036 , maximum_positioner_length(cfg["maximum_positioner_length"]) 00037 , left_offset(cfg["left_offset"]) 00038 , right_offset(cfg["right_offset"]) 00039 { 00040 /*WIKI 00041 * @page = GUIWidgetDefinitionWML 00042 * @order = 1_slider 00043 * 00044 * == Slider == 00045 * 00046 * @macro = slider_description 00047 * 00048 * @begin{parent}{name="gui/"} 00049 * @begin{tag}{name="slider_definition"}{min=0}{max=-1}{super="generic/widget_definition"} 00050 * @begin{tag}{name="resolution"}{min=0}{max=-1}{super="generic/widget_definition/resolution"} 00051 * @begin{table}{config} 00052 * minimum_positioner_length & unsigned & & 00053 * The minimum size the positioner is 00054 * allowed to be. The engine needs to know 00055 * this in order to calculate the best size 00056 * for the positioner. $ 00057 * maximum_positioner_length & unsigned & 0 & 00058 * The maximum size the positioner is 00059 * allowed to be. If minimum and maximum are 00060 * the same value the positioner is fixed 00061 * size. If the maximum is 0 (and the 00062 * minimum not) there's no maximum. $ 00063 * left_offset & unsigned & 0 & The number of pixels at the left side 00064 * which can't be used by the positioner. $ 00065 * right_offset & unsigned & 0 & The number of pixels at the right side 00066 * which can't be used by the positioner. $ 00067 * @end{table} 00068 * 00069 * The following states exist: 00070 * * state_enabled, the slider is enabled. 00071 * * state_disabled, the slider is disabled. 00072 * * state_pressed, the left mouse button is down on the positioner of the 00073 * slider. 00074 * * state_focussed, the mouse is over the positioner of the slider. 00075 * @begin{tag}{name="state_enabled"}{min=0}{max=1}{super="generic/state"} 00076 * @end{tag}{name="state_enabled"} 00077 * @begin{tag}{name="state_disabled"}{min=0}{max=1}{super="generic/state"} 00078 * @end{tag}{name="state_disabled"} 00079 * @begin{tag}{name="state_pressed"}{min=0}{max=1}{super="generic/state"} 00080 * @end{tag}{name="state_pressed"} 00081 * @begin{tag}{name="state_focussed"}{min=0}{max=1}{super="generic/state"} 00082 * @end{tag}{name="state_focussed"} 00083 * @end{tag}{name="resolution"} 00084 * @end{tag}{name="slider_definition"} 00085 * @end{parent}{name="gui/"} 00086 */ 00087 VALIDATE(minimum_positioner_length 00088 , missing_mandatory_wml_key( 00089 "resolution" 00090 , "minimum_positioner_length")); 00091 00092 // Note the order should be the same as the enum tstate is slider.hpp. 00093 state.push_back(tstate_definition(cfg.child("state_enabled"))); 00094 state.push_back(tstate_definition(cfg.child("state_disabled"))); 00095 state.push_back(tstate_definition(cfg.child("state_pressed"))); 00096 state.push_back(tstate_definition(cfg.child("state_focussed"))); 00097 } 00098 00099 } // namespace gui2 00100
| Generated by doxygen 1.7.1 on Fri May 25 2012 01:02:55 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |