libyui-ncurses  2.44.1
 All Classes Functions Variables
NCCheckBox.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: NCCheckBox.h
20 
21  Author: Michael Andres <ma@suse.de>
22 
23 /-*/
24 
25 #ifndef NCCheckBox_h
26 #define NCCheckBox_h
27 
28 #include <iosfwd>
29 
30 #include <yui/YCheckBox.h>
31 #include "NCWidget.h"
32 
33 
34 class NCCheckBox : public YCheckBox, public NCWidget
35 {
36 
37  friend std::ostream & operator<<( std::ostream & STREAM, const NCCheckBox & OBJ );
38 
39  NCCheckBox & operator=( const NCCheckBox & );
40  NCCheckBox( const NCCheckBox & );
41 
42 protected:
43 
44  enum State
45  {
46  S_DC = 0,
47  S_OFF = 1,
48  S_ON = 2
49  };
50 
51 private:
52 
53  static unsigned char statetag[3];
54 
55  bool tristate;
56  State checkstate;
57  NClabel label;
58 
59 protected:
60 
61  virtual const char * location() const { return "NCCheckBox"; }
62 
63  virtual void wRedraw();
64 
65 public:
66 
67  NCCheckBox( YWidget * parent,
68  const std::string & label,
69  bool checked );
70  virtual ~NCCheckBox();
71 
72  virtual int preferredWidth();
73  virtual int preferredHeight();
74 
75  virtual void setSize( int newWidth, int newHeight );
76 
77  virtual void setLabel( const std::string & nlabel );
78 
79  virtual void setValue( YCheckBoxState state );
80 
81  virtual YCheckBoxState value();
82 
83  virtual NCursesEvent wHandleInput( wint_t key );
84 
85  virtual void setEnabled( bool do_bv );
86 
87  virtual bool setKeyboardFocus()
88  {
89  if ( !grabFocus() )
90  return YWidget::setKeyboardFocus();
91 
92  return true;
93  }
94 };
95 
96 
97 #endif // NCCheckBox_h
virtual void setEnabled(bool do_bv)
Definition: NCCheckBox.cc:66
Definition: NCtext.h:81