[yast-commit] r41489 - in /branches/tmp/sh/mod-ui/ncurses/src: NCMenuButton.cc NCMenuButton.h NCPopupMenu.cc NCPopupMenu.h
![](https://seccdn.libravatar.org/avatar/9d45ad4c714db4d170a42527a4a6b8dc.jpg?s=120&d=mm&r=g)
Author: gs Date: Fri Oct 19 17:57:36 2007 New Revision: 41489 URL: http://svn.opensuse.org/viewcvs/yast?rev=41489&view=rev Log: more fixes - but not yet working correctly Modified: branches/tmp/sh/mod-ui/ncurses/src/NCMenuButton.cc branches/tmp/sh/mod-ui/ncurses/src/NCMenuButton.h branches/tmp/sh/mod-ui/ncurses/src/NCPopupMenu.cc branches/tmp/sh/mod-ui/ncurses/src/NCPopupMenu.h Modified: branches/tmp/sh/mod-ui/ncurses/src/NCMenuButton.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCMenuButton.cc?rev=41489&r1=41488&r2=41489&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/ncurses/src/NCMenuButton.cc (original) +++ branches/tmp/sh/mod-ui/ncurses/src/NCMenuButton.cc Fri Oct 19 17:57:36 2007 @@ -189,6 +189,7 @@ { wpos at( ScreenPos() + wpos( win->height(), 0 ) ); NCPopupMenu * dialog = new NCPopupMenu( at, + this, itemsBegin(), itemsEnd() ); YUI_CHECK_NEW( dialog ); @@ -202,8 +203,7 @@ NCursesEvent ret = NCursesEvent::menu; // FIXME - check this - dialog->setSelectedItem( findMenuItem( selection ) ); - YStringWidgetID * selectionID = new YStringWidgetID( dialog->selectedItem()->label() ); + YStringWidgetID * selectionID = new YStringWidgetID( findMenuItem( selection )->label() ); ret.selection = selectionID; YDialog::deleteTopmostDialog(); Modified: branches/tmp/sh/mod-ui/ncurses/src/NCMenuButton.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCMenuButton.h?rev=41489&r1=41488&r2=41489&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/ncurses/src/NCMenuButton.h (original) +++ branches/tmp/sh/mod-ui/ncurses/src/NCMenuButton.h Fri Oct 19 17:57:36 2007 @@ -75,6 +75,8 @@ virtual void setEnabled( bool do_bv ); + YMenuItem * findItem( int selection ) { return findMenuItem( selection ); } + virtual bool setKeyboardFocus() { if ( !grabFocus() ) return YWidget::setKeyboardFocus(); Modified: branches/tmp/sh/mod-ui/ncurses/src/NCPopupMenu.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCPopupMenu.cc?rev=41489&r1=41488&r2=41489&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/ncurses/src/NCPopupMenu.cc (original) +++ branches/tmp/sh/mod-ui/ncurses/src/NCPopupMenu.cc Fri Oct 19 17:57:36 2007 @@ -30,9 +30,9 @@ // // DESCRIPTION : // -NCPopupMenu::NCPopupMenu( const wpos at, YItemIterator begin, YItemIterator end ) +NCPopupMenu::NCPopupMenu( const wpos at, NCMenuButton * menuButton, YItemIterator begin, YItemIterator end ) : NCPopupTable( at ) - , _selectedItem( 0 ) + , menu( menuButton ) { vector<string> row( 2 ); createList( row ); @@ -73,8 +73,7 @@ NCursesEvent ret; switch ( ch ) { case KEY_RIGHT: - //if ( menu.itemList()[getCurrentItem()]->hasChildren() ) - if ( selectedItem()->hasChildren() ) + if ( menu->findItem(getCurrentItem()+1)->hasChildren() ) ret = NCursesEvent::button; break; case KEY_LEFT: @@ -103,13 +102,20 @@ int selection = ( postevent == NCursesEvent::button ) ? getCurrentItem() : -1; + YMenuItem * item = menu->findItem( selection + 1 ); + NCMIL << "Item: " << item->label() << endl; + + if ( !item ) + return again; + if ( selection != -1 ) { - if ( _selectedItem && _selectedItem->hasChildren() ) { + if ( item->hasChildren() ) { // post submenu wpos at( ScreenPos() + wpos( selection, inparent.Sze.W - 1 ) ); NCPopupMenu * dialog = new NCPopupMenu( at, - _selectedItem->childrenBegin(), - _selectedItem->childrenEnd() ); + menu, + item->childrenBegin(), + item->childrenEnd() ); YUI_CHECK_NEW( dialog ); again = (dialog->post( &postevent ) == NCursesEvent::CONTINUE); @@ -117,7 +123,7 @@ } else { // store selection //postevent.detail = menu.itemList()[selection]->getIndex(); - postevent.detail = _selectedItem->index(); + postevent.detail = item->index(); } } return again; Modified: branches/tmp/sh/mod-ui/ncurses/src/NCPopupMenu.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCPopupMenu.h?rev=41489&r1=41488&r2=41489&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/ncurses/src/NCPopupMenu.h (original) +++ branches/tmp/sh/mod-ui/ncurses/src/NCPopupMenu.h Fri Oct 19 17:57:36 2007 @@ -25,7 +25,7 @@ using namespace std; #include "NCPopupTable.h" - +#include "NCMenuButton.h" /////////////////////////////////////////////////////////////////// // @@ -40,7 +40,7 @@ private: - YMenuItem * _selectedItem; + NCMenuButton * menu; protected: @@ -49,12 +49,13 @@ public: - NCPopupMenu( const wpos at, YItemIterator begin, YItemIterator end ); + NCPopupMenu( const wpos at, + NCMenuButton * menu, + YItemIterator begin, + YItemIterator end); virtual ~NCPopupMenu(); - YMenuItem * selectedItem() { return _selectedItem; } - void setSelectedItem ( YMenuItem * item ) { _selectedItem = item; } }; /////////////////////////////////////////////////////////////////// -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
gs@svn.opensuse.org