X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/98ebf9194b9211a1ddd244083383bd8a4469b7ed..184fc6c87d232c6bcd0e7eb9b319183a9609ea69:/src/msw/window.cpp diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 50d4d88eb7..6908a7b317 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -1701,6 +1701,13 @@ void wxWindowMSW::DoGetPosition(int *x, int *y) const // children, not for the dialogs/frames if ( !IsTopLevel() ) { + if ( wxTheApp->GetLayoutDirection() == wxLayout_RightToLeft ) + { + // In RTL mode, we want the logical left x-coordinate, + // which would be the physical right x-coordinate. + point.x = rect.right; + } + // Since we now have the absolute screen coords, if there's a // parent we must subtract its top left corner if ( parent ) @@ -4358,7 +4365,7 @@ void wxWindowMSW::OnPaint(wxPaintEvent& event) bool wxWindowMSW::HandleEraseBkgnd(WXHDC hdc) { - wxDCTemp dc(hdc); + wxDCTemp dc(hdc, GetClientSize()); dc.SetHDC(hdc); dc.SetWindow((wxWindow *)this); @@ -4461,11 +4468,37 @@ WXHBRUSH wxWindowMSW::MSWGetBgBrush(WXHDC hDC, WXHWND hWndToPaint) return 0; } -bool wxWindowMSW::HandlePrintClient(WXHDC WXUNUSED(hDC)) +bool wxWindowMSW::HandlePrintClient(WXHDC hDC) { - // TODO: handle wxBG_STYLE_CUSTOM and/or wxBG_STYLE_COLOUR here so when - // DrawParentThemeBackground() from uxtheme.dll is called we don't get - // the default background e.g. the border when custom drawing buttons + // we receive this message when DrawThemeParentBackground() is + // called from def window proc of several controls under XP and we + // must draw properly themed background here + // + // note that naively I'd expect filling the client rect with the + // brush returned by MSWGetBgBrush() work -- but for some reason it + // doesn't and we have to call parents MSWPrintChild() which is + // supposed to call DrawThemeBackground() with appropriate params + // + // also note that in this case lParam == PRF_CLIENT but we're + // clearly expected to paint the background and nothing else! + + if ( IsTopLevel() || InheritsBackgroundColour() ) + return false; + + // sometimes we don't want the parent to handle it at all, instead + // return whatever value this window wants + if ( !MSWShouldPropagatePrintChild() ) + return MSWPrintChild(hDC, (wxWindow *)this); + + for ( wxWindow *win = GetParent(); win; win = win->GetParent() ) + { + if ( win->MSWPrintChild(hDC, (wxWindow *)this) ) + return true; + + if ( win->IsTopLevel() || win->InheritsBackgroundColour() ) + break; + } + return false; }