From a4906f1222c44af5534836f38bfd48561cbed854 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 17 Feb 2020 19:35:40 +0100 Subject: [PATCH] Change wxGetTopLevelParent() to take wxWindowBase This makes it more convenient to use when building wxUniv, when wxWindow$TOOLKIT objects are wxWindowBase but not actually wxWindow. No real changes. --- include/wx/window.h | 2 +- src/common/wincmn.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/wx/window.h b/include/wx/window.h index 22fc655a4b..814e9487ad 100644 --- a/include/wx/window.h +++ b/include/wx/window.h @@ -2073,7 +2073,7 @@ extern WXDLLIMPEXP_CORE wxPoint wxGetMousePosition(); extern WXDLLIMPEXP_CORE wxWindow *wxGetActiveWindow(); // get the (first) top level parent window -WXDLLIMPEXP_CORE wxWindow* wxGetTopLevelParent(wxWindow *win); +WXDLLIMPEXP_CORE wxWindow* wxGetTopLevelParent(wxWindowBase *win); #if wxUSE_ACCESSIBILITY // ---------------------------------------------------------------------------- diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index 0ea559aab3..0cd0df79eb 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -3655,8 +3655,9 @@ void wxWindowBase::DragAcceptFiles(bool accept) // global functions // ---------------------------------------------------------------------------- -wxWindow* wxGetTopLevelParent(wxWindow *win) +wxWindow* wxGetTopLevelParent(wxWindowBase *win_) { + wxWindow* win = static_cast(win_); while ( win && !win->IsTopLevel() ) win = win->GetParent();