// SPDX-License-Identifier: MIT // // ES-DE // GuiTextEditPopup.h // // Text edit popup. // Has a default mode and a complex mode, both with various options passed as arguments. // #ifndef ES_CORE_GUIS_GUI_TEXT_EDIT_POPUP_H #define ES_CORE_GUIS_GUI_TEXT_EDIT_POPUP_H #include "GuiComponent.h" #include "components/ButtonComponent.h" #include "components/ComponentGrid.h" #include "components/TextComponent.h" #include "components/TextEditComponent.h" class GuiTextEditPopup : public GuiComponent { public: GuiTextEditPopup(const HelpStyle& helpstyle, const std::string& title, const std::string& initValue, const std::function& okCallback, bool multiLine, const std::string& acceptBtnText = "OK", const std::string& saveConfirmationText = "SAVE CHANGES?", const std::string& infoString = "", const std::string& defaultValue = "", const std::string& loadBtnHelpText = "LOAD DEFAULT", const std::string& clearBtnHelpText = "CLEAR", const std::string& cancelBtnHelpText = "DISCARD CHANGES"); void onSizeChanged() override; bool input(InputConfig* config, Input input) override; void update(int deltaTime) override; std::vector getHelpPrompts() override; HelpStyle getHelpStyle() override { return mHelpStyle; } private: void updateDeleteRepeat(int deltaTime); NinePatchComponent mBackground; ComponentGrid mGrid; HelpStyle mHelpStyle; std::shared_ptr mTitle; std::shared_ptr mInfoString; std::shared_ptr mDefaultValue; std::shared_ptr mText; std::shared_ptr mButtonGrid; std::string mInitValue; std::string mAcceptBtnText; std::string mSaveConfirmationText; std::string mLoadBtnHelpText; std::string mClearBtnHelpText; std::string mCancelBtnHelpText; std::function mOkCallback; bool mMultiLine; bool mComplexMode; bool mDeleteRepeat; int mDeleteRepeatTimer; }; #endif // ES_CORE_GUIS_GUI_TEXT_EDIT_POPUP_H