The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
viewport.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2012 - 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_VIEWPORT_HPP_INCLUDED
16 #define GUI_WIDGETS_VIEWPORT_HPP_INCLUDED
17 
19 #include "gui/widgets/widget.hpp"
20 
21 namespace gui2
22 {
23 
24 // ------------ WIDGET -----------{
25 
26 namespace implementation
27 {
28 struct tbuilder_viewport;
29 } // namespace implementation
30 
31 class tgrid;
32 
33 class tviewport : public twidget
34 {
35  friend struct tviewport_implementation;
36 
37 public:
38  /** @deprecated use the second overload. */
39  explicit tviewport(twidget& widget);
40 
41 private:
43  const tbuilder_widget::treplacements& replacements);
44 
45 public:
46  static tviewport* build(const implementation::tbuilder_viewport& builder,
47  const tbuilder_widget::treplacements& replacements);
48 
49  ~tviewport();
50 
51  /** See @ref twidget::place. */
52  virtual void place(const tpoint& origin, const tpoint& size) override;
53 
54  /** See @ref twidget::layout_initialise. */
55  virtual void layout_initialise(const bool full_initialisation) override;
56 
57  /** See @ref twidget::impl_draw_children. */
58  virtual void impl_draw_children(surface& frame_buffer,
59  int x_offset,
60  int y_offset) override;
61 
62  /** See @ref twidget::child_populate_dirty_list. */
63  virtual void
65  const std::vector<twidget*>& call_stack) override;
66 
67  /** See @ref twidget::request_reduce_width. */
68  virtual void request_reduce_width(const unsigned maximum_width) override;
69 
70  /** See @ref twidget::find_at. */
71  virtual twidget* find_at(const tpoint& coordinate,
72  const bool must_be_active) override;
73 
74  /** See @ref twidget::find_at. */
75  virtual const twidget* find_at(const tpoint& coordinate,
76  const bool must_be_active) const override;
77 
78  /** See @ref twidget::find. */
79  twidget* find(const std::string& id, const bool must_be_active) override;
80 
81  /** See @ref twidget::find. */
82  const twidget* find(const std::string& id,
83  const bool must_be_active) const override;
84 
85 private:
86  /** See @ref twidget::calculate_best_size. */
87  virtual tpoint calculate_best_size() const override;
88 
89 public:
90  /** See @ref twidget::disable_click_dismiss. */
91  bool disable_click_dismiss() const override;
92 
93  /** See @ref twidget::create_walker. */
94  virtual iterator::twalker_* create_walker() override;
95 
96 private:
98 
100 };
101 
102 // }---------- BUILDER -----------{
103 
104 namespace implementation
105 {
106 
108 {
109  explicit tbuilder_viewport(const config& cfg);
110 
111  twidget* build() const;
112 
113  twidget* build(const treplacements& replacements) const;
114 
116 };
117 
118 } // namespace implementation
119 
120 // }------------ END --------------
121 
122 } // namespace gui2
123 
124 #endif
virtual void child_populate_dirty_list(twindow &caller, const std::vector< twidget * > &call_stack) override
See twidget::child_populate_dirty_list.
Definition: viewport.cpp:138
virtual tpoint calculate_best_size() const override
See twidget::calculate_best_size.
Definition: viewport.cpp:171
virtual void request_reduce_width(const unsigned maximum_width) override
See twidget::request_reduce_width.
Definition: viewport.cpp:145
Contains the info needed to instantiate a widget.
virtual void impl_draw_children(surface &frame_buffer, int x_offset, int y_offset) override
See twidget::impl_draw_children.
Definition: viewport.cpp:124
virtual iterator::twalker_ * create_walker() override
See twidget::create_walker.
Definition: viewport.cpp:181
tviewport(twidget &widget)
Definition: viewport.cpp:80
base class of top level items, the only item which needs to store the final canvases to draw on ...
Definition: window.hpp:62
A class inherited from ttext_box that displays its input as stars.
Definition: field-fwd.hpp:23
Helper to implement private functions without modifying the header.
Definition: viewport.cpp:38
twidget & widget_
Definition: viewport.hpp:97
bool disable_click_dismiss() const override
See twidget::disable_click_dismiss.
Definition: viewport.cpp:176
virtual void place(const tpoint &origin, const tpoint &size) override
See twidget::place.
Definition: viewport.cpp:107
virtual void layout_initialise(const bool full_initialisation) override
See twidget::layout_initialise.
Definition: viewport.cpp:114
twidget * find(const std::string &id, const bool must_be_active) override
See twidget::find.
Definition: viewport.cpp:160
Holds a 2D point.
Definition: point.hpp:24
GLsizeiptr size
Definition: glew.h:1649
static tviewport * build(const implementation::tbuilder_viewport &builder, const tbuilder_widget::treplacements &replacements)
Definition: viewport.cpp:101
Base class for all widgets.
Definition: widget.hpp:49
The walker abstract base class.
Definition: walker.hpp:27
std::map< std::string, boost::intrusive_ptr< tbuilder_widget > > treplacements
The replacements type is used to define replacement types.
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:83
virtual twidget * find_at(const tpoint &coordinate, const bool must_be_active) override
See twidget::find_at.
Definition: viewport.cpp:149
GLsizei const GLcharARB ** string
Definition: glew.h:4503
Contains the implementation details for lexical_cast and shouldn't be used directly.