Initial commit.
[CMakeLuaTailorHgBridge.git] / CMakeLua / Source / CursesDialog / cmCursesWidget.h
blob297f542041bbc8fadfd03ba0968109fc46cb28ae
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmCursesWidget.h,v $
5 Language: C++
6 Date: $Date: 2006/03/16 15:44:55 $
7 Version: $Revision: 1.8 $
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 __cmCursesWidget_h
18 #define __cmCursesWidget_h
20 #include "../cmCacheManager.h"
21 #include "cmCursesStandardIncludes.h"
23 class cmCursesMainForm;
25 class cmCursesWidget
27 public:
28 cmCursesWidget(int width, int height, int left, int top);
29 virtual ~cmCursesWidget();
31 /**
32 * Handle user input. Called by the container of this widget
33 * when this widget has focus. Returns true if the input was
34 * handled
36 virtual bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w) = 0;
38 /**
39 * Change the position of the widget. Set isNewPage to true
40 * if this widget marks the beginning of a new page.
42 virtual void Move(int x, int y, bool isNewPage);
44 /**
45 * Set/Get the value (setting the value also changes the contents
46 * of the field buffer).
48 virtual void SetValue(const char* value);
49 virtual const char* GetValue();
51 /**
52 * Get the type of the widget (STRING, PATH etc...)
54 cmCacheManager::CacheEntryType GetType()
55 { return this->Type; }
57 /**
58 * If there are any, print the widget specific commands
59 * in the toolbar and return true. Otherwise, return false
60 * and the parent widget will print.
62 virtual bool PrintKeys()
64 return false;
67 /**
68 * Set/Get the page this widget is in.
70 void SetPage(int page)
72 this->Page = page;
74 int GetPage()
76 return this->Page;
79 friend class cmCursesMainForm;
81 protected:
82 cmCursesWidget(const cmCursesWidget& from);
83 void operator=(const cmCursesWidget&);
85 cmCacheManager::CacheEntryType Type;
86 std::string Value;
87 FIELD* Field;
88 // The page in the main form this widget is in
89 int Page;
92 #endif // __cmCursesWidget_h