Author: gs Date: Tue Jul 17 12:23:10 2007 New Revision: 39465 URL: http://svn.opensuse.org/viewcvs/yast?rev=39465&view=rev Log: implement value(), setValue() Modified: branches/tmp/sh/mod-ui/ncurses/src/NCCheckBox.cc branches/tmp/sh/mod-ui/ncurses/src/NCCheckBox.h Modified: branches/tmp/sh/mod-ui/ncurses/src/NCCheckBox.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCCheckBox.cc?rev=39465&r1=39464&r2=39465&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/ncurses/src/NCCheckBox.cc (original) +++ branches/tmp/sh/mod-ui/ncurses/src/NCCheckBox.cc Tue Jul 17 12:23:10 2007 @@ -109,9 +109,9 @@ // METHOD NAME : NCCheckBox::setLabel // METHOD TYPE : void // -// DESCRIPTION : +// DESCRIPTION : set label // -void NCCheckBox::setLabel( const YCPString & nlabel ) +void NCCheckBox::setLabel( const string & nlabel ) { label = NCstring( nlabel ); label.stripHotkey(); @@ -128,6 +128,28 @@ // // DESCRIPTION : // +void NCCheckBox::setValue( YCheckBoxState state ) +{ + switch ( state ) + { + case YCheckBox_on: + checkstate = S_ON; + tristate = false; + break; + + case YCheckBox_off: + checkstate = S_OFF; + tristate = false; + break; + + case YCheckBox_dont_care: + tristate = true; + checkstate = S_DC; + break; + } +} + +#if 0 void NCCheckBox::setValue( const YCPValue & newval ) { if ( newval->isBoolean() ) { @@ -141,20 +163,34 @@ Redraw(); } + +// replaced by value() +YCPValue NCCheckBox::getValue() +{ + if ( checkstate == S_DC ) + return YCPVoid(); + + return YCPBoolean( checkstate == S_ON ); +} +#endif + /////////////////////////////////////////////////////////////////// // // -// METHOD NAME : NCCheckBox::getValue -// METHOD TYPE : YCPBoolean +// METHOD NAME : NCCheckBox::value +// METHOD TYPE : YCheckBoxState // // DESCRIPTION : // -YCPValue NCCheckBox::getValue() +YCheckBoxState NCCheckBox::value() { - if ( checkstate == S_DC ) - return YCPVoid(); + if ( checkstate == S_DC ) + return YCheckBox_dont_care; - return YCPBoolean( checkstate == S_ON ); + if ( checkstate == S_ON ) + return YCheckBox_on; + else + return YCheckBox_off; } /////////////////////////////////////////////////////////////////// Modified: branches/tmp/sh/mod-ui/ncurses/src/NCCheckBox.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCCheckBox.h?rev=39465&r1=39464&r2=39465&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/ncurses/src/NCCheckBox.h (original) +++ branches/tmp/sh/mod-ui/ncurses/src/NCCheckBox.h Tue Jul 17 12:23:10 2007 @@ -80,10 +80,11 @@ **/ virtual void setSize( int newWidth, int newHeight ); - virtual void setLabel( const YCPString & nlabel ); + virtual void setLabel( const string & nlabel ); - virtual void setValue( const YCPValue & newval ); - virtual YCPValue getValue(); + virtual void setValue( YCheckBoxState state ); + + virtual YCheckBoxState value(); virtual NCursesEvent wHandleInput( wint_t key ); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org