MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / WindowTextInputKey

Function WindowTextInputKey

src/openrct2-ui/windows/TextInput.cpp:417–437  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

415 }
416
417 void WindowTextInputKey(WindowBase* w, uint32_t keycode)
418 {
419 const auto wndNumber = w->number;
420 const auto wndClass = w->classification;
421
422 // If the return button is pressed stop text input
423 if (keycode == SDLK_RETURN || keycode == SDLK_KP_ENTER)
424 {
425 if (w->classification == WindowClass::textinput)
426 {
427 auto textInputWindow = static_cast<TextInputWindow*>(w);
428 textInputWindow->onReturnPressed();
429 }
430 }
431
432 // The window can be potentially closed within a callback, we need to check if its still alive.
433 auto* windowMgr = GetWindowManager();
434 w = windowMgr->FindByNumber(wndClass, wndNumber);
435 if (w != nullptr)
436 w->invalidate();
437 }
438} // namespace OpenRCT2::Ui::Windows

Callers 1

processMethod · 0.85

Calls 4

GetWindowManagerFunction · 0.85
onReturnPressedMethod · 0.80
FindByNumberMethod · 0.45
invalidateMethod · 0.45

Tested by

no test coverage detected