libyui-ncurses
2.44.1
|
00001 /* 00002 Copyright (C) 2000-2012 Novell, Inc 00003 This library is free software; you can redistribute it and/or modify 00004 it under the terms of the GNU Lesser General Public License as 00005 published by the Free Software Foundation; either version 2.1 of the 00006 License, or (at your option) version 3.0 of the License. This library 00007 is distributed in the hope that it will be useful, but WITHOUT ANY 00008 WARRANTY; without even the implied warranty of MERCHANTABILITY or 00009 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 00010 License for more details. You should have received a copy of the GNU 00011 Lesser General Public License along with this library; if not, write 00012 to the Free Software Foundation, Inc., 51 Franklin Street, Fifth 00013 Floor, Boston, MA 02110-1301 USA 00014 */ 00015 00016 00017 /*-/ 00018 00019 File: NCCheckBox.h 00020 00021 Author: Michael Andres <ma@suse.de> 00022 00023 /-*/ 00024 00025 #ifndef NCCheckBox_h 00026 #define NCCheckBox_h 00027 00028 #include <iosfwd> 00029 00030 #include <yui/YCheckBox.h> 00031 #include "NCWidget.h" 00032 00033 00034 class NCCheckBox : public YCheckBox, public NCWidget 00035 { 00036 00037 friend std::ostream & operator<<( std::ostream & STREAM, const NCCheckBox & OBJ ); 00038 00039 NCCheckBox & operator=( const NCCheckBox & ); 00040 NCCheckBox( const NCCheckBox & ); 00041 00042 protected: 00043 00044 enum State 00045 { 00046 S_DC = 0, 00047 S_OFF = 1, 00048 S_ON = 2 00049 }; 00050 00051 private: 00052 00053 static unsigned char statetag[3]; 00054 00055 bool tristate; 00056 State checkstate; 00057 NClabel label; 00058 00059 protected: 00060 00061 virtual const char * location() const { return "NCCheckBox"; } 00062 00063 virtual void wRedraw(); 00064 00065 public: 00066 00067 NCCheckBox( YWidget * parent, 00068 const std::string & label, 00069 bool checked ); 00070 virtual ~NCCheckBox(); 00071 00072 virtual int preferredWidth(); 00073 virtual int preferredHeight(); 00074 00075 virtual void setSize( int newWidth, int newHeight ); 00076 00077 virtual void setLabel( const std::string & nlabel ); 00078 00079 virtual void setValue( YCheckBoxState state ); 00080 00081 virtual YCheckBoxState value(); 00082 00083 virtual NCursesEvent wHandleInput( wint_t key ); 00084 00085 virtual void setEnabled( bool do_bv ); 00086 00087 virtual bool setKeyboardFocus() 00088 { 00089 if ( !grabFocus() ) 00090 return YWidget::setKeyboardFocus(); 00091 00092 return true; 00093 } 00094 }; 00095 00096 00097 #endif // NCCheckBox_h