MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / OnKeyPress

Method OnKeyPress

src/misc_gui.cpp:1151–1168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1149 }
1150
1151 EventState OnKeyPress([[maybe_unused]] char32_t key, uint16_t keycode) override
1152 {
1153 /* ESC closes the window, Enter confirms the action */
1154 switch (keycode) {
1155 case WKC_RETURN:
1156 case WKC_NUM_ENTER:
1157 if (this->proc != nullptr) {
1158 this->proc(this->parent, true);
1159 this->proc = nullptr;
1160 }
1161 [[fallthrough]];
1162
1163 case WKC_ESC:
1164 this->Close();
1165 return ES_HANDLED;
1166 }
1167 return ES_NOT_HANDLED;
1168 }
1169};
1170
1171static constexpr std::initializer_list<NWidgetPart> _nested_query_widgets = {

Callers

nothing calls this directly

Calls 1

CloseMethod · 0.95

Tested by

no test coverage detected