Path: blob/master/Source/CursesDialog/cmCursesStringWidget.h
5015 views
/* 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 "cmCursesWidget.h"1011class cmCursesMainForm;1213/** \class cmCursesStringWidget14* \brief A simple entry widget.15*16* cmCursesStringWdiget is a simple text entry widget.17*/1819class cmCursesStringWidget : public cmCursesWidget20{21public:22cmCursesStringWidget(int width, int height, int left, int top);2324/**25* Handle user input. Called by the container of this widget26* when this widget has focus. Returns true if the input was27* handled.28*/29bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) override;3031/**32* Set/Get the string.33*/34void SetString(std::string const& value);35char const* GetString();36char const* GetValue() override;3738/**39* Set/Get InEdit flag. Can be used to tell the widget to leave40* edit mode (in case of a resize for example).41*/42void SetInEdit(bool inedit);43bool GetInEdit() { return this->InEdit; }4445/**46* This method is called when different keys are pressed. The47* subclass can have a special implementation handler for this.48*/49virtual void OnTab(cmCursesMainForm* fm, WINDOW* w);50virtual void OnReturn(cmCursesMainForm* fm, WINDOW* w);51virtual void OnType(int& key, cmCursesMainForm* fm, WINDOW* w);5253/**54* If there are any, print the widget specific commands55* in the toolbar and return true. Otherwise, return false56* and the parent widget will print.57*/58bool PrintKeys() override;5960protected:61// true if the widget is in edit mode62bool InEdit;63std::string OriginalString;64bool Done;65};666768