1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmCursesStringWidget.h,v $
6 Date: $Date: 2006-03-16 15:44:55 $
7 Version: $Revision: 1.6 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #ifndef __cmCursesStringWidget_h
18 #define __cmCursesStringWidget_h
20 #include "cmCursesWidget.h"
22 class cmCursesMainForm
;
24 /** \class cmCursesStringWidget
25 * \brief A simple entry widget.
27 * cmCursesStringWdiget is a simple text entry widget.
30 class cmCursesStringWidget
: public cmCursesWidget
33 cmCursesStringWidget(int width
, int height
, int left
, int top
);
36 * Handle user input. Called by the container of this widget
37 * when this widget has focus. Returns true if the input was
40 virtual bool HandleInput(int& key
, cmCursesMainForm
* fm
, WINDOW
* w
);
45 void SetString(const char* value
);
46 const char* GetString();
47 virtual const char* GetValue();
50 * Set/Get InEdit flag. Can be used to tell the widget to leave
51 * edit mode (in case of a resize for example).
53 void SetInEdit(bool inedit
) { this->InEdit
= inedit
; }
54 bool GetInEdit() { return this->InEdit
; }
57 * This method is called when different keys are pressed. The
58 * subclass can have a special implementation handler for this.
60 virtual void OnTab(cmCursesMainForm
* fm
, WINDOW
* w
);
61 virtual void OnReturn(cmCursesMainForm
* fm
, WINDOW
* w
);
62 virtual void OnType(int& key
, cmCursesMainForm
* fm
, WINDOW
* w
);
65 * If there are any, print the widget specific commands
66 * in the toolbar and return true. Otherwise, return false
67 * and the parent widget will print.
69 virtual bool PrintKeys();
72 cmCursesStringWidget(const cmCursesStringWidget
& from
);
73 void operator=(const cmCursesStringWidget
&);
75 // true if the widget is in edit mode
81 #endif // __cmCursesStringWidget_h