GlobalLobbyWidget.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * GlobalLobbyWidget.h, 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. #pragma once
  11. #include "../gui/InterfaceObjectConfigurable.h"
  12. class GlobalLobbyWindow;
  13. struct GlobalLobbyAccount;
  14. struct GlobalLobbyRoom;
  15. class CListBox;
  16. class GlobalLobbyWidget : public InterfaceObjectConfigurable
  17. {
  18. GlobalLobbyWindow * window;
  19. using CreateFunc = std::function<std::shared_ptr<CIntObject>(size_t)>;
  20. std::shared_ptr<CIntObject> buildItemList(const JsonNode &) const;
  21. CreateFunc getItemListConstructorFunc(const std::string & callbackName) const;
  22. public:
  23. explicit GlobalLobbyWidget(GlobalLobbyWindow * window);
  24. std::shared_ptr<CLabel> getAccountNameLabel();
  25. std::shared_ptr<CTextInput> getMessageInput();
  26. std::shared_ptr<CTextBox> getGameChat();
  27. std::shared_ptr<CListBox> getAccountList();
  28. std::shared_ptr<CListBox> getRoomList();
  29. std::shared_ptr<CListBox> getChannelList();
  30. std::shared_ptr<CListBox> getMatchList();
  31. std::shared_ptr<CLabel> getGameChatHeader();
  32. std::shared_ptr<CLabel> getAccountListHeader();
  33. std::shared_ptr<CLabel> getRoomListHeader();
  34. std::shared_ptr<CLabel> getChannelListHeader();
  35. std::shared_ptr<CLabel> getMatchListHeader();
  36. };
  37. class GlobalLobbyChannelCardBase : public CIntObject
  38. {
  39. GlobalLobbyWindow * window;
  40. std::string channelType;
  41. std::string channelName;
  42. std::string channelDescription;
  43. void clickPressed(const Point & cursorPosition) override;
  44. std::shared_ptr<TransparentFilledRectangle> backgroundOverlay;
  45. public:
  46. GlobalLobbyChannelCardBase(GlobalLobbyWindow * window, const Point & dimensions, const std::string & channelType, const std::string & channelName, const std::string & channelDescription);
  47. };
  48. class GlobalLobbyAccountCard : public GlobalLobbyChannelCardBase
  49. {
  50. std::shared_ptr<TransparentFilledRectangle> backgroundOverlay;
  51. std::shared_ptr<CLabel> labelName;
  52. std::shared_ptr<CLabel> labelStatus;
  53. public:
  54. GlobalLobbyAccountCard(GlobalLobbyWindow * window, const GlobalLobbyAccount & accountDescription);
  55. };
  56. class GlobalLobbyRoomCard : public CIntObject
  57. {
  58. GlobalLobbyWindow * window;
  59. std::string roomUUID;
  60. std::shared_ptr<TransparentFilledRectangle> backgroundOverlay;
  61. std::shared_ptr<CLabel> labelName;
  62. std::shared_ptr<CLabel> labelRoomSize;
  63. std::shared_ptr<CLabel> labelRoomStatus;
  64. std::shared_ptr<CLabel> labelDescription;
  65. std::shared_ptr<CPicture> iconRoomSize;
  66. void clickPressed(const Point & cursorPosition) override;
  67. public:
  68. GlobalLobbyRoomCard(GlobalLobbyWindow * window, const GlobalLobbyRoom & roomDescription);
  69. };
  70. class GlobalLobbyChannelCard : public GlobalLobbyChannelCardBase
  71. {
  72. std::shared_ptr<CLabel> labelName;
  73. std::shared_ptr<CButton> buttonClose;
  74. public:
  75. GlobalLobbyChannelCard(GlobalLobbyWindow * window, const std::string & channelName);
  76. };
  77. class GlobalLobbyMatchCard : public GlobalLobbyChannelCardBase
  78. {
  79. std::shared_ptr<CLabel> labelMatchDate;
  80. std::shared_ptr<CLabel> labelMatchOpponent;
  81. public:
  82. GlobalLobbyMatchCard(GlobalLobbyWindow * window, const GlobalLobbyRoom & matchDescription);
  83. };