| 217 | void BaseScreen::finish() {} |
| 218 | |
| 219 | void BaseScreen::eventOccurred(Event *e) |
| 220 | { |
| 221 | form->eventOccured(e); |
| 222 | |
| 223 | if (e->type() == EVENT_KEY_DOWN) |
| 224 | { |
| 225 | if (form->findControlTyped<TextEdit>("TEXT_BASE_NAME")->isFocused()) |
| 226 | return; |
| 227 | if (e->keyboard().KeyCode == SDLK_ESCAPE || e->keyboard().KeyCode == SDLK_RETURN || |
| 228 | e->keyboard().KeyCode == SDLK_KP_ENTER) |
| 229 | { |
| 230 | form->findControl("BUTTON_OK")->click(); |
| 231 | return; |
| 232 | } |
| 233 | if (e->keyboard().KeyCode == SDLK_F10) |
| 234 | { |
| 235 | for (auto &facility : state->current_base->facilities) |
| 236 | { |
| 237 | { |
| 238 | facility->buildTime = 0; |
| 239 | } |
| 240 | } |
| 241 | return; |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | if (e->type() == EVENT_MOUSE_MOVE) |
| 246 | { |
| 247 | mousePos = {e->mouse().X, e->mouse().Y}; |
| 248 | } |
| 249 | |
| 250 | if (e->type() == EVENT_FORM_INTERACTION) |
| 251 | { |
| 252 | if (e->forms().RaisedBy == baseView) |
| 253 | { |
| 254 | if (e->forms().EventFlag == FormEventType::MouseMove) |
| 255 | { |
| 256 | selection = {e->forms().MouseInfo.X, e->forms().MouseInfo.Y}; |
| 257 | selection /= BaseGraphics::TILE_SIZE; |
| 258 | if (!drag) |
| 259 | { |
| 260 | selFacility = state->current_base->getFacility(selection); |
| 261 | } |
| 262 | return; |
| 263 | } |
| 264 | else if (e->forms().EventFlag == FormEventType::MouseLeave) |
| 265 | { |
| 266 | selection = NO_SELECTION; |
| 267 | selFacility = nullptr; |
| 268 | return; |
| 269 | } |
| 270 | } |
| 271 | if (e->forms().RaisedBy->Name == "LISTBOX_FACILITIES") |
| 272 | { |
| 273 | if (!drag && e->forms().EventFlag == FormEventType::ListBoxChangeHover) |
| 274 | { |
| 275 | auto list = form->findControlTyped<ListBox>("LISTBOX_FACILITIES"); |
| 276 | auto dragFacilityName = list->getHoveredData<UString>(); |
nothing calls this directly
no test coverage detected