]> git.saurik.com Git - wxWidgets.git/commitdiff
More RTL fixes.
authorRobert Roebling <robert@roebling.de>
Thu, 14 Sep 2006 19:24:41 +0000 (19:24 +0000)
committerRobert Roebling <robert@roebling.de>
Thu, 14 Sep 2006 19:24:41 +0000 (19:24 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41226 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/listctrl.cpp
src/gtk/renderer.cpp

index 8cd3701243651750ddc2c85996b26a0f45a1934d..c6585cd0691d3d104755ee9465a95a9413ba1412 100644 (file)
@@ -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
index b5200d0d3564649a92b53b102741d35f59471feb..133f7af1cf1537b6ecc27d7db3953b41802b303d 100644 (file)
@@ -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);