GlobalLobbyWidget.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. };
  32. class GlobalLobbyChannelCardBase : public CIntObject
  33. {
  34. GlobalLobbyWindow * window;
  35. std::string channelType;
  36. std::string channelName;
  37. void clickPressed(const Point & cursorPosition) override;
  38. public:
  39. GlobalLobbyChannelCardBase(GlobalLobbyWindow * window, const std::string & channelType, const std::string & channelName);
  40. };
  41. class GlobalLobbyAccountCard : public GlobalLobbyChannelCardBase
  42. {
  43. std::shared_ptr<TransparentFilledRectangle> backgroundOverlay;
  44. std::shared_ptr<CLabel> labelName;
  45. std::shared_ptr<CLabel> labelStatus;
  46. std::shared_ptr<CButton> buttonInvite;
  47. public:
  48. GlobalLobbyAccountCard(GlobalLobbyWindow * window, const GlobalLobbyAccount & accountDescription);
  49. };
  50. class GlobalLobbyRoomCard : public CIntObject
  51. {
  52. std::shared_ptr<TransparentFilledRectangle> backgroundOverlay;
  53. std::shared_ptr<CLabel> labelName;
  54. std::shared_ptr<CLabel> labelRoomSize;
  55. std::shared_ptr<CLabel> labelRoomStatus;
  56. std::shared_ptr<CLabel> labelDescription;
  57. std::shared_ptr<CButton> buttonJoin;
  58. std::shared_ptr<CPicture> iconRoomSize;
  59. public:
  60. GlobalLobbyRoomCard(GlobalLobbyWindow * window, const GlobalLobbyRoom & roomDescription);
  61. };
  62. class GlobalLobbyChannelCard : public GlobalLobbyChannelCardBase
  63. {
  64. std::shared_ptr<TransparentFilledRectangle> backgroundOverlay;
  65. std::shared_ptr<CLabel> labelName;
  66. public:
  67. GlobalLobbyChannelCard(GlobalLobbyWindow * window, const std::string & channelName);
  68. };
  69. class GlobalLobbyMatchCard : public GlobalLobbyChannelCardBase
  70. {
  71. std::shared_ptr<TransparentFilledRectangle> backgroundOverlay;
  72. std::shared_ptr<CLabel> labelMatchDate;
  73. std::shared_ptr<CLabel> labelMatchOpponent;
  74. public:
  75. GlobalLobbyMatchCard(GlobalLobbyWindow * window, const GlobalLobbyRoom & matchDescription);
  76. };