mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-08-15 20:15:32 -04:00
update seed generation modal when generation finishes
This commit is contained in:
+23
-8
@@ -27,14 +27,7 @@ Modal::Modal(Props props) : WindowSmall("modal", "modal-dialog"), mProps(std::mo
|
||||
actions->SetClass("modal-actions", true);
|
||||
|
||||
for (auto& action : mProps.actions) {
|
||||
auto btn = std::make_unique<Button>(actions, action.label);
|
||||
btn->root()->SetClass("modal-btn", true);
|
||||
btn->on_pressed([this, callback = std::move(action.onPressed)] {
|
||||
if (callback) {
|
||||
callback(*this);
|
||||
}
|
||||
});
|
||||
mButtons.push_back(std::move(btn));
|
||||
add_action(action);
|
||||
}
|
||||
|
||||
mDoAud_seStartMenu(kSoundWindowOpen);
|
||||
@@ -47,6 +40,28 @@ bool Modal::focus() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void Modal::add_action(ModalAction action) {
|
||||
auto actions = mDialog->QuerySelector(".modal-actions");
|
||||
auto btn = std::make_unique<Button>(actions, action.label);
|
||||
btn->root()->SetClass("modal-btn", true);
|
||||
btn->on_pressed([this, callback = std::move(action.onPressed)] {
|
||||
if (callback) {
|
||||
callback(*this);
|
||||
}
|
||||
});
|
||||
mButtons.push_back(std::move(btn));
|
||||
}
|
||||
|
||||
void Modal::set_body(const Rml::String& bodyRml) {
|
||||
auto body = mDialog->QuerySelector(".modal-body");
|
||||
body->SetInnerRML(bodyRml);
|
||||
}
|
||||
|
||||
void Modal::set_icon(const Rml::String& iconStr) {
|
||||
auto icon = mDialog->QuerySelector("icon");
|
||||
icon->SetClassNames({iconStr});
|
||||
}
|
||||
|
||||
void Modal::dismiss() {
|
||||
if (mProps.onDismiss) {
|
||||
mProps.onDismiss(*this);
|
||||
|
||||
Reference in New Issue
Block a user