gui/auxiliary/widget_definition/listbox.cpp

Go to the documentation of this file.
00001 /* $Id: listbox.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/listbox.hpp"
00019 
00020 #include "gettext.hpp"
00021 #include "gui/auxiliary/log.hpp"
00022 #include "wml_exception.hpp"
00023 
00024 namespace gui2 {
00025 
00026 tlistbox_definition::tlistbox_definition(const config& cfg)
00027     : tcontrol_definition(cfg)
00028 {
00029     DBG_GUI_P << "Parsing listbox " << id << '\n';
00030 
00031     load_resolutions<tresolution>(cfg);
00032 }
00033 
00034 tlistbox_definition::tresolution::tresolution(const config& cfg)
00035     : tresolution_definition_(cfg)
00036     , grid(NULL)
00037 {
00038 /*WIKI
00039  * @page = GUIWidgetDefinitionWML
00040  * @order = 1_listbox
00041  * @begin{parent}{name="gui/"}
00042  * @begin{tag}{name="listbox_definition"}{min=0}{max=-1}{super="generic/widget_definition"}
00043  * == Listbox ==
00044  *
00045  * @macro = listbox_description
00046  *
00047  * The definition of a listbox contains the definition of its scrollbar.
00048  *
00049  * The resolution for a listbox also contains the following keys:
00050  * @begin{tag}{name="resolution"}{min=0}{max=-1}{super=generic/widget_definition/resolution}
00051  * @begin{table}{config}
00052  *     scrollbar & section & &            A grid containing the widgets for the
00053  *                                     scrollbar. The scrollbar has some special
00054  *                                     widgets so it can make default behaviour
00055  *                                     for certain widgets. $
00056  * @end{table}
00057  * @begin{table}{dialog_widgets}
00058  *     _begin & & clickable & o &           Moves the position to the beginning of
00059  *                                     the list. $
00060  *     _line_up & & clickable & o &         Move the position one item up. (NOTE if
00061  *                                     too many items to move per item it might
00062  *                                     be more items.) $
00063  *     _half_page_up & & clickable & o &    Move the position half the number of the
00064  *                                     visible items up. (See note at _line_up.) $
00065  *     _page_up & & clickable & o &         Move the position the number of visible
00066  *                                     items up. (See note at _line_up.) $
00067  *
00068  *     _end & & clickable & o &             Moves the position to the end of the
00069  *                                     list. $
00070  *     _line_down & & clickable & o &       Move the position one item down.(See note
00071  *                                     at _line_up.) $
00072  *     _half_page_down & & clickable & o &  Move the position half the number of the
00073  *                                     visible items down. (See note at
00074  *                                     _line_up.) $
00075  *     _page_down & & clickable & o &       Move the position the number of visible
00076  *                                     items down. (See note at _line_up.) $
00077  *
00078  *     _scrollbar & & vertical_scrollbar & m & This is the scrollbar so the user can
00079  *                                     scroll through the list. $
00080  * @end{table}
00081  * A clickable is one of:
00082  * * button
00083  * * repeating_button
00084  * @{allow}{link}{name="gui/window/resolution/grid/row/column/button"}
00085  * @{allow}{link}{name="gui/window/resolution/grid/row/column/repeating_button"}
00086  * The following states exist:
00087  * * state_enabled, the listbox is enabled.
00088  * * state_disabled, the listbox is disabled.
00089  * @begin{tag}{name="state_enabled"}{min=0}{max=1}{super="generic/state"}
00090  * @end{tag}{name="state_enabled"}
00091  * @begin{tag}{name="state_disabled"}{min=0}{max=1}{super="generic/state"}
00092  * @end{tag}{name="state_disabled"}
00093  * @allow{link}{name="gui/window/resolution/grid"}
00094  * @end{tag}{name="resolution"}
00095  * @end{tag}{name="listbox_definition"}
00096  * @end{parent}{name="gui/"}
00097  */
00098 
00099 /*WIKI
00100  * @page = GUIWidgetDefinitionWML
00101  * @order = 1_horizonal_listbox
00102  *
00103  * == Horizontal listbox ==
00104  * @begin{parent}{name="gui/"}
00105  * @begin{tag}{name="horizontal_listbox_definition"}{min=0}{max=-1}{super="gui/listbox_definition"}
00106  * @end{tag}{name="horizontal_listbox_definition"}
00107  * @end{parent}{name="gui/"}
00108  * @macro = horizontal_listbox_description
00109  * The definition of a horizontal listbox is the same as for a normal listbox.
00110  */
00111     // Note the order should be the same as the enum tstate in listbox.hpp.
00112     state.push_back(tstate_definition(cfg.child("state_enabled")));
00113     state.push_back(tstate_definition(cfg.child("state_disabled")));
00114 
00115     const config &child = cfg.child("grid");
00116     VALIDATE(child, _("No grid defined."));
00117 
00118     grid = new tbuilder_grid(child);
00119 }
00120 
00121 } // namespace gui2
00122 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Wed May 23 2012 01:02:41 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs