mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #20479 from mrmbernardi/resize_dropdowns
Add a window method to resize dropdowns
This commit is contained in:
commit
1f5f273083
|
@ -205,6 +205,11 @@ public:
|
|||
height = min_height;
|
||||
}
|
||||
|
||||
widgets[WIDX_SORT].left = width - 60;
|
||||
widgets[WIDX_SORT].right = width - 60 + 54;
|
||||
|
||||
ResizeDropdown(WIDX_CURRENT_INFORMATION_TYPE, { 150, 46 }, { width - 216, DROPDOWN_HEIGHT });
|
||||
|
||||
// Refreshing the list can be a very intensive operation
|
||||
// owing to its use of ride_has_any_track_elements().
|
||||
// This makes sure it's only refreshed every 64 ticks.
|
||||
|
|
|
@ -2158,7 +2158,7 @@ void WindowBase::ResizeSpinner(WidgetIndex widgetIndex, const ScreenCoordsXY& or
|
|||
widgets[widgetIndex].right = right;
|
||||
widgets[widgetIndex].bottom = bottom;
|
||||
|
||||
widgets[widgetIndex + 1].left = right - size.height;
|
||||
widgets[widgetIndex + 1].left = right - size.height; // subtract height to maintain aspect ratio
|
||||
widgets[widgetIndex + 1].top = origin.y + 1;
|
||||
widgets[widgetIndex + 1].right = right - 1;
|
||||
widgets[widgetIndex + 1].bottom = bottom - 1;
|
||||
|
@ -2167,4 +2167,19 @@ void WindowBase::ResizeSpinner(WidgetIndex widgetIndex, const ScreenCoordsXY& or
|
|||
widgets[widgetIndex + 2].top = origin.y + 1;
|
||||
widgets[widgetIndex + 2].right = right - size.height - 1;
|
||||
widgets[widgetIndex + 2].bottom = bottom - 1;
|
||||
}
|
||||
}
|
||||
|
||||
void WindowBase::ResizeDropdown(WidgetIndex widgetIndex, const ScreenCoordsXY& origin, const ScreenSize& size)
|
||||
{
|
||||
auto right = origin.x + size.width - 1;
|
||||
auto bottom = origin.y + size.height - 1;
|
||||
widgets[widgetIndex].left = origin.x;
|
||||
widgets[widgetIndex].top = origin.y;
|
||||
widgets[widgetIndex].right = right;
|
||||
widgets[widgetIndex].bottom = bottom;
|
||||
|
||||
widgets[widgetIndex + 1].left = right - size.height + 1; // subtract height to maintain aspect ratio
|
||||
widgets[widgetIndex + 1].top = origin.y + 1;
|
||||
widgets[widgetIndex + 1].right = right - 1;
|
||||
widgets[widgetIndex + 1].bottom = bottom - 1;
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ constexpr uint8_t CloseButtonWidth = 10;
|
|||
#define TABLE_CELL_HEIGHT 12
|
||||
#define BUTTON_FACE_HEIGHT 12
|
||||
#define SPINNER_HEIGHT 12
|
||||
#define DROPDOWN_HEIGHT 12
|
||||
|
||||
#define TEXT_INPUT_SIZE 1024
|
||||
#define TOP_TOOLBAR_HEIGHT 27
|
||||
|
|
|
@ -172,6 +172,7 @@ struct WindowBase
|
|||
void ResizeFrameWithPage();
|
||||
|
||||
void ResizeSpinner(WidgetIndex widgetIndex, const ScreenCoordsXY& origin, const ScreenSize& size);
|
||||
void ResizeDropdown(WidgetIndex widgetIndex, const ScreenCoordsXY& origin, const ScreenSize& size);
|
||||
};
|
||||
|
||||
#ifdef __WARN_SUGGEST_FINAL_METHODS__
|
||||
|
|
Loading…
Reference in New Issue