Author: kmachalkova
Date: Mon Nov 5 16:01:33 2007
New Revision: 41804
URL: http://svn.opensuse.org/viewcvs/yast?rev=41804&view=rev
Log:
* Setting correct index for tree items
* Fixed sending SelectionChanged event
* Making selectItem() method more effective
Modified:
branches/tmp/sh/mod-ui/ncurses/src/NCTree.cc
branches/tmp/sh/mod-ui/ncurses/src/README_mod-ui
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCTree.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCTree.cc?rev=41804&r1=41803&r2=41804&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCTree.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCTree.cc Mon Nov 5 16:01:33 2007
@@ -339,24 +339,19 @@
YTreeItem * treeItem = dynamic_cast (item);
YUI_CHECK_PTR( treeItem );
- // FIXME - index NOT set (is -1) ????????????
- NCMIL << "Index: " << treeItem->index() << endl;
+ const YTreeItem *citem = getCurrentItem();
+ NCMIL << "Index: " << citem->index() << endl;
- if ( !selected )
+ if ( !selected && ( treeItem == citem ))
{
YTree::deselectAllItems();
}
else
{
- for ( unsigned i = 0; i < myPad()->Lines(); ++i ) {
- const NCTreeLine * cline = getTreeLine( i );
- if ( &cline->Yitem() == treeItem ) {
- NCMIL << "got " << treeItem->label() << " at " << i << endl;
- myPad()->ShowItem( cline );
- break;
- }
- }
+ int at = treeItem->index();
+
YTree::selectItem( treeItem, selected );
+ myPad()->ShowItem( getTreeLine (at) );
}
}
@@ -429,6 +424,9 @@
//
void NCTree::Dit( NCTreeLine * p, NCTreePad * pad, YTreeItem * item )
{
+ static int idx = 0;
+ item->setIndex( idx++ );
+
NCTreeLine * c = new NCTreeLine( p, *item );
pad->Append( c );
@@ -487,12 +485,12 @@
YUI_CHECK_PTR( currentItem );
YTree::selectItem( const_cast(currentItem), true );
- NCMIL << "Old item: " << oldCurrentItem->label() << " Current: " << currentItem->label() << endl;
- // FIXME !!!!! (oldCurrentItem != getCurrentItem()) is NOT true ???
- if ( notify() && (oldCurrentItem != getCurrentItem()) )
+ NCDBG << "Old item: " << oldCurrentItem->label() << " Current: " << currentItem->label() << endl;
+ if ( notify() && (oldCurrentItem != currentItem) )
ret = NCursesEvent::SelectionChanged;
+
- NCMIL << "Notify: " << (notify()?"true":"false") << " Return event: " << ret << endl;
+ NCDBG << "Notify: " << (notify()?"true":"false") << " Return event: " << ret << endl;
return ret;
}
Modified: branches/tmp/sh/mod-ui/ncurses/src/README_mod-ui
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/README_mod-ui?rev=41804&r1=41803&r2=41804&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/README_mod-ui (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/README_mod-ui Mon Nov 5 16:01:33 2007
@@ -11,16 +11,6 @@
YItemIterator itemsBegin()/itemsEnd() used to iterate over toplevel items
YItemIterator YTreeItem::childrenBegin()/childrenEnd() used to iterate over children
-selectItem() added
-TODO: check selectItem() methods !
- - YItem::index() is always -1 ??? (see debug in NCTree.cc, line 343)
- - are the methods complete and are the methods from YTree and myPad()
- called correctly?
-
-wHandleInput()
-TODO: (oldCurrentItem != getCurrentItem()) doesn't return true for different items
- => SelectionChanged event isn't set
-
EVENTs
------
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org