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

Function GetToolbarAlignedWindowPosition

src/window.cpp:1685–1691  ·  view source on GitHub ↗

* Computer the position of the top-left corner of a window to be opened right * under the toolbar. * @param window_width the width of the window to get the position for. * @return Coordinate of the top-left corner of the new window. */

Source from the content-addressed store, hash-verified

1683 * @return Coordinate of the top-left corner of the new window.
1684 */
1685Point GetToolbarAlignedWindowPosition(int window_width)
1686{
1687 const Window *w = FindWindowById(WC_MAIN_TOOLBAR, 0);
1688 assert(w != nullptr);
1689 Point pt = { _current_text_dir == TD_RTL ? w->left : (w->left + w->width) - window_width, w->top + w->height };
1690 return pt;
1691}
1692
1693/**
1694 * Compute the position of the construction toolbars.

Callers 4

OnInitialPositionMethod · 0.85
LocalGetWindowPlacementFunction · 0.85
OnInitialPositionMethod · 0.85

Calls 1

FindWindowByIdFunction · 0.85

Tested by

no test coverage detected