libyui-ncurses  2.48.1
NCDateField.h
1 /*
2  Copyright (C) 2014 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: NCDateField.h
21 
22  Author: Angelo Naselli <anaselli@linux.it>
23 
24 /-*/
25 
26 #ifndef NCDateField_h
27 #define NCDateField_h
28 
29 #include <iosfwd>
30 
31 #include <yui/YDateField.h>
32 #include "NCWidget.h"
33 #include "NCInputTextBase.h"
34 
35 class NCDateField : public YDateField, public NCInputTextBase
36 {
37 
38  friend std::ostream & operator<< ( std::ostream & STREAM, const NCDateField & OBJ );
39 
40  NCDateField & operator= ( const NCDateField & );
41  NCDateField ( const NCDateField & );
42 
43 private:
44  static const unsigned fieldLength;
45 
46  bool validDate(const std::string& input_date);
47 
48 protected:
49 
50  virtual const char * location() const
51  {
52  return "NCDateField";
53  }
54 
55 public:
56 
57  NCDateField ( YWidget * parent,
58  const std::string & label
59  );
60  virtual ~NCDateField();
61 
62  virtual int preferredWidth();
63  virtual int preferredHeight();
64 
65  virtual void setSize ( int newWidth, int newHeight );
66 
67  virtual void setLabel ( const std::string & nlabel );
68 
69  virtual void setValue ( const std::string & ntext );
70  virtual std::string value();
71 
72  virtual void setEnabled ( bool do_bv );
73 
74  virtual NCursesEvent wHandleInput ( wint_t key );
75 
76  virtual bool setKeyboardFocus()
77  {
78  if ( !grabFocus() )
79  return YWidget::setKeyboardFocus();
80 
81  return true;
82  }
83 
84 };
85 
86 
87 #endif // NCDateField_h
virtual void setEnabled(bool do_bv)
Pure virtual to make sure every widget implements it.
Definition: NCDateField.cc:76