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) )
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() )
{
{
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
}
else // !report
{
- if (rect.x-view_x < 5)
- Scroll( (rect.x - 5) / SCROLL_UNIT_X, -1 );
- if (rect.x + rect.width - 5 > view_x + client_w)
- Scroll( (rect.x + rect.width - client_w + SCROLL_UNIT_X) / SCROLL_UNIT_X, -1 );
+ if (GetLayoutDirection() == wxLayout_RightToLeft)
+ {
+#if 0
+ wxPrintf( wxT("rect %d %d %d %d view_x %d\n"), rect.x, rect.y, rect.width, rect.height, view_x );
+ int virtual_width = GetVirtualSize().x;
+ view_x = virtual_width - view_x - client_w;
+ wxPrintf( wxT("virtual_width %d view_x = %d client_w = %d\n"), virtual_width, view_x, client_w );
+#endif
+ }
+ else
+ {
+ if (rect.x-view_x < 5)
+ Scroll( (rect.x - 5) / SCROLL_UNIT_X, -1 );
+ if (rect.x + rect.width - 5 > view_x + client_w)
+ Scroll( (rect.x + rect.width - client_w + SCROLL_UNIT_X) / SCROLL_UNIT_X, -1 );
+ }
}
}