From 822809ef783c2c29c1a8ee9bb52dc186c912cbb5 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 17 May 2018 03:39:24 +0200 Subject: [PATCH] Stop forwarding DoPopupMenu() to wxGenericListCtrl main window There doesn't seem to be anything wrong with just showing the popup menu in this window itself and this avoids the need to do any coordinate adjustments, which didn't work correctly for the menus shown over the header window after the previous commit (and hadn't worked correctly for the menus shown over the non-header area before it). See #18133. --- include/wx/generic/listctrl.h | 2 -- src/generic/listctrl.cpp | 15 --------------- 2 files changed, 17 deletions(-) diff --git a/include/wx/generic/listctrl.h b/include/wx/generic/listctrl.h index 0bbe5d2cbb..6b71353fed 100644 --- a/include/wx/generic/listctrl.h +++ b/include/wx/generic/listctrl.h @@ -211,8 +211,6 @@ protected: long DoInsertColumn(long col, const wxListItem& info) wxOVERRIDE; - virtual bool DoPopupMenu( wxMenu *menu, int x, int y ) wxOVERRIDE; - virtual wxSize DoGetBestClientSize() const wxOVERRIDE; // return the text for the given column of the given item diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 73773de48c..1a09a29232 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -5464,21 +5464,6 @@ wxColour wxGenericListCtrl::GetForegroundColour() const return m_mainWin ? m_mainWin->GetForegroundColour() : wxColour(); } -bool wxGenericListCtrl::DoPopupMenu( wxMenu *menu, int x, int y ) -{ -#if wxUSE_MENUS - // Coordinates here are given in this control coordinates system, but - // PopupMenu() wants them in the coordinates system of the window it's - // called on, so transform them. - ClientToScreen(&x, &y); - m_mainWin->ScreenToClient(&x, &y); - - return m_mainWin->PopupMenu( menu, x, y ); -#else - return false; -#endif -} - wxSize wxGenericListCtrl::DoGetBestClientSize() const { // The base class version can compute the best size in report view only.