Teek::UI::Screens Class
Push/pop stack for content screens - works directly against ordinary
DSL handles (a ui.panel/ui.box, or a ui.window) instead of
requiring a bespoke per-screen class with its own show/hide/cleanup
protocol. Pushing conceals the current screen (if any) before
revealing the new one; popping reverses it, re-revealing whatever is
now on top.
A :window handle is revealed/concealed through its own Handle#show/
Handle#hide (deiconify/raise/modal, or grab-release/withdraw);
anything else is packed to fill its parent, or pack-forgotten via the
plain pack/pack forget primitive.
A screen being pushed/replaced-in can also be a lazy: true node
that hasn’t been realized yet (see WidgetDSL#append_container) -
it’s realized on demand, right before being revealed, with nothing
extra to call by hand, as long as this stack was constructed with
document:. A screen with no opinion on laziness at all (any plain
object exposing just type/path/app or type/show/hide,
the original “push an already-built Handle” usage) behaves exactly
as before either way. Concealing never destroys a screen’s widget -
see Handle#destroy! for that as a separate, explicit step
(typically screens.pop&.destroy!).
Inherits: Object
Instance Methods ↑
active?
Returns Boolean — true if any screen is on the stack
current
Returns Symbol, nil — name of the topmost screen
current_screen
Returns Handle, nil — the topmost screen's handle
initialize(document: nil)
Parameters
documentDocument, nil— needed only to lazilyHandle#realize!a not-yet-realized screen on push - omit if every screen pushed onto this stack is already realized
Returns Screens — a new instance of Screens
@api private
pop
Pop the current screen off the stack. The popped screen is
concealed (never destroyed - see Handle#destroy! to additionally
release it); if a screen remains underneath, it’s revealed again.
Returns Object, nil — the just-popped screen, or nil if the stack was empty
push(name, screen)
Push a screen onto the stack. The previous screen (if any) is concealed before the new one is realized (if it isn’t already) and revealed.
Parameters
nameSymbol— identifier (e.g.:picker,:emulator)screenHandle— a:windowhandle, or any other container/widget handle
Returns void
replace_current(screen)
Replace the current screen in-place, without changing stack depth - the existing screen is concealed, the new one takes its name, realizes if needed, and is revealed.
Parameters
screenHandle
Returns void
size
Returns Integer — number of screens on the stack
Members: Classes (1)
- C Entry