// show popup menu at the given position, generate events for the items
// selected in it
bool PopupMenu(wxMenu *menu, const wxPoint& pos = wxDefaultPosition)
- { return DoPopupMenu(menu, pos.x, pos.y); }
- bool PopupMenu(wxMenu *menu, int x, int y)
- { return DoPopupMenu(menu, x, y); }
+ { return PopupMenu(menu, pos.x, pos.y); }
+ bool PopupMenu(wxMenu *menu, int x, int y);
// simply return the id of the selected item or wxID_NONE without
// generating any events
// Windows List
WXDLLIMPEXP_DATA_CORE(wxWindowList) wxTopLevelWindows;
+// globals
+#if wxUSE_MENUS_NATIVE
+wxMenu *wxCurrentPopupMenu = NULL;
+#endif // wxUSE_MENUS_NATIVE
+
// ----------------------------------------------------------------------------
// static data
// ----------------------------------------------------------------------------
// we weren't a dialog class
wxTopLevelWindows.DeleteObject((wxWindow*)this);
+ // The associated popup menu can still be alive, disassociate from it in
+ // this case
+ if ( wxCurrentPopupMenu && wxCurrentPopupMenu->GetInvokingWindow() == this )
+ wxCurrentPopupMenu->SetInvokingWindow(NULL);
+
wxASSERT_MSG( GetChildren().GetCount() == 0, wxT("children not destroyed") );
// notify the parent about this window destruction
#if wxUSE_MENUS
+bool wxWindowBase::PopupMenu(wxMenu *menu, int x, int y)
+{
+ wxCHECK_MSG( menu, false, "can't popup NULL menu" );
+
+ wxCurrentPopupMenu = menu;
+ const bool rc = DoPopupMenu(menu, x, y);
+ wxCurrentPopupMenu = NULL;
+
+ return rc;
+}
+
// this is used to pass the id of the selected item from the menu event handler
// to the main function itself
//
// global variables
// ---------------------------------------------------------------------------
-#if wxUSE_MENUS_NATIVE
-wxMenu *wxCurrentPopupMenu = NULL;
-#endif // wxUSE_MENUS_NATIVE
-
#ifdef __WXWINCE__
extern wxChar *wxCanvasClassName;
#else
point.x = x;
point.y = y;
::ClientToScreen(hWnd, &point);
- wxCurrentPopupMenu = menu;
#if defined(__WXWINCE__)
static const UINT flags = 0;
#else // !__WXWINCE__
// for example) and so we do need to process the event immediately
wxYieldForCommandsOnly();
- wxCurrentPopupMenu = NULL;
-
menu->SetInvokingWindow(NULL);
return true;
DoGetSize(0,&nHeight);
nY = nHeight - nY;
}
- wxCurrentPopupMenu = pMenu;
::WinPopupMenu( hWndParent
,hWndOwner
::WinDispatchMsg(vHabmain, (PQMSG)&vMsg);
}
- wxCurrentPopupMenu = NULL;
pMenu->SetInvokingWindow(NULL);
return true;
} // end of wxWindowOS2::DoPopupMenu
// global variables
// ---------------------------------------------------------------------------
-#if wxUSE_MENUS_NATIVE
-wxMenu *wxCurrentPopupMenu = NULL;
-#endif // wxUSE_MENUS_NATIVE
-
// ---------------------------------------------------------------------------
// private functions
// ---------------------------------------------------------------------------