Skip to content

Commit f7e79f7

Browse files
authored
feat: Add icon with tooltip (#11)
1 parent 6e239f5 commit f7e79f7

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

widget/icon.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package widget
2+
3+
import (
4+
"fyne.io/fyne/v2"
5+
"fyne.io/fyne/v2/widget"
6+
)
7+
8+
// Icon widget is a basic image component that load's its resource to match the theme.
9+
type Icon struct {
10+
widget.Icon
11+
ToolTipWidgetExtend
12+
}
13+
14+
// NewIcon returns a new icon widget that displays a themed icon resource.
15+
func NewIcon(res fyne.Resource) *Icon {
16+
w := &Icon{}
17+
w.ExtendBaseWidget(w)
18+
w.SetResource(res)
19+
return w
20+
}
21+
22+
func (w *Icon) ExtendBaseWidget(wid fyne.Widget) {
23+
w.ExtendToolTipWidget(wid)
24+
w.Icon.ExtendBaseWidget(wid)
25+
}

0 commit comments

Comments
 (0)