Skip to content

Commit cb7a223

Browse files
committed
Merge branch 'skia_2024'
2 parents 17d84d0 + f7f8d43 commit cb7a223

File tree

4 files changed

+10
-16
lines changed

4 files changed

+10
-16
lines changed

examples/status_bars/main.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using namespace cycfi::elements;
1010
using namespace std::chrono_literals;
1111

12+
constexpr auto bred = colors::red.opacity(0.4);
1213
constexpr auto bgreen = colors::green.level(0.7).opacity(0.8);
1314
constexpr auto pgold = colors::gold.opacity(0.8);
1415

@@ -42,12 +43,12 @@ void prog_animate(concepts::StatusBar auto& prog_bar, view& view_)
4243

4344
auto make_bars(view& view_)
4445
{
45-
auto prog_bar = share(progress_bar(rbox(colors::black), rbox(pgold)));
46-
auto bsy_bar = share(busy_bar(rbox(colors::black), rbox(bgreen)));
47-
auto start_stop = toggle_icon_button(icons::play, icons::stop, 2.0);
46+
auto prog_bar = share(progress_bar(rbox(colors::black), rbox(pgold)));
47+
auto bsy_bar = share(busy_bar(rbox(colors::black), rbox(bgreen)));
48+
auto start_stop = toggle_icon_button(icons::play, icons::stop, 2.0, bred);
4849

4950
start_stop.on_click =
50-
[prog_bar, bsy_bar, &view_](bool state) mutable
51+
[prog_bar, bsy_bar, &view_](bool state)
5152
{
5253
if (state)
5354
{
@@ -66,7 +67,7 @@ auto make_bars(view& view_)
6667
return
6768
margin({20, 20, 20, 20},
6869
htile(
69-
start_stop,
70+
align_middle(start_stop),
7071
hspace(10),
7172
vtile(
7273
vsize(27, hold(prog_bar)),

lib/include/elements/element/status_bar.hpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ namespace cycfi::elements
108108

109109
void start(view& view_, duration time);
110110
void stop(view& view_);
111+
bool is_stopped() const { return _time == _time.zero(); }
111112

112113
rect foreground_bounds(context const& ctx) const override;
113114

@@ -132,7 +133,8 @@ namespace cycfi::elements
132133
return {
133134
std::forward<Background>(bg),
134135
std::forward<Foreground>(fg),
135-
init_value, start_pos};
136+
init_value, start_pos
137+
};
136138
}
137139
}
138140

lib/src/element/busy_bar.cpp

-9
This file was deleted.

lib/src/element/status_bar.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ namespace cycfi::elements
126126

127127
void busy_bar_base::animate(view& view_)
128128
{
129-
if (_time == _time.zero())
129+
if (is_stopped())
130130
{
131131
_status = -0.2;
132132
value(0.0);

0 commit comments

Comments
 (0)