{
public:
wxPopupMenuWindow(wxWindow *parent, wxMenu *menu);
+
+ ~wxPopupMenuWindow();
// override the base class version to select the first item initially
virtual void Popup(wxWindow *focus = NULL);
}
else
{
+ // return FALSE;
+
return wxEvtHandler::ProcessEvent(event);
}
}
SetCursor(wxCURSOR_ARROW);
}
+wxPopupMenuWindow::~wxPopupMenuWindow()
+{
+}
+
// ----------------------------------------------------------------------------
// wxPopupMenuWindow current item/node handling
// ----------------------------------------------------------------------------
wxPopupMenuWindow *win = menu->m_popupMenu;
wxCHECK_MSG( win, FALSE, _T("parent menu not shown?") );
-
+
pos = ClientToScreen(pos);
if ( win->GetMenuItemFromPoint(win->ScreenToClient(pos)) )
{
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;
// 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;
wxCHECK_RET( m_invokingWindow, _T("what kind of menu is this?") );
m_invokingWindow->DismissPopupMenu();
- SetInvokingWindow(NULL);
+
+ // Why reset it here? We need it for sending the event to...
+ // SetInvokingWindow(NULL);
}
}
}
{
m_popupMenu->SelectFirst();
}
-
+
// the geometry might have changed since the last time we were shown, so
// always resize
m_popupMenu->SetClientSize(GetGeometryInfo().GetSize());
// not applicabled
isChecked = -1;
}
-
+
return SendEvent(item->GetId(), isChecked);
}
void wxMenuBar::SelectMenu(size_t pos)
{
SetFocus();
- wxLogDebug("Capturing mouse from wxMenuBar::SelectMenu");
+ wxLogTrace(_T("mousecapture"), _T("Capturing mouse from wxMenuBar::SelectMenu"));
CaptureMouse();
DoSelectMenu(pos);
}
else // on item
{
- wxLogDebug("Capturing mouse from wxMenuBar::OnLeftDown");
+ wxLogTrace(_T("mousecapture"), _T("Capturing mouse from wxMenuBar::OnLeftDown"));
CaptureMouse();
// show it as selected
{
if ( GetCapture() )
{
- wxLogDebug("Releasing mouse from wxMenuBar::OnDismiss");
+ wxLogTrace(_T("mousecapture"), _T("Releasing mouse from wxMenuBar::OnDismiss"));
GetCapture()->ReleaseMouse();
}
#endif // 0
menu->SetInvokingWindow(this);
+
+ // wxLogDebug( "Name of invoking window %s", menu->GetInvokingWindow()->GetName().c_str() );
+
menu->Popup(ClientToScreen(wxPoint(x, y)), wxSize(0, 0));
// this is not very useful if the menu was popped up because of the mouse
void wxWindow::DismissPopupMenu()
{
wxCHECK_RET( ms_evtLoopPopup, _T("no popup menu shown") );
-
+
ms_evtLoopPopup->Exit();
}