Author: tgoettlicher Date: Mon Dec 20 16:58:33 2010 New Revision: 63015 URL: http://svn.opensuse.org/viewcvs/yast?rev=63015&view=rev Log: - Added support for check boxes in tree widgets Modified: trunk/libyui/VERSION trunk/libyui/package/yast2-libyui.changes trunk/libyui/src/YDialogSpy.cc trunk/libyui/src/YTree.cc trunk/libyui/src/YTree.h trunk/libyui/src/YWidgetFactory.h Modified: trunk/libyui/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/VERSION?rev=63015&r1=63014&r2=63015&view=diff ============================================================================== --- trunk/libyui/VERSION (original) +++ trunk/libyui/VERSION Mon Dec 20 16:58:33 2010 @@ -1 +1 @@ -2.19.1 +2.19.2 Modified: trunk/libyui/package/yast2-libyui.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/package/yast2-libyui.changes?rev=63015&r1=63014&r2=63015&view=diff ============================================================================== --- trunk/libyui/package/yast2-libyui.changes (original) +++ trunk/libyui/package/yast2-libyui.changes Mon Dec 20 16:58:33 2010 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Mon Dec 20 16:44:56 CET 2010 - tgoettlicher@suse.de + +- Added support for check boxes in tree widgets +- V 2.19.2 + +------------------------------------------------------------------- Fri Apr 9 17:29:14 CEST 2010 - tgoettlicher@suse.de - Fixed endless loop in layout algorithm (bnc #558699) Modified: trunk/libyui/src/YDialogSpy.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YDialogSpy.cc?rev=63015&r1=63014&r2=63015&view=diff ============================================================================== --- trunk/libyui/src/YDialogSpy.cc (original) +++ trunk/libyui/src/YDialogSpy.cc Mon Dec 20 16:58:33 2010 @@ -155,7 +155,7 @@ YAlignment * minSize = fac->createMinSize( vbox, TREE_WIDTH, TREE_HEIGHT ); minSize->setWeight( YD_VERT, TREE_VWEIGHT ); - priv->widgetTree = fac->createTree( minSize, "Widget &Tree" ); + priv->widgetTree = fac->createTree( minSize, "Widget &Tree", false ); priv->widgetTree->setNotify( true ); YWidgetTreeItem * rootItem = new YWidgetTreeItem( targetDialog, true ); Modified: trunk/libyui/src/YTree.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YTree.cc?rev=63015&r1=63014&r2=63015&view=diff ============================================================================== --- trunk/libyui/src/YTree.cc (original) +++ trunk/libyui/src/YTree.cc Mon Dec 20 16:58:33 2010 @@ -57,11 +57,9 @@ }; - - -YTree::YTree( YWidget * parent, const string & label ) +YTree::YTree( YWidget * parent, const string & label, bool multiSelection ) : YSelectionWidget( parent, label, - true ) // enforceSingleSelection + ! multiSelection ) , priv( new YTreePrivate() ) { YUI_CHECK_NEW( priv ); @@ -117,6 +115,7 @@ * @property map<ItemID> OpenItems Map of IDs of all open items - can only be queried, not set * @property string Label Caption above the tree * @property string IconPath Base path for icons + * @property bool MultiSelection Flag: User can select multiple items (read-only) */ propSet.add( YProperty( YUIProperty_Value, YOtherProperty ) ); propSet.add( YProperty( YUIProperty_CurrentItem, YOtherProperty ) ); @@ -125,7 +124,10 @@ propSet.add( YProperty( YUIProperty_OpenItems, YOtherProperty ) ); propSet.add( YProperty( YUIProperty_Label, YStringProperty ) ); propSet.add( YProperty( YUIProperty_IconPath, YStringProperty ) ); + propSet.add( YProperty( YUIProperty_SelectedItems, YOtherProperty ) ); + propSet.add( YProperty( YUIProperty_MultiSelection, YBoolProperty, true ) ); // read-only propSet.add( YWidget::propertySet() ); + } return propSet; @@ -142,8 +144,10 @@ else if ( propertyName == YUIProperty_CurrentBranch ) return false; // Needs special handling else if ( propertyName == YUIProperty_Items ) return false; // Needs special handling else if ( propertyName == YUIProperty_OpenItems ) return false; // Needs special handling + else if ( propertyName == YUIProperty_SelectedItems ) return false; // Needs special handling else if ( propertyName == YUIProperty_Label ) setLabel( val.stringVal() ); else if ( propertyName == YUIProperty_IconPath ) setIconBasePath( val.stringVal() ); + else { return YWidget::setProperty( propertyName, val ); @@ -165,9 +169,16 @@ else if ( propertyName == YUIProperty_OpenItems ) return YPropertyValue( YOtherProperty ); else if ( propertyName == YUIProperty_Label ) return YPropertyValue( label() ); else if ( propertyName == YUIProperty_IconPath ) return YPropertyValue( iconBasePath() ); + else if ( propertyName == YUIProperty_SelectedItems ) return YPropertyValue( YOtherProperty ); else { return YWidget::getProperty( propertyName ); } } +bool +YTree::hasMultiSelection() const +{ + return ! YSelectionWidget::enforceSingleSelection(); +} + Modified: trunk/libyui/src/YTree.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YTree.h?rev=63015&r1=63014&r2=63015&view=diff ============================================================================== --- trunk/libyui/src/YTree.h (original) +++ trunk/libyui/src/YTree.h Mon Dec 20 16:58:33 2010 @@ -62,14 +62,20 @@ * (*) Not all UIs (in particular not text-based UIs) support displaying icons, * so an icon should never be an exclusive means to display any kind of * information. + + * 'multiSelection' indicates whether or not the user can select multiple + * items at the same time. This can only be set in the constructor. **/ + + class YTree : public YSelectionWidget { protected: /** * Constructor. **/ - YTree( YWidget * parent, const string & label ); +// YTree( YWidget * parent, const string & label, bool multiSelection = false ); + YTree( YWidget * parent, const string & label, bool multiSelection); public: /** @@ -165,6 +171,14 @@ **/ const char * userInputProperty() { return YUIProperty_CurrentItem; } + + /** + * Return 'true' if the user can select multiple items at the same time + **/ + bool hasMultiSelection() const; + + + private: ImplPtr<YTreePrivate> priv; Modified: trunk/libyui/src/YWidgetFactory.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YWidgetFactory.h?rev=63015&r1=63014&r2=63015&view=diff ============================================================================== --- trunk/libyui/src/YWidgetFactory.h (original) +++ trunk/libyui/src/YWidgetFactory.h Mon Dec 20 16:58:33 2010 @@ -122,7 +122,7 @@ virtual YRadioButton * createRadioButton ( YWidget * parent, const string & label, bool isChecked = false ) = 0; virtual YComboBox * createComboBox ( YWidget * parent, const string & label, bool editable = false ) = 0; virtual YSelectionBox * createSelectionBox ( YWidget * parent, const string & label ) = 0; - virtual YTree * createTree ( YWidget * parent, const string & label ) = 0; + virtual YTree * createTree ( YWidget * parent, const string & label, bool multiselection = false ) = 0; virtual YTable * createTable ( YWidget * parent, YTableHeader * header_disown, bool multiSelection = false ) = 0; virtual YProgressBar * createProgressBar ( YWidget * parent, const string & label, int maxValue = 100 ) = 0; virtual YRichText * createRichText ( YWidget * parent, const string & text = string(), bool plainTextMode = false ) = 0; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org