mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-08-31 00:04:07 -04:00
Dual pane navigation & more player editor
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user