neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
progress_bar.hpp
Go to the documentation of this file.
1// progress_bar.hpp
2/*
3 neogfx C++ App/Game Engine
4 Copyright (c) 2022 Leigh Johnston. All Rights Reserved.
5
6 This program is free software: you can redistribute it and / or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#pragma once
21
22#include <neogfx/neogfx.hpp>
28
29namespace neogfx
30{
31 class progress_bar : public widget<>, public i_progress_bar
32 {
34 public:
35 class bar : public widget<>
36 {
37 public:
38 bar(progress_bar& aOwner);
39 public:
40 size minimum_size(optional_size const& aAvailableSpace = optional_size{}) const override;
41 public:
42 void paint(i_graphics_context& aGc) const override;
43 private:
44 progress_bar& iOwner;
45 };
46 public:
50 public:
51 progress_bar_style style() const override;
52 void set_style(progress_bar_style aStyle) override;
53 i_string const& text() const override;
54 void set_text(i_string const& aText) override;
55 public:
56 scalar value() const override;
57 void set_value(scalar aValue) override;
58 scalar minimum() const override;
59 void set_minimum(scalar aMinimum) override;
60 scalar maximum() const override;
61 void set_maximum(scalar aMaximum) override;
62 public:
63 rect bar_rect() const override;
64 i_text_widget const& text_label() const override;
66 i_string const& value_as_text() const override;
67 private:
68 void init();
69 void placement_changed();
70 void changed();
71 void animate();
72 private:
73 progress_bar_style iStyle;
74 grid_layout iLayout;
75 bar iBar;
76 label iLabel;
77 string iText = "%pct%%%";
78 scalar iValue = 0.0;
79 scalar iMinimum = 0.0;
80 scalar iMaximum = 100.0;
81 string iValueAsText;
82 widget_timer iAnimator;
83 };
84}
void set_value(scalar aValue) override
void set_text(i_string const &aText) override
void set_minimum(scalar aMinimum) override
progress_bar(i_layout &aLayout, progress_bar_style aStyle=progress_bar_style::Default)
rect bar_rect() const override
scalar minimum() const override
scalar maximum() const override
void set_maximum(scalar aMaximum) override
progress_bar(i_widget &aParent, progress_bar_style aStyle=progress_bar_style::Default)
i_string const & text() const override
i_text_widget & text_label() override
i_string const & value_as_text() const override
progress_bar(progress_bar_style aStyle=progress_bar_style::Default)
i_text_widget const & text_label() const override
progress_bar_style style() const override
void set_style(progress_bar_style aStyle) override
scalar value() const override
double scalar
Definition numerical.hpp:63
#define meta_object(...)
Definition i_object.hpp:28