ludic/packages/ludic.ui/screen_class.ludic

39 lines
1.1 KiB
Text

# screen_class.ludic - a Ludic component shown as a whole screen
# a Ludic component shown as a screen: an instance at the top, keyed by its name
function fr_class_nodes(ui_st: mut UiState, cls: UiClass) -> UiNode {
pl_begin(ui_st, cls.name)
ui_st.uv_on = true
lc_begin(ui_st)
ui_st.in_build += 1
ui_st.ui_view = null
uc_load(ui_st, cls)
let root = fr_root(ui_st, cls.name, cls.sheet)
if cls.use == null {
let use = new UiTpl
use.tag = cls.name
use.cls = cls
use.keys = new []string
use.vals = new []UiExpr
use.on_keys = new []string
use.on_acts = new []UiAct
use.kids = new []UiTpl
cls.use = use
cls.none = Value.object()
}
let use = cls.use
let e = env_new(ui_st, null)
e.model = cls.none
root.env = e
bd_class(ui_st, use, e, cls.name, root.children)
in_sweep(ui_st, cls.name)
cs_tree(ui_st, root)
ui_st.uv_on = false
return root
}
function fr_root(ui_st: mut UiState, key: string, sheet: UiSheet) -> UiNode {
let root = nd_take(ui_st)
root.key = key
root.tag = "screen"
root.sheet = sheet
return root
}