Lots of things to make menus and submenus work.

Also added wxPopTransientWindow::CanDismiss() which will
    be needed for pop-up menus, although that actually
    still has to be done...


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14436 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2002-02-28 22:42:14 +00:00
parent 4e89ceb11e
commit ea1ad04b43
5 changed files with 31 additions and 7 deletions

View File

@@ -123,6 +123,8 @@ class wxPopupMenuWindow : public wxPopupTransientWindow
{
public:
wxPopupMenuWindow(wxWindow *parent, wxMenu *menu);
~wxPopupMenuWindow();
// override the base class version to select the first item initially
virtual void Popup(wxWindow *focus = NULL);
@@ -308,6 +310,10 @@ wxPopupMenuWindow::wxPopupMenuWindow(wxWindow *parent, wxMenu *menu)
SetCursor(wxCURSOR_ARROW);
}
wxPopupMenuWindow::~wxPopupMenuWindow()
{
}
// ----------------------------------------------------------------------------
// wxPopupMenuWindow current item/node handling
// ----------------------------------------------------------------------------
@@ -1154,6 +1160,10 @@ wxWindow *wxMenu::GetRootWindow() const
wxMenu *menu = GetParent();
while ( menu )
{
// We are a submenu of a menu of a menubar
if (menu->GetMenuBar())
return menu->GetMenuBar();
win = menu->GetInvokingWindow();
if ( win )
break;
@@ -1164,7 +1174,7 @@ wxWindow *wxMenu::GetRootWindow() const
// we're probably going to crash in the caller anyhow, but try to detect
// this error as soon as possible
wxASSERT_MSG( win, _T("menu without any associated window?") );
// also remember it in this menu so that we don't have to search for it the
// next time
wxConstCast(this, wxMenu)->m_invokingWindow = win;
@@ -2379,6 +2389,9 @@ bool wxWindow::DoPopupMenu(wxMenu *menu, int x, int y)
void wxWindow::DismissPopupMenu()
{
wxCHECK_RET( ms_evtLoopPopup, _T("no popup menu shown") );
char *crash = NULL;
(*crash) = 0;
ms_evtLoopPopup->Exit();
}