00001 /*---------------------------------------------------------------------\ 00002 | | 00003 | __ __ ____ _____ ____ | 00004 | \ \ / /_ _/ ___|_ _|___ \ | 00005 | \ V / _` \___ \ | | __) | | 00006 | | | (_| |___) || | / __/ | 00007 | |_|\__,_|____/ |_| |_____| | 00008 | | 00009 | core system | 00010 | (C) SuSE GmbH | 00011 \----------------------------------------------------------------------/ 00012 00013 File: NCCheckBox.h 00014 00015 Author: Michael Andres <ma@suse.de> 00016 Maintainer: Michael Andres <ma@suse.de> 00017 00018 /-*/ 00019 #ifndef NCCheckBox_h 00020 #define NCCheckBox_h 00021 00022 #include <iosfwd> 00023 00024 #include "YCheckBox.h" 00025 #include "NCWidget.h" 00026 00027 class NCCheckBox; 00028 00030 // 00031 // CLASS NAME : NCCheckBox 00032 // 00033 // DESCRIPTION : 00034 // 00035 class NCCheckBox : public YCheckBox, public NCWidget { 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 S_DC = 0, 00046 S_OFF = 1, 00047 S_ON = 2 00048 }; 00049 00050 private: 00051 00052 static unsigned char statetag[3]; 00053 00054 bool tristate; 00055 State checkstate; 00056 NClabel label; 00057 00058 protected: 00059 00060 virtual const char * location() const { return "NCCheckBox"; } 00061 00062 virtual void wRedraw(); 00063 00064 public: 00065 00066 NCCheckBox( NCWidget * parent, const YWidgetOpt & opt, 00067 const YCPString & label, 00068 bool checked ); 00069 virtual ~NCCheckBox(); 00070 00071 virtual long nicesize( YUIDimension dim ); 00072 virtual void setSize( long newwidth, long newheight ); 00073 00074 virtual void setLabel( const YCPString & nlabel ); 00075 00076 virtual void setValue( const YCPValue & newval ); 00077 virtual YCPValue getValue(); 00078 00079 virtual NCursesEvent wHandleInput( wint_t key ); 00080 00081 virtual void setEnabling( bool do_bv ) { NCWidget::setEnabling( enabled=do_bv ); } 00082 00083 virtual bool setKeyboardFocus() { 00084 if ( !grabFocus() ) 00085 return YWidget::setKeyboardFocus(); 00086 return true; 00087 } 00088 }; 00089 00091 00092 #endif // NCCheckBox_h