| 33 | #include <cassert> |
| 34 | |
| 35 | GameEditorModeConsole::GameEditorModeConsole(ModeManager* modeManager): |
| 36 | mConsoleInterface(std::bind(&GameEditorModeConsole::printToConsole, this, std::placeholders::_1)), |
| 37 | mModeManager(modeManager) |
| 38 | { |
| 39 | ConsoleCommands::addConsoleCommands(mConsoleInterface); |
| 40 | |
| 41 | CEGUI::Window* consoleRootWindow = mModeManager->getGui().getGuiSheet(Gui::guiSheet::console); |
| 42 | assert(consoleRootWindow != nullptr); |
| 43 | CEGUI::Window* listbox = consoleRootWindow->getChild("ConsoleHistoryWindow"); |
| 44 | assert(listbox->getType().compare("OD/Listbox") == 0); |
| 45 | mConsoleHistoryWindow = static_cast<CEGUI::Listbox*>(listbox); |
| 46 | CEGUI::Window* editbox = consoleRootWindow->getChild("Editbox"); |
| 47 | mEditboxWindow = static_cast<CEGUI::Editbox*>(editbox); |
| 48 | CEGUI::Window* sendButton = consoleRootWindow->getChild("SendButton"); |
| 49 | |
| 50 | addEventConnection( |
| 51 | sendButton->subscribeEvent(CEGUI::PushButton::EventClicked, |
| 52 | CEGUI::Event::Subscriber(&GameEditorModeConsole::executeCurrentPrompt, this)) |
| 53 | ); |
| 54 | |
| 55 | addEventConnection( |
| 56 | mEditboxWindow->subscribeEvent(CEGUI::Editbox::EventCharacterKey, |
| 57 | CEGUI::Event::Subscriber(&GameEditorModeConsole::characterEntered, this)) |
| 58 | ); |
| 59 | |
| 60 | mConsoleHistoryWindow->getVertScrollbar()->setEndLockEnabled(true); |
| 61 | |
| 62 | // Permits closing the console. |
| 63 | addEventConnection( |
| 64 | consoleRootWindow->subscribeEvent(CEGUI::FrameWindow::EventCloseClicked, |
| 65 | CEGUI::Event::Subscriber(&GameEditorModeConsole::leaveConsole, this)) |
| 66 | ); |
| 67 | } |
| 68 | |
| 69 | GameEditorModeConsole::~GameEditorModeConsole() |
| 70 | { |
nothing calls this directly
no test coverage detected