cmCursesStringWidget.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #ifndef __cmCursesStringWidget_h
  14. #define __cmCursesStringWidget_h
  15. #include "cmCursesWidget.h"
  16. class cmCursesMainForm;
  17. /** \class cmCursesStringWidget
  18. * \brief A simple entry widget.
  19. *
  20. * cmCursesStringWdiget is a simple text entry widget.
  21. */
  22. class cmCursesStringWidget : public cmCursesWidget
  23. {
  24. public:
  25. cmCursesStringWidget(int width, int height, int left, int top);
  26. /**
  27. * Handle user input. Called by the container of this widget
  28. * when this widget has focus. Returns true if the input was
  29. * handled.
  30. */
  31. virtual bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w);
  32. /**
  33. * Set/Get the string.
  34. */
  35. void SetString(const char* value);
  36. const char* GetString();
  37. virtual const char* GetValue();
  38. /**
  39. * Set/Get InEdit flag. Can be used to tell the widget to leave
  40. * edit mode (in case of a resize for example).
  41. */
  42. void SetInEdit(bool inedit)
  43. { m_InEdit = inedit; }
  44. bool GetInEdit()
  45. { return m_InEdit; }
  46. /**
  47. * If there are any, print the widget specific commands
  48. * in the toolbar and return true. Otherwise, return false
  49. * and the parent widget will print.
  50. */
  51. virtual bool PrintKeys();
  52. protected:
  53. cmCursesStringWidget(const cmCursesStringWidget& from);
  54. void operator=(const cmCursesStringWidget&);
  55. // true if the widget is in edit mode
  56. bool m_InEdit;
  57. };
  58. #endif // __cmCursesStringWidget_h