Boost.UI
User Interface Boost library
progress_bar.hpp
Go to the documentation of this file.
1 // Copyright (c) 2017 Kolya Kosenko
2 
3 // Distributed under the Boost Software License, Version 1.0.
4 // See http://www.boost.org/LICENSE_1_0.txt
5 
7 
8 #ifndef BOOST_UI_PROGRESS_BAR_HPP
9 #define BOOST_UI_PROGRESS_BAR_HPP
10 
11 #include <boost/ui/config.hpp>
12 
13 #ifdef BOOST_HAS_PRAGMA_ONCE
14 #pragma once
15 #endif
16 
17 #include <boost/ui/widget.hpp>
18 
19 namespace boost {
20 namespace ui {
21 
25 
26 class BOOST_UI_DECL progress_bar : public widget
27 {
28 public:
30  typedef int value_type;
31 
34  progress_bar& value(value_type value);
35 
37  value_type value() const;
38 
40  value_type max() const;
41 
42 protected:
43  progress_bar() {}
44 
45 #ifndef DOXYGEN
46  void detail_create(widget& parent, bool horizontal, value_type initial,
47  value_type max);
48 #endif
49 
50 private:
51  void check_range(value_type value) const
52  { check_range(value, max()); }
53  static void check_range(value_type value, value_type max);
54 
55  class detail_impl;
56  detail_impl* get_impl();
57  const detail_impl* get_impl() const;
58 };
59 
62 
63 class BOOST_UI_DECL hprogress_bar : public progress_bar
64 {
65 public:
66  hprogress_bar() {}
67 
70  explicit hprogress_bar(widget& parent, value_type initial = 0,
71  value_type max = 100)
72  { create(parent, initial, max); }
73  hprogress_bar& create(widget& parent, value_type initial = 0,
74  value_type max = 100)
75  { detail_create(parent, true, initial, max); return *this; }
77 };
78 
81 
82 class BOOST_UI_DECL vprogress_bar : public progress_bar
83 {
84 public:
85  vprogress_bar() {}
86 
89  explicit vprogress_bar(widget& parent, value_type initial = 0,
90  value_type max = 100)
91  { create(parent, initial, max); }
92  vprogress_bar& create(widget& parent, value_type initial = 0,
93  value_type max = 100)
94  { detail_create(parent, false, initial, max); return *this; }
96 };
97 
98 } // namespace ui
99 } // namespace boost
100 
101 #endif // BOOST_UI_PROGRESS_BAR_HPP
boost::ui::progress_bar::value_type
int value_type
Progress bar value type.
Definition: progress_bar.hpp:30
boost::ui::vprogress_bar::vprogress_bar
vprogress_bar(widget &parent, value_type initial=0, value_type max=100)
Creates vertical progress bar.
Definition: progress_bar.hpp:89
boost::ui::vprogress_bar::create
vprogress_bar & create(widget &parent, value_type initial=0, value_type max=100)
Creates vertical progress bar.
Definition: progress_bar.hpp:92
config.hpp
Configuration options.
widget.hpp
Widget class.
boost
Boost C++ libraries namespace.
Definition: window.hpp:19
boost::ui::hprogress_bar::hprogress_bar
hprogress_bar(widget &parent, value_type initial=0, value_type max=100)
Creates horizontal progress bar.
Definition: progress_bar.hpp:70
boost::ui::progress_bar
Progress bar widget base class.
Definition: progress_bar.hpp:26
boost::ui::vprogress_bar
Vertical progress bar widget.
Definition: progress_bar.hpp:82
boost::ui::widget
Base class for all widgets.
Definition: widget.hpp:45
boost::ui::hprogress_bar
Horizontal progress bar widget.
Definition: progress_bar.hpp:63
boost::ui::hprogress_bar::create
hprogress_bar & create(widget &parent, value_type initial=0, value_type max=100)
Creates horizontal progress bar.
Definition: progress_bar.hpp:73