MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GetWidgetFromPos

Function GetWidgetFromPos

src/widget.cpp:292–296  ·  view source on GitHub ↗

* Returns the index for the widget located at the given position * relative to the window. It includes all widget-corner pixels as well. * @param *w Window to look inside * @param x The Window client X coordinate * @param y The Window client y coordinate * @return A widget index, or \c INVALID_WIDGET if no widget was found. */

Source from the content-addressed store, hash-verified

290 * @return A widget index, or \c INVALID_WIDGET if no widget was found.
291 */
292WidgetID GetWidgetFromPos(const Window *w, int x, int y)
293{
294 NWidgetCore *nw = w->nested_root->GetWidgetFromPos(x, y);
295 return (nw != nullptr) ? nw->GetIndex() : INVALID_WIDGET;
296}
297
298/**
299 * Draw frame rectangle.

Callers 3

OnDropdownCloseMethod · 0.85
HandleMouseDragDropFunction · 0.85
GetDropDownItemMethod · 0.85

Calls 2

GetWidgetFromPosMethod · 0.45
GetIndexMethod · 0.45

Tested by

no test coverage detected