mirror of https://github.com/OpenRCT2/OpenRCT2.git
Create function to resize window frame
This commit is contained in:
parent
22a2d11cfc
commit
27f3a3a796
|
@ -148,11 +148,7 @@ public:
|
|||
|
||||
void OnPrepareDraw() override
|
||||
{
|
||||
widgets[WIDX_BACKGROUND].right = width - 1;
|
||||
widgets[WIDX_BACKGROUND].bottom = height - 1;
|
||||
widgets[WIDX_TITLE].right = width - 2;
|
||||
widgets[WIDX_CLOSE].left = width - 13;
|
||||
widgets[WIDX_CLOSE].right = width - 3;
|
||||
ResizeFrame();
|
||||
|
||||
auto& list = widgets[WIDX_LIST];
|
||||
list.left = 6;
|
||||
|
|
|
@ -147,13 +147,7 @@ public:
|
|||
|
||||
void OnPrepareDraw() override
|
||||
{
|
||||
widgets[WIDX_BACKGROUND].right = width - 1;
|
||||
widgets[WIDX_BACKGROUND].bottom = height - 1;
|
||||
widgets[WIDX_TITLE].right = width - 2;
|
||||
widgets[WIDX_CLOSE].left = width - 13;
|
||||
widgets[WIDX_CLOSE].right = width - 3;
|
||||
widgets[WIDX_CONTENT_PANEL].right = width - 1;
|
||||
widgets[WIDX_CONTENT_PANEL].bottom = height - 1;
|
||||
ResizeFrameWithPage();
|
||||
widgets[WIDX_SCROLL].right = width - 3;
|
||||
widgets[WIDX_SCROLL].bottom = height - 22;
|
||||
widgets[WIDX_OPEN_URL].bottom = height - 5;
|
||||
|
|
|
@ -442,13 +442,7 @@ public:
|
|||
widgets[WIDX_CLOSE].type = gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR ? WindowWidgetType::Empty
|
||||
: WindowWidgetType::CloseBox;
|
||||
|
||||
widgets[WIDX_BACKGROUND].right = width - 1;
|
||||
widgets[WIDX_BACKGROUND].bottom = height - 1;
|
||||
widgets[WIDX_TITLE].right = width - 2;
|
||||
widgets[WIDX_CLOSE].left = width - 13;
|
||||
widgets[WIDX_CLOSE].right = width - 3;
|
||||
widgets[WIDX_RESIZE].right = width - 1;
|
||||
widgets[WIDX_RESIZE].bottom = height - 1;
|
||||
ResizeFrameWithPage();
|
||||
|
||||
int16_t scrollListHeight = (height - 88) / 2;
|
||||
|
||||
|
|
|
@ -815,13 +815,7 @@ public:
|
|||
void OnPrepareDraw() override
|
||||
{
|
||||
// Resize widgets
|
||||
widgets[WIDX_BACKGROUND].right = width - 1;
|
||||
widgets[WIDX_BACKGROUND].bottom = height - 1;
|
||||
widgets[WIDX_TITLE].right = width - 2;
|
||||
widgets[WIDX_CLOSE].left = width - 13;
|
||||
widgets[WIDX_CLOSE].right = width - 3;
|
||||
widgets[WIDX_TAB_CONTENT_PANEL].right = width - 1;
|
||||
widgets[WIDX_TAB_CONTENT_PANEL].bottom = height - 1;
|
||||
ResizeFrameWithPage();
|
||||
widgets[WIDX_ADVANCED].left = width - 130;
|
||||
widgets[WIDX_ADVANCED].right = width - 9;
|
||||
widgets[WIDX_LIST].right = width - 309;
|
||||
|
|
|
@ -225,13 +225,7 @@ static void WindowEditorObjectiveOptionsSetPressedTab(rct_window* w)
|
|||
|
||||
static void WindowEditorObjectiveOptionsAnchorBorderWidgets(rct_window* w)
|
||||
{
|
||||
w->widgets[WIDX_BACKGROUND].right = w->width - 1;
|
||||
w->widgets[WIDX_BACKGROUND].bottom = w->height - 1;
|
||||
w->widgets[WIDX_PAGE_BACKGROUND].right = w->width - 1;
|
||||
w->widgets[WIDX_PAGE_BACKGROUND].bottom = w->height - 1;
|
||||
w->widgets[WIDX_TITLE].right = w->width - 2;
|
||||
w->widgets[WIDX_CLOSE].left = w->width - 13;
|
||||
w->widgets[WIDX_CLOSE].right = w->width - 3;
|
||||
w->ResizeFrameWithPage();
|
||||
}
|
||||
|
||||
static void WindowEditorObjectiveOptionsDrawTabImages(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
|
|
|
@ -317,13 +317,7 @@ private:
|
|||
|
||||
void AnchorBorderWidgets()
|
||||
{
|
||||
widgets[WIDX_BACKGROUND].right = width - 1;
|
||||
widgets[WIDX_BACKGROUND].bottom = height - 1;
|
||||
widgets[WIDX_PAGE_BACKGROUND].right = width - 1;
|
||||
widgets[WIDX_PAGE_BACKGROUND].bottom = height - 1;
|
||||
widgets[WIDX_TITLE].right = width - 2;
|
||||
widgets[WIDX_CLOSE].left = width - 13;
|
||||
widgets[WIDX_CLOSE].right = width - 3;
|
||||
ResizeFrameWithPage();
|
||||
}
|
||||
|
||||
void DrawTabImages(rct_drawpixelinfo& dpi)
|
||||
|
|
|
@ -440,13 +440,7 @@ private:
|
|||
auto ft = Formatter::Common();
|
||||
peep->FormatNameTo(ft);
|
||||
|
||||
widgets[WIDX_BACKGROUND].right = width - 1;
|
||||
widgets[WIDX_BACKGROUND].bottom = height - 1;
|
||||
widgets[WIDX_PAGE_BACKGROUND].right = width - 1;
|
||||
widgets[WIDX_PAGE_BACKGROUND].bottom = height - 1;
|
||||
widgets[WIDX_TITLE].right = width - 2;
|
||||
widgets[WIDX_CLOSE].left = width - 13;
|
||||
widgets[WIDX_CLOSE].right = width - 3;
|
||||
ResizeFrameWithPage();
|
||||
|
||||
window_align_tabs(this, WIDX_TAB_1, WIDX_TAB_7);
|
||||
}
|
||||
|
|
|
@ -414,13 +414,7 @@ public:
|
|||
if (_selectedTab == TabId::Individual && _selectedFilter)
|
||||
widgets[WIDX_MAP].type = WindowWidgetType::FlatBtn;
|
||||
|
||||
widgets[WIDX_BACKGROUND].right = width - 1;
|
||||
widgets[WIDX_BACKGROUND].bottom = height - 1;
|
||||
widgets[WIDX_TAB_CONTENT_PANEL].right = width - 1;
|
||||
widgets[WIDX_TAB_CONTENT_PANEL].bottom = height - 1;
|
||||
widgets[WIDX_TITLE].right = width - 2;
|
||||
widgets[WIDX_CLOSE].left = width - 13;
|
||||
widgets[WIDX_CLOSE].right = width - 3;
|
||||
ResizeFrameWithPage();
|
||||
widgets[WIDX_GUEST_LIST].right = width - 4;
|
||||
widgets[WIDX_GUEST_LIST].bottom = height - 15;
|
||||
widgets[WIDX_MAP].left = 273 - 350 + width;
|
||||
|
|
|
@ -654,16 +654,7 @@ static void WindowLoadsaveComputeMaxDateWidth()
|
|||
|
||||
static void WindowLoadsaveInvalidate(rct_window* w)
|
||||
{
|
||||
window_loadsave_widgets[WIDX_TITLE].right = w->width - 2;
|
||||
// close button has to move if it's on the right side
|
||||
window_loadsave_widgets[WIDX_CLOSE].left = w->width - 13;
|
||||
window_loadsave_widgets[WIDX_CLOSE].right = w->width - 3;
|
||||
|
||||
window_loadsave_widgets[WIDX_BACKGROUND].right = w->width - 1;
|
||||
window_loadsave_widgets[WIDX_BACKGROUND].bottom = w->height - 1;
|
||||
window_loadsave_widgets[WIDX_RESIZE].top = w->height - 1;
|
||||
window_loadsave_widgets[WIDX_RESIZE].right = w->width - 1;
|
||||
window_loadsave_widgets[WIDX_RESIZE].bottom = w->height - 1;
|
||||
w->ResizeFrameWithPage();
|
||||
|
||||
rct_widget* date_widget = &window_loadsave_widgets[WIDX_SORT_DATE];
|
||||
date_widget->right = w->width - 5;
|
||||
|
|
|
@ -752,13 +752,7 @@ public:
|
|||
SetWidgetDisabled(WIDX_MAP_SIZE_LINK, gMapSize.x != gMapSize.y);
|
||||
|
||||
// Resize widgets to window size
|
||||
widgets[WIDX_BACKGROUND].right = width - 1;
|
||||
widgets[WIDX_BACKGROUND].bottom = height - 1;
|
||||
widgets[WIDX_RESIZE].right = width - 1;
|
||||
widgets[WIDX_RESIZE].bottom = height - 1;
|
||||
widgets[WIDX_TITLE].right = width - 2;
|
||||
widgets[WIDX_CLOSE].left = width - 2 - 11;
|
||||
widgets[WIDX_CLOSE].right = width - 2 - 11 + 10;
|
||||
ResizeFrameWithPage();
|
||||
widgets[WIDX_MAP].right = width - 4;
|
||||
|
||||
if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode)
|
||||
|
|
|
@ -266,13 +266,7 @@ static void WindowMultiplayerSetPage(rct_window* w, int32_t page)
|
|||
|
||||
static void WindowMultiplayerAnchorBorderWidgets(rct_window* w)
|
||||
{
|
||||
w->widgets[WIDX_BACKGROUND].right = w->width - 1;
|
||||
w->widgets[WIDX_BACKGROUND].bottom = w->height - 1;
|
||||
w->widgets[WIDX_TITLE].right = w->width - 2;
|
||||
w->widgets[WIDX_CONTENT_PANEL].right = w->width - 1;
|
||||
w->widgets[WIDX_CONTENT_PANEL].bottom = w->height - 1;
|
||||
w->widgets[WIDX_CLOSE].left = w->width - 13;
|
||||
w->widgets[WIDX_CLOSE].right = w->width - 3;
|
||||
w->ResizeFrameWithPage();
|
||||
}
|
||||
|
||||
static void WindowMultiplayerSetPressedTab(rct_window* w)
|
||||
|
|
|
@ -94,11 +94,7 @@ public:
|
|||
|
||||
void OnPrepareDraw() override
|
||||
{
|
||||
widgets[WIDX_BACKGROUND].right = width - 1;
|
||||
widgets[WIDX_BACKGROUND].bottom = height - 1;
|
||||
widgets[WIDX_TITLE].right = width - 2;
|
||||
widgets[WIDX_CLOSE].left = width - 2 - 0x0B;
|
||||
widgets[WIDX_CLOSE].right = width - 2 - 0x0B + 0x0A;
|
||||
ResizeFrame();
|
||||
}
|
||||
|
||||
void OnDraw(rct_drawpixelinfo& dpi) override
|
||||
|
|
|
@ -762,18 +762,12 @@ private:
|
|||
Invalidate();
|
||||
|
||||
// Resize widgets to new window size
|
||||
widgets[WIDX_BACKGROUND].right = newWidth - 1;
|
||||
widgets[WIDX_BACKGROUND].bottom = newHeight - 1;
|
||||
widgets[WIDX_PAGE_BACKGROUND].right = newWidth - 1;
|
||||
widgets[WIDX_PAGE_BACKGROUND].bottom = newHeight - 1;
|
||||
widgets[WIDX_TITLE].right = newWidth - 2;
|
||||
widgets[WIDX_CLOSE].left = newWidth - 13;
|
||||
widgets[WIDX_CLOSE].right = newWidth - 3;
|
||||
width = newWidth;
|
||||
height = newHeight;
|
||||
ResizeFrameWithPage();
|
||||
widgets[WIDX_GROUP_BY_TRACK_TYPE].left = newWidth - 8 - GroupByTrackTypeWidth;
|
||||
widgets[WIDX_GROUP_BY_TRACK_TYPE].right = newWidth - 8;
|
||||
|
||||
width = newWidth;
|
||||
height = newHeight;
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
|
|
|
@ -1202,13 +1202,7 @@ private:
|
|||
|
||||
void AnchorBorderWidgets()
|
||||
{
|
||||
widgets[WIDX_BACKGROUND].right = width - 1;
|
||||
widgets[WIDX_BACKGROUND].bottom = height - 1;
|
||||
widgets[WIDX_PAGE_BACKGROUND].right = width - 1;
|
||||
widgets[WIDX_PAGE_BACKGROUND].bottom = height - 1;
|
||||
widgets[WIDX_TITLE].right = width - 2;
|
||||
widgets[WIDX_CLOSE].left = width - 13;
|
||||
widgets[WIDX_CLOSE].right = width - 3;
|
||||
ResizeFrameWithPage();
|
||||
}
|
||||
|
||||
void SetPressedTab()
|
||||
|
|
|
@ -379,13 +379,7 @@ void WindowPlayerOverviewInvalidate(rct_window* w)
|
|||
|
||||
WindowPlayerUpdateTitle(w);
|
||||
|
||||
w->widgets[WIDX_BACKGROUND].right = w->width - 1;
|
||||
w->widgets[WIDX_BACKGROUND].bottom = w->height - 1;
|
||||
w->widgets[WIDX_PAGE_BACKGROUND].right = w->width - 1;
|
||||
w->widgets[WIDX_PAGE_BACKGROUND].bottom = w->height - 1;
|
||||
w->widgets[WIDX_TITLE].right = w->width - 2;
|
||||
w->widgets[WIDX_CLOSE].left = w->width - 13;
|
||||
w->widgets[WIDX_CLOSE].right = w->width - 3;
|
||||
w->ResizeFrameWithPage();
|
||||
w->widgets[WIDX_LOCATE].right = w->width - 2;
|
||||
w->widgets[WIDX_LOCATE].left = w->width - 25;
|
||||
w->widgets[WIDX_KICK].right = w->width - 2;
|
||||
|
@ -472,13 +466,7 @@ void WindowPlayerStatisticsInvalidate(rct_window* w)
|
|||
|
||||
WindowPlayerUpdateTitle(w);
|
||||
|
||||
w->widgets[WIDX_BACKGROUND].right = w->width - 1;
|
||||
w->widgets[WIDX_BACKGROUND].bottom = w->height - 1;
|
||||
w->widgets[WIDX_PAGE_BACKGROUND].right = w->width - 1;
|
||||
w->widgets[WIDX_PAGE_BACKGROUND].bottom = w->height - 1;
|
||||
w->widgets[WIDX_TITLE].right = w->width - 2;
|
||||
w->widgets[WIDX_CLOSE].left = w->width - 13;
|
||||
w->widgets[WIDX_CLOSE].right = w->width - 3;
|
||||
w->ResizeFrameWithPage();
|
||||
|
||||
window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_2);
|
||||
}
|
||||
|
|
|
@ -1468,13 +1468,7 @@ static void WindowRideSetPressedTab(rct_window* w)
|
|||
|
||||
static void WindowRideAnchorBorderWidgets(rct_window* w)
|
||||
{
|
||||
w->widgets[WIDX_BACKGROUND].right = w->width - 1;
|
||||
w->widgets[WIDX_BACKGROUND].bottom = w->height - 1;
|
||||
w->widgets[WIDX_PAGE_BACKGROUND].right = w->width - 1;
|
||||
w->widgets[WIDX_PAGE_BACKGROUND].bottom = w->height - 1;
|
||||
w->widgets[WIDX_TITLE].right = w->width - 2;
|
||||
w->widgets[WIDX_CLOSE].left = w->width - 13;
|
||||
w->widgets[WIDX_CLOSE].right = w->width - 3;
|
||||
w->ResizeFrameWithPage();
|
||||
}
|
||||
|
||||
#pragma region Main
|
||||
|
|
|
@ -450,15 +450,7 @@ public:
|
|||
else
|
||||
pressed_widgets &= ~(1uLL << WIDX_QUICK_DEMOLISH);
|
||||
|
||||
widgets[WIDX_BACKGROUND].right = width - 1;
|
||||
widgets[WIDX_BACKGROUND].bottom = height - 1;
|
||||
widgets[WIDX_PAGE_BACKGROUND].right = width - 1;
|
||||
widgets[WIDX_PAGE_BACKGROUND].bottom = height - 1;
|
||||
widgets[WIDX_TITLE].right = width - 2;
|
||||
|
||||
// if close button is on the right then it must move
|
||||
widgets[WIDX_CLOSE].left = width - 13;
|
||||
widgets[WIDX_CLOSE].right = width - 3;
|
||||
ResizeFrameWithPage();
|
||||
|
||||
widgets[WIDX_LIST].right = width - 26;
|
||||
widgets[WIDX_LIST].bottom = height - 15;
|
||||
|
|
|
@ -412,20 +412,11 @@ static void WindowScenarioselectInvalidate(rct_window* w)
|
|||
|
||||
w->pressed_widgets |= 1LL << (w->selected_tab + WIDX_TAB1);
|
||||
|
||||
int32_t windowWidth = w->width;
|
||||
window_scenarioselect_widgets[WIDX_BACKGROUND].right = windowWidth - 1;
|
||||
window_scenarioselect_widgets[WIDX_TITLEBAR].right = windowWidth - 2;
|
||||
window_scenarioselect_widgets[WIDX_CLOSE].left = windowWidth - 13;
|
||||
window_scenarioselect_widgets[WIDX_CLOSE].right = windowWidth - 3;
|
||||
window_scenarioselect_widgets[WIDX_TABCONTENT].right = windowWidth - 1;
|
||||
window_scenarioselect_widgets[WIDX_SCENARIOLIST].right = windowWidth - 179;
|
||||
|
||||
int32_t windowHeight = w->height;
|
||||
window_scenarioselect_widgets[WIDX_BACKGROUND].bottom = windowHeight - 1;
|
||||
window_scenarioselect_widgets[WIDX_TABCONTENT].bottom = windowHeight - 1;
|
||||
w->ResizeFrameWithPage();
|
||||
|
||||
const int32_t bottomMargin = gConfigGeneral.DebuggingTools ? 17 : 5;
|
||||
window_scenarioselect_widgets[WIDX_SCENARIOLIST].bottom = windowHeight - bottomMargin;
|
||||
window_scenarioselect_widgets[WIDX_SCENARIOLIST].right = w->width - 179;
|
||||
window_scenarioselect_widgets[WIDX_SCENARIOLIST].bottom = w->height - bottomMargin;
|
||||
}
|
||||
|
||||
static void WindowScenarioselectPaint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
|
|
|
@ -352,11 +352,7 @@ static OpenRCT2String WindowServerListTooltip(rct_window* const w, const WidgetI
|
|||
|
||||
static void WindowServerListInvalidate(rct_window* w)
|
||||
{
|
||||
window_server_list_widgets[WIDX_BACKGROUND].right = w->width - 1;
|
||||
window_server_list_widgets[WIDX_BACKGROUND].bottom = w->height - 1;
|
||||
window_server_list_widgets[WIDX_TITLE].right = w->width - 2;
|
||||
window_server_list_widgets[WIDX_CLOSE].left = w->width - 2 - 11;
|
||||
window_server_list_widgets[WIDX_CLOSE].right = w->width - 2 - 11 + 10;
|
||||
w->ResizeFrame();
|
||||
|
||||
int32_t margin = 6;
|
||||
int32_t buttonHeight = 13;
|
||||
|
|
|
@ -234,13 +234,7 @@ public:
|
|||
|
||||
void OnPrepareDraw() override
|
||||
{
|
||||
widgets[WIDX_BACKGROUND].right = width - 1;
|
||||
widgets[WIDX_BACKGROUND].bottom = height - 1;
|
||||
widgets[WIDX_TITLE].right = width - 2;
|
||||
widgets[WIDX_CLOSE].right = width - 3;
|
||||
widgets[WIDX_CLOSE].left = width - 13;
|
||||
widgets[WIDX_TAB_CONTENT_PANEL].right = width - 1;
|
||||
widgets[WIDX_TAB_CONTENT_PANEL].bottom = height - 1;
|
||||
ResizeFrameWithPage();
|
||||
widgets[WIDX_SCROLL].right = width - 5;
|
||||
widgets[WIDX_SCROLL].bottom = height - 19;
|
||||
widgets[WIDX_RESET].top = height - 16;
|
||||
|
|
|
@ -339,16 +339,7 @@ private:
|
|||
auto ft = Formatter::Common();
|
||||
staff->FormatNameTo(ft);
|
||||
|
||||
widgets[WIDX_BACKGROUND].right = width - 1;
|
||||
widgets[WIDX_BACKGROUND].bottom = height - 1;
|
||||
|
||||
widgets[WIDX_RESIZE].right = width - 1;
|
||||
widgets[WIDX_RESIZE].bottom = height - 1;
|
||||
|
||||
widgets[WIDX_TITLE].right = width - 2;
|
||||
|
||||
widgets[WIDX_CLOSE].left = width - 13;
|
||||
widgets[WIDX_CLOSE].right = width - 3;
|
||||
ResizeFrameWithPage();
|
||||
}
|
||||
|
||||
void CommonPrepareDrawAfter()
|
||||
|
|
|
@ -177,13 +177,7 @@ public:
|
|||
{
|
||||
rct_widget* viewportWidget = &window_viewport_widgets[WIDX_VIEWPORT];
|
||||
|
||||
widgets[WIDX_BACKGROUND].right = width - 1;
|
||||
widgets[WIDX_BACKGROUND].bottom = height - 1;
|
||||
widgets[WIDX_TITLE].right = width - 2;
|
||||
widgets[WIDX_CLOSE].left = width - 13;
|
||||
widgets[WIDX_CLOSE].right = width - 3;
|
||||
widgets[WIDX_CONTENT_PANEL].right = width - 1;
|
||||
widgets[WIDX_CONTENT_PANEL].bottom = height - 1;
|
||||
ResizeFrameWithPage();
|
||||
widgets[WIDX_ZOOM_IN].left = width - 27;
|
||||
widgets[WIDX_ZOOM_IN].right = width - 2;
|
||||
widgets[WIDX_ZOOM_OUT].left = width - 27;
|
||||
|
|
|
@ -2238,3 +2238,23 @@ void WidgetScrollUpdateThumbs(rct_window& w, WidgetIndex widget_index)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void rct_window::ResizeFrame()
|
||||
{
|
||||
// Frame
|
||||
widgets[0].right = width - 1;
|
||||
widgets[0].bottom = height - 1;
|
||||
// Title
|
||||
widgets[1].right = width - 2;
|
||||
// Close button
|
||||
widgets[2].left = width - 13;
|
||||
widgets[2].right = width - 3;
|
||||
}
|
||||
|
||||
void rct_window::ResizeFrameWithPage()
|
||||
{
|
||||
ResizeFrame();
|
||||
// Page background
|
||||
widgets[3].right = width - 1;
|
||||
widgets[3].bottom = height - 1;
|
||||
}
|
||||
|
|
|
@ -197,6 +197,9 @@ struct rct_window
|
|||
virtual void OnUnknown5()
|
||||
{
|
||||
}
|
||||
|
||||
void ResizeFrame();
|
||||
void ResizeFrameWithPage();
|
||||
};
|
||||
|
||||
#ifdef __WARN_SUGGEST_FINAL_METHODS__
|
||||
|
|
Loading…
Reference in New Issue