More RTL fixes.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41226 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2006-09-14 19:24:41 +00:00
parent 0c246b3ca3
commit 5eefe02976
2 changed files with 29 additions and 8 deletions

View File

@@ -1698,11 +1698,27 @@ void wxListHeaderWindow::AdjustDC(wxDC& dc)
int xpix; int xpix;
m_owner->GetScrollPixelsPerUnit( &xpix, NULL ); m_owner->GetScrollPixelsPerUnit( &xpix, NULL );
int x; int view_start;
m_owner->GetViewStart( &x, NULL ); 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 // 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) ) void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
@@ -2629,8 +2645,8 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
GetVisibleLinesRange(&visibleFrom, &visibleTo); GetVisibleLinesRange(&visibleFrom, &visibleTo);
wxRect rectLine; wxRect rectLine;
wxCoord xOrig, yOrig; int xOrig = dc.LogicalToDeviceX( 0 );
CalcUnscrolledPosition(0, 0, &xOrig, &yOrig); int yOrig = dc.LogicalToDeviceY( 0 );
// tell the caller cache to cache the data // tell the caller cache to cache the data
if ( IsVirtual() ) if ( IsVirtual() )
@@ -2647,7 +2663,8 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
{ {
rectLine = GetLineRect(line); rectLine = GetLineRect(line);
if ( !IsExposed(rectLine.x - xOrig, rectLine.y - yOrig,
if ( !IsExposed(rectLine.x + xOrig, rectLine.y + yOrig,
rectLine.width, rectLine.height) ) rectLine.width, rectLine.height) )
{ {
// don't redraw unaffected lines to avoid flicker // don't redraw unaffected lines to avoid flicker

View File

@@ -190,6 +190,10 @@ wxRendererGTK::DrawHeaderButton(wxWindow *win,
GtkWidget *button = GetButtonWidget(); GtkWidget *button = GetButtonWidget();
int x_diff = 0;
if (win->GetLayoutDirection() == wxLayout_RightToLeft)
x_diff = rect.width;
gtk_paint_box gtk_paint_box
( (
button->style, button->style,
@@ -201,7 +205,7 @@ wxRendererGTK::DrawHeaderButton(wxWindow *win,
NULL, NULL,
button, button,
"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); DrawHeaderButtonContents(win, dc, rect, flags, params);