MCPcopy Index your code
hub / github.com/g3n/engine / BuildLayout

Method BuildLayout

gui/builder_layout.go:13–38  ·  view source on GitHub ↗

BuildLayout builds and returns an HBoxLayout with the specified attributes

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

Source from the content-addressed store, hash-verified

11
12// BuildLayout builds and returns an HBoxLayout with the specified attributes
13func (bl *BuilderLayoutHBox) BuildLayout(b *Builder, am map[string]interface{}) (ILayout, error) {
14
15 // Creates layout and sets optional spacing
16 l := NewHBoxLayout()
17 var spacing float32
18 if sp := am[AttribSpacing]; sp != nil {
19 spacing = sp.(float32)
20 }
21 l.SetSpacing(spacing)
22
23 // Sets optional horizontal alignment
24 if ah := am[AttribAlignh]; ah != nil {
25 l.SetAlignH(ah.(Align))
26 }
27
28 // Sets optional minheight flag
29 if mh := am[AttribAutoHeight]; mh != nil {
30 l.SetAutoHeight(mh.(bool))
31 }
32
33 // Sets optional minwidth flag
34 if mw := am[AttribAutoWidth]; mw != nil {
35 l.SetAutoWidth(mw.(bool))
36 }
37 return l, nil
38}
39
40// BuildParams builds and returns a pointer to HBoxLayoutParams with the specified attributes
41func (bl *BuilderLayoutHBox) BuildParams(b *Builder, am map[string]interface{}) (interface{}, error) {

Callers

nothing calls this directly

Calls 5

SetSpacingMethod · 0.95
SetAlignHMethod · 0.95
SetAutoHeightMethod · 0.95
SetAutoWidthMethod · 0.95
NewHBoxLayoutFunction · 0.85

Tested by

no test coverage detected