GCC Code Coverage Report


Directory: src/gate/
File: src/gate/ui/cxx_statusbars.cpp
Date: 2025-12-12 23:40:09
Exec Total Coverage
Lines: 66 77 85.7%
Functions: 13 15 86.7%
Branches: 18 46 39.1%

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 1 Statusbar::Statusbar()
37 1 : Control(&impl.ctrl)
38 {
39 1 Mem::clear(&this->impl, sizeof(this->impl));
40
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 gate_ui_ctrl_init(&this->impl.ctrl);
41 1 }
42 2 Statusbar::~Statusbar() noexcept
43 {
44
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
2 if (this->isCreated())
45 {
46 this->destroy();
47 }
48 2 }
49 1 void Statusbar::create(ControlContainer& parent, Position const& pose, String const& caption, uint32_t flags)
50 {
51 1 this->failIfCreated("Statusbar::create");
52
53 1 result_t result = gate_ui_statusbar_create(&this->impl, *parent, &pose, caption.c_impl(), flags, this);
54
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 GATEXX_CHECK_ERROR(result);
55
56 1 this->attachNativeControl(&this->impl.ctrl);
57 1 }
58
59
60
61
62
63
64
65 1 Progressbar::Progressbar()
66 1 : Control(&impl.ctrl)
67 {
68 1 Mem::clear(&this->impl, sizeof(this->impl));
69
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 gate_ui_ctrl_init(&this->impl.ctrl);
70 1 }
71 2 Progressbar::~Progressbar() noexcept
72 {
73 2 this->destroy();
74 2 }
75
76 1 void Progressbar::create(ControlContainer& parent, Position const& pos, uint32_t flags)
77 {
78 1 this->failIfCreated("Progressbar::create");
79
80 1 result_t result = gate_ui_progressbar_create(&this->impl, *parent, &pos, flags, this);
81
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 GATEXX_CHECK_ERROR(result);
82
83 1 this->attachNativeControl(&this->impl.ctrl);
84 1 }
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 1 void Progressbar::setMinMax(uint32_t minimum, uint32_t maximum)
99 {
100 1 this->failIfNotCreated("Progressbar::setMinMax");
101 1 result_t result = gate_ui_progressbar_set_limits(&this->impl, &minimum, &maximum);
102
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 GATEXX_CHECK_EXCEPTION(result);
103 1 }
104
105 3 void Progressbar::setValue(uint32_t value)
106 {
107 3 this->failIfNotCreated("Progressbar::setValue");
108 3 result_t result = gate_ui_progressbar_set_value(&this->impl, value);
109
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
3 GATEXX_CHECK_EXCEPTION(result);
110 3 }
111 1 void Progressbar::setPercent(real32_t value)
112 {
113 1 this->failIfNotCreated("Progressbar::setPercent");
114 1 result_t result = gate_ui_progressbar_set_percent(&this->impl, value);
115
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 GATEXX_CHECK_EXCEPTION(result);
116 1 }
117
118 1 uint32_t Progressbar::getMinimum()
119 {
120
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->failIfNotCreated("Progressbar::getMinimum");
121 1 uint32_t ret = 0;
122
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 result_t result = gate_ui_progressbar_get_limits(&this->impl, &ret, NULL);
123
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 GATEXX_CHECK_EXCEPTION(result);
124 1 return ret;
125 }
126 1 uint32_t Progressbar::getMaximum()
127 {
128
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->failIfNotCreated("Progressbar::getMaximum");
129 1 uint32_t ret = 0;
130
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 result_t result = gate_ui_progressbar_get_limits(&this->impl, NULL, &ret);
131
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 GATEXX_CHECK_EXCEPTION(result);
132 1 return ret;
133 }
134 1 void Progressbar::getMinMax(uint32_t& minimum, uint32_t& maximum)
135 {
136 1 this->failIfNotCreated("Progressbar::getMinMax");
137 1 result_t result = gate_ui_progressbar_get_limits(&this->impl, &minimum, &maximum);
138
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 GATEXX_CHECK_EXCEPTION(result);
139 1 }
140 1 uint32_t Progressbar::getValue()
141 {
142
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 this->failIfNotCreated("Progressbar::getValue");
143 1 uint32_t ret = 0;
144
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 result_t result = gate_ui_progressbar_get_value(&this->impl, &ret);
145
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 GATEXX_CHECK_EXCEPTION(result);
146 1 return ret;
147 }
148
149
150
151 } // end of namespace ui
152 } // end of namespace gate
153