Dual pane navigation & more player editor

This commit is contained in:
Luke Street
2026-05-01 12:06:00 -06:00
parent 2b505f1be4
commit 8f7b9cdfdd
13 changed files with 437 additions and 115 deletions
+28 -1
View File
@@ -13,6 +13,9 @@ void Component::update() {
}
bool Component::focus() {
if (disabled()) {
return false;
}
// Can we focus self?
if (mRoot->Focus(true)) {
mRoot->ScrollIntoView(Rml::ScrollIntoViewOptions{
@@ -32,6 +35,31 @@ bool Component::focus() {
return false;
}
void Component::set_selected(bool value) {
// Subclasses may override selected() to return a dynamic value, but
// we're only interested in if the pseudoclass is set or not, so we
// use Component::selected() directly rather than selected().
if (Component::selected() == value) {
return;
}
mRoot->SetPseudoClass("selected", value);
mRoot->DispatchEvent(Rml::EventId::Change, {{"selected", Rml::Variant{value}}});
}
void Component::set_disabled(bool value) {
if (Component::disabled() == value) {
return;
}
if (value) {
mRoot->SetAttribute("disabled", "");
mRoot->SetPseudoClass("disabled", true);
mRoot->Blur();
} else {
mRoot->RemoveAttribute("disabled");
mRoot->SetPseudoClass("disabled", false);
}
}
Rml::Element* Component::append(Rml::Element* parent, const Rml::String& tag) {
if (parent == nullptr) {
return nullptr;
@@ -42,7 +70,6 @@ Rml::Element* Component::append(Rml::Element* parent, const Rml::String& tag) {
}
return parent->AppendChild(doc->CreateElement(tag));
}
void Component::listen(Rml::Element* element, Rml::EventId event,
ScopedEventListener::Callback callback, bool capture) {
if (element == nullptr) {