X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ef6816ef25f4d5e0ff0100fd7e402419e9c0a794..30413fd03ea2a41832d5ad101819bbad54b8252e:/src/common/wincmn.cpp diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index 320bd80bee..546182a212 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -388,6 +388,7 @@ void wxWindowBase::Centre(int direction) int widthParent, heightParent; wxWindow *parent = NULL; + wxTopLevelWindow *winTop = NULL; if ( !(direction & wxCENTRE_ON_SCREEN) ) { @@ -409,9 +410,10 @@ void wxWindowBase::Centre(int direction) // Windows, for example, this places it completely off the screen if ( parent ) { - wxTopLevelWindow *winTop = wxDynamicCast(parent, wxTopLevelWindow); + winTop = wxDynamicCast(parent, wxTopLevelWindow); if ( winTop && winTop->IsIconized() ) { + winTop = NULL; parent = NULL; } } @@ -434,11 +436,16 @@ void wxWindowBase::Centre(int direction) { if ( IsTopLevel() ) { - // centre on the parent - parent->GetSize(&widthParent, &heightParent); + if(winTop) + winTop->GetRectForTopLevelChildren(&posParent.x, &posParent.y, &widthParent, &heightParent); + else + { + // centre on the parent + parent->GetSize(&widthParent, &heightParent); - // adjust to the parents position - posParent = parent->GetPosition(); + // adjust to the parents position + posParent = parent->GetPosition(); + } } else { @@ -1041,6 +1048,9 @@ bool wxWindowBase::SetBackgroundColour( const wxColour &colour ) return false; m_hasBgCol = colour.Ok(); + if ( m_backgroundStyle != wxBG_STYLE_CUSTOM ) + m_backgroundStyle = m_hasBgCol ? wxBG_STYLE_COLOUR : wxBG_STYLE_SYSTEM; + m_inheritBgCol = m_hasBgCol; m_backgroundColour = colour; SetThemeEnabled( !m_hasBgCol && !m_foregroundColour.Ok() ); @@ -2210,7 +2220,7 @@ void wxWindowBase::OnMiddleClick( wxMouseEvent& event ) #else "", #endif -#if __WXDEBUG__ +#ifdef __WXDEBUG__ _T(" Debug build"), #else _T(""),