Move retained popups to checked handles
This commit is contained in:
@@ -30,8 +30,13 @@ void NodeComboBox::loaded()
|
||||
popup->init();
|
||||
popup->create();
|
||||
popup->loaded();
|
||||
(void)pp::panopainter::attach_legacy_overlay_node_to_root(*this, popup);
|
||||
const auto popup_overlay = pp::panopainter::open_legacy_overlay_node_with_handle(*this, popup);
|
||||
if (!popup_overlay) {
|
||||
return;
|
||||
}
|
||||
const auto popup_handle = popup_overlay.value();
|
||||
m_items.clear();
|
||||
int popup_child_index = -1;
|
||||
for (int i = 0; i < m_data.size(); i++)
|
||||
{
|
||||
if (m_data[i] == "-")
|
||||
@@ -47,17 +52,21 @@ void NodeComboBox::loaded()
|
||||
btn->m_text->set_text(m_data[i].c_str());
|
||||
btn->m_border->SetWidthP(100.f);
|
||||
btn->m_border->SetHeight(GetHeight());
|
||||
popup_child_index++;
|
||||
int index = (int)m_items.size();
|
||||
if (index == m_current_index)
|
||||
m_selected_child_index = popup->get_child_index(btn);
|
||||
m_selected_child_index = popup_child_index;
|
||||
m_items.push_back(m_data[i]);
|
||||
btn->on_click = [this,popup,btn,index](Node* target) {
|
||||
const int clicked_child_index = popup_child_index;
|
||||
btn->on_click = [this, popup_handle, index, clicked_child_index](Node* target) {
|
||||
m_current_index = index;
|
||||
m_selected_child_index = popup->get_child_index(target);
|
||||
m_selected_child_index = clicked_child_index;
|
||||
m_text->set_text(m_items[index].c_str());
|
||||
if (on_select)
|
||||
on_select(btn, index);
|
||||
pp::panopainter::close_legacy_popup_overlay(*popup);
|
||||
on_select(target, index);
|
||||
const auto close_status =
|
||||
pp::panopainter::close_legacy_overlay_node(*this, popup_handle);
|
||||
(void)close_status;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user