Move app dialog overlays to checked handles
This commit is contained in:
@@ -15,6 +15,25 @@ namespace pp::panopainter {
|
||||
|
||||
namespace {
|
||||
|
||||
template <class NodeT>
|
||||
void attach_legacy_app_overlay_with_handle_or_fallback(
|
||||
App& app,
|
||||
const std::shared_ptr<NodeT>& node) noexcept
|
||||
{
|
||||
if (!node) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (auto* anchor = app.layout[app.main_id]) {
|
||||
const auto overlay = open_legacy_overlay_node_with_handle(*anchor, node);
|
||||
if (overlay) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
(void)attach_legacy_overlay_node(app, node);
|
||||
}
|
||||
|
||||
struct LegacyOverlayContext {
|
||||
pp::ui::NodeHandle root_handle {};
|
||||
pp::ui::NodeLifetimeTree tree {};
|
||||
@@ -320,7 +339,7 @@ std::shared_ptr<NodeProgressBar> create_legacy_progress_dialog_overlay(
|
||||
progress->m_title->set_text(plan.title.c_str());
|
||||
progress->m_total = plan.total;
|
||||
progress->m_count = plan.count;
|
||||
(void)attach_legacy_overlay_node(app, progress);
|
||||
attach_legacy_app_overlay_with_handle_or_fallback(app, progress);
|
||||
return progress;
|
||||
}
|
||||
|
||||
@@ -336,7 +355,7 @@ std::shared_ptr<NodeMessageBox> create_legacy_message_dialog_overlay(
|
||||
message->btn_cancel->m_text->set_text(plan.cancel_caption.c_str());
|
||||
else
|
||||
close_legacy_dialog_node(*message->btn_cancel);
|
||||
(void)attach_legacy_overlay_node(app, message);
|
||||
attach_legacy_app_overlay_with_handle_or_fallback(app, message);
|
||||
return message;
|
||||
}
|
||||
|
||||
@@ -348,7 +367,7 @@ std::shared_ptr<NodeInputBox> create_legacy_input_dialog_overlay(
|
||||
input->m_title->set_text(plan.title.c_str());
|
||||
input->m_field_name->set_text(plan.field_name.c_str());
|
||||
input->btn_ok->m_text->set_text(plan.ok_caption.c_str());
|
||||
(void)attach_legacy_overlay_node(app, input);
|
||||
attach_legacy_app_overlay_with_handle_or_fallback(app, input);
|
||||
return input;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user