mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-08 03:45:24 +00:00
dialog: allow custom 'Select_button' attributes
This is useful to conditionally set the style to "unimportant", or to use text other than the widget Id::Value. Issue #5008 Issue #5053
This commit is contained in:
parent
133cbd272e
commit
fa6c7204cd
@ -56,7 +56,7 @@ struct Dialog::Select_button : Widget<Button>
|
||||
|
||||
Select_button(ENUM value) : _value(value) { }
|
||||
|
||||
void view(Scope<Button> &s, ENUM selected_value) const
|
||||
void view(Scope<Button> &s, ENUM selected_value, auto const &fn) const
|
||||
{
|
||||
bool const selected = (selected_value == _value),
|
||||
hovered = (s.hovered() && !s.dragged() && !selected);
|
||||
@ -64,7 +64,13 @@ struct Dialog::Select_button : Widget<Button>
|
||||
if (selected) s.attribute("selected", "yes");
|
||||
if (hovered) s.attribute("hovered", "yes");
|
||||
|
||||
s.sub_scope<Dialog::Label>(s.id.value);
|
||||
fn(s);
|
||||
}
|
||||
|
||||
void view(Scope<Button> &s, ENUM selected_value) const
|
||||
{
|
||||
view(s, selected_value, [&] (auto &s) {
|
||||
s.template sub_scope<Dialog::Label>(s.id.value); });
|
||||
}
|
||||
|
||||
template <typename FN>
|
||||
|
Loading…
x
Reference in New Issue
Block a user