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
bool wxNonOwnedWindow::Create(wxWindow *parent,
wxWindowID id,
bool wxNonOwnedWindow::Create(wxWindow *parent,
wxWindowID id,
- const wxPoint& pos,
- const wxSize& size,
+ const wxPoint& posOrig,
+ const wxSize& sizeOrig,
long style,
const wxString& name)
{
long style,
const wxString& name)
{
m_windowStyle = style;
m_isShown = false;
m_windowStyle = style;
m_isShown = false;
- // create frame.
- int x = (int)pos.x;
- int y = (int)pos.y;
-
- wxRect display = wxGetClientDisplayRect() ;
-
- if ( x == wxDefaultPosition.x )
- x = display.x ;
+ // use the appropriate defaults for the position and size if necessary
+ wxPoint pos(posOrig);
+ if ( !pos.IsFullySpecified() )
+ pos.SetDefaults(wxGetClientDisplayRect().GetPosition());
- if ( y == wxDefaultPosition.y )
- y = display.y ;
+ wxSize size(sizeOrig);
+ if ( !size.IsFullySpecified() )
+ size.SetDefaults(wxTopLevelWindow::GetDefaultSize());
- 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 );
+ // create frame.
+ m_nowpeer = wxNonOwnedWindowImpl::CreateNonOwnedWindow
+ (
+ this, parent,
+ pos , size,
+ style, GetExtraStyle(),
+ name
+ );
wxNonOwnedWindowImpl::Associate( m_nowpeer->GetWXWindow() , m_nowpeer ) ;
m_peer = wxWidgetImpl::CreateContentView(this);
wxNonOwnedWindowImpl::Associate( m_nowpeer->GetWXWindow() , m_nowpeer ) ;
m_peer = wxWidgetImpl::CreateContentView(this);
long style,
const wxString& name)
{
long style,
const wxString& name)
{
- int w = WidthDefault(size.x);
- int h = HeightDefault(size.y);
-
- if ( !wxNonOwnedWindow::Create(parent, id, pos, wxSize(w,h), style, name) )
+ if ( !wxNonOwnedWindow::Create(parent, id, pos, size, style, name) )
return false;
wxWindow::SetLabel( title ) ;
return false;
wxWindow::SetLabel( title ) ;