Fix for drawing check box in the wxPG edit mode when RTL layout direction is set under wxMSW.

Check box isn't drawn correctly in the edit mode under wxMSW due to the problems with RTL handling in wxAutoBufferedPaintDC and wxPaintDC (see #16254).
We need to only draw the image, no text, so we can work around the problem by overriding layout direction to LTR.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76932 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Artur Wieczorek 2014-07-15 16:30:10 +00:00
parent 7203fd5c6b
commit c85cfb1bc0

View File

@ -1551,11 +1551,23 @@ wxBitmap* wxSimpleCheckBox::ms_doubleBuffer = NULL;
void wxSimpleCheckBox::OnPaint( wxPaintEvent& WXUNUSED(event) )
{
wxSize clientSize = GetClientSize();
wxRect rect(GetClientSize());
#ifdef __WXMSW__
wxPaintDC dc(this);
// Under MSW, wxAutoBufferedPaintDC, wxPaintDC don't work fine with RTL,
// so we need to bypass this problem by setting LTR direction for this DC.
// Fortunately, we have only check box image to draw, no texts.
if ( dc.GetLayoutDirection() == wxLayout_RightToLeft )
{
dc.SetLayoutDirection(wxLayout_LeftToRight);
// Some hack to prevent shifting the ouput image.
rect.x -= 2;
}
#else
wxAutoBufferedPaintDC dc(this);
#endif
dc.Clear();
wxRect rect(0,0,clientSize.x,clientSize.y);
rect.y += 1;
rect.width += 1;