MCPcopy Create free account
hub / github.com/SolarLune/masterplan / SetOptions

Method SetOptions

gui.go:1021–1048  ·  view source on GitHub ↗
(options ...string)

Source from the content-addressed store, hash-verified

1019}
1020
1021func (dropdown *Dropdown) SetOptions(options ...string) {
1022
1023 dropdown.Options = append([]string{}, options...)
1024
1025 for _, b := range dropdown.Choices {
1026 b.Destroy()
1027 }
1028
1029 dropdown.Choices = []*Button{}
1030
1031 for i, o := range options {
1032 index := i
1033 b := NewButton(o, nil, nil, dropdown.WorldSpace, func() {
1034 dropdown.ChosenIndex = index
1035 dropdown.Open = false
1036
1037 if dropdown.Property != nil {
1038 dropdown.Property.Set(dropdown.Options[dropdown.ChosenIndex])
1039 }
1040
1041 if dropdown.OnChoose != nil {
1042 dropdown.OnChoose(index)
1043 }
1044 })
1045 b.BackgroundColor = getThemeColor(GUIMenuColor).Accent()
1046 dropdown.Choices = append(dropdown.Choices, b)
1047 }
1048}
1049
1050func (dropdown *Dropdown) Update() {
1051

Callers 2

NewDropdownFunction · 0.95
ConstructMenusFunction · 0.95

Calls 5

DestroyMethod · 0.95
NewButtonFunction · 0.85
getThemeColorFunction · 0.85
AccentMethod · 0.80
SetMethod · 0.45

Tested by

no test coverage detected