[yast-commit] r39129 - in /branches/tmp/sh/mod-ui/core/libyui/src: YCPPropertyHandler.cc YCPPropertyHandler.h
Author: sh-sh-sh Date: Mon Jul 2 18:20:33 2007 New Revision: 39129 URL: http://svn.opensuse.org/viewcvs/yast?rev=39129&view=rev Log: get MultiSelBox SelItems Modified: branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.cc branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.h Modified: branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.cc?rev=39129&r1=39128&r2=39129&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.cc (original) +++ branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.cc Mon Jul 2 18:20:33 2007 @@ -29,16 +29,18 @@ #include <ycp/y2log.h> #include "YCPPropertyHandler.h" + #include "YCPDialogParser.h" +#include "YCPItem.h" #include "YCPItemParser.h" #include "YCPValueWidgetID.h" #include "YCheckBox.h" -#include "YSelectionBox.h" #include "YComboBox.h" -#include "YRadioButtonGroup.h" +#include "YMultiSelectionBox.h" #include "YRadioButton.h" -#include "YCPItem.h" +#include "YRadioButtonGroup.h" +#include "YSelectionBox.h" #include "YUISymbols.h" @@ -66,7 +68,11 @@ } else if ( propertyName == YUIProperty_CurrentButton ) { - if ( trySetRadioButtonGroupCurrentButton( widget, val ) ) return true; + if ( trySetRadioButtonGroupCurrentButton( widget, val ) ) return true; + } + else if ( propertyName == YUIProperty_SelectedItems ) + { + // if ( trySetMultiSelectionBoxSelecteditems( widget, val ) ) return true; } y2error( "Can't handle property %s::%s - not changing anything", @@ -98,13 +104,16 @@ { val = tryGetRadioButtonGroupCurrentButton( widget ); if ( ! val.isNull() ) return val; } + else if ( propertyName == YUIProperty_SelectedItems ) + { + val = tryGetMultiSelectionBoxSelectedItems( widget ); if ( ! val.isNull() ) return val; + } // FIXME: TO DO: // FIXME: TO DO: // FIXME: TO DO: - // tryGetMultiSelectionBoxSelectedItems // tryGetSelectionWidgetItems y2error( "Can't handle property %s::%s - returning 'nil'", @@ -383,3 +392,35 @@ return YCPVoid(); } + + +YCPValue +YCPPropertyHandler::tryGetMultiSelectionBoxSelectedItems( YWidget * widget ) +{ + YMultiSelectionBox * multiSelBox = dynamic_cast<YMultiSelectionBox *> (widget); + + if ( ! multiSelBox ) + return YCPNull(); + + YCPList selectedItemsList; + YConstItemCollection selectedItems = multiSelBox->selectedItems(); + + for ( YConstItemConstIterator it = selectedItems.begin(); + it != selectedItems.end(); + ++it ) + { + const YCPItem * item = dynamic_cast<const YCPItem *> (*it); + + if ( item ) + { + if ( item->hasId() ) + selectedItemsList->add( item->id() ); + else + y2error( "Item has no ID: %s", item->label()->value().c_str() ); + } + else + y2error( "Wrong item type (not a YCPItem): %s", (*it)->label().c_str() ); + } + + return selectedItemsList; +} Modified: branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.h?rev=39129&r1=39128&r2=39129&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.h (original) +++ branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.h Mon Jul 2 18:20:33 2007 @@ -86,6 +86,7 @@ static bool trySetComboBoxValue ( YWidget * widget, const YCPValue & val ); static bool trySetSelectionWidgetItems ( YWidget * widget, const YCPValue & val ); static bool trySetRadioButtonGroupCurrentButton ( YWidget * widget, const YCPValue & val ); + // static bool trySetMultiSelectionBoxSelecteditems ( YWidget * widget, const YCPValue & val ); /** * All trySet..() functions try to dynamic_cast 'widget' to the expected @@ -97,6 +98,7 @@ static YCPValue tryGetComboBoxValue ( YWidget * widget ); static YCPValue tryGetSelectionBoxValue ( YWidget * widget ); static YCPValue tryGetRadioButtonGroupCurrentButton ( YWidget * widget ); + static YCPValue tryGetMultiSelectionBoxSelectedItems( YWidget * widget ); }; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
sh-sh-sh@svn.opensuse.org