cmCursesStringWidget.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef __cmCursesStringWidget_h
  2. #define __cmCursesStringWidget_h
  3. #include "cmCursesWidget.h"
  4. class cmCursesMainForm;
  5. /** \class cmCursesStringWidget
  6. * \brief A simple entry widget.
  7. *
  8. * cmCursesStringWdiget is a simple text entry widget.
  9. */
  10. class cmCursesStringWidget : public cmCursesWidget
  11. {
  12. public:
  13. cmCursesStringWidget(int width, int height, int left, int top);
  14. /**
  15. * Handle user input. Called by the container of this widget
  16. * when this widget has focus. Returns true if the input was
  17. * handled.
  18. */
  19. virtual bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w);
  20. /**
  21. * Set/Get the string.
  22. */
  23. void SetString(const char* value);
  24. const char* GetString();
  25. virtual const char* GetValue();
  26. /**
  27. * Set/Get InEdit flag. Can be used to tell the widget to leave
  28. * edit mode (in case of a resize for example).
  29. */
  30. void SetInEdit(bool inedit)
  31. { m_InEdit = inedit; }
  32. bool GetInEdit()
  33. { return m_InEdit; }
  34. /**
  35. * If there are any, print the widget specific commands
  36. * in the toolbar and return true. Otherwise, return false
  37. * and the parent widget will print.
  38. */
  39. virtual bool PrintKeys();
  40. protected:
  41. cmCursesStringWidget(const cmCursesStringWidget& from);
  42. void operator=(const cmCursesStringWidget&);
  43. // true if the widget is in edit mode
  44. bool m_InEdit;
  45. };
  46. #endif // __cmCursesStringWidget_h