diff --git a/include/wx/toplevel.h b/include/wx/toplevel.h index 1fc0ef0466..5c446d89a7 100644 --- a/include/wx/toplevel.h +++ b/include/wx/toplevel.h @@ -325,6 +325,8 @@ protected: DoGetPosition(x, y); } + virtual wxSize DoGetBestClientSize() const override; + // test whether this window makes part of the frame // (menubar, toolbar and statusbar are excluded from automatic layout) virtual bool IsOneOfBars(const wxWindow *WXUNUSED(win)) const diff --git a/src/common/toplvcmn.cpp b/src/common/toplvcmn.cpp index c7224e6962..c0da2a47c1 100644 --- a/src/common/toplvcmn.cpp +++ b/src/common/toplvcmn.cpp @@ -486,6 +486,18 @@ bool wxTopLevelWindowBase::Layout() return false; } +wxSize wxTopLevelWindowBase::DoGetBestClientSize() const +{ + // The logic here parallels that of Layout() above. + if ( !UsesAutoLayout() ) + { + if ( wxWindow* const child = GetUniqueChild() ) + return child->GetBestSize(); + } + + return wxNonOwnedWindow::DoGetBestClientSize(); +} + // The default implementation for the close window event. void wxTopLevelWindowBase::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) {