X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c5c4c31e6cdaea9afcc10b04e6fe37ec02e300a4..09cbc94feafe9c5a424eb1d462589f9620a1977e:/src/msw/control.cpp diff --git a/src/msw/control.cpp b/src/msw/control.cpp index 96547014e9..d32372b29f 100644 --- a/src/msw/control.cpp +++ b/src/msw/control.cpp @@ -126,11 +126,15 @@ bool wxControl::MSWCreateControl(const wxChar *classname, style |= WS_VISIBLE; } - // choose the position for the control + // choose the position for the control: we have a problem with default size + // here as we can't calculate the best size before the control exists + // (DoGetBestSize() may need to use m_hWnd), so just choose the minimal + // possible but non 0 size because 0 window width/height result in problems + // elsewhere int x = pos.x == wxDefaultCoord ? 0 : pos.x, y = pos.y == wxDefaultCoord ? 0 : pos.y, - w = size.x == wxDefaultCoord ? 0 : size.x, - h = size.y == wxDefaultCoord ? 0 : size.y; + w = size.x == wxDefaultCoord ? 1 : size.x, + h = size.y == wxDefaultCoord ? 1 : size.y; // ... and adjust it to account for a possible parent frames toolbar AdjustForParentClientOrigin(x, y); @@ -331,7 +335,11 @@ WXHBRUSH wxControl::MSWControlColorSolid(WXHDC pDC, wxColour colBg) { HDC hdc = (HDC)pDC; if ( m_hasFgCol ) + { ::SetTextColor(hdc, wxColourToRGB(GetForegroundColour())); + if ( !colBg.Ok() ) + colBg = GetBackgroundColour(); + } if ( colBg.Ok() ) { @@ -354,24 +362,9 @@ WXHBRUSH wxControl::MSWControlColor(WXHDC pDC) ::SetBkMode((HDC)pDC, TRANSPARENT); -#if wxUSE_UXTHEME && wxUSE_NOTEBOOK - if ( wxUxThemeEngine::GetIfActive() ) - { - for ( wxWindow *win = this; win; win = win->GetParent() ) - { - wxNotebook *nbook = wxDynamicCast(win, wxNotebook); - if ( nbook ) - { - // return value may be NULL but it is ok: if the first parent - // notebook doesn't use themes, then we don't have to process - // this message at all, so let default processing take place - return nbook->GetThemeBackgroundBrush(pDC, this); - } - } - } -#endif // wxUSE_UXTHEME + hbr = MSWGetBgBrush(pDC); - return MSWAlwaysDrawBg() ? 0 : ::GetStockObject(NULL_BRUSH); + return hbr ? hbr : MSWGetDefaultBgBrush(); } WXHBRUSH wxControl::MSWControlColorDisabled(WXHDC pDC)