gui/auxiliary/window_builder/scroll_label.cpp

Go to the documentation of this file.
00001 /* $Id: scroll_label.cpp 52533 2012-01-07 02:35:17Z shadowmaster $ */
00002 /*
00003    Copyright (C) 2008 - 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/window_builder/scroll_label.hpp"
00019 
00020 #include "config.hpp"
00021 #include "gui/auxiliary/log.hpp"
00022 #include "gui/auxiliary/window_builder/helper.hpp"
00023 #include "gui/auxiliary/widget_definition/scroll_label.hpp"
00024 #include "gui/widgets/scroll_label.hpp"
00025 
00026 namespace gui2 {
00027 
00028 namespace implementation {
00029 
00030 tbuilder_scroll_label::tbuilder_scroll_label(const config& cfg)
00031     : implementation::tbuilder_control(cfg)
00032     , vertical_scrollbar_mode(
00033             get_scrollbar_mode(cfg["vertical_scrollbar_mode"]))
00034     , horizontal_scrollbar_mode(
00035             get_scrollbar_mode(cfg["horizontal_scrollbar_mode"]))
00036 {
00037 }
00038 
00039 twidget* tbuilder_scroll_label::build() const
00040 {
00041     tscroll_label* widget = new tscroll_label();
00042 
00043     init_control(widget);
00044 
00045     widget->set_vertical_scrollbar_mode(vertical_scrollbar_mode);
00046     widget->set_horizontal_scrollbar_mode(horizontal_scrollbar_mode);
00047 
00048     boost::intrusive_ptr<const tscroll_label_definition::tresolution> conf =
00049             boost::dynamic_pointer_cast
00050                 <const tscroll_label_definition::tresolution>(widget->config());
00051     assert(conf);
00052 
00053     widget->init_grid(conf->grid);
00054     widget->finalize_setup();
00055 
00056     DBG_GUI_G << "Window builder: placed scroll label '"
00057             << id << "' with definition '"
00058             << definition << "'.\n";
00059 
00060     return widget;
00061 }
00062 
00063 } // namespace implementation
00064 
00065 } // namespace gui2
00066 
00067 /*WIKI_MACRO
00068  * @begin{macro}{scroll_label_description}
00069  *
00070  *        A scroll label is a label that wraps its text and also has a
00071  *        vertical scrollbar. This way a text can't be too long to be shown
00072  *        for this widget.
00073  * @end{macro}
00074  */
00075 
00076 /*WIKI
00077  * @page = GUIWidgetInstanceWML
00078  * @order = 2_scroll_label
00079  * @begin{parent}{name="gui/window/resolution/grid/row/column/"}
00080  * @begin{tag}{name="scroll_label"}{min="0"}{max="-1"}{super="generic/widget_instance"}
00081  * == Scroll label ==
00082  *
00083  * @macro = scroll_label_description
00084  *
00085  * List with the scroll label specific variables:
00086  * @begin{table}{config}
00087  *     vertical_scrollbar_mode & scrollbar_mode & initial_auto &
00088  *                                     Determines whether or not to show the
00089  *                                     scrollbar. $
00090  *     horizontal_scrollbar_mode & scrollbar_mode & initial_auto &
00091  *                                     Determines whether or not to show the
00092  *                                     scrollbar. $
00093  * @end{table}
00094  * @end{tag}{name="scroll_label"}
00095  * @end{parent}{name="gui/window/resolution/grid/row/column/"}
00096  */
00097 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

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