mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-05-24 15:00:55 -04:00
Pane: Focus selected child first
This commit is contained in:
+1
-1
@@ -55,7 +55,7 @@ popup tab-bar tab {
|
||||
transition: decorator 0.1s linear-in-out, opacity 0.1s linear-in-out;
|
||||
}
|
||||
|
||||
popup tab-bar tab.selected {
|
||||
popup tab-bar tab:selected {
|
||||
opacity: 1;
|
||||
border-bottom: 4dp #C2A42D;
|
||||
font-effect: glow(0dp 4dp 0dp 4dp black);
|
||||
|
||||
+3
-5
@@ -70,7 +70,7 @@ window tab-bar tab {
|
||||
transition: decorator 0.1s linear-in-out, opacity 0.1s linear-in-out;
|
||||
}
|
||||
|
||||
window tab-bar tab.selected {
|
||||
window tab-bar tab:selected {
|
||||
opacity: 1;
|
||||
border-bottom: 4dp #C2A42D;
|
||||
font-effect: glow(0dp 4dp 0dp 4dp black);
|
||||
@@ -193,14 +193,13 @@ button {
|
||||
focus: auto;
|
||||
}
|
||||
|
||||
button:not(:disabled).active,
|
||||
button:not(:disabled):hover,
|
||||
button:not(:disabled):focus-visible {
|
||||
background-color: rgba(204, 184, 119, 20%);
|
||||
box-shadow: #C2A42D 0 0 0 2dp;
|
||||
}
|
||||
|
||||
button:not(:disabled).selected,
|
||||
button:not(:disabled):selected,
|
||||
button:not(:disabled):active {
|
||||
opacity: 1;
|
||||
background-color: rgba(204, 184, 119, 40%);
|
||||
@@ -221,14 +220,13 @@ select-button {
|
||||
focus: auto;
|
||||
}
|
||||
|
||||
select-button:not(:disabled).active,
|
||||
select-button:not(:disabled):hover,
|
||||
select-button:not(:disabled):focus-visible {
|
||||
background-color: rgba(204, 184, 119, 20%);
|
||||
box-shadow: #C2A42D 0 0 0 2dp;
|
||||
}
|
||||
|
||||
select-button:not(:disabled).selected,
|
||||
select-button:not(:disabled):selected,
|
||||
select-button:not(:disabled):active {
|
||||
opacity: 1;
|
||||
background-color: rgba(204, 184, 119, 40%);
|
||||
|
||||
@@ -29,7 +29,7 @@ void Button::set_text(const Rml::String& text) {
|
||||
|
||||
void Button::set_selected(bool selected) {
|
||||
if (mProps.selected != selected) {
|
||||
mRoot->SetClass("selected", selected);
|
||||
mRoot->SetPseudoClass("selected", selected);
|
||||
mProps.selected = selected;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ public:
|
||||
}
|
||||
|
||||
Rml::Element* root() const { return mRoot; }
|
||||
bool selected() const { return mRoot->IsPseudoClassSet("selected"); }
|
||||
|
||||
protected:
|
||||
static Rml::Element* append(Rml::Element* parent, const Rml::String& tag);
|
||||
|
||||
@@ -57,6 +57,12 @@ void Pane::update() {
|
||||
}
|
||||
|
||||
bool Pane::focus() {
|
||||
// If there's a selected child, focus that
|
||||
for (const auto& child : mChildren) {
|
||||
if (child->selected() && child->focus()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for (const auto& child : mChildren) {
|
||||
if (child->focus()) {
|
||||
return true;
|
||||
|
||||
@@ -47,7 +47,7 @@ bool SelectButton::focus() {
|
||||
|
||||
void SelectButton::set_selected(bool selected) {
|
||||
if (mProps.selected != selected) {
|
||||
mRoot->SetClass("selected", selected);
|
||||
mRoot->SetPseudoClass("selected", selected);
|
||||
mProps.selected = selected;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user