/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying1file LICENSE.rst or https://cmake.org/licensing for details. */2#pragma once34#include "cmConfigure.h" // IWYU pragma: keep56#include <string>78#include "cmCursesStandardIncludes.h"9#include "cmStateTypes.h"1011class cmCursesMainForm;1213class cmCursesWidget14{15public:16cmCursesWidget(int width, int height, int left, int top);17virtual ~cmCursesWidget();1819cmCursesWidget(cmCursesWidget const&) = delete;20cmCursesWidget& operator=(cmCursesWidget const&) = delete;2122/**23* Handle user input. Called by the container of this widget24* when this widget has focus. Returns true if the input was25* handled26*/27virtual bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) = 0;2829/**30* Change the position of the widget. Set isNewPage to true31* if this widget marks the beginning of a new page.32*/33virtual void Move(int x, int y, bool isNewPage);3435/**36* Set/Get the value (setting the value also changes the contents37* of the field buffer).38*/39virtual void SetValue(std::string const& value);40virtual char const* GetValue();4142/**43* Get the type of the widget (STRING, PATH etc...)44*/45cmStateEnums::CacheEntryType GetType() { return this->Type; }4647/**48* If there are any, print the widget specific commands49* in the toolbar and return true. Otherwise, return false50* and the parent widget will print.51*/52virtual bool PrintKeys() { return false; }5354/**55* Set/Get the page this widget is in.56*/57void SetPage(int page) { this->Page = page; }58int GetPage() { return this->Page; }5960friend class cmCursesMainForm;6162protected:63cmStateEnums::CacheEntryType Type;64std::string Value;65FIELD* Field;66// The page in the main form this widget is in67int Page;68};697071