cmCursesWidget.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*=========================================================================
  2. Program: Insight Segmentation & Registration Toolkit
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Insight Consortium. All rights reserved.
  8. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm 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 __cmCursesWidget_h
  14. #define __cmCursesWidget_h
  15. #include "../cmCacheManager.h"
  16. #include "cmCursesStandardIncludes.h"
  17. class cmCursesMainForm;
  18. class cmCursesWidget
  19. {
  20. public:
  21. cmCursesWidget(int width, int height, int left, int top);
  22. virtual ~cmCursesWidget();
  23. /**
  24. * Handle user input. Called by the container of this widget
  25. * when this widget has focus. Returns true if the input was
  26. * handled
  27. */
  28. virtual bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) = 0;
  29. /**
  30. * Change the position of the widget. Set isNewPage to true
  31. * if this widget marks the beginning of a new page.
  32. */
  33. virtual void Move(int x, int y, bool isNewPage);
  34. /**
  35. * Set/Get the value (setting the value also changes the contents
  36. * of the field buffer).
  37. */
  38. virtual void SetValue(const char* value);
  39. virtual const char* GetValue();
  40. /**
  41. * Get the type of the widget (STRING, PATH etc...)
  42. */
  43. cmCacheManager::CacheEntryType GetType()
  44. { return m_Type; }
  45. /**
  46. * If there are any, print the widget specific commands
  47. * in the toolbar and return true. Otherwise, return false
  48. * and the parent widget will print.
  49. */
  50. virtual bool PrintKeys()
  51. {
  52. return false;
  53. }
  54. /**
  55. * Set/Get the page this widget is in.
  56. */
  57. void SetPage(int page)
  58. {
  59. m_Page = page;
  60. }
  61. int GetPage()
  62. {
  63. return m_Page;
  64. }
  65. friend class cmCursesMainForm;
  66. protected:
  67. cmCursesWidget(const cmCursesWidget& from);
  68. void operator=(const cmCursesWidget&);
  69. cmCacheManager::CacheEntryType m_Type;
  70. std::string m_Value;
  71. FIELD* m_Field;
  72. // The page in the main form this widget is in
  73. int m_Page;
  74. };
  75. #endif // __cmCursesWidget_h