mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 09:55:40 +00:00
widget/material: [API] add description argument to IconButton
Icons have no inherent semantic meaning such as a label, so this change adds another argument to the IconButton constructor for the client to provide a description. This is an API change, because it seems best to force every client to provide semantic descriptions for icon buttons. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+12
-10
@@ -43,9 +43,10 @@ type IconButtonStyle struct {
|
|||||||
Color color.NRGBA
|
Color color.NRGBA
|
||||||
Icon *widget.Icon
|
Icon *widget.Icon
|
||||||
// Size is the icon size.
|
// Size is the icon size.
|
||||||
Size unit.Value
|
Size unit.Value
|
||||||
Inset layout.Inset
|
Inset layout.Inset
|
||||||
Button *widget.Clickable
|
Button *widget.Clickable
|
||||||
|
Description string
|
||||||
}
|
}
|
||||||
|
|
||||||
func Button(th *Theme, button *widget.Clickable, txt string) ButtonStyle {
|
func Button(th *Theme, button *widget.Clickable, txt string) ButtonStyle {
|
||||||
@@ -72,14 +73,15 @@ func ButtonLayout(th *Theme, button *widget.Clickable) ButtonLayoutStyle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func IconButton(th *Theme, button *widget.Clickable, icon *widget.Icon) IconButtonStyle {
|
func IconButton(th *Theme, button *widget.Clickable, icon *widget.Icon, description string) IconButtonStyle {
|
||||||
return IconButtonStyle{
|
return IconButtonStyle{
|
||||||
Background: th.Palette.ContrastBg,
|
Background: th.Palette.ContrastBg,
|
||||||
Color: th.Palette.ContrastFg,
|
Color: th.Palette.ContrastFg,
|
||||||
Icon: icon,
|
Icon: icon,
|
||||||
Size: unit.Dp(24),
|
Size: unit.Dp(24),
|
||||||
Inset: layout.UniformInset(unit.Dp(12)),
|
Inset: layout.UniformInset(unit.Dp(12)),
|
||||||
Button: button,
|
Button: button,
|
||||||
|
Description: description,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user