More RTL work.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41206 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -3138,10 +3138,22 @@ void wxListMainWindow::MoveToItem(size_t item)
|
||||
}
|
||||
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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -2242,12 +2242,7 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
|
||||
|
||||
if ( image != NO_IMAGE )
|
||||
{
|
||||
#ifdef __WXGTK__
|
||||
if (GetLayoutDirection() == wxLayout_RightToLeft)
|
||||
dc.SetClippingRegion( item->GetX()+image_w-2, item->GetY(), image_w-2, total_h );
|
||||
else
|
||||
#endif
|
||||
dc.SetClippingRegion( item->GetX(), item->GetY(), image_w-2, total_h );
|
||||
dc.SetClippingRegion( item->GetX(), item->GetY(), image_w-2, total_h );
|
||||
m_imageListNormal->Draw( image, dc,
|
||||
item->GetX(),
|
||||
item->GetY() +((total_h > image_h)?((total_h-image_h)/2):0),
|
||||
@@ -2392,6 +2387,7 @@ void wxGenericTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level
|
||||
int yy = y_mid - image_h/2;
|
||||
|
||||
wxDCClipper clip(dc, xx, yy, image_w, image_h);
|
||||
wxPrintf( wxT("hi\n") );
|
||||
m_imageListButtons->Draw(image, dc, xx, yy,
|
||||
wxIMAGELIST_DRAW_TRANSPARENT);
|
||||
}
|
||||
|
@@ -331,8 +331,24 @@ wxWindowDC::wxWindowDC( wxWindow *window )
|
||||
m_signX = -1;
|
||||
|
||||
// origin in the upper right corner
|
||||
wxScrolledWindow *sw = wxDynamicCast( m_owner, wxScrolledWindow );
|
||||
if (sw)
|
||||
|
||||
int scroll_lines = 0;
|
||||
int scroll_step = 0;
|
||||
|
||||
// Are we using scrolling?
|
||||
wxScrollHelper *sh = (wxScrollHelper*) m_owner->GetScrollHelper();
|
||||
if (sh)
|
||||
{
|
||||
scroll_lines = sh->GetScrollLines(wxHORIZONTAL);
|
||||
sh->GetScrollPixelsPerUnit( &scroll_step, NULL );
|
||||
}
|
||||
|
||||
if (scroll_lines == 0)
|
||||
{
|
||||
int client_width = m_owner->GetClientSize().x;
|
||||
m_deviceOriginX = client_width;
|
||||
}
|
||||
else
|
||||
{
|
||||
// We cannot use just the virtual size here, because
|
||||
// the virtual size may be less than the visible area
|
||||
@@ -340,26 +356,11 @@ wxWindowDC::wxWindowDC( wxWindow *window )
|
||||
// horizontal scroll step is 10 pixels and the virtual
|
||||
// area is 97 pixels, we should be able to see or scroll
|
||||
// to 100 pixels, so the origin is at -100, not -97.
|
||||
if (sw->GetScrollLines(wxHORIZONTAL) == 0)
|
||||
{
|
||||
int client_width = m_owner->GetClientSize().x;
|
||||
m_deviceOriginX = client_width;
|
||||
}
|
||||
else
|
||||
{
|
||||
int scroll_step = 0;
|
||||
sw->GetScrollPixelsPerUnit( &scroll_step, NULL );
|
||||
int client_width = m_owner->GetClientSize().x;
|
||||
int virtual_size = sw->GetVirtualSize().x;
|
||||
int steps = (virtual_size + scroll_step - 1) / scroll_step;
|
||||
int width = steps * scroll_step + (client_width % scroll_step);
|
||||
m_deviceOriginX = width;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int client_width = m_owner->GetClientSize().x;
|
||||
m_deviceOriginX = client_width;
|
||||
int client_width = sh->GetTargetWindow()->GetClientSize().x;
|
||||
int virtual_size = m_owner->GetVirtualSize().x;
|
||||
int steps = (virtual_size + scroll_step - 1) / scroll_step;
|
||||
int width = steps * scroll_step + (client_width % scroll_step);
|
||||
m_deviceOriginX = width;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2151,6 +2152,11 @@ void wxWindowDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoo
|
||||
rect.width = XLOG2DEVREL(width);
|
||||
rect.height = YLOG2DEVREL(height);
|
||||
|
||||
if (m_owner && m_owner->m_wxwindow && (m_owner->GetLayoutDirection() == wxLayout_RightToLeft))
|
||||
{
|
||||
rect.x -= rect.width;
|
||||
}
|
||||
|
||||
if (!m_currentClippingRegion.IsNull())
|
||||
m_currentClippingRegion.Intersect( rect );
|
||||
else
|
||||
|
@@ -2137,7 +2137,7 @@ void gtk_window_size_callback( GtkWidget *WXUNUSED(widget),
|
||||
alloc->height );
|
||||
#endif
|
||||
|
||||
GTK_PIZZA(win->m_wxwindow)->m_width = alloc->width;
|
||||
GTK_PIZZA(win->m_wxwindow)->m_width = win->GetClientSize().x;
|
||||
|
||||
win->m_oldClientWidth = client_width;
|
||||
win->m_oldClientHeight = client_height;
|
||||
@@ -2465,7 +2465,7 @@ bool wxWindowGTK::Create( wxWindow *parent,
|
||||
|
||||
#ifndef __WXUNIVERSAL__
|
||||
GtkPizza *pizza = GTK_PIZZA(m_wxwindow);
|
||||
|
||||
|
||||
if (HasFlag(wxRAISED_BORDER))
|
||||
{
|
||||
gtk_pizza_set_shadow_type( pizza, GTK_MYSHADOW_OUT );
|
||||
@@ -2753,10 +2753,6 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags
|
||||
wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") );
|
||||
wxASSERT_MSG( (m_parent != NULL), wxT("wxWindowGTK::SetSize requires parent.\n") );
|
||||
|
||||
/*
|
||||
printf( "DoSetSize: name %s, x,y,w,h: %d,%d,%d,%d \n", GetName().c_str(), x,y,width,height );
|
||||
*/
|
||||
|
||||
if (m_resizing) return; /* I don't like recursions */
|
||||
m_resizing = true;
|
||||
|
||||
@@ -3107,7 +3103,15 @@ void wxWindowGTK::DoClientToScreen( int *x, int *y ) const
|
||||
}
|
||||
}
|
||||
|
||||
if (x) *x += org_x;
|
||||
|
||||
if (x)
|
||||
{
|
||||
if (GetLayoutDirection() == wxLayout_RightToLeft)
|
||||
*x = (GetClientSize().x - *x) + org_x;
|
||||
else
|
||||
*x += org_x;
|
||||
}
|
||||
|
||||
if (y) *y += org_y;
|
||||
}
|
||||
|
||||
@@ -3136,7 +3140,13 @@ void wxWindowGTK::DoScreenToClient( int *x, int *y ) const
|
||||
}
|
||||
}
|
||||
|
||||
if (x) *x -= org_x;
|
||||
if (x)
|
||||
{
|
||||
if (GetLayoutDirection() == wxLayout_RightToLeft)
|
||||
*x = (GetClientSize().x - *x) - org_x;
|
||||
else
|
||||
*x -= org_x;
|
||||
}
|
||||
if (y) *y -= org_y;
|
||||
}
|
||||
|
||||
@@ -3752,6 +3762,8 @@ void wxWindowGTK::Refresh( bool eraseBackground, const wxRect *rect )
|
||||
gdk_rect.y = rect->y;
|
||||
gdk_rect.width = rect->width;
|
||||
gdk_rect.height = rect->height;
|
||||
if (GetLayoutDirection() == wxLayout_RightToLeft)
|
||||
gdk_rect.x = GetClientSize().x - gdk_rect.x - gdk_rect.width;
|
||||
p = &gdk_rect;
|
||||
}
|
||||
else // invalidate everything
|
||||
@@ -3759,8 +3771,6 @@ void wxWindowGTK::Refresh( bool eraseBackground, const wxRect *rect )
|
||||
p = NULL;
|
||||
}
|
||||
|
||||
p = NULL;
|
||||
|
||||
gdk_window_invalidate_rect( GTK_PIZZA(m_wxwindow)->bin_window, p, TRUE );
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user