onCursor process subscribed cursor events over the window title.
(evname string, ev interface{})
| 380 | |
| 381 | // onCursor process subscribed cursor events over the window title. |
| 382 | func (wt *WindowTitle) onCursor(evname string, ev interface{}) { |
| 383 | |
| 384 | if evname == OnCursorLeave { |
| 385 | window.Get().SetCursor(window.ArrowCursor) |
| 386 | wt.pressed = false |
| 387 | } else if evname == OnCursor { |
| 388 | if !wt.pressed { |
| 389 | return |
| 390 | } |
| 391 | cev := ev.(*window.CursorEvent) |
| 392 | dy := wt.mouseY - cev.Ypos |
| 393 | dx := wt.mouseX - cev.Xpos |
| 394 | wt.mouseX = cev.Xpos |
| 395 | wt.mouseY = cev.Ypos |
| 396 | posX := wt.win.Position().X - dx |
| 397 | posY := wt.win.Position().Y - dy |
| 398 | wt.win.SetPosition(posX, posY) |
| 399 | } |
| 400 | } |
| 401 | |
| 402 | // applyStyle applies the specified WindowTitleStyle. |
| 403 | func (wt *WindowTitle) applyStyle(s *WindowTitleStyle) { |
nothing calls this directly
no test coverage detected