The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
panel.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2016 by Mark de Wever <[email protected]>
3  Part of the Battle for Wesnoth Project http://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 #ifndef GUI_WIDGETS_PANEL_HPP_INCLUDED
16 #define GUI_WIDGETS_PANEL_HPP_INCLUDED
17 
19 
22 
23 namespace gui2
24 {
25 
26 // ------------ WIDGET -----------{
27 
28 /**
29  * Visible container to hold multiple widgets.
30  *
31  * This widget can draw items beyond the widgets it holds and in front of them.
32  * A panel is always active so these functions return dummy values.
33  */
34 class tpanel : public tcontainer_
35 {
36 
37 public:
38  /**
39  * Constructor.
40  *
41  * @param canvas_count The canvas count for tcontrol.
42  */
43  explicit tpanel(const unsigned canvas_count = 2) : tcontainer_(canvas_count)
44  {
45  }
46 
47  /** See @ref tcontainer_::get_client_rect. */
48  virtual SDL_Rect get_client_rect() const override;
49 
50  /** See @ref tcontrol::get_active. */
51  virtual bool get_active() const override;
52 
53  /** See @ref tcontrol::get_state. */
54  virtual unsigned get_state() const override;
55 
56 private:
57  /** See @ref twidget::impl_draw_background. */
58  virtual void impl_draw_background(surface& frame_buffer,
59  int x_offset,
60  int y_offset) override;
61 
62  /** See @ref twidget::impl_draw_foreground. */
63  virtual void impl_draw_foreground(surface& frame_buffer,
64  int x_offset,
65  int y_offset) override;
66 
67  /** See @ref tcontrol::get_control_type. */
68  virtual const std::string& get_control_type() const override;
69 
70  /** See @ref tcontainer_::border_space. */
71  virtual tpoint border_space() const override;
72 
73  /** See @ref tcontainer_::set_self_active. */
74  virtual void set_self_active(const bool active) override;
75 };
76 
77 // }---------- DEFINITION ---------{
78 
80 {
81  explicit tpanel_definition(const config& cfg);
82 
84  {
85  explicit tresolution(const config& cfg);
86 
87  unsigned top_border;
88  unsigned bottom_border;
89 
90  unsigned left_border;
91  unsigned right_border;
92  };
93 };
94 
95 // }---------- BUILDER -----------{
96 
97 namespace implementation
98 {
99 
101 {
102  explicit tbuilder_panel(const config& cfg);
103 
105 
106  twidget* build() const;
107 
109 };
110 
111 } // namespace implementation
112 
113 // }------------ END --------------
114 
115 } // namespace gui2
116 
117 #endif
virtual bool get_active() const override
See tcontrol::get_active.
Definition: panel.cpp:53
tpanel_definition(const config &cfg)
Definition: panel.cpp:101
virtual const std::string & get_control_type() const override
See tcontrol::get_control_type.
Definition: panel.cpp:88
virtual void set_self_active(const bool active) override
See tcontainer_::set_self_active.
Definition: panel.cpp:94
tresolution(const config &cfg)
Definition: panel.cpp:147
Base class of a resolution, contains the common keys for a resolution.
A class inherited from ttext_box that displays its input as stars.
Definition: field-fwd.hpp:23
virtual twidget * build() const =0
virtual SDL_Rect get_client_rect() const override
See tcontainer_::get_client_rect.
Definition: panel.cpp:37
Visible container to hold multiple widgets.
Definition: panel.hpp:34
virtual unsigned get_state() const override
See tcontrol::get_state.
Definition: panel.cpp:58
Holds a 2D point.
Definition: point.hpp:24
virtual void impl_draw_foreground(surface &frame_buffer, int x_offset, int y_offset) override
See twidget::impl_draw_foreground.
Definition: panel.cpp:71
A generic container base class.
Definition: container.hpp:32
virtual void impl_draw_background(surface &frame_buffer, int x_offset, int y_offset) override
See twidget::impl_draw_background.
Definition: panel.cpp:63
tpanel(const unsigned canvas_count=2)
Constructor.
Definition: panel.hpp:43
Base class for all widgets.
Definition: widget.hpp:49
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:83
virtual tpoint border_space() const override
See tcontainer_::border_space.
Definition: panel.cpp:77
GLsizei const GLcharARB ** string
Definition: glew.h:4503
tbuilder_panel(const config &cfg)
Definition: panel.cpp:192
Contains the implementation details for lexical_cast and shouldn't be used directly.