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