Add tool tips to tracklist names, etc + refactoring

This commit is contained in:
Drew Weymouth
2024-08-05 17:53:01 -07:00
parent 7c94a4c694
commit 66b8d4bc89
11 changed files with 200 additions and 84 deletions
+5 -3
View File
@@ -5,13 +5,14 @@ import (
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/theme"
"fyne.io/fyne/v2/widget"
ttwidget "github.com/dweymouth/fyne-tooltip/widget"
)
// OptionHyperlink is a widget that displays a "vertical dots"/"more" button
// to the right of the text, which can show a menu.
type OptionHyperlink struct {
widget.BaseWidget
h *widget.Hyperlink
h *ttwidget.Hyperlink
b *IconButton
OnShowMenu func(btnPos fyne.Position)
@@ -21,7 +22,7 @@ type OptionHyperlink struct {
func NewOptionHyperlink() *OptionHyperlink {
o := &OptionHyperlink{
h: widget.NewHyperlink("", nil),
h: ttwidget.NewHyperlink("", nil),
}
o.h.Truncation = fyne.TextTruncateEllipsis
o.b = NewIconButton(theme.MoreVerticalIcon(), func() {
@@ -34,8 +35,9 @@ func NewOptionHyperlink() *OptionHyperlink {
return o
}
func (o *OptionHyperlink) SetText(text string) {
func (o *OptionHyperlink) SetTextAndToolTip(text string) {
o.h.SetText(text)
o.h.SetToolTip(text)
o.updatePreferredWidth()
o.BaseWidget.Refresh()
}