GlobalLobbyWidget.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * GlobalLobbyWidget.cpp, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #include "StdInc.h"
  11. #include "GlobalLobbyWidget.h"
  12. #include "GlobalLobbyWindow.h"
  13. #include "../gui/CGuiHandler.h"
  14. #include "../gui/WindowHandler.h"
  15. #include "../widgets/TextControls.h"
  16. GlobalLobbyWidget::GlobalLobbyWidget(GlobalLobbyWindow * window)
  17. : window(window)
  18. {
  19. addCallback("closeWindow", [](int) { GH.windows().popWindows(1); });
  20. addCallback("sendMessage", [this](int) { this->window->doSendChatMessage(); });
  21. const JsonNode config(JsonPath::builtin("config/widgets/lobbyWindow.json"));
  22. build(config);
  23. }
  24. std::shared_ptr<CLabel> GlobalLobbyWidget::getAccountNameLabel()
  25. {
  26. return widget<CLabel>("accountNameLabel");
  27. }
  28. std::shared_ptr<CTextInput> GlobalLobbyWidget::getMessageInput()
  29. {
  30. return widget<CTextInput>("messageInput");
  31. }
  32. std::shared_ptr<CTextBox> GlobalLobbyWidget::getGameChat()
  33. {
  34. return widget<CTextBox>("gameChat");
  35. }