Skip to content

Commit f7f8d43

Browse files
committed
some more tweaks
1 parent 729980e commit f7f8d43

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
@@ -11,6 +11,7 @@ using cycfi::artist::rgba;
1111
namespace colors = cycfi::artist::colors;
1212
using namespace std::chrono_literals;
1313

14+
constexpr auto bred = colors::red.opacity(0.4);
1415
constexpr auto bgreen = colors::green.level(0.7).opacity(0.8);
1516
constexpr auto pgold = colors::gold.opacity(0.8);
1617

@@ -44,12 +45,12 @@ void prog_animate(concepts::StatusBar auto& prog_bar, view& view_)
4445

4546
auto make_bars(view& view_)
4647
{
47-
auto prog_bar = share(progress_bar(rbox(colors::black), rbox(pgold)));
48-
auto bsy_bar = share(busy_bar(rbox(colors::black), rbox(bgreen)));
49-
auto start_stop = toggle_icon_button(icons::play, icons::stop, 2.0);
48+
auto prog_bar = share(progress_bar(rbox(colors::black), rbox(pgold)));
49+
auto bsy_bar = share(busy_bar(rbox(colors::black), rbox(bgreen)));
50+
auto start_stop = toggle_icon_button(icons::play, icons::stop, 2.0, bred);
5051

5152
start_stop.on_click =
52-
[prog_bar, bsy_bar, &view_](bool state) mutable
53+
[prog_bar, bsy_bar, &view_](bool state)
5354
{
5455
if (state)
5556
{
@@ -68,7 +69,7 @@ auto make_bars(view& view_)
6869
return
6970
margin({20, 20, 20, 20},
7071
htile(
71-
start_stop,
72+
align_middle(start_stop),
7273
hspace(10),
7374
vtile(
7475
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)