GUIFramework 1.1.0
Framework for desktop GUI applications in C++.
Loading...
Searching...
No Matches
BaseProgressBar.cpp
Go to the documentation of this file.
1#include "BaseProgressBar.h"
2
5
6using namespace std;
7
8namespace gui_framework
9{
10 BaseProgressBar::BaseProgressBar(const wstring& progressBarName, const utility::ComponentSettings& settings, BaseComposite* parent, int minRange, int maxRange, int updateStep) :
12 (
13 standard_classes::progressBar,
14 progressBarName,
15 settings,
16 styles::DefaultStyles(),
17 parent
18 ),
19 IProgressBarColor
20 (
21 handle
22 ),
23 minRange(minRange),
24 maxRange(maxRange),
25 updateStep(updateStep)
26 {
27
28 }
29
30 void BaseProgressBar::update(int newPosition)
31 {
32 SendMessageW(handle, PBM_SETPOS, newPosition, NULL);
33 }
34
36 {
37 SendMessageW(handle, PBM_STEPIT, NULL, NULL);
38 }
39
41 {
42 SendMessageW(handle, PBM_DELTAPOS, position, NULL);
43 }
44
46 {
47 SendMessageW(handle, PBM_SETRANGE32, minRange, maxRange);
48
49 this->minRange = minRange;
50 }
51
53 {
54 SendMessageW(handle, PBM_SETRANGE32, minRange, maxRange);
55
56 this->maxRange = maxRange;
57 }
58
59 void BaseProgressBar::setUpdateStep(int updateStep)
60 {
61 this->updateStep = updateStep;
62
63 SendMessageW(handle, PBM_SETSTEP, updateStep, NULL);
64 }
65
67 {
68 return updateStep;
69 }
70
72 {
73 return minRange;
74 }
75
77 {
78 return maxRange;
79 }
80
81 void BaseProgressBar::setBackgroundColor(uint8_t red, uint8_t green, uint8_t blue)
82 {
83 BaseComponent::setBackgroundColor(red, green, blue);
84
85 IProgressBarColor::setProgressBarBackgroundColor(red, green, blue);
86 }
87
88 void BaseProgressBar::setProgressBarBackgroundColor(uint8_t red, uint8_t green, uint8_t blue)
89 {
90 BaseComponent::setBackgroundColor(red, green, blue);
91
92 IProgressBarColor::setProgressBarBackgroundColor(red, green, blue);
93 }
94
95 void BaseProgressBar::setTextColor(uint8_t red, uint8_t green, uint8_t blue)
96 {
97 __utility::throwNotImplementedException(__FUNCTION__, "BaseProgressBar"sv);
98 }
99
100 json::JSONBuilder BaseProgressBar::getStructure() const
101 {
102 using json::utility::jsonObject;
103
104 json::JSONBuilder builder = BaseComponent::getStructure();
105 jsonObject& current = get<jsonObject>(builder[utility::to_string(windowName, ISerializable::getCodepage())]);
106
107 current.data.push_back({ "minRange"s, static_cast<int64_t>(minRange) });
108 current.data.push_back({ "maxRange"s, static_cast<int64_t>(maxRange) });
109
110 current.data.push_back({ "updateStep"s, static_cast<int64_t>(updateStep) });
111
112 return builder;
113 }
114}
Base class for all windows, controls, etc.
virtual json::JSONBuilder getStructure() const override
const std::wstring windowName
virtual void setBackgroundColor(uint8_t red, uint8_t green, uint8_t blue)
Base class for all windows that has children windows.
virtual void setTextColor(uint8_t red, uint8_t green, uint8_t blue) final override
Not implemented.
virtual int getMaxRange() const final
virtual void setUpdateStep(int updateStep) final
virtual int getMinRange() const final
virtual void setMaxRange(int maxRange) final
virtual void advancePosition(int position) final
virtual void setMinRange(int minRange) final
virtual void setProgressBarBackgroundColor(uint8_t red, uint8_t green, uint8_t blue) final override
Inherited from IProgressBarColor.
BaseProgressBar(const std::wstring &progressBarName, const utility::ComponentSettings &settings, BaseComposite *parent, int minRange=defaultMinRange, int maxRange=defaultMaxRange, int updateStep=defaultUpdateStep)
virtual void setBackgroundColor(uint8_t red, uint8_t green, uint8_t blue) final override
Same as setProgressBarBackgroundColor.
virtual json::JSONBuilder getStructure() const override
virtual int getUpdateStep() const final
void throwNotImplementedException(string_view methodName, string_view className)
Definition Utility.cpp:186
string to_string(wstring_view stringToConvert, uint32_t codepage)
Definition Utility.cpp:41