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