* Dispatch hover of the mouse over a window. * @param w Window to dispatch event in. * @param x X coordinate of the click. * @param y Y coordinate of the click. */
| 790 | * @param y Y coordinate of the click. |
| 791 | */ |
| 792 | static void DispatchHoverEvent(Window *w, int x, int y) |
| 793 | { |
| 794 | NWidgetCore *wid = w->nested_root->GetWidgetFromPos(x, y); |
| 795 | |
| 796 | /* No widget to handle */ |
| 797 | if (wid == nullptr) return; |
| 798 | |
| 799 | Point pt = { x, y }; |
| 800 | |
| 801 | /* Show the tooltip if there is any */ |
| 802 | if (!w->OnTooltip(pt, wid->GetIndex(), TCC_HOVER) && wid->GetToolTip() != STR_NULL) { |
| 803 | GuiShowTooltips(w, GetEncodedString(wid->GetToolTip()), TCC_HOVER); |
| 804 | return; |
| 805 | } |
| 806 | |
| 807 | /* Widget has no index, so the window is not interested in it. */ |
| 808 | if (wid->GetIndex() < 0) return; |
| 809 | |
| 810 | w->OnHover(pt, wid->GetIndex()); |
| 811 | } |
| 812 | |
| 813 | /** |
| 814 | * Dispatch the mousewheel-action to the window. |
no test coverage detected