libyui-ncurses  2.47.4
 All Classes Functions Variables
NCTimeField.h
1 /*
2  Copyright (C) Angelo Naselli
3 
4  This library is free software; you can redistribute it and/or modify
5  it under the terms of the GNU Lesser General Public License as
6  published by the Free Software Foundation; either version 2.1 of the
7  License, or (at your option) version 3.0 of the License. This library
8  is distributed in the hope that it will be useful, but WITHOUT ANY
9  WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
11  License for more details. You should have received a copy of the GNU
12  Lesser General Public License along with this library; if not, write
13  to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
14  Floor, Boston, MA 02110-1301 USA
15 */
16 
17 
18 /*-/
19 
20  File: NCTimeField.h
21 
22  Author: Angelo Naselli <anaselli@linux.it>
23 
24 /-*/
25 
26 #ifndef NCTimeField_h
27 #define NCTimeField_h
28 
29 #include <iosfwd>
30 
31 #include <yui/YTimeField.h>
32 #include "NCWidget.h"
33 #include "NCInputTextBase.h"
34 
35 
36 class NCTimeField : public YTimeField, public NCInputTextBase
37 {
38 
39  friend std::ostream & operator<< ( std::ostream & STREAM, const NCTimeField & OBJ );
40 
41  NCTimeField & operator= ( const NCTimeField & );
42  NCTimeField ( const NCTimeField & );
43 
44 private:
45  static const unsigned fieldLength;
46 
47  bool validTime(const std::string& input_time);
48 
49 protected:
50 
51  virtual const char * location() const
52  {
53  return "NCTimeField";
54  }
55 
56 public:
57 
58  NCTimeField ( YWidget * parent,
59  const std::string & label
60  );
61  virtual ~NCTimeField();
62 
63  virtual int preferredWidth();
64  virtual int preferredHeight();
65 
66  virtual void setSize ( int newWidth, int newHeight );
67 
68  virtual void setLabel ( const std::string & nlabel );
69 
70  virtual void setValue ( const std::string & ntext );
71  virtual std::string value();
72 
73  virtual void setEnabled ( bool do_bv );
74 
75  virtual NCursesEvent wHandleInput ( wint_t key );
76 
77  virtual bool setKeyboardFocus()
78  {
79  if ( !grabFocus() )
80  return YWidget::setKeyboardFocus();
81 
82  return true;
83  }
84 
85 };
86 
87 
88 #endif // NCTimeField_h
virtual void setEnabled(bool do_bv)
Pure virtual to make sure every widget implements it.
Definition: NCTimeField.cc:81