From ca8bf9766ee94ec2a5adce6a104c0ca28477ebe8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 18 Sep 2000 15:40:15 +0000 Subject: [PATCH] give frame a reasonable default size if none specified git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8394 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/frame.cpp | 18 +++++++++++++++--- src/gtk1/frame.cpp | 18 +++++++++++++++--- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/gtk/frame.cpp b/src/gtk/frame.cpp index 9cae95648b..71d58cae4d 100644 --- a/src/gtk/frame.cpp +++ b/src/gtk/frame.cpp @@ -455,12 +455,24 @@ void wxFrame::Init() bool wxFrame::Create( wxWindow *parent, wxWindowID id, - const wxString &title, - const wxPoint &pos, - const wxSize &size, + const wxString& title, + const wxPoint& pos, + const wxSize& sizeOrig, long style, const wxString &name ) { + // always create a frame of some reasonable, even if arbitrary, size (at + // least for MSW compatibility) + wxSize size = sizeOrig; + if ( size.x == -1 || size.y == -1 ) + { + wxSize sizeDpy = wxGetDisplaySize(); + if ( size.x == -1 ) + size.x = sizeDpy.x / 3; + if ( size.y == -1 ) + size.y = sizeDpy.y / 5; + } + wxTopLevelWindows.Append( this ); m_needParent = FALSE; diff --git a/src/gtk1/frame.cpp b/src/gtk1/frame.cpp index 9cae95648b..71d58cae4d 100644 --- a/src/gtk1/frame.cpp +++ b/src/gtk1/frame.cpp @@ -455,12 +455,24 @@ void wxFrame::Init() bool wxFrame::Create( wxWindow *parent, wxWindowID id, - const wxString &title, - const wxPoint &pos, - const wxSize &size, + const wxString& title, + const wxPoint& pos, + const wxSize& sizeOrig, long style, const wxString &name ) { + // always create a frame of some reasonable, even if arbitrary, size (at + // least for MSW compatibility) + wxSize size = sizeOrig; + if ( size.x == -1 || size.y == -1 ) + { + wxSize sizeDpy = wxGetDisplaySize(); + if ( size.x == -1 ) + size.x = sizeDpy.x / 3; + if ( size.y == -1 ) + size.y = sizeDpy.y / 5; + } + wxTopLevelWindows.Append( this ); m_needParent = FALSE; -- 2.45.2