The Battle for Wesnoth  1.15.12+dev
scrollbar_panel.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2009 - 2018 by Mark de Wever <koraq@xs4all.nl>
3  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 #pragma once
16 
18 
21 
22 namespace gui2
23 {
24 
25 // ------------ WIDGET -----------{
26 
27 namespace implementation
28 {
29 struct builder_scrollbar_panel;
30 }
31 
32 /**
33  * @ingroup GUIWidgetWML
34  *
35  * Visible container to hold multiple widgets.
36  *
37  * This widget can draw items beyond the widgets it holds and in front of them.
38  * A panel is always active so these functions return dummy values.
39  *
40  * A panel is a container holding other elements in its grid.
41  * It uses the states as layers to draw on.
42  *
43  * Key |Type |Default |Description
44  * -------------|----------------------------|---------|-----------
45  * grid | @ref guivartype_grid "grid"|mandatory|A grid containing the widgets for main widget.
46  * The following layers exist:
47  * * background - the background of the panel.
48  * * foreground - the foreground of the panel.
49  * List with the scrollbar_panel specific variables:
50  * Key |Type |Default |Description
51  * -------------------------|------------------------------------------------|------------|-----------
52  * vertical_scrollbar_mode | @ref guivartype_scrollbar_mode "scrollbar_mode"|initial_auto|Determines whether or not to show the scrollbar.
53  * horizontal_scrollbar_mode| @ref guivartype_scrollbar_mode "scrollbar_mode"|initial_auto|Determines whether or not to show the scrollbar.
54  * definition | @ref guivartype_section "section" |mandatory |This defines how a scrollbar_panel item looks. It must contain the grid definition for 1 row of the list.
55  */
57 {
59 
60 public:
61  /**
62  * Constructor.
63  */
65 
66  /** See @ref styled_widget::get_active. */
67  virtual bool get_active() const override;
68 
69  /** See @ref styled_widget::get_state. */
70  virtual unsigned get_state() const override;
71 
72  /** Static type getter that does not rely on the widget being constructed. */
73  static const std::string& type();
74 
75 private:
76  /** Inherited from styled_widget, implemented by REGISTER_WIDGET. */
77  virtual const std::string& get_control_type() const override;
78 
79  /** See @ref container_base::set_self_active. */
80  virtual void set_self_active(const bool active) override;
81 };
82 
83 // }---------- DEFINITION ---------{
84 
86 {
87 
88  explicit scrollbar_panel_definition(const config& cfg);
89 
91  {
92  explicit resolution(const config& cfg);
93 
95  };
96 };
97 
98 // }---------- BUILDER -----------{
99 
100 namespace implementation
101 {
102 
104 {
105  explicit builder_scrollbar_panel(const config& cfg);
106 
108 
109  virtual widget* build() const override;
110 
113 
115 };
116 
117 } // namespace implementation
118 
119 // }------------ END --------------
120 
121 } // namespace gui2
Base class of a resolution, contains the common keys for a resolution.
scrollbar_container::scrollbar_mode horizontal_scrollbar_mode
virtual widget * build() const =0
Base class for all widgets.
Definition: widget.hpp:49
Generic file dialog.
Definition: field-fwd.hpp:22
Visible container to hold multiple widgets.
Base class for creating containers with one or two scrollbar(s).
scrollbar_mode
The way to handle the showing or hiding of the scrollbar.
point resolution()
Definition: general.cpp:387
std::unique_ptr< window > build(const builder_window::window_resolution &definition)
Builds a window.
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:59
std::shared_ptr< builder_grid > builder_grid_ptr
Contains the implementation details for lexical_cast and shouldn&#39;t be used directly.
scrollbar_container::scrollbar_mode vertical_scrollbar_mode