MCPcopy
hub / github.com/g3n/engine / buildWindow

Function buildWindow

gui/builder_panel.go:596–628  ·  view source on GitHub ↗

buildWindow builds a gui object of type: Window

(b *Builder, am map[string]interface{})

Source from the content-addressed store, hash-verified

594
595// buildWindow builds a gui object of type: Window
596func buildWindow(b *Builder, am map[string]interface{}) (IPanel, error) {
597
598 // Builds window and sets its common attributes
599 win := NewWindow(0, 0)
600 err := b.SetAttribs(am, win)
601 if err != nil {
602 return nil, err
603 }
604
605 // Sets optional title
606 if title := am[AttribTitle]; title != nil {
607 win.SetTitle(title.(string))
608 }
609
610 // Set optional resizable borders
611 if resiz := am[AttribResizeBorders]; resiz != nil {
612 win.SetResizable(resiz.(bool))
613 }
614
615 // Builds window children
616 if v := am[AttribItems]; v != nil {
617 items := v.([]map[string]interface{})
618 for i := 0; i < len(items); i++ {
619 item := items[i]
620 child, err := b.build(item, win)
621 if err != nil {
622 return nil, err
623 }
624 win.Add(child)
625 }
626 }
627 return win, nil
628}
629
630// buildChart builds a gui object of type: Chart
631func buildChart(b *Builder, am map[string]interface{}) (IPanel, error) {

Callers

nothing calls this directly

Calls 6

SetTitleMethod · 0.95
SetResizableMethod · 0.95
AddMethod · 0.95
NewWindowFunction · 0.85
SetAttribsMethod · 0.80
buildMethod · 0.80

Tested by

no test coverage detected