Centralize retained UI overlay insertion
This commit is contained in:
34
src/legacy_ui_overlay_services.cpp
Normal file
34
src/legacy_ui_overlay_services.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#include "pch.h"
|
||||
#include "legacy_ui_overlay_services.h"
|
||||
|
||||
#include "app.h"
|
||||
#include "node.h"
|
||||
|
||||
namespace pp::panopainter {
|
||||
|
||||
void initialize_legacy_overlay_node(App& app, Node& node)
|
||||
{
|
||||
node.set_manager(&app.layout);
|
||||
node.init();
|
||||
node.create();
|
||||
node.loaded();
|
||||
}
|
||||
|
||||
pp::foundation::Status attach_legacy_overlay_node(
|
||||
App& app,
|
||||
const std::shared_ptr<Node>& node) noexcept
|
||||
{
|
||||
if (!node) {
|
||||
return pp::foundation::Status::invalid_argument("legacy overlay node is null");
|
||||
}
|
||||
|
||||
auto* root = app.layout[app.main_id];
|
||||
if (!root) {
|
||||
return pp::foundation::Status::invalid_argument("legacy overlay root is missing");
|
||||
}
|
||||
|
||||
root->add_child(node);
|
||||
return pp::foundation::Status::success();
|
||||
}
|
||||
|
||||
} // namespace pp::panopainter
|
||||
Reference in New Issue
Block a user