/* * ShortcutsWindow.h, part of VCMI engine * * Authors: listed in file AUTHORS in main folder * * License: GNU General Public License v2.0 or later * Full text of license available in license.txt file, in main folder * */ #pragma once #include "../CWindowObject.h" #include "../../../lib/json/JsonNode.h" class CFilledTexture; class CButton; class CLabel; class TransparentFilledRectangle; class CSlider; class CTextBox; const int MAX_LINES = 11; const int LINE_HEIGHT = 30; class ShortcutElement : public CIntObject { private: std::shared_ptr buttonEdit; std::shared_ptr labelName; std::shared_ptr labelKeys; std::shared_ptr seperationLine; // rectangle is cleaner than line... std::function func; public: ShortcutElement(std::string id, JsonNode keys, int elem, std::function func); ShortcutElement(std::string group, int elem); }; class ShortcutsWindow : public CWindowObject { private: std::shared_ptr backgroundTexture; std::shared_ptr buttonOk; std::shared_ptr labelTitle; std::shared_ptr backgroundRect; std::shared_ptr slider; std::vector> listElements; JsonNode shortcuts; void fillList(int start); void setKeyBinding(const std::string & id, const std::string & keyName, bool append); public: ShortcutsWindow(); }; class ShortcutsEditWindow : public CWindowObject { private: std::shared_ptr backgroundTexture; std::shared_ptr text; std::string id; std::function func; void keyPressed(const std::string & keyName) override; public: ShortcutsEditWindow(const std::string & id, std::function func); };