Centralize retained message dialog close callbacks
This commit is contained in:
@@ -82,4 +82,11 @@ void bind_legacy_click_destroys_node(ButtonT& button, Node& target) noexcept
|
||||
};
|
||||
}
|
||||
|
||||
inline std::function<void(Node*)> legacy_destroy_node_callback(Node& target)
|
||||
{
|
||||
return [&target](Node*) {
|
||||
target.destroy();
|
||||
};
|
||||
}
|
||||
|
||||
} // namespace pp::panopainter
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "pch.h"
|
||||
#include "log.h"
|
||||
#include "legacy_ui_overlay_services.h"
|
||||
#include "node_input_box.h"
|
||||
#include "layout.h"
|
||||
|
||||
@@ -24,7 +25,7 @@ void NodeInputBox::init()
|
||||
on_submit(this, m_field_text->m_text);
|
||||
};
|
||||
btn_cancel = find<NodeButton>("btn-cancel");
|
||||
btn_cancel->on_click = [&](Node*) { destroy(); };
|
||||
pp::panopainter::bind_legacy_click_destroys_node(*btn_cancel, *this);
|
||||
m_capture_children = false; // don't capture children events on mouse_capture
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "pch.h"
|
||||
#include "log.h"
|
||||
#include "legacy_ui_overlay_services.h"
|
||||
#include "node_message_box.h"
|
||||
#include "layout.h"
|
||||
|
||||
@@ -23,7 +24,7 @@ void NodeMessageBox::init()
|
||||
on_submit(this);
|
||||
};
|
||||
btn_cancel = find<NodeButton>("btn-cancel");
|
||||
on_submit = btn_cancel->on_click = [&](Node*) { destroy(); };
|
||||
on_submit = btn_cancel->on_click = pp::panopainter::legacy_destroy_node_callback(*this);
|
||||
m_capture_children = false; // don't capture children events on mouse_capture
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user