00001 /* $Id: scroll_label.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/scroll_label.hpp" 00019 00020 #include "gettext.hpp" 00021 #include "gui/auxiliary/log.hpp" 00022 #include "wml_exception.hpp" 00023 00024 namespace gui2 { 00025 00026 tscroll_label_definition::tscroll_label_definition(const config& cfg) 00027 : tcontrol_definition(cfg) 00028 { 00029 DBG_GUI_P << "Parsing scroll label " << id << '\n'; 00030 00031 load_resolutions<tresolution>(cfg); 00032 } 00033 00034 tscroll_label_definition::tresolution::tresolution(const config& cfg) 00035 : tresolution_definition_(cfg) 00036 , grid(NULL) 00037 { 00038 /*WIKI 00039 * @page = GUIWidgetDefinitionWML 00040 * @order = 1_scroll_label 00041 * 00042 * == Scroll label == 00043 * 00044 * @macro = scroll_label_description 00045 * 00046 * @begin{parent}{name="gui/"} 00047 * This widget is slower as a normal label widget so only use this widget 00048 * when the scrollbar is required (or expected to become required). 00049 * @begin{tag}{name="scroll_label_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 * grid & grid & & A grid containing the widgets for main 00053 * widget. $ 00054 * @end{table} 00055 * @allow{link}{name="gui/window/resolution/grid"} 00056 * TODO we need one definition for a vertical scrollbar since this is the second 00057 * time we use it. 00058 * 00059 * @begin{table}{dialog_widgets} 00060 * _content_grid & & grid & m & A grid which should only contain one 00061 * label widget. $ 00062 * _scrollbar_grid & & grid & m & A grid for the scrollbar 00063 * (Merge with listbox info.) $ 00064 * @end{table} 00065 * @begin{tag}{name="content_grid"}{min=0}{max=1}{super="gui/window/resolution/grid"} 00066 * @end{tag}{name="content_grid"} 00067 * @begin{tag}{name="scrollbar_grid"}{min=0}{max=1}{super="gui/window/resolution/grid"} 00068 * @end{tag}{name="scrollbar_grid"} 00069 * The following states exist: 00070 * * state_enabled, the scroll label is enabled. 00071 * * state_disabled, the scroll label is disabled. 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 * @end{tag}{name="resolution"} 00077 * @end{tag}{name="scroll_label_definition"} 00078 * @end{parent}{name="gui/"} 00079 */ 00080 // Note the order should be the same as the enum tstate is scroll_label.hpp. 00081 state.push_back(tstate_definition(cfg.child("state_enabled"))); 00082 state.push_back(tstate_definition(cfg.child("state_disabled"))); 00083 00084 const config &child = cfg.child("grid"); 00085 VALIDATE(child, _("No grid defined.")); 00086 00087 grid = new tbuilder_grid(child); 00088 } 00089 00090 } // namespace gui2 00091
| Generated by doxygen 1.7.1 on Wed May 23 2012 01:02:42 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |