MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / GameEditorModeConsole

Method GameEditorModeConsole

source/modes/GameEditorModeConsole.cpp:35–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33#include <cassert>
34
35GameEditorModeConsole::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
69GameEditorModeConsole::~GameEditorModeConsole()
70{

Callers

nothing calls this directly

Calls 3

addConsoleCommandsFunction · 0.85
getGuiSheetMethod · 0.80
getTypeMethod · 0.45

Tested by

no test coverage detected