Handle wxDefaultSize correctly in wxNonOwnedWindow under wxOSX.
Creating a wxNonOwnedWindow with default size created tiny, practically invisible windows because the default size was only taken care of at wxTopLevelWindow level but not in wxNonOwnedWindow itself. In particular, this broke creation of wxMDIChildFrames with the default size as this class only derived from wxNonOwnedWindow and not from wxTopLevelWindow under OS X. It also probably wasn't intentional as the code did use {Width,Height}Default() functions but they were wxWindow methods and not the wxTopLevelWindow (confusingly and error-pronely) named the same. Fix this, remove the now redundant checks for the default size in wxTopLevelWindow itself and also rationalize and condense the checks for the default position and size components in wxNonOwnedWindow::Create(). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65261 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -101,8 +101,8 @@ void wxNonOwnedWindow::Init()
|
|||||||
|
|
||||||
bool wxNonOwnedWindow::Create(wxWindow *parent,
|
bool wxNonOwnedWindow::Create(wxWindow *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxPoint& pos,
|
const wxPoint& posOrig,
|
||||||
const wxSize& size,
|
const wxSize& sizeOrig,
|
||||||
long style,
|
long style,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
@@ -114,22 +114,23 @@ bool wxNonOwnedWindow::Create(wxWindow *parent,
|
|||||||
m_windowStyle = style;
|
m_windowStyle = style;
|
||||||
m_isShown = false;
|
m_isShown = false;
|
||||||
|
|
||||||
|
// use the appropriate defaults for the position and size if necessary
|
||||||
|
wxPoint pos(posOrig);
|
||||||
|
if ( !pos.IsFullySpecified() )
|
||||||
|
pos.SetDefaults(wxGetClientDisplayRect().GetPosition());
|
||||||
|
|
||||||
|
wxSize size(sizeOrig);
|
||||||
|
if ( !size.IsFullySpecified() )
|
||||||
|
size.SetDefaults(wxTopLevelWindow::GetDefaultSize());
|
||||||
|
|
||||||
// create frame.
|
// create frame.
|
||||||
int x = (int)pos.x;
|
m_nowpeer = wxNonOwnedWindowImpl::CreateNonOwnedWindow
|
||||||
int y = (int)pos.y;
|
(
|
||||||
|
this, parent,
|
||||||
wxRect display = wxGetClientDisplayRect() ;
|
pos , size,
|
||||||
|
style, GetExtraStyle(),
|
||||||
if ( x == wxDefaultPosition.x )
|
name
|
||||||
x = display.x ;
|
);
|
||||||
|
|
||||||
if ( y == wxDefaultPosition.y )
|
|
||||||
y = display.y ;
|
|
||||||
|
|
||||||
int w = WidthDefault(size.x);
|
|
||||||
int h = HeightDefault(size.y);
|
|
||||||
|
|
||||||
m_nowpeer = wxNonOwnedWindowImpl::CreateNonOwnedWindow(this, parent, wxPoint(x,y) , wxSize(w,h) , style , GetExtraStyle(), name );
|
|
||||||
wxNonOwnedWindowImpl::Associate( m_nowpeer->GetWXWindow() , m_nowpeer ) ;
|
wxNonOwnedWindowImpl::Associate( m_nowpeer->GetWXWindow() , m_nowpeer ) ;
|
||||||
m_peer = wxWidgetImpl::CreateContentView(this);
|
m_peer = wxWidgetImpl::CreateContentView(this);
|
||||||
|
|
||||||
|
@@ -73,10 +73,7 @@ bool wxTopLevelWindowMac::Create(wxWindow *parent,
|
|||||||
long style,
|
long style,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
int w = WidthDefault(size.x);
|
if ( !wxNonOwnedWindow::Create(parent, id, pos, size, style, name) )
|
||||||
int h = HeightDefault(size.y);
|
|
||||||
|
|
||||||
if ( !wxNonOwnedWindow::Create(parent, id, pos, wxSize(w,h), style, name) )
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
wxWindow::SetLabel( title ) ;
|
wxWindow::SetLabel( title ) ;
|
||||||
|
Reference in New Issue
Block a user