()
| 132 | func (ib *IconButton) WidgetValue() any { return &ib.Icon } |
| 133 | |
| 134 | func (ib *IconButton) Init() { |
| 135 | ib.Button.Init() |
| 136 | ib.Updater(func() { |
| 137 | if !ib.Icon.IsSet() { |
| 138 | ib.SetText("Select an icon") |
| 139 | } else { |
| 140 | ib.SetText("") |
| 141 | } |
| 142 | if ib.IsReadOnly() { |
| 143 | ib.SetType(ButtonText) |
| 144 | if !ib.Icon.IsSet() { |
| 145 | ib.SetText("").SetIcon(icons.Blank) |
| 146 | } |
| 147 | } else { |
| 148 | ib.SetType(ButtonTonal) |
| 149 | } |
| 150 | }) |
| 151 | InitValueButton(ib, false, func(d *Body) { |
| 152 | d.SetTitle("Select an icon") |
| 153 | si := 0 |
| 154 | used := maps.Keys(icons.Used) |
| 155 | ls := NewList(d) |
| 156 | ls.SetSlice(&used).SetSelectedValue(ib.Icon).BindSelect(&si) |
| 157 | ls.OnChange(func(e events.Event) { |
| 158 | ib.Icon = used[si] |
| 159 | }) |
| 160 | }) |
| 161 | } |
| 162 | |
| 163 | // FontName is used to specify a font family name. |
| 164 | // It results in a [FontButton] [Value]. |
nothing calls this directly
no test coverage detected