SetDefaultButtonWidth sets the default button width of the ToolBar. Calling this method affects all buttons in the ToolBar, no matter if they are added before or after the call. A width of 0 results in automatic sizing behavior. Negative values are not allowed.
(width int)
| 183 | // added before or after the call. A width of 0 results in automatic sizing |
| 184 | // behavior. Negative values are not allowed. |
| 185 | func (tb *ToolBar) SetDefaultButtonWidth(width int) error { |
| 186 | if width == tb.defaultButtonWidth { |
| 187 | return nil |
| 188 | } |
| 189 | |
| 190 | if width < 0 { |
| 191 | return newError("width must be >= 0") |
| 192 | } |
| 193 | |
| 194 | old := tb.defaultButtonWidth |
| 195 | |
| 196 | tb.defaultButtonWidth = width |
| 197 | |
| 198 | for _, action := range tb.actions.actions { |
| 199 | if err := tb.onActionChanged(action); err != nil { |
| 200 | tb.defaultButtonWidth = old |
| 201 | |
| 202 | return err |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | return tb.applyDefaultButtonWidth() |
| 207 | } |
| 208 | |
| 209 | func (tb *ToolBar) MaxTextRows() int { |
| 210 | return tb.maxTextRows |
nothing calls this directly
no test coverage detected