mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-06-25 15:20:31 -04:00
Add Remote App & UI updates. (#1451)
* Alpha order sub-menus * WIP Getting Remote types outlined * WIP building UI * WIP adding RemoteButton control * WIP Fix build * WIP Basic editing support * Border on the active button * Make TxView2 sane * Add easier RGB color creation from uint32 * Center some button icons * WIP Remote - main UI * WIP main UI mostly working, can send * Add 'join' utility * WIP save/load * Pre-alloc buttons to prevent focus dangling * Alpha order settings/debug pages * Add UI for picking capture and set frequency * WIP Getting really close now * Fix path for init name * Some fit & finish
This commit is contained in:
parent
537cf2e79b
commit
fca373d936
27 changed files with 1205 additions and 312 deletions
|
@ -1139,9 +1139,9 @@ NewButton::NewButton(
|
|||
Color color,
|
||||
bool vertical_center)
|
||||
: Widget{parent_rect},
|
||||
color_{color},
|
||||
text_{text},
|
||||
bitmap_{bitmap},
|
||||
color_{color},
|
||||
vertical_center_{vertical_center} {
|
||||
set_focusable(true);
|
||||
}
|
||||
|
@ -1182,18 +1182,8 @@ void NewButton::paint(Painter& painter) {
|
|||
if (!bitmap_ && text_.empty())
|
||||
return;
|
||||
|
||||
Color bg, fg;
|
||||
const auto r = screen_rect();
|
||||
|
||||
if (has_focus() || highlighted()) {
|
||||
bg = style().foreground;
|
||||
fg = Color::black();
|
||||
} else {
|
||||
bg = Color::grey();
|
||||
fg = style().foreground;
|
||||
}
|
||||
|
||||
const Style paint_style = {style().font, bg, fg};
|
||||
const Style style = paint_style();
|
||||
|
||||
painter.draw_rectangle({r.location(), {r.width(), 1}}, Color::light_grey());
|
||||
painter.draw_rectangle({r.left(), r.top() + r.height() - 1, r.width(), 1}, Color::dark_grey());
|
||||
|
@ -1201,7 +1191,7 @@ void NewButton::paint(Painter& painter) {
|
|||
|
||||
painter.fill_rectangle(
|
||||
{r.left(), r.top() + 1, r.width() - 1, r.height() - 2},
|
||||
paint_style.background);
|
||||
style.background);
|
||||
|
||||
int y = r.top();
|
||||
if (bitmap_) {
|
||||
|
@ -1213,18 +1203,32 @@ void NewButton::paint(Painter& painter) {
|
|||
bmp_pos,
|
||||
*bitmap_,
|
||||
color_,
|
||||
bg);
|
||||
style.background);
|
||||
}
|
||||
|
||||
if (!text_.empty()) {
|
||||
const auto label_r = paint_style.font.size_of(text_);
|
||||
const auto label_r = style.font.size_of(text_);
|
||||
painter.draw_string(
|
||||
{r.left() + (r.width() - label_r.width()) / 2, y + (r.height() - label_r.height()) / 2},
|
||||
paint_style,
|
||||
style,
|
||||
text_);
|
||||
}
|
||||
}
|
||||
|
||||
Style NewButton::paint_style() {
|
||||
MutableStyle s{style()};
|
||||
|
||||
if (has_focus() || highlighted()) {
|
||||
s.background = style().foreground;
|
||||
s.foreground = Color::black();
|
||||
} else {
|
||||
s.background = Color::grey();
|
||||
s.foreground = style().foreground;
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
void NewButton::on_focus() {
|
||||
if (on_highlight)
|
||||
on_highlight(*this);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue