mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-24 15:24:30 +01:00
Make rct_windowclass strong type WindowClass
This already revealed some places where implicit conversions were done, including some where its use was nonsense (MouseInput.cpp). The changes to the Intent class were necessary to keep things working, and this splits things up more neatly.
This commit is contained in:
@@ -70,7 +70,7 @@ public:
|
||||
// Save calling window details so that the information can be passed back to the correct window & widget
|
||||
if (parentWindow == nullptr)
|
||||
{
|
||||
_parentWidget.window.classification = WC_NULL;
|
||||
_parentWidget.window.classification = WindowClass::Null;
|
||||
_parentWidget.window.number = 0;
|
||||
_parentWidget.widget_index = 0;
|
||||
|
||||
@@ -360,7 +360,7 @@ private:
|
||||
|
||||
bool HasParentWindow() const
|
||||
{
|
||||
return _parentWidget.window.classification != WC_NULL;
|
||||
return _parentWidget.window.classification != WindowClass::Null;
|
||||
}
|
||||
|
||||
rct_window* GetParentWindow() const
|
||||
@@ -374,10 +374,10 @@ void WindowTextInputRawOpen(
|
||||
rct_window* call_w, rct_widgetindex call_widget, StringId title, StringId description, const Formatter& descriptionArgs,
|
||||
const_utf8string existing_text, int32_t maxLength)
|
||||
{
|
||||
window_close_by_class(WC_TEXTINPUT);
|
||||
window_close_by_class(WindowClass::Textinput);
|
||||
|
||||
auto height = TextInputWindow::CalculateWindowHeight(existing_text);
|
||||
auto w = WindowCreate<TextInputWindow>(WC_TEXTINPUT, WW, height, WF_CENTRE_SCREEN | WF_STICK_TO_FRONT);
|
||||
auto w = WindowCreate<TextInputWindow>(WindowClass::Textinput, WW, height, WF_CENTRE_SCREEN | WF_STICK_TO_FRONT);
|
||||
if (w != nullptr)
|
||||
{
|
||||
w->SetParentWindow(call_w, call_widget);
|
||||
@@ -391,7 +391,7 @@ void WindowTextInputOpen(
|
||||
std::function<void(std::string_view)> callback, std::function<void()> cancelCallback)
|
||||
{
|
||||
auto height = TextInputWindow::CalculateWindowHeight(initialValue);
|
||||
auto w = WindowCreate<TextInputWindow>(WC_TEXTINPUT, WW, height, WF_CENTRE_SCREEN | WF_STICK_TO_FRONT);
|
||||
auto w = WindowCreate<TextInputWindow>(WindowClass::Textinput, WW, height, WF_CENTRE_SCREEN | WF_STICK_TO_FRONT);
|
||||
if (w != nullptr)
|
||||
{
|
||||
w->SetTitle(title, description);
|
||||
@@ -416,7 +416,7 @@ void WindowTextInputKey(rct_window* w, char keychar)
|
||||
// If the return button is pressed stop text input
|
||||
if (keychar == '\r')
|
||||
{
|
||||
if (w->classification == WC_TEXTINPUT)
|
||||
if (w->classification == WindowClass::Textinput)
|
||||
{
|
||||
auto textInputWindow = static_cast<TextInputWindow*>(w);
|
||||
textInputWindow->OnReturnPressed();
|
||||
|
||||
Reference in New Issue
Block a user