Skip to content

Commit

Permalink
Merge pull request fyne-io#4832 from dweymouth/hyperlink-sizename
Browse files Browse the repository at this point in the history
Add SizeName property to Hyperlink widget
  • Loading branch information
dweymouth authored May 23, 2024
2 parents 09c078f + f2e6c04 commit 80f9710
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion widget/hyperlink.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,17 @@ type Hyperlink struct {
Alignment fyne.TextAlign // The alignment of the Text
Wrapping fyne.TextWrap // The wrapping of the Text
TextStyle fyne.TextStyle // The style of the hyperlink text

// The truncation mode of the hyperlink
//
// Since: 2.5
Truncation fyne.TextTruncation

// The theme size name for the text size of the hyperlink
//
// Since: 2.5
SizeName fyne.ThemeSizeName

// OnTapped overrides the default `fyne.OpenURL` call when the link is tapped
//
// Since: 2.2
Expand Down Expand Up @@ -282,7 +288,12 @@ func (hl *Hyperlink) syncSegments() {
segment.Text = hl.Text
}

hl.textSize = fyne.MeasureText(hl.Text, th.Size(theme.SizeNameText), hl.TextStyle)
sizeName := hl.SizeName
if sizeName == "" {
sizeName = theme.SizeNameText
}
hl.provider.Segments[0].(*TextSegment).Style.SizeName = sizeName
hl.textSize = fyne.MeasureText(hl.Text, th.Size(sizeName), hl.TextStyle)
}

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

0 comments on commit 80f9710

Please sign in to comment.