Author: kmachalkova
Date: Fri Apr 17 13:37:14 2009
New Revision: 56830
URL: http://svn.opensuse.org/viewcvs/yast?rev=56830&view=rev
Log:
Make wizard menus work - use NCursesEvent.result
for sending item ID
Modified:
branches/tmp/bubli/ncurses/src/NCMenuButton.h
branches/tmp/bubli/ncurses/src/NCWizard.cc
branches/tmp/bubli/ncurses/src/NCWizard.h
branches/tmp/bubli/ncurses/src/NCtoY2Event.cc
Modified: branches/tmp/bubli/ncurses/src/NCMenuButton.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/bubli/ncurses/src/NCMenuButton.h?rev=56830&r1=56829&r2=56830&view=diff
==============================================================================
--- branches/tmp/bubli/ncurses/src/NCMenuButton.h (original)
+++ branches/tmp/bubli/ncurses/src/NCMenuButton.h Fri Apr 17 13:37:14 2009
@@ -44,7 +44,7 @@
virtual void wRedraw();
- NCursesEvent postMenu();
+ virtual NCursesEvent postMenu();
public:
Modified: branches/tmp/bubli/ncurses/src/NCWizard.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/bubli/ncurses/src/NCWizard.cc?rev=56830&r1=56829&r2=56830&view=diff
==============================================================================
--- branches/tmp/bubli/ncurses/src/NCWizard.cc (original)
+++ branches/tmp/bubli/ncurses/src/NCWizard.cc Fri Apr 17 13:37:14 2009
@@ -61,6 +61,22 @@
}
};
+NCWizardMenuButton:: NCWizardMenuButton( YWidget * parent, string & label, NCWizard *w )
+ : NCMenuButton( parent, label )
+ , wizard(w)
+{}
+
+NCursesEvent NCWizardMenuButton::postMenu()
+{
+ NCursesEvent ev = NCMenuButton::postMenu();
+ YMenuItem *item = ev.selection;
+
+ NCursesEvent res = NCursesEvent::menu;
+ res.result = wizard->_menuItemIDs[item];
+ yuiMilestone() << res.result << endl;
+ return res;
+};
+
NCWizard::NCWizard( YWidget * parent,
const string & backButtonLabel,
const string & abortButtonLabel,
@@ -287,8 +303,9 @@
_menu->setSize(oldSize.Sze.W, oldSize.Sze.H );
pos = 0;
}
+ string localtext = text;
- NCMenuButton* newmenu = new NCMenuButton( _menu, text );
+ NCWizardMenuButton* newmenu = new NCWizardMenuButton( _menu, localtext, this );
newmenu->setSize(newmenu->wGetDefsze().W, newmenu->wGetDefsze().H);
_menu->moveChild( newmenu, pos, 0);
@@ -307,19 +324,21 @@
}
void NCWizard::addMenuEntry( const string & parentMenuID,
- const string & text,
- const string & id )
+ const string & text,
+ const string & id )
{
if( _topLevelMenus.find(parentMenuID) != _topLevelMenus.end())
{
YMenuItem* item = new YMenuItem( text );
_topLevelMenus[parentMenuID]->addItem( item );
- _menuItemIDs[id] = item;
+ _menuItems[id] = item;
+ _menuItemIDs[item] = id;
}
- else if( _menuItemIDs.find(parentMenuID) != _menuItemIDs.end())
+ else if( _menuItems.find(parentMenuID) != _menuItems.end())
{
- YMenuItem* item = new YMenuItem( _menuItemIDs[parentMenuID], text );
- _menuItemIDs[id] = item;
+ YMenuItem* item = new YMenuItem( _menuItems[parentMenuID], text );
+ _menuItems[id] = item;
+ _menuItemIDs[item] = id;
}
else
yuiError() << "Skipping adding submenu to non-existent '" << parentMenuID << "'" << endl;
Modified: branches/tmp/bubli/ncurses/src/NCWizard.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/bubli/ncurses/src/NCWizard.h?rev=56830&r1=56829&r2=56830&view=diff
==============================================================================
--- branches/tmp/bubli/ncurses/src/NCWizard.h (original)
+++ branches/tmp/bubli/ncurses/src/NCWizard.h Fri Apr 17 13:37:14 2009
@@ -24,13 +24,15 @@
#include "NCWidget.h"
#include "NCPushButton.h"
+#include "NCMenuButton.h"
#include "NCReplacePoint.h"
#include "YWizard.h"
class NCLayoutBox;
class NCLabel;
-class NCMenuButton;
+//class NCMenuButton;
class NCTree;
+class NCWizard;
class YItem;
class YMenuItem;
@@ -57,7 +59,17 @@
string _id;
};
+class NCWizardMenuButton: public NCMenuButton {
+public:
+ NCWizardMenuButton( YWidget * parent, string & label, NCWizard *w );
+
+ virtual ~NCWizardMenuButton() {}
+
+ virtual NCursesEvent postMenu();
+private:
+ NCWizard *wizard;
+};
/**
* A wizard is a more complex frame typically used for multi-step workflows:
*
@@ -312,6 +324,8 @@
virtual NCursesEvent wHandleInput( wint_t key );
private:
+ friend class NCWizardMenuButton;
+
NCPushButton* _helpButton;
NCPushButton* _nextButton;
NCPushButton* _backButton;
@@ -331,8 +345,9 @@
std::map