Mailinglist Archive: yast-commit (535 mails)

< Previous Next >
[yast-commit] r41503 - in /branches/tmp/sh/mod-ui/ncurses/src: NCPopup.cc NCPopupMenu.cc NCPopupMenu.h
  • From: gs@xxxxxxxxxxxxxxxx
  • Date: Mon, 22 Oct 2007 08:58:28 -0000
  • Message-id: <20071022085829.1509E25082@xxxxxxxxxxxxxxxx>
Author: gs
Date: Mon Oct 22 10:58:28 2007
New Revision: 41503

URL: http://svn.opensuse.org/viewcvs/yast?rev=41503&view=rev
Log:
store startIndex

Modified:
    branches/tmp/sh/mod-ui/ncurses/src/NCPopup.cc
    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/NCPopup.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCPopup.cc?rev=41503&r1=41502&r2=41503&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCPopup.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCPopup.cc Mon Oct 22 10:58:28 2007
@@ -105,7 +105,7 @@
     if ( returnevent )
        *returnevent = postevent;
 
-    NCMIL << "Return: " << postevent.detail << endl;
+    NCMIL << "Return event.detail:  " << postevent.detail << endl;
     
     return postevent.detail;
 }

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=41503&r1=41502&r2=41503&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCPopupMenu.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCPopupMenu.cc Mon Oct 22 10:58:28 2007
@@ -33,13 +33,19 @@
 NCPopupMenu::NCPopupMenu( const wpos at, NCMenuButton * menuButton, YItemIterator begin, YItemIterator end )
     : NCPopupTable( at )
     , menu( menuButton )
+    , startIndex( 0 )
 {
   vector<string> row( 2 );
   createList( row );
+  YMenuItem * startItem = dynamic_cast<YMenuItem *> (*begin);
+  YUI_CHECK_PTR( startItem );
+  startIndex = startItem->index();
+  
   for ( YItemIterator it = begin; it != end; ++it )
   {
     YMenuItem * item = dynamic_cast<YMenuItem *> (*it);
     YUI_CHECK_PTR( item );
+
     row[0] = item->label();
     row[1] = item->hasChildren() ? "..." : "";
     YItem *tableItem = new YTableItem( row[0], row[1] );
@@ -101,14 +107,14 @@
   bool again = false;
   int  selection = ( postevent == NCursesEvent::button ) ? getCurrentItem()
                                                          : -1;
-
-  YMenuItem * item = menu->findItem( selection + 1 );
+  YMenuItem * item = menu->findItem( startIndex + selection );
   
   if ( !item )
       return again;
   
-  if ( selection != -1 ) {
-      if ( item->hasChildren() ) {
+  if ( selection != -1 )
+  {
+    if ( item->hasChildren() ) {
       // post submenu
       wpos at( ScreenPos() + wpos( selection, inparent.Sze.W - 1 ) );
       NCPopupMenu * dialog = new NCPopupMenu( at,
@@ -118,7 +124,8 @@
       YUI_CHECK_NEW( dialog );
       
       again = (dialog->post( &postevent ) == NCursesEvent::CONTINUE);
-      YDialog::deleteTopmostDialog();
+      if ( !again )
+         YDialog::deleteTopmostDialog();
     } else {
       // store selection
       //postevent.detail = menu.itemList()[selection]->getIndex();

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=41503&r1=41502&r2=41503&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCPopupMenu.h (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCPopupMenu.h Mon Oct 22 10:58:28 2007
@@ -41,7 +41,8 @@
   private:
 
     NCMenuButton * menu;
-
+    int startIndex;
+    
   protected:
 
     virtual NCursesEvent wHandleInput( wint_t ch );

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages