ShortcutsWindow.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * ShortcutsWindow.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 "../CWindowObject.h"
  12. #include "../../../lib/json/JsonNode.h"
  13. class CFilledTexture;
  14. class CButton;
  15. class CLabel;
  16. class TransparentFilledRectangle;
  17. class CSlider;
  18. const int MAX_LINES = 11;
  19. const int LINE_HEIGHT = 30;
  20. class ShortcutElement : public CIntObject
  21. {
  22. private:
  23. std::shared_ptr<CButton> buttonEdit;
  24. std::shared_ptr<CLabel> labelName;
  25. std::shared_ptr<CLabel> labelKeys;
  26. std::shared_ptr<TransparentFilledRectangle> seperationLine; // rectangle is cleaner than line...
  27. public:
  28. ShortcutElement(std::string id, JsonNode keys, int elem);
  29. ShortcutElement(std::string group, int elem);
  30. };
  31. class ShortcutsWindow : public CWindowObject
  32. {
  33. private:
  34. std::shared_ptr<CFilledTexture> backgroundTexture;
  35. std::shared_ptr<CButton> buttonOk;
  36. std::shared_ptr<CLabel> labelTitle;
  37. std::shared_ptr<TransparentFilledRectangle> backgroundRect;
  38. std::shared_ptr<CSlider> slider;
  39. std::vector<std::shared_ptr<ShortcutElement>> listElements;
  40. JsonNode shortcuts;
  41. void fillList(int start);
  42. public:
  43. ShortcutsWindow();
  44. };
  45. class ShortcutsEditWindow : public CWindowObject
  46. {
  47. private:
  48. void keyPressed(const std::string & keyName) override;
  49. public:
  50. ShortcutsEditWindow(const std::string & id);
  51. };