HandleTextClick handles click events such that the given function will be called on any links that are clicked on.
(openLink func(tl *paint.TextLink))
| 253 | // HandleTextClick handles click events such that the given function will be called |
| 254 | // on any links that are clicked on. |
| 255 | func (tx *Text) HandleTextClick(openLink func(tl *paint.TextLink)) { |
| 256 | tx.OnClick(func(e events.Event) { |
| 257 | tl, _ := tx.findLink(e.Pos()) |
| 258 | if tl == nil { |
| 259 | return |
| 260 | } |
| 261 | openLink(tl) |
| 262 | e.SetHandled() |
| 263 | }) |
| 264 | } |
| 265 | |
| 266 | func (tx *Text) WidgetTooltip(pos image.Point) (string, image.Point) { |
| 267 | if pos == image.Pt(-1, -1) { |
no test coverage detected