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

Method SetShaded

src/window.cpp:1023–1042  ·  view source on GitHub ↗

* Set the shaded state of the window to \a make_shaded. * @param make_shaded If \c true, shade the window (roll up until just the title bar is visible), else unshade/unroll the window to its original size. * @note The method uses #Window::ReInit(), thus after the call, the whole window should be considered changed. */

Source from the content-addressed store, hash-verified

1021 * @note The method uses #Window::ReInit(), thus after the call, the whole window should be considered changed.
1022 */
1023void Window::SetShaded(bool make_shaded)
1024{
1025 if (this->shade_select == nullptr) return;
1026
1027 int desired = make_shaded ? SZSP_HORIZONTAL : 0;
1028 if (this->shade_select->shown_plane != desired) {
1029 if (make_shaded) {
1030 if (this->nested_focus != nullptr) this->UnfocusFocusedWidget();
1031 this->unshaded_size.width = this->width;
1032 this->unshaded_size.height = this->height;
1033 this->shade_select->SetDisplayedPlane(desired);
1034 this->ReInit(0, -this->height);
1035 } else {
1036 this->shade_select->SetDisplayedPlane(desired);
1037 int dx = ((int)this->unshaded_size.width > this->width) ? (int)this->unshaded_size.width - this->width : 0;
1038 int dy = ((int)this->unshaded_size.height > this->height) ? (int)this->unshaded_size.height - this->height : 0;
1039 this->ReInit(dx, dy);
1040 }
1041 }
1042}
1043
1044/**
1045 * Find the Window whose parent pointer points to this window

Callers 4

DispatchLeftClickEventFunction · 0.80
DispatchMouseWheelEventFunction · 0.80
BringWindowToFrontByIdFunction · 0.80
OnClickMethod · 0.80

Calls 3

UnfocusFocusedWidgetMethod · 0.95
ReInitMethod · 0.95
SetDisplayedPlaneMethod · 0.80

Tested by

no test coverage detected