The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
unit_preview_pane.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2016 by the Battle for Wesnoth Project http://www.wesnoth.org/
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY.
10 
11  See the COPYING file for more details.
12 */
13 
14 #ifndef GUI_WIDGETS_UNIT_PREVIEW_PANE_HPP_INCLUDED
15 #define GUI_WIDGETS_UNIT_PREVIEW_PANE_HPP_INCLUDED
16 
18 
19 #include <string>
20 
21 class unit_type;
22 
23 namespace gui2
24 {
25 
26 // ------------ WIDGET -----------{
27 
28 class tbutton;
29 class timage;
30 class tlabel;
31 
32 namespace implementation
33 {
34  struct tbuilder_unit_preview_pane;
35 }
36 
38 {
40 
41 public:
43  : tcontainer_(1)
44  , current_type_("")
45  , icon_type_()
46  , icon_race_()
47  , icon_alignment_()
48  , label_name_()
49  , label_level_()
50  , label_details_()
51  , button_profile_()
52  {
53  }
54 
55  /**
56  * Initializes the interneral sub-widget pointers.
57  * Should be called when building the window, so the pointers
58  * are initilized when set_displayed_type() is called.
59  */
60  void finalize_setup();
61 
62  /** Displays the stats of a specified unit type */
63  void set_displayed_type(const unit_type* type);
64 
65  /** Callback for the profile button */
67 
68  /** See @ref tcontrol::set_active. */
69  virtual void set_active(const bool active) override;
70 
71  /** See @ref tcontrol::get_active. */
72  virtual bool get_active() const override;
73 
74  /** See @ref tcontrol::get_state. */
75  virtual unsigned get_state() const override;
76 
77 private:
79 
80  timage* icon_type_;
81  timage* icon_race_;
82  timage* icon_alignment_;
83 
87 
89 
90  enum tstate {
92  };
93 
94  /** See @ref tcontrol::get_control_type. */
95  virtual const std::string& get_control_type() const override;
96 
97  /** See @ref tcontainer_::set_self_active. */
98  virtual void set_self_active(const bool active) override;
99 
100 };
101 
102 // }---------- DEFINITION ---------{
103 
105 {
106 
107  explicit tunit_preview_pane_definition(const config& cfg);
108 
110  {
111  explicit tresolution(const config& cfg);
112 
114  };
115 };
116 
117 // }---------- BUILDER -----------{
118 
119 namespace implementation
120 {
121 
123 {
124  explicit tbuilder_unit_preview_pane(const config& cfg);
125 
127 
128  twidget* build() const;
129 };
130 
131 } // namespace implementation
132 
133 // }------------ END --------------
134 
135 } // namespace gui2
136 
137 #endif
virtual unsigned get_state() const override
See tcontrol::get_state.
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1221
void set_displayed_type(const unit_type *type)
Displays the stats of a specified unit type.
Label showing a text.
Definition: label.hpp:29
void finalize_setup()
Initializes the interneral sub-widget pointers.
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
Simple push button.
Definition: button.hpp:32
virtual bool get_active() const override
See tcontrol::get_active.
virtual const std::string & get_control_type() const override
See tcontrol::get_control_type.
virtual twidget * build() const =0
virtual void set_active(const bool active) override
See tcontrol::set_active.
void profile_button_callback()
Callback for the profile button.
virtual void set_self_active(const bool active) override
See tcontainer_::set_self_active.
A generic container base class.
Definition: container.hpp:32
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
GLsizei const GLcharARB ** string
Definition: glew.h:4503
Contains the implementation details for lexical_cast and shouldn't be used directly.