Author: tgoettlicher Date: Fri Apr 15 16:15:27 2011 New Revision: 63787 URL: http://svn.opensuse.org/viewcvs/yast?rev=63787&view=rev Log: - Added support for recursive selection in tree widgets Modified: trunk/libyui/VERSION trunk/libyui/package/yast2-libyui.changes trunk/libyui/src/Makefile.am trunk/libyui/src/YSelectionWidget.cc trunk/libyui/src/YSelectionWidget.h trunk/libyui/src/YTree.cc trunk/libyui/src/YTree.h trunk/libyui/src/YUISymbols.h trunk/libyui/src/YWidgetFactory.h trunk/libyui/yast2-libyui.spec.in Modified: trunk/libyui/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/VERSION?rev=63787&r1=63786&r2=63787&view=diff ============================================================================== --- trunk/libyui/VERSION (original) +++ trunk/libyui/VERSION Fri Apr 15 16:15:27 2011 @@ -1 +1 @@ -2.20.2 +2.20.3 Modified: trunk/libyui/package/yast2-libyui.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/package/yast2-libyui.changes?rev=63787&r1=63786&r2=63787&view=diff ============================================================================== --- trunk/libyui/package/yast2-libyui.changes (original) +++ trunk/libyui/package/yast2-libyui.changes Fri Apr 15 16:15:27 2011 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Fri Apr 15 16:14:13 CEST 2011 - tgoettlicher@suse.de + +- Added support for recursive selection in tree widgets +- V 2.20.3 + +------------------------------------------------------------------- Fri Feb 11 11:41:53 CET 2011 - tgoettlicher@suse.de - Fixed segfault for currentItem on tree widget Modified: trunk/libyui/src/Makefile.am URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/Makefile.am?rev=63787&r1=63786&r2=63787&view=diff ============================================================================== --- trunk/libyui/src/Makefile.am (original) +++ trunk/libyui/src/Makefile.am Fri Apr 15 16:15:27 2011 @@ -14,7 +14,7 @@ lib_LTLIBRARIES = libyui.la -libyui_la_LDFLAGS = -version-info 3:0:0 -Wl,--no-undefined +libyui_la_LDFLAGS = -version-info 4:0:0 -Wl,--no-undefined libyui_la_LIBADD = -lpthread -ldl libyui_la_SOURCES = \ Modified: trunk/libyui/src/YSelectionWidget.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YSelectionWidget.cc?rev=63787&r1=63786&r2=63787&view=diff ============================================================================== --- trunk/libyui/src/YSelectionWidget.cc (original) +++ trunk/libyui/src/YSelectionWidget.cc Fri Apr 15 16:15:27 2011 @@ -50,13 +50,16 @@ struct YSelectionWidgetPrivate { YSelectionWidgetPrivate( const string & label, - bool enforceSingleSelection ) + bool enforceSingleSelection, + bool recursiveSelection ) : label( label ) , enforceSingleSelection( enforceSingleSelection ) + , recursiveSelection ( recursiveSelection ) {} string label; bool enforceSingleSelection; + bool recursiveSelection; string iconBasePath; YItemCollection itemCollection; }; @@ -66,9 +69,10 @@ YSelectionWidget::YSelectionWidget( YWidget * parent, const string & label, - bool enforceSingleSelection ) + bool enforceSingleSelection , + bool recursiveSelection ) : YWidget( parent ) - , priv( new YSelectionWidgetPrivate( label, enforceSingleSelection ) ) + , priv( new YSelectionWidgetPrivate( label, enforceSingleSelection, recursiveSelection ) ) { YUI_CHECK_NEW( priv ); } @@ -116,6 +120,12 @@ return priv->enforceSingleSelection; } +bool YSelectionWidget::recursiveSelection() const +{ + return priv->recursiveSelection; +} + + void YSelectionWidget::setEnforceSingleSelection( bool enforceSingleSelection ) { @@ -403,6 +413,17 @@ oldSelectedItem->setSelected( false ); } + + if ( recursiveSelection() && item->hasChildren() ) + { + for ( YItemIterator it = item->childrenBegin(); it != item->childrenEnd(); ++it ) + { + YItem * item = *it; + selectItem(item, selected ); + item->setSelected( selected ); + } + } + item->setSelected( selected ); } Modified: trunk/libyui/src/YSelectionWidget.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YSelectionWidget.h?rev=63787&r1=63786&r2=63787&view=diff ============================================================================== --- trunk/libyui/src/YSelectionWidget.h (original) +++ trunk/libyui/src/YSelectionWidget.h Fri Apr 15 16:15:27 2011 @@ -69,7 +69,8 @@ **/ YSelectionWidget( YWidget * parent, const string & label, - bool enforceSingleSelection ); + bool enforceSingleSelection, + bool recurisveSelection = false ); public: /** @@ -301,6 +302,11 @@ bool enforceSingleSelection() const; /** + * Return 'true' if this base class should select children recursively. + **/ + bool recursiveSelection() const; + + /** * Recursively try to find the first selected item between iterators * 'begin' and 'end'. Return that item or 0 if there is none. **/ Modified: trunk/libyui/src/YTree.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YTree.cc?rev=63787&r1=63786&r2=63787&view=diff ============================================================================== --- trunk/libyui/src/YTree.cc (original) +++ trunk/libyui/src/YTree.cc Fri Apr 15 16:15:27 2011 @@ -57,9 +57,10 @@ }; -YTree::YTree( YWidget * parent, const string & label, bool multiSelection ) +YTree::YTree( YWidget * parent, const string & label, bool multiSelection, bool recursiveSelection ) : YSelectionWidget( parent, label, - ! multiSelection ) + ! multiSelection, + recursiveSelection ) , priv( new YTreePrivate() ) { YUI_CHECK_NEW( priv ); Modified: trunk/libyui/src/YTree.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YTree.h?rev=63787&r1=63786&r2=63787&view=diff ============================================================================== --- trunk/libyui/src/YTree.h (original) +++ trunk/libyui/src/YTree.h Fri Apr 15 16:15:27 2011 @@ -74,8 +74,7 @@ /** * Constructor. **/ -// YTree( YWidget * parent, const string & label, bool multiSelection = false ); - YTree( YWidget * parent, const string & label, bool multiSelection); + YTree( YWidget * parent, const string & label, bool multiSelection, bool recursiveSelection); public: /** @@ -177,7 +176,6 @@ **/ bool hasMultiSelection() const; - /** * Return the the item that currently has the keyboard focus * or 0 if no item currently has the keyboard focus. Modified: trunk/libyui/src/YUISymbols.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YUISymbols.h?rev=63787&r1=63786&r2=63787&view=diff ============================================================================== --- trunk/libyui/src/YUISymbols.h (original) +++ trunk/libyui/src/YUISymbols.h Fri Apr 15 16:15:27 2011 @@ -265,6 +265,7 @@ #define YUIOpt_youMode "youMode" #define YUIOpt_zeroHeight "zeroHeight" #define YUIOpt_zeroWidth "zeroWidth" +#define YUIOpt_recursiveSelection "recursiveSelection" #define YUIOpt_key_F1 "key_F1" #define YUIOpt_key_F2 "key_F2" Modified: trunk/libyui/src/YWidgetFactory.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YWidgetFactory.h?rev=63787&r1=63786&r2=63787&view=diff ============================================================================== --- trunk/libyui/src/YWidgetFactory.h (original) +++ trunk/libyui/src/YWidgetFactory.h Fri Apr 15 16:15:27 2011 @@ -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, bool multiselection = false ) = 0; + virtual YTree * createTree ( YWidget * parent, const string & label, bool multiselection = false, bool recursiveselection = 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; Modified: trunk/libyui/yast2-libyui.spec.in URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/yast2-libyui.spec.in?rev=63787&r1=63786&r2=63787&view=diff ============================================================================== --- trunk/libyui/yast2-libyui.spec.in (original) +++ trunk/libyui/yast2-libyui.spec.in Fri Apr 15 16:15:27 2011 @@ -19,7 +19,7 @@ BuildRequires: boost-devel Summary: YaST2 - User Interface Engine -Provides: %{_libdir}/libyui.so.3.0.0 +Provides: %{_libdir}/libyui.so.4.0.0 %description This is the YaST2 user interface engine that provides the abstraction -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org