Add wxApp::GetMainTopWindow() wrapper

This trivial function just allows to avoid checking if wxTheApp is not
null before calling GetTopWindow() on it.

Replace the existing "wxTheApp && wxTheApp->GetTopWindow()" calls with
wxApp::GetMainTopWindow().

No real changes.
This commit is contained in:
Vadim Zeitlin
2021-03-07 15:25:27 +01:00
parent e9f619e561
commit 69e48f036b
15 changed files with 51 additions and 25 deletions

View File

@@ -471,7 +471,7 @@ bool wxICOFileHandler::LoadIcon(wxIcon *icon,
else
#endif
// were we asked for a large icon?
const wxWindow* win = wxTheApp ? wxTheApp->GetTopWindow() : NULL;
const wxWindow* win = wxApp::GetMainTopWindow();
if ( desiredWidth == wxGetSystemMetrics(SM_CXICON, win) &&
desiredHeight == wxGetSystemMetrics(SM_CYICON, win) )
{
@@ -666,7 +666,7 @@ wxSize wxGetHiconSize(HICON hicon)
if ( !size.x )
{
// use default icon size on this hardware
const wxWindow* win = wxTheApp ? wxTheApp->GetTopWindow() : NULL;
const wxWindow* win = wxApp::GetMainTopWindow();
size.x = wxGetSystemMetrics(SM_CXICON, win);
size.y = wxGetSystemMetrics(SM_CYICON, win);
}