From 5eefe029764003751db7998a92f0645765c6e6c7 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Thu, 14 Sep 2006 19:24:41 +0000 Subject: [PATCH] More RTL fixes. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41226 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/listctrl.cpp | 31 ++++++++++++++++++++++++------- src/gtk/renderer.cpp | 6 +++++- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 8cd3701243..c6585cd069 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -1698,11 +1698,27 @@ void wxListHeaderWindow::AdjustDC(wxDC& dc) int xpix; m_owner->GetScrollPixelsPerUnit( &xpix, NULL ); - int x; - m_owner->GetViewStart( &x, NULL ); + int view_start; + m_owner->GetViewStart( &view_start, NULL ); + + if (GetLayoutDirection() == wxLayout_RightToLeft) + { + // FIXME: we need a better way for RTL scrolling.. + int scroll_lines = m_owner->GetScrollLines( wxHORIZONTAL ); + if (scroll_lines) + { + int client_size = m_owner->GetClientSize().x; + view_start = scroll_lines - (client_size / xpix) - view_start; + view_start = -view_start; + } + } + + int org_x = 0; + int org_y = 0; + dc.GetDeviceOrigin( &org_x, &org_y ); // account for the horz scrollbar offset - dc.SetDeviceOrigin( -x * xpix, 0 ); + dc.SetDeviceOrigin( org_x - (view_start * xpix), org_y ); } void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) @@ -2629,9 +2645,9 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) GetVisibleLinesRange(&visibleFrom, &visibleTo); wxRect rectLine; - wxCoord xOrig, yOrig; - CalcUnscrolledPosition(0, 0, &xOrig, &yOrig); - + int xOrig = dc.LogicalToDeviceX( 0 ); + int yOrig = dc.LogicalToDeviceY( 0 ); + // tell the caller cache to cache the data if ( IsVirtual() ) { @@ -2647,7 +2663,8 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) { rectLine = GetLineRect(line); - if ( !IsExposed(rectLine.x - xOrig, rectLine.y - yOrig, + + if ( !IsExposed(rectLine.x + xOrig, rectLine.y + yOrig, rectLine.width, rectLine.height) ) { // don't redraw unaffected lines to avoid flicker diff --git a/src/gtk/renderer.cpp b/src/gtk/renderer.cpp index b5200d0d35..133f7af1cf 100644 --- a/src/gtk/renderer.cpp +++ b/src/gtk/renderer.cpp @@ -190,6 +190,10 @@ wxRendererGTK::DrawHeaderButton(wxWindow *win, GtkWidget *button = GetButtonWidget(); + int x_diff = 0; + if (win->GetLayoutDirection() == wxLayout_RightToLeft) + x_diff = rect.width; + gtk_paint_box ( button->style, @@ -201,7 +205,7 @@ wxRendererGTK::DrawHeaderButton(wxWindow *win, NULL, button, "button", - dc.LogicalToDeviceX(rect.x), rect.y, rect.width, rect.height + dc.LogicalToDeviceX(rect.x) - x_diff, rect.y, rect.width, rect.height ); DrawHeaderButtonContents(win, dc, rect, flags, params); -- 2.45.2