Move gui2::tbuilder_scroll_label to its own file.
This commit is contained in:
parent
0ecb029bca
commit
cded3918c7
10 changed files with 130 additions and 53 deletions
|
@ -15,6 +15,7 @@ src/gui/auxiliary/window_builder/label.cpp
|
|||
src/gui/auxiliary/window_builder/listbox.cpp
|
||||
src/gui/auxiliary/window_builder/minimap.cpp
|
||||
src/gui/auxiliary/window_builder/menubar.cpp
|
||||
src/gui/auxiliary/window_builder/scroll_label.cpp
|
||||
src/gui/auxiliary/window_builder/slider.cpp
|
||||
src/gui/auxiliary/window_builder/spacer.cpp
|
||||
src/gui/auxiliary/window_builder/text_box.cpp
|
||||
|
|
|
@ -273,6 +273,7 @@ SET(wesnoth-main_SRC
|
|||
gui/auxiliary/window_builder/listbox.cpp
|
||||
gui/auxiliary/window_builder/minimap.cpp
|
||||
gui/auxiliary/window_builder/menubar.cpp
|
||||
gui/auxiliary/window_builder/scroll_label.cpp
|
||||
gui/auxiliary/window_builder/slider.cpp
|
||||
gui/auxiliary/window_builder/spacer.cpp
|
||||
gui/auxiliary/window_builder/text_box.cpp
|
||||
|
|
|
@ -98,6 +98,7 @@ wesnoth_source = \
|
|||
gui/auxiliary/window_builder/listbox.cpp \
|
||||
gui/auxiliary/window_builder/minimap.cpp \
|
||||
gui/auxiliary/window_builder/menubar.cpp \
|
||||
gui/auxiliary/window_builder/scroll_label.cpp \
|
||||
gui/auxiliary/window_builder/slider.cpp \
|
||||
gui/auxiliary/window_builder/spacer.cpp \
|
||||
gui/auxiliary/window_builder/text_box.cpp \
|
||||
|
|
|
@ -254,6 +254,7 @@ wesnoth_sources = Split("""
|
|||
gui/auxiliary/window_builder/listbox.cpp
|
||||
gui/auxiliary/window_builder/minimap.cpp
|
||||
gui/auxiliary/window_builder/menubar.cpp
|
||||
gui/auxiliary/window_builder/scroll_label.cpp
|
||||
gui/auxiliary/window_builder/slider.cpp
|
||||
gui/auxiliary/window_builder/spacer.cpp
|
||||
gui/auxiliary/window_builder/text_box.cpp
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "gui/auxiliary/window_builder/minimap.hpp"
|
||||
#include "gui/auxiliary/window_builder/menubar.hpp"
|
||||
#include "gui/auxiliary/window_builder/slider.hpp"
|
||||
#include "gui/auxiliary/window_builder/scroll_label.hpp"
|
||||
#include "gui/auxiliary/window_builder/spacer.hpp"
|
||||
#include "gui/auxiliary/window_builder/text_box.hpp"
|
||||
#include "gui/auxiliary/window_builder/panel.hpp"
|
||||
|
@ -483,26 +484,6 @@ twidget* tbuilder_multi_page::build() const
|
|||
return multi_page;
|
||||
}
|
||||
|
||||
twidget* tbuilder_scroll_label::build() const
|
||||
{
|
||||
tscroll_label* widget = new tscroll_label();
|
||||
|
||||
init_control(widget);
|
||||
|
||||
boost::intrusive_ptr<const tscroll_label_definition::tresolution> conf =
|
||||
boost::dynamic_pointer_cast
|
||||
<const tscroll_label_definition::tresolution>(widget->config());
|
||||
assert(conf);
|
||||
|
||||
widget->init_grid(conf->grid);
|
||||
widget->finalize_setup();
|
||||
|
||||
DBG_GUI_G << "Window builder: placed scroll label '" << id << "' with defintion '"
|
||||
<< definition << "'.\n";
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
||||
tbuilder_scrollbar_panel::tbuilder_scrollbar_panel(const config& cfg)
|
||||
: implementation::tbuilder_control(cfg)
|
||||
, vertical_scrollbar_mode(
|
||||
|
|
74
src/gui/auxiliary/window_builder/scroll_label.cpp
Normal file
74
src/gui/auxiliary/window_builder/scroll_label.cpp
Normal file
|
@ -0,0 +1,74 @@
|
|||
/* $Id$ */
|
||||
/*
|
||||
Copyright (C) 2008 - 2009 by Mark de Wever <koraq@xs4all.nl>
|
||||
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License version 2
|
||||
or at your option any later version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY.
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
#define GETTEXT_DOMAIN "wesnoth-lib"
|
||||
|
||||
#include "gui/auxiliary/window_builder/scroll_label.hpp"
|
||||
|
||||
#include "config.hpp"
|
||||
#include "gui/auxiliary/log.hpp"
|
||||
#include "gui/widgets/scroll_label.hpp"
|
||||
|
||||
namespace gui2 {
|
||||
|
||||
namespace implementation {
|
||||
|
||||
tbuilder_scroll_label::tbuilder_scroll_label(const config& cfg)
|
||||
: implementation::tbuilder_control(cfg)
|
||||
, auto_hide_scrollbar_(
|
||||
utils::string_bool(cfg["auto_hide_scrollbar"], true))
|
||||
{
|
||||
}
|
||||
|
||||
twidget* tbuilder_scroll_label::build() const
|
||||
{
|
||||
tscroll_label* widget = new tscroll_label();
|
||||
|
||||
init_control(widget);
|
||||
|
||||
boost::intrusive_ptr<const tscroll_label_definition::tresolution> conf =
|
||||
boost::dynamic_pointer_cast
|
||||
<const tscroll_label_definition::tresolution>(widget->config());
|
||||
assert(conf);
|
||||
|
||||
widget->init_grid(conf->grid);
|
||||
widget->finalize_setup();
|
||||
|
||||
DBG_GUI_G << "Window builder: placed scroll label '"
|
||||
<< id << "' with defintion '"
|
||||
<< definition << "'.\n";
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
|
||||
} // namespace gui2
|
||||
|
||||
/*WIKI
|
||||
* @page = GUIWidgetInstanceWML
|
||||
* @order = 2_scroll_label
|
||||
*
|
||||
* == Scroll label ==
|
||||
*
|
||||
* A scroll label has no special fields.
|
||||
*
|
||||
* @start_table = config
|
||||
* auto_hide_scrollbar (bool = true)
|
||||
* Automatically hide the scrollbar when
|
||||
* the text can be shown without the
|
||||
* scrollbar.
|
||||
* @end_table
|
||||
*/
|
||||
|
41
src/gui/auxiliary/window_builder/scroll_label.hpp
Normal file
41
src/gui/auxiliary/window_builder/scroll_label.hpp
Normal file
|
@ -0,0 +1,41 @@
|
|||
/* $Id$ */
|
||||
/*
|
||||
Copyright (C) 2008 - 2009 by Mark de Wever <koraq@xs4all.nl>
|
||||
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License version 2
|
||||
or at your option any later version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY.
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
#ifndef GUI_AUXILIARY_WINDOW_BUILDER_SCROLL_LABEL_HPP_INCLUDED
|
||||
#define GUI_AUXILIARY_WINDOW_BUILDER_SCROLL_LABEL_HPP_INCLUDED
|
||||
|
||||
#include "gui/auxiliary/window_builder/control.hpp"
|
||||
|
||||
namespace gui2 {
|
||||
|
||||
namespace implementation {
|
||||
|
||||
struct tbuilder_scroll_label
|
||||
: public tbuilder_control
|
||||
{
|
||||
tbuilder_scroll_label(const config& cfg);
|
||||
|
||||
twidget* build () const;
|
||||
|
||||
private:
|
||||
|
||||
bool auto_hide_scrollbar_;
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
|
||||
} // namespace gui2
|
||||
|
||||
#endif
|
||||
|
|
@ -74,37 +74,6 @@ public:
|
|||
std::vector<string_map> data;
|
||||
};
|
||||
|
||||
struct tbuilder_scroll_label : public implementation::tbuilder_control
|
||||
{
|
||||
public:
|
||||
/*WIKI
|
||||
* @page = GUIWidgetInstanceWML
|
||||
* @order = 2_scroll_label
|
||||
*
|
||||
* == Scroll label ==
|
||||
*
|
||||
* A scroll label has no special fields.
|
||||
*
|
||||
* @start_table = config
|
||||
* auto_hide_scrollbar (bool = true)
|
||||
* Automatically hide the scrollbar when the
|
||||
* text can be shown without the scrollbar.
|
||||
* @end_table
|
||||
*/
|
||||
tbuilder_scroll_label(const config& cfg)
|
||||
: implementation::tbuilder_control(cfg)
|
||||
, auto_hide_scrollbar_(
|
||||
utils::string_bool(cfg["auto_hide_scrollbar"], true))
|
||||
{
|
||||
}
|
||||
|
||||
twidget* build () const;
|
||||
|
||||
private:
|
||||
|
||||
bool auto_hide_scrollbar_;
|
||||
};
|
||||
|
||||
struct tbuilder_scrollbar_panel
|
||||
: public implementation::tbuilder_control
|
||||
{
|
||||
|
|
|
@ -22,6 +22,10 @@ namespace gui2 {
|
|||
class tlabel;
|
||||
class tspacer;
|
||||
|
||||
namespace implementation {
|
||||
struct tbuilder_scroll_label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Label showing a text.
|
||||
*
|
||||
|
@ -31,7 +35,7 @@ class tspacer;
|
|||
*/
|
||||
class tscroll_label : public tscrollbar_container
|
||||
{
|
||||
friend struct tbuilder_scroll_label;
|
||||
friend struct implementation::tbuilder_scroll_label;
|
||||
public:
|
||||
|
||||
tscroll_label();
|
||||
|
|
|
@ -22,6 +22,10 @@ namespace gui2 {
|
|||
class tscrollbar_;
|
||||
class tspacer;
|
||||
|
||||
namespace implementation {
|
||||
struct tbuilder_scroll_label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Base class for creating containers with one or two scrollbar(s).
|
||||
*
|
||||
|
@ -35,7 +39,7 @@ class tscrollbar_container
|
|||
{
|
||||
friend class tdebug_layout_graph;
|
||||
|
||||
friend struct tbuilder_scroll_label;
|
||||
friend struct implementation::tbuilder_scroll_label;
|
||||
friend struct tbuilder_scrollbar_panel;
|
||||
friend class tlistbox;
|
||||
friend struct tscrollbar_container_implementation;
|
||||
|
|
Loading…
Add table
Reference in a new issue