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

Method SetAttribs

gui/builder.go:518–591  ·  view source on GitHub ↗

SetAttribs sets common attributes from the description to the specified panel

(am map[string]interface{}, ipan IPanel)

Source from the content-addressed store, hash-verified

516
517// SetAttribs sets common attributes from the description to the specified panel
518func (b *Builder) SetAttribs(am map[string]interface{}, ipan IPanel) error {
519
520 panel := ipan.GetPanel()
521 // Set optional position
522 if am[AttribPosition] != nil {
523 va := am[AttribPosition].([]float32)
524 panel.SetPosition(va[0], va[1])
525 }
526
527 // Set optional panel width
528 if am[AttribWidth] != nil {
529 panel.SetWidth(am[AttribWidth].(float32))
530 }
531
532 // Sets optional panel height
533 if am[AttribHeight] != nil {
534 panel.SetHeight(am[AttribHeight].(float32))
535 }
536
537 // Set optional margin sizes
538 if am[AttribMargins] != nil {
539 panel.SetMarginsFrom(am[AttribMargins].(*RectBounds))
540 }
541
542 // Set optional border sizes
543 if am[AttribBorders] != nil {
544 panel.SetBordersFrom(am[AttribBorders].(*RectBounds))
545 }
546
547 // Set optional border color
548 if am[AttribBorderColor] != nil {
549 panel.SetBordersColor4(am[AttribBorderColor].(*math32.Color4))
550 }
551
552 // Set optional paddings sizes
553 if am[AttribPaddings] != nil {
554 panel.SetPaddingsFrom(am[AttribPaddings].(*RectBounds))
555 }
556
557 // Set optional panel color
558 if am[AttribColor] != nil {
559 panel.SetColor4(am[AttribColor].(*math32.Color4))
560 }
561
562 if am[AttribName] != nil {
563 panel.SetName(am[AttribName].(string))
564 }
565
566 if am[AttribVisible] != nil {
567 panel.SetVisible(am[AttribVisible].(bool))
568 }
569
570 if am[AttribEnabled] != nil {
571 panel.SetEnabled(am[AttribEnabled].(bool))
572 }
573
574 if am[AttribRender] != nil {
575 panel.SetRenderable(am[AttribRender].(bool))

Callers 15

buildPanelFunction · 0.80
buildImagePanelFunction · 0.80
buildLabelFunction · 0.80
buildImageLabelFunction · 0.80
buildButtonFunction · 0.80
buildEditFunction · 0.80
buildCheckBoxFunction · 0.80
buildRadioButtonFunction · 0.80
buildVListFunction · 0.80
buildHListFunction · 0.80
buildDropDownFunction · 0.80
buildMenuFunction · 0.80

Calls 15

setLayoutMethod · 0.95
setLayoutParamsMethod · 0.95
SetWidthMethod · 0.80
SetHeightMethod · 0.80
SetMarginsFromMethod · 0.80
SetBordersFromMethod · 0.80
SetBordersColor4Method · 0.80
SetPaddingsFromMethod · 0.80
SetUserDataMethod · 0.80
GetPanelMethod · 0.65
SetPositionMethod · 0.65
SetNameMethod · 0.65

Tested by

no test coverage detected