libyui-ncurses  2.44.1
 All Classes Functions Variables
NCIntField.h
1 /*
2  Copyright (C) 2000-2012 Novell, Inc
3  This library is free software; you can redistribute it and/or modify
4  it under the terms of the GNU Lesser General Public License as
5  published by the Free Software Foundation; either version 2.1 of the
6  License, or (at your option) version 3.0 of the License. This library
7  is distributed in the hope that it will be useful, but WITHOUT ANY
8  WARRANTY; without even the implied warranty of MERCHANTABILITY or
9  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10  License for more details. You should have received a copy of the GNU
11  Lesser General Public License along with this library; if not, write
12  to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
13  Floor, Boston, MA 02110-1301 USA
14 */
15 
16 
17 /*-/
18 
19  File: NCIntField.h
20 
21  Author: Michael Andres <ma@suse.de>
22 
23 /-*/
24 
25 #ifndef NCIntField_h
26 #define NCIntField_h
27 
28 #include <iosfwd>
29 
30 #include <yui/YIntField.h>
31 #include "NCWidget.h"
32 
33 
34 class NCIntField : public YIntField, public NCWidget
35 {
36 private:
37 
38  friend std::ostream & operator<<( std::ostream & STREAM, const NCIntField & OBJ );
39 
40  NCIntField & operator=( const NCIntField & );
41  NCIntField( const NCIntField & );
42 
43 
44  static const unsigned taglen;
45 
46  NClabel label;
47  NCursesWindow * lwin;
48  NCursesWindow * twin;
49 
50  int cvalue;
51  unsigned vlen;
52  unsigned vstart;
53 
54  void setDefsze();
55  void tUpdate();
56 
57 protected:
58 
59  virtual const char * location() const { return "NCIntField"; }
60 
61  virtual void wCreate( const wrect & newrect );
62  virtual void wDelete();
63 
64  virtual void wRedraw();
65 
66  bool Increment( const bool bigstep = false );
67  bool Decrement( const bool bigstep = false );
68 
69  int enterPopup( wchar_t first = L'\0' );
70 
71 public:
72 
73  NCIntField( YWidget * parent,
74  const std::string & label,
75  int minValue, int maxValue,
76  int initialValue );
77  virtual ~NCIntField();
78 
79  virtual int preferredWidth();
80  virtual int preferredHeight();
81 
82  virtual void setSize( int newWidth, int newHeight );
83 
84  virtual void setLabel( const std::string & nlabel );
85 
86  virtual void setValueInternal( int newValue );
87 
88  virtual int value() { return cvalue; }
89 
90  virtual NCursesEvent wHandleInput( wint_t key );
91 
92  virtual bool setKeyboardFocus()
93  {
94  if ( !grabFocus() )
95  return YWidget::setKeyboardFocus();
96 
97  return true;
98  }
99 
100  virtual void setEnabled( bool do_bv );
101 };
102 
103 
104 #endif // NCIntField_h
C++ class for windows.
Definition: ncursesw.h:904
Definition: NCtext.h:81
virtual void setEnabled(bool do_bv)
Definition: NCIntField.cc:85