The Battle for Wesnoth  1.15.0+dev
progress_bar.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2010 - 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 namespace implementation
25 {
26 struct builder_progress_bar;
27 }
28 
29 // ------------ WIDGET -----------{
30 
32 {
33 public:
34  explicit progress_bar(const implementation::builder_progress_bar& builder);
35 
36  /***** ***** ***** ***** Inherited ***** ***** ***** *****/
37 
38  /** See @ref styled_widget::set_active. */
39  virtual void set_active(const bool active) override;
40 
41  /** See @ref styled_widget::get_active. */
42  virtual bool get_active() const override;
43 
44  /** See @ref styled_widget::get_state. */
45  virtual unsigned get_state() const override;
46 
47  /** See @ref widget::disable_click_dismiss. */
48  bool disable_click_dismiss() const override;
49 
50 
51  /***** ***** ***** setters / getters for members ***** ****** *****/
52 
53  void set_percentage(unsigned percentage);
54  unsigned get_percentage() const
55  {
56  return percentage_;
57  }
58 
59 private:
60  /**
61  * Possible states of the widget.
62  *
63  * Note the order of the states must be the same as defined in settings.hpp.
64  */
65  enum state_t {
67  };
68 
69  /** The percentage done. */
70  unsigned percentage_;
71 
72 public:
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 
81 // }---------- DEFINITION ---------{
82 
84 {
85  explicit progress_bar_definition(const config& cfg);
86 
88  {
89  explicit resolution(const config& cfg);
90  };
91 };
92 
93 // }---------- BUILDER -----------{
94 
95 namespace implementation
96 {
97 
99 {
100 
101  explicit builder_progress_bar(const config& cfg);
102 
104 
105  widget* build() const;
106 };
107 
108 } // namespace implementation
109 
110 // }------------ END --------------
111 
112 } // namespace gui2
Base class of a resolution, contains the common keys for a resolution.
virtual widget * build() const =0
Base class for all widgets.
Definition: widget.hpp:47
unsigned get_percentage() const
Generic file dialog.
Definition: field-fwd.hpp:22
state_t
Possible states of the widget.
window * build(const builder_window::window_resolution *definition)
Builds a window.
Base class for all visible items.
point resolution()
Definition: general.cpp:373
unsigned percentage_
The percentage done.
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:92
Contains the implementation details for lexical_cast and shouldn&#39;t be used directly.