mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 19:13:07 +01:00
Move widget constants from Windows.h to Widget.h
This commit is contained in:
@@ -9,8 +9,6 @@
|
||||
|
||||
#include "Widget.h"
|
||||
|
||||
#include "Window.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Input.h>
|
||||
@@ -567,13 +565,13 @@ static void WidgetCaptionDraw(DrawPixelInfo& dpi, WindowBase& w, WidgetIndex wid
|
||||
int32_t width = widget->width() - 4;
|
||||
if ((widget + 1)->type == WindowWidgetType::CloseBox)
|
||||
{
|
||||
width -= CloseButtonWidth;
|
||||
width -= kCloseButtonWidth;
|
||||
if ((widget + 2)->type == WindowWidgetType::CloseBox)
|
||||
width -= CloseButtonWidth;
|
||||
width -= kCloseButtonWidth;
|
||||
}
|
||||
topLeft.x += width / 2;
|
||||
if (Config::Get().interface.WindowButtonsOnTheLeft)
|
||||
topLeft.x += CloseButtonWidth;
|
||||
topLeft.x += kCloseButtonWidth;
|
||||
|
||||
DrawTextEllipsised(
|
||||
dpi, topLeft, width, widget->text, Formatter::Common(),
|
||||
|
||||
@@ -828,7 +828,7 @@ void WindowAlignTabs(WindowBase* w, WidgetIndex start_tab_id, WidgetIndex end_ta
|
||||
|
||||
ScreenCoordsXY WindowGetViewportSoundIconPos(WindowBase& w)
|
||||
{
|
||||
const uint8_t buttonOffset = (Config::Get().interface.WindowButtonsOnTheLeft) ? CloseButtonWidth + 2 : 0;
|
||||
const uint8_t buttonOffset = (Config::Get().interface.WindowButtonsOnTheLeft) ? kCloseButtonWidth + 2 : 0;
|
||||
return w.windowPos + ScreenCoordsXY{ 2 + buttonOffset, 2 };
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Window.h"
|
||||
#include <cstdint>
|
||||
|
||||
struct WindowBase;
|
||||
|
||||
using WidgetIndex = int16_t;
|
||||
|
||||
enum class WindowWidgetType : uint8_t
|
||||
{
|
||||
@@ -39,6 +43,18 @@ enum class WindowWidgetType : uint8_t
|
||||
Last = 26,
|
||||
};
|
||||
|
||||
constexpr uint8_t kCloseButtonWidth = 10;
|
||||
|
||||
constexpr int32_t kScrollableRowHeight = 12;
|
||||
constexpr uint8_t kListRowHeight = 12;
|
||||
constexpr uint8_t kTableCellHeight = 12;
|
||||
constexpr uint8_t kButtonFaceHeight = 12;
|
||||
constexpr uint8_t kSpinnerHeight = 12;
|
||||
constexpr uint8_t kDropdownHeight = 12;
|
||||
|
||||
constexpr uint16_t kTextInputSize = 1024;
|
||||
constexpr uint16_t kTopToolbarHeight = 27;
|
||||
|
||||
enum
|
||||
{
|
||||
SCROLL_HORIZONTAL = (1 << 0),
|
||||
|
||||
@@ -1849,11 +1849,11 @@ void WindowBase::ResizeFrame()
|
||||
if (Config::Get().interface.WindowButtonsOnTheLeft)
|
||||
{
|
||||
widgets[2].left = 2;
|
||||
widgets[2].right = 2 + CloseButtonWidth;
|
||||
widgets[2].right = 2 + kCloseButtonWidth;
|
||||
}
|
||||
else
|
||||
{
|
||||
widgets[2].left = width - 3 - CloseButtonWidth;
|
||||
widgets[2].left = width - 3 - kCloseButtonWidth;
|
||||
widgets[2].right = width - 3;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "../windows/TileInspectorGlobals.h"
|
||||
#include "../world/Location.hpp"
|
||||
#include "../world/ScenerySelection.h"
|
||||
#include "Widget.h"
|
||||
#include "WindowClasses.h"
|
||||
#include "ZoomLevel.h"
|
||||
|
||||
@@ -39,20 +40,7 @@ enum class CursorID : uint8_t;
|
||||
enum class RideConstructionState : uint8_t;
|
||||
enum class CloseWindowModifier : uint8_t;
|
||||
|
||||
constexpr uint8_t CloseButtonWidth = 10;
|
||||
|
||||
constexpr int32_t kScrollableRowHeight = 12;
|
||||
constexpr uint8_t kListRowHeight = 12;
|
||||
constexpr uint8_t kTableCellHeight = 12;
|
||||
constexpr uint8_t kButtonFaceHeight = 12;
|
||||
constexpr uint8_t kSpinnerHeight = 12;
|
||||
constexpr uint8_t kDropdownHeight = 12;
|
||||
|
||||
constexpr uint16_t kTextInputSize = 1024;
|
||||
constexpr uint16_t kTopToolbarHeight = 27;
|
||||
|
||||
using rct_windownumber = uint16_t;
|
||||
using WidgetIndex = int16_t;
|
||||
|
||||
struct WindowIdentifier
|
||||
{
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "../drawing/Text.h"
|
||||
#include "../interface/Chat.h"
|
||||
#include "../interface/InteractiveConsole.h"
|
||||
#include "../interface/Widget.h"
|
||||
#include "../localisation/FormatCodes.h"
|
||||
#include "../localisation/Formatting.h"
|
||||
#include "../localisation/Language.h"
|
||||
@@ -133,7 +134,7 @@ void Painter::PaintFPS(DrawPixelInfo& dpi)
|
||||
const bool isTitle = gScreenFlags == SCREEN_FLAGS_TITLE_DEMO;
|
||||
if (!isTitle && Config::Get().interface.ToolbarButtonsCentred)
|
||||
{
|
||||
screenCoords.y = 30; // kTopToolbarHeight; don't want to include Window.h here
|
||||
screenCoords.y = kTopToolbarHeight + 3;
|
||||
}
|
||||
|
||||
DrawText(dpi, screenCoords, { COLOUR_WHITE }, buffer);
|
||||
|
||||
Reference in New Issue
Block a user