The Battle for Wesnoth  1.17.0-dev
scrollbar_panel.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2009 - 2021
3  by Mark de Wever <koraq@xs4all.nl>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 #pragma once
17 
19 
22 
23 namespace gui2
24 {
25 
26 // ------------ WIDGET -----------{
27 
28 namespace implementation
29 {
30 struct builder_scrollbar_panel;
31 }
32 
33 /**
34  * @ingroup GUIWidgetWML
35  *
36  * Visible container to hold multiple widgets.
37  *
38  * This widget can draw items beyond the widgets it holds and in front of them.
39  * A panel is always active so these functions return dummy values.
40  *
41  * A panel is a container holding other elements in its grid.
42  * It uses the states as layers to draw on.
43  *
44  * Key |Type |Default |Description
45  * -------------|----------------------------|---------|-----------
46  * grid | @ref guivartype_grid "grid"|mandatory|A grid containing the widgets for main widget.
47  * The following layers exist:
48  * * background - the background of the panel.
49  * * foreground - the foreground of the panel.
50  * List with the scrollbar_panel specific variables:
51  * Key |Type |Default |Description
52  * -------------------------|------------------------------------------------|------------|-----------
53  * vertical_scrollbar_mode | @ref guivartype_scrollbar_mode "scrollbar_mode"|initial_auto|Determines whether or not to show the scrollbar.
54  * horizontal_scrollbar_mode| @ref guivartype_scrollbar_mode "scrollbar_mode"|initial_auto|Determines whether or not to show the scrollbar.
55  * 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.
56  */
58 {
60 
61 public:
62  /**
63  * Constructor.
64  */
66 
67  /** See @ref styled_widget::get_active. */
68  virtual bool get_active() const override;
69 
70  /** See @ref styled_widget::get_state. */
71  virtual unsigned get_state() const override;
72 
73  /** Static type getter that does not rely on the widget being constructed. */
74  static const std::string& type();
75 
76 private:
77  /** Inherited from styled_widget, implemented by REGISTER_WIDGET. */
78  virtual const std::string& get_control_type() const override;
79 
80  /** See @ref container_base::set_self_active. */
81  virtual void set_self_active(const bool active) override;
82 };
83 
84 // }---------- DEFINITION ---------{
85 
87 {
88 
89  explicit scrollbar_panel_definition(const config& cfg);
90 
92  {
93  explicit resolution(const config& cfg);
94 
96  };
97 };
98 
99 // }---------- BUILDER -----------{
100 
101 namespace implementation
102 {
103 
105 {
106  explicit builder_scrollbar_panel(const config& cfg);
107 
109 
110  virtual widget* build() const override;
111 
114 
116 };
117 
118 } // namespace implementation
119 
120 // }------------ END --------------
121 
122 } // 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:23
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:393
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:61
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