Skip to content

Commit

Permalink
custom Hyperlink mod - add SizeName property
Browse files Browse the repository at this point in the history
  • Loading branch information
dweymouth committed Feb 23, 2024
1 parent 8ae51d5 commit fb9d4c2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion widget/hyperlink.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ type Hyperlink struct {
// Since: 2.5
Truncation fyne.TextTruncation

// Custom for Supersonic - unreleased in Fyne
SizeName fyne.ThemeSizeName

// OnTapped overrides the default `fyne.OpenURL` call when the link is tapped
//
// Since: 2.2
Expand Down Expand Up @@ -243,16 +246,22 @@ func (hl *Hyperlink) openURL() {
func (hl *Hyperlink) syncSegments() {
hl.provider.Wrapping = hl.Wrapping
hl.provider.Truncation = hl.Truncation
sizeName := theme.SizeNameText
if hl.SizeName != "" {
sizeName = hl.SizeName
}
hl.provider.Segments = []RichTextSegment{&TextSegment{
Style: RichTextStyle{
Alignment: hl.Alignment,
ColorName: theme.ColorNameHyperlink,
Inline: true,
TextStyle: hl.TextStyle,
SizeName: sizeName,
},
Text: hl.Text,
}}
hl.textSize = fyne.MeasureText(hl.Text, theme.TextSize(), hl.TextStyle)
th := fyne.CurrentApp().Settings().Theme()
hl.textSize = fyne.MeasureText(hl.Text, th.Size(sizeName), hl.TextStyle)
}

var _ fyne.WidgetRenderer = (*hyperlinkRenderer)(nil)
Expand Down

0 comments on commit fb9d4c2

Please sign in to comment.