Hello,
if in checkbox.go, add method to modifiable the icons, it would be useful when user want to custom the icon rather than default
func (c *CheckBoxStyle) SetIcons(checked *widget.Icon, unchecked *widget.Icon) {
if checked != nil {
c.checkedStateIcon = checked
}
if unchecked != nil {
c.uncheckedStateIcon = unchecked
}
}
Thanks
On Tue Jul 21, 2020 at 20:26, Pham Song wrote:
> Hello, >> if in checkbox.go, add method to modifiable the icons, it would be useful when user want to custom the icon rather than default>>> func (c *CheckBoxStyle) SetIcons(checked *widget.Icon, unchecked *widget.Icon) {> if checked != nil {> c.checkedStateIcon = checked> }>> if unchecked != nil {> c.uncheckedStateIcon = unchecked> }> }>
Sure. I think a better fix is to export the icon fields on Theme:
https://git.sr.ht/~eliasnaur/gio/tree/master/widget/material/theme.go#L26
and add similar exported fields to CheckBoxStyle.
Elias
Could you also just in general make a policy that all Theme fields
should be exported? It seems to me that it shouldn't ever be
impossible to create your own completely custom theme.
Either that, or instead of a concrete struct, use an interface (or set
of interfaces, of course).
Or conceivably both, where the api uses interfaces but the struct
implements all the appropriate interfaces.
Just my thoughts.
-- Larry
On Tue, Jul 21, 2020 at 1:54 PM Elias Naur <mail@eliasnaur.com> wrote:
>> On Tue Jul 21, 2020 at 20:26, Pham Song wrote:> > Hello,> >> > if in checkbox.go, add method to modifiable the icons, it would be useful when user want to custom the icon rather than default> >> >> > func (c *CheckBoxStyle) SetIcons(checked *widget.Icon, unchecked *widget.Icon) {> > if checked != nil {> > c.checkedStateIcon = checked> > }> >> > if unchecked != nil {> > c.uncheckedStateIcon = unchecked> > }> > }> >>> Sure. I think a better fix is to export the icon fields on Theme:>> https://git.sr.ht/~eliasnaur/gio/tree/master/widget/material/theme.go#L26>> and add similar exported fields to CheckBoxStyle.>> Elias