1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-04 13:42:55 +01:00

Use window shim in more windows (#23986)

* ProgressWindow: use WINDOW_SHIM; call OnResize

* Use window shim in multiplayer windows
This commit is contained in:
Aaron van Geffen
2025-03-13 20:14:34 +01:00
committed by GitHub
parent 7040588337
commit 0382973afe
5 changed files with 16 additions and 26 deletions

View File

@@ -64,10 +64,8 @@ namespace OpenRCT2::Ui::Windows
// clang-format off
#define MAIN_MULTIPLAYER_WIDGETS \
MakeWidget({ 0, 0}, {340, 240}, WindowWidgetType::Frame, WindowColour::Primary ), /* panel / background */ \
MakeWidget({ 1, 1}, {338, 14}, WindowWidgetType::Caption, WindowColour::Primary, kStringIdNone, STR_WINDOW_TITLE_TIP ), /* title bar */ \
MakeWidget({327, 2}, { 11, 12}, WindowWidgetType::CloseBox, WindowColour::Primary, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP ), /* close x button */ \
MakeWidget({ 0, 43}, {340, 197}, WindowWidgetType::Resize, WindowColour::Secondary ), /* content panel */ \
WINDOW_SHIM(kStringIdNone, 340, 240), \
MakeWidget({ 0, 43}, {340, 197}, WindowWidgetType::Resize, WindowColour::Secondary ), /* content panel */ \
MakeTab ({ 3, 17}, STR_SHOW_SERVER_INFO_TIP), /* tab */ \
MakeTab ({ 34, 17}, STR_PLAYERS_TIP ), /* tab */ \
MakeTab ({ 65, 17}, STR_GROUPS_TIP ), /* tab */ \

View File

@@ -33,7 +33,6 @@ namespace OpenRCT2::Ui::Windows
#pragma region Widgets
// clang-format off
enum WindowPlayerWidgetIdx
{
WIDX_BACKGROUND,
@@ -50,21 +49,20 @@ namespace OpenRCT2::Ui::Windows
WIDX_VIEWPORT,
};
#define WINDOW_PLAYER_COMMON_WIDGETS \
MakeWidget({ 0, 0 }, { 192, 157 }, WindowWidgetType::Frame, WindowColour::Primary), \
MakeWidget({ 1, 1 }, { 190, 14 }, WindowWidgetType::Caption, WindowColour::Primary, STR_STRING, STR_WINDOW_TITLE_TIP), \
MakeWidget({ 179, 2 }, { 11, 12 }, WindowWidgetType::CloseBox, WindowColour::Primary, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP), \
MakeWidget({ 0, 43 }, { 192, 114 }, WindowWidgetType::Resize, WindowColour::Secondary), \
MakeTab({ 3, 17 }), \
// clang-format off
#define WINDOW_PLAYER_COMMON_WIDGETS \
WINDOW_SHIM(STR_STRING, 192, 157), \
MakeWidget({ 0, 43 }, { 192, 114 }, WindowWidgetType::Resize, WindowColour::Secondary), \
MakeTab({ 3, 17 }), \
MakeTab({ 34, 17 })
static constexpr Widget window_player_overview_widgets[] = {
WINDOW_PLAYER_COMMON_WIDGETS,
MakeWidget({ 3, 46}, {175, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), // Permission group
MakeWidget({167, 47}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH ),
MakeWidget({179, 45}, { 12, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_LOCATE), STR_LOCATE_PLAYER_TIP), // Locate button
MakeWidget({179, 69}, { 12, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_DEMOLISH), STR_KICK_PLAYER_TIP ), // Kick button
MakeWidget({ 3, 60}, {175, 61}, WindowWidgetType::Viewport, WindowColour::Secondary ), // Viewport
MakeWidget({ 3, 46}, {175, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), // Permission group
MakeWidget({167, 47}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH ),
MakeWidget({179, 45}, { 12, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_LOCATE), STR_LOCATE_PLAYER_TIP), // Locate button
MakeWidget({179, 69}, { 12, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_DEMOLISH), STR_KICK_PLAYER_TIP ), // Kick button
MakeWidget({ 3, 60}, {175, 61}, WindowWidgetType::Viewport, WindowColour::Secondary ), // Viewport
};
static constexpr Widget window_player_statistics_widgets[] = {

View File

@@ -35,9 +35,7 @@ namespace OpenRCT2::Ui::Windows
// clang-format off
static constexpr Widget kProgressWindowWidgets[] = {
MakeWidget({ 0, 0}, { kWindowWidth, kWindowHeight}, WindowWidgetType::Frame, WindowColour::Primary ), // panel / background
MakeWidget({ 1, 1}, {kWindowWidth - 3, 14}, WindowWidgetType::Caption, WindowColour::Primary, STR_STRINGID, STR_WINDOW_TITLE_TIP), // title bar
MakeWidget({kWindowWidth - 12, 2}, { 11, 12}, WindowWidgetType::CloseBox, WindowColour::Primary, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP), // close x button
WINDOW_SHIM(STR_STRINGID, kWindowWidth, kWindowHeight)
};
struct LoaderVehicleStyle
@@ -92,6 +90,7 @@ namespace OpenRCT2::Ui::Windows
frame_no = 0;
ApplyStyle();
OnResize();
}
void OnClose() override

View File

@@ -64,9 +64,7 @@ namespace OpenRCT2::Ui::Windows
// clang-format off
static constexpr Widget _serverListWidgets[] = {
MakeWidget({ 0, 0}, {341, 91}, WindowWidgetType::Frame, WindowColour::Primary ), // panel / background
MakeWidget({ 1, 1}, {338, 14}, WindowWidgetType::Caption, WindowColour::Primary, STR_SERVER_LIST, STR_WINDOW_TITLE_TIP), // title bar
MakeWidget({327, 2}, { 11, 12}, WindowWidgetType::CloseBox, WindowColour::Primary, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP), // close x button
WINDOW_SHIM(STR_SERVER_LIST, 340, 90),
MakeWidget({100, 20}, {245, 12}, WindowWidgetType::TextBox, WindowColour::Secondary ), // player name text box
MakeWidget({ 6, 37}, {489, 226}, WindowWidgetType::Scroll, WindowColour::Secondary ), // server list
MakeWidget({ 6, 53}, {101, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_FETCH_SERVERS ), // fetch servers button
@@ -98,7 +96,6 @@ namespace OpenRCT2::Ui::Windows
SetWidgets(_serverListWidgets);
widgets[WIDX_PLAYER_NAME_INPUT].string = const_cast<utf8*>(_playerName.c_str());
InitScrollWidgets();
WindowSetResize(*this, { 320, 90 }, { 320, 90 });
no_list_items = 0;
selected_list_item = -1;

View File

@@ -47,9 +47,7 @@ namespace OpenRCT2::Ui::Windows
// clang-format off
static constexpr Widget _windowServerStartWidgets[] = {
MakeWidget({ 0, 0 }, { WW, WH }, WindowWidgetType::Frame, WindowColour::Primary), // panel / background
MakeWidget({ 1, 1 }, { 298, 14 }, WindowWidgetType::Caption, WindowColour::Primary, STR_START_SERVER,STR_WINDOW_TITLE_TIP), // title bar
MakeWidget({ WW - 13, 2 }, { 11, 12 }, WindowWidgetType::CloseBox, WindowColour::Primary, STR_CLOSE_X,STR_CLOSE_WINDOW_TIP), // close x button
WINDOW_SHIM(STR_START_SERVER, WW, WH),
MakeWidget({ 120, 20 }, { 173, 13 }, WindowWidgetType::TextBox, WindowColour::Secondary), // port text box
MakeWidget({ 120, 36 }, { 173, 13 }, WindowWidgetType::TextBox, WindowColour::Secondary), // name text box
MakeWidget({ 120, 52 }, { 173, 13 }, WindowWidgetType::TextBox, WindowColour::Secondary), // description text box