From 8d8c902879d618b5b490a5d61ea9af1b97e0ce40 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 9 Aug 2014 17:56:29 +0000 Subject: [PATCH] Remove manual mirroring in RTL case from wxGrid code. This is not necessary as wxDC already inherits RTL from the window itself and, in fact, breaks the display when using RTL. Closes #16250. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@77037 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/generic/grid.cpp | 11 ++--------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 1a7c665b57..35fb351d8d 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -603,6 +603,7 @@ wxMSW: - Fix background of wxRadioBox buttons and wxSlider (Artur Wieczorek). - Fix appearance of wxToggleButtons with non default colours (Artur Wieczorek). - Fix drawing on wxDC when using right-to-left layout (Artur Wieczorek). +- Fix wxGrid appearance and behaviour in RTL (Artur Wieczorek). 3.0.1: (released 2014-06-15) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index f60841049d..6d7815a3ab 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -1680,10 +1680,7 @@ void wxGridColLabelWindow::OnPaint( wxPaintEvent& WXUNUSED(event) ) int x, y; m_owner->CalcUnscrolledPosition( 0, 0, &x, &y ); wxPoint pt = dc.GetDeviceOrigin(); - if (GetLayoutDirection() == wxLayout_RightToLeft) - dc.SetDeviceOrigin( pt.x+x, pt.y ); - else - dc.SetDeviceOrigin( pt.x-x, pt.y ); + dc.SetDeviceOrigin( pt.x-x, pt.y ); wxArrayInt cols = m_owner->CalcColLabelsExposed( GetUpdateRegion() ); m_owner->DrawColLabels( dc, cols ); @@ -3736,13 +3733,9 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event ) // and check if we're on the "near" (usually left but right // in RTL case) part of the column - bool onNearPart; const int middle = GetColLeft(colValid) + GetColWidth(colValid)/2; - if ( GetLayoutDirection() == wxLayout_LeftToRight ) - onNearPart = (x <= middle); - else // wxLayout_RightToLeft - onNearPart = (x > middle); + const bool onNearPart = (x <= middle); // adjust for the column being dragged itself if ( pos < GetColPos(m_dragRowOrCol) )