I'm trying to get a Dropdown inside a Dialog, but since there's only a single overlay allowed at a given time, setting the Dropdown overlay would remove the Dialog overlay (I think). It would be nice to have a stack of overlays so that this situation would work.
How this might work:
// show a dialog// - events are directed at the dialog// - tapping outside the dialog hides it// - when this overlay is hidden, control returns to the main sceneui::MainLoop::show_overlay(dialog_scene);
// show a dropdown on top of the dialog// - events are directed at the dropdown// - tapping outside the dropdown hides it (but does not hide the dialog)// - when this overlay is hidden, control returns to the dialogui::MainLoop::show_overlay(dropdown_scene);
In fact, it might work to just have a single scene stack, where keyboard is just another overlay, and main_scene is always on the bottom of the stack.
The main issue I can think of is that currently hiding the overlay doesn't remove it from MainLoop (so it always stays alive, since Scene is a shared_ptr). The simplest version of the scene stack would push scenes on a std::stack, and hiding would actually pop the shared_ptr from the stack, which would decrease the refcount . . . so if you wanted to hold onto a hidden scene you'd have to retain the pointer yourself. And toggle_scene wouldn't really make sense with this setup.
I'm trying to get a Dropdown inside a Dialog, but since there's only a single overlay allowed at a given time, setting the Dropdown overlay would remove the Dialog overlay (I think). It would be nice to have a stack of overlays so that this situation would work.
How this might work:
In fact, it might work to just have a single scene stack, where keyboard is just another overlay, and main_scene is always on the bottom of the stack.
The main issue I can think of is that currently hiding the overlay doesn't remove it from MainLoop (so it always stays alive, since Scene is a shared_ptr). The simplest version of the scene stack would push scenes on a std::stack, and hiding would actually pop the shared_ptr from the stack, which would decrease the refcount . . . so if you wanted to hold onto a hidden scene you'd have to retain the pointer yourself. And toggle_scene wouldn't really make sense with this setup.