libyui-ncurses  2.46.6
 All Classes Functions Variables
NCInputTextBase.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: NCInputText.h
21 
22  Author: Angelo Naselli <anaselli@linux.it>
23 
24 /-*/
25 #ifndef NCInputText_h
26 #define NCInputText_h
27 
28 #include <iosfwd>
29 
30 #include "NCWidget.h"
31 
32 
33 class NCInputTextBase : public NCWidget
34 {
35 
36  friend std::ostream & operator<< ( std::ostream & STREAM, const NCInputTextBase & OBJ );
37 
38  NCInputTextBase & operator= ( const NCInputTextBase & );
39  NCInputTextBase ( const NCInputTextBase & );
40 
41 protected:
42 
43  bool passwd;
44  NClabel _label;
45  std::wstring buffer;
46 
47  NCursesWindow * lwin;
48  NCursesWindow * twin;
49 
50  unsigned maxFldLength;
51  unsigned maxInputLength;
52 
53  unsigned fldstart;
54  unsigned fldlength;
55  unsigned curpos;
56 
57  bool returnOnReturn_b;
58 
59  virtual void setDefsze();
60  virtual void tUpdate();
61 
62  virtual bool bufferFull() const;
63  virtual unsigned maxCursor() const;
64 
65  virtual const char * location() const
66  {
67  return "NCInputTextBase";
68  }
69 
70  virtual void wCreate ( const wrect & newrect );
71  virtual void wDelete();
72 
73  virtual void wRedraw();
74 
75 
76  NCInputTextBase ( YWidget * parent,
77  bool passwordMode = false,
78  unsigned maxInput = 0,
79  unsigned maxFld = 0
80  );
81  virtual ~NCInputTextBase();
82 
83 public:
84 
85  void setReturnOnReturn ( bool on_br )
86  {
87  returnOnReturn_b = on_br;
88  }
89 
90  virtual int preferredWidth();
91  virtual int preferredHeight();
92 
93  virtual void setSize ( int newWidth, int newHeight );
94 
95  virtual void setEnabled ( bool do_bv );
96 
97  virtual void setCurPos ( unsigned pos )
98  {
99  curpos = pos;
100  }
101 
102 };
103 
104 
105 #endif // NCInputText_h
C++ class for windows.
Definition: ncursesw.h:904
Definition: NCtext.h:81
virtual void setEnabled(bool do_bv)
Pure virtual to make sure every widget implements it.