Line |
Branch |
Exec |
Source |
1 |
|
|
/* GATE PROJECT LICENSE: |
2 |
|
|
+----------------------------------------------------------------------------+ |
3 |
|
|
| Copyright(c) 2018-2025, Stefan Meislinger <sm@opengate.at> | |
4 |
|
|
| All rights reserved. | |
5 |
|
|
| | |
6 |
|
|
| Redistribution and use in source and binary forms, with or without | |
7 |
|
|
| modification, are permitted provided that the following conditions are met:| |
8 |
|
|
| | |
9 |
|
|
| 1. Redistributions of source code must retain the above copyright notice, | |
10 |
|
|
| this list of conditions and the following disclaimer. | |
11 |
|
|
| 2. Redistributions in binary form must reproduce the above copyright | |
12 |
|
|
| notice, this list of conditions and the following disclaimer in the | |
13 |
|
|
| documentation and/or other materials provided with the distribution. | |
14 |
|
|
| | |
15 |
|
|
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"| |
16 |
|
|
| AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
17 |
|
|
| IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
18 |
|
|
| ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | |
19 |
|
|
| LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
20 |
|
|
| CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
21 |
|
|
| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
22 |
|
|
| INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
23 |
|
|
| CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
24 |
|
|
| ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
25 |
|
|
| THE POSSIBILITY OF SUCH DAMAGE. | |
26 |
|
|
+----------------------------------------------------------------------------+ |
27 |
|
|
*/ |
28 |
|
|
|
29 |
|
|
#include "gate/ui/statusbars.hpp" |
30 |
|
|
|
31 |
|
|
namespace gate |
32 |
|
|
{ |
33 |
|
|
namespace ui |
34 |
|
|
{ |
35 |
|
|
|
36 |
|
✗ |
Statusbar::Statusbar() |
37 |
|
✗ |
: Control(&impl.ctrl) |
38 |
|
|
{ |
39 |
|
✗ |
Mem::clear(&this->impl, sizeof(this->impl)); |
40 |
|
✗ |
gate_ui_ctrl_init(&this->impl.ctrl); |
41 |
|
✗ |
} |
42 |
|
✗ |
Statusbar::~Statusbar() noexcept |
43 |
|
|
{ |
44 |
|
✗ |
if (this->isCreated()) |
45 |
|
|
{ |
46 |
|
✗ |
this->destroy(); |
47 |
|
|
} |
48 |
|
✗ |
} |
49 |
|
✗ |
void Statusbar::create(ControlContainer& parent, Position const& pose, String const& caption, uint32_t flags) |
50 |
|
|
{ |
51 |
|
✗ |
this->failIfCreated("Statusbar::create"); |
52 |
|
|
|
53 |
|
✗ |
result_t result = gate_ui_statusbar_create(&this->impl, *parent, &pose, caption.c_impl(), flags, this); |
54 |
|
✗ |
GATEXX_CHECK_ERROR(result); |
55 |
|
|
|
56 |
|
✗ |
this->attachNativeControl(&this->impl.ctrl); |
57 |
|
✗ |
} |
58 |
|
|
|
59 |
|
|
|
60 |
|
|
|
61 |
|
|
|
62 |
|
|
|
63 |
|
|
|
64 |
|
|
|
65 |
|
✗ |
Progressbar::Progressbar() |
66 |
|
✗ |
: Control(&impl.ctrl) |
67 |
|
|
{ |
68 |
|
✗ |
Mem::clear(&this->impl, sizeof(this->impl)); |
69 |
|
✗ |
gate_ui_ctrl_init(&this->impl.ctrl); |
70 |
|
✗ |
} |
71 |
|
✗ |
Progressbar::~Progressbar() noexcept |
72 |
|
|
{ |
73 |
|
✗ |
this->destroy(); |
74 |
|
✗ |
} |
75 |
|
|
|
76 |
|
✗ |
void Progressbar::create(ControlContainer& parent, Position const& pos, uint32_t flags) |
77 |
|
|
{ |
78 |
|
✗ |
this->failIfCreated("Progressbar::create"); |
79 |
|
|
|
80 |
|
✗ |
result_t result = gate_ui_progressbar_create(&this->impl, *parent, &pos, flags, this); |
81 |
|
✗ |
GATEXX_CHECK_ERROR(result); |
82 |
|
|
|
83 |
|
✗ |
this->attachNativeControl(&this->impl.ctrl); |
84 |
|
✗ |
} |
85 |
|
|
|
86 |
|
✗ |
void Progressbar::setMinimum(uint32_t value) |
87 |
|
|
{ |
88 |
|
✗ |
this->failIfNotCreated("Progressbar::setMinimum"); |
89 |
|
✗ |
result_t result = gate_ui_progressbar_set_limits(&this->impl, &value, NULL); |
90 |
|
✗ |
GATEXX_CHECK_EXCEPTION(result); |
91 |
|
✗ |
} |
92 |
|
✗ |
void Progressbar::setMaximum(uint32_t value) |
93 |
|
|
{ |
94 |
|
✗ |
this->failIfNotCreated("Progressbar::setMaximum"); |
95 |
|
✗ |
result_t result = gate_ui_progressbar_set_limits(&this->impl, NULL, &value); |
96 |
|
✗ |
GATEXX_CHECK_EXCEPTION(result); |
97 |
|
✗ |
} |
98 |
|
✗ |
void Progressbar::setMinMax(uint32_t minimum, uint32_t maximum) |
99 |
|
|
{ |
100 |
|
✗ |
this->failIfNotCreated("Progressbar::setMinMax"); |
101 |
|
✗ |
result_t result = gate_ui_progressbar_set_limits(&this->impl, &minimum, &maximum); |
102 |
|
✗ |
GATEXX_CHECK_EXCEPTION(result); |
103 |
|
✗ |
} |
104 |
|
|
|
105 |
|
✗ |
void Progressbar::setValue(uint32_t value) |
106 |
|
|
{ |
107 |
|
✗ |
this->failIfNotCreated("Progressbar::setValue"); |
108 |
|
✗ |
result_t result = gate_ui_progressbar_set_value(&this->impl, value); |
109 |
|
✗ |
GATEXX_CHECK_EXCEPTION(result); |
110 |
|
✗ |
} |
111 |
|
✗ |
void Progressbar::setPercent(real32_t value) |
112 |
|
|
{ |
113 |
|
✗ |
this->failIfNotCreated("Progressbar::setPercent"); |
114 |
|
✗ |
result_t result = gate_ui_progressbar_set_percent(&this->impl, value); |
115 |
|
✗ |
GATEXX_CHECK_EXCEPTION(result); |
116 |
|
✗ |
} |
117 |
|
|
|
118 |
|
✗ |
uint32_t Progressbar::getMinimum() |
119 |
|
|
{ |
120 |
|
✗ |
this->failIfNotCreated("Progressbar::getMinimum"); |
121 |
|
✗ |
uint32_t ret = 0; |
122 |
|
✗ |
result_t result = gate_ui_progressbar_get_limits(&this->impl, &ret, NULL); |
123 |
|
✗ |
GATEXX_CHECK_EXCEPTION(result); |
124 |
|
✗ |
return ret; |
125 |
|
|
} |
126 |
|
✗ |
uint32_t Progressbar::getMaximum() |
127 |
|
|
{ |
128 |
|
✗ |
this->failIfNotCreated("Progressbar::getMaximum"); |
129 |
|
✗ |
uint32_t ret = 0; |
130 |
|
✗ |
result_t result = gate_ui_progressbar_get_limits(&this->impl, NULL, &ret); |
131 |
|
✗ |
GATEXX_CHECK_EXCEPTION(result); |
132 |
|
✗ |
return ret; |
133 |
|
|
} |
134 |
|
✗ |
void Progressbar::getMinMax(uint32_t& minimum, uint32_t& maximum) |
135 |
|
|
{ |
136 |
|
✗ |
this->failIfNotCreated("Progressbar::getMinMax"); |
137 |
|
✗ |
result_t result = gate_ui_progressbar_get_limits(&this->impl, &minimum, &maximum); |
138 |
|
✗ |
GATEXX_CHECK_EXCEPTION(result); |
139 |
|
✗ |
} |
140 |
|
✗ |
uint32_t Progressbar::getValue() |
141 |
|
|
{ |
142 |
|
✗ |
this->failIfNotCreated("Progressbar::getValue"); |
143 |
|
✗ |
uint32_t ret = 0; |
144 |
|
✗ |
result_t result = gate_ui_progressbar_get_value(&this->impl, &ret); |
145 |
|
✗ |
GATEXX_CHECK_EXCEPTION(result); |
146 |
|
✗ |
return ret; |
147 |
|
|
} |
148 |
|
|
|
149 |
|
|
|
150 |
|
|
|
151 |
|
|
} // end of namespace ui |
152 |
|
|
} // end of namespace gate |
153 |
|
|
|