25 #define YUILogComponent "ncurses"
26 #include <yui/YUILog.h>
28 #include "NCCheckBox.h"
31 unsigned char NCCheckBox::statetag[3] = {
'?',
' ',
'x' };
34 NCCheckBox::NCCheckBox( YWidget * parent,
35 const std::string & nlabel,
37 : YCheckBox( parent, nlabel )
40 , checkstate( checked ? S_ON : S_OFF )
42 yuiDebug() << std::endl;
48 NCCheckBox::~NCCheckBox()
50 yuiDebug() << std::endl;
54 int NCCheckBox::preferredWidth()
56 return wGetDefsze().W;
60 int NCCheckBox::preferredHeight()
62 return wGetDefsze().H;
69 YCheckBox::setEnabled( do_bv );
73 void NCCheckBox::setSize(
int newwidth,
int newheight )
75 wRelocate(
wpos( 0 ),
wsze( newheight, newwidth ) );
79 void NCCheckBox::setLabel(
const std::string & nlabel )
83 defsze =
wsze( label.height(), label.width() + 4 );
84 YCheckBox::setLabel( nlabel );
89 void NCCheckBox::setValue( YCheckBoxState state )
103 case YCheckBox_dont_care:
113 YCheckBoxState NCCheckBox::value()
115 if ( checkstate == S_DC )
116 return YCheckBox_dont_care;
118 if ( checkstate == S_ON )
121 return YCheckBox_off;
125 void NCCheckBox::wRedraw()
134 win->
printw( 0, 0,
"[ ] " );
136 label.drawAt( *win, style,
wpos( 0, 4 ) );
140 win->
printw( 0, 1,
"%c", statetag[checkstate] );
154 switch ( checkstate )
165 checkstate = tristate ? S_DC : S_ON;
172 ret = NCursesEvent::ValueChanged;
int printw(const char *fmt,...)
virtual void setEnabled(bool do_bv)