X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a02dc3e3ff6a99000b29eeac3be32bcf6dd776da..6e7b6cc6f79fdcacfda3cc4e498a6d6f77b75c4d:/src/common/wincmn.cpp diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index 068a995fd3..01532a8bfb 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -126,7 +126,7 @@ void wxWindowBase::InitBase() #if !defined(__WXMAC__) && !defined(__WXGTK__) m_font = *wxSWISS_FONT; // and this? #else - m_font = settings.GetSystemFont(wxSYS_DEFAULT_GUI_FONT); + m_font = settings.GetSystemFont(wxSYS_DEFAULT_GUI_FONT); #endif // no style bits @@ -183,6 +183,14 @@ bool wxWindowBase::CreateBase(wxWindowBase *parent, SetValidator(validator); #endif // wxUSE_VALIDATORS + // if the parent window has wxWS_EX_VALIDATE_RECURSIVELY set, we want to + // have it too - like this it's possible to set it only in the top level + // dialog/frame and all children will inherit it by defult + if ( parent && (parent->GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY) ) + { + SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY); + } + return TRUE; } @@ -345,10 +353,11 @@ void wxWindowBase::Centre(int direction) // controls are always centered on their parent because it doesn't make // sense to centre them on the screen - if ( !(direction & wxCENTRE_ON_SCREEN) || wxDynamicCast(this, wxControl) ) + if ( !(direction & wxCENTRE_ON_SCREEN) || !IsTopLevel() ) { - // theo nly chance to get this is to have a wxControl without parent - wxCHECK_RET( parent, wxT("a control must have a parent") ); + // the only chance to get this is to have a not top level window + // without parent which shouldn't happen + wxCHECK_RET( parent, wxT("this window must have a parent") ); // adjust to the parents client area origin wxPoint posParent = parent->ClientToScreen(wxPoint(0, 0)); @@ -394,6 +403,14 @@ wxSize wxWindowBase::DoGetBestSize() const int wx, wy, ww, wh; win->GetPosition(&wx, &wy); + + // if the window hadn't been positioned yet, assume that it is in + // the origin + if ( wx == -1 ) + wx = 0; + if ( wy == -1 ) + wy = 0; + win->GetSize(&ww, &wh); if ( wx + ww > maxX ) maxX = wx + ww;