if (!win->m_hasVMT)
return;
- int dw = 0;
- int dh = 0;
-
- if (win->m_hasScrolling)
- {
- GetScrollbarWidth(widget, dw, dh);
- }
-
int dx = 0;
int dy = 0;
if (GTK_WIDGET_NO_WINDOW (widget))
dy += widget->allocation.y;
}
+ int x = dx;
+ int y = dy;
+
+ int dw = 0;
+ int dh = 0;
+ if (win->m_hasScrolling)
+ {
+ GetScrollbarWidth(widget, dw, dh);
+
+ if (win->GetLayoutDirection() == wxLayout_RightToLeft)
+ {
+ // This is actually wrong for old GTK+ version
+ // which do not display the scrollbar on the
+ // left side in RTL
+ x += dw;
+ }
+ }
+
+ int w = widget->allocation.width-dw;
+ int h = widget->allocation.height-dh;
+
if (win->HasFlag(wxRAISED_BORDER))
{
gtk_paint_shadow (widget->style,
GTK_STATE_NORMAL,
GTK_SHADOW_OUT,
NULL, NULL, NULL, // FIXME: No clipping?
- dx, dy,
- widget->allocation.width-dw, widget->allocation.height-dh );
+ x, y, w, h );
return;
}
GTK_STATE_NORMAL,
GTK_SHADOW_IN,
NULL, NULL, NULL, // FIXME: No clipping?
- dx, dy,
- widget->allocation.width-dw, widget->allocation.height-dh );
+ x, y, w, h );
return;
}
GdkGC *gc;
gc = gdk_gc_new( widget->window );
gdk_gc_set_foreground( gc, &widget->style->black );
- gdk_draw_rectangle( widget->window, gc, FALSE,
- dx, dy,
- widget->allocation.width-dw-1, widget->allocation.height-dh-1 );
+ gdk_draw_rectangle( widget->window, gc, FALSE, x, y, w-1, h-1 );
g_object_unref (gc);
return;
}
m_scrollBar[ScrollDir_Horz] = GTK_RANGE(scrolledWindow->hscrollbar);
m_scrollBar[ScrollDir_Vert] = GTK_RANGE(scrolledWindow->vscrollbar);
+ if (GetLayoutDirection() == wxLayout_RightToLeft)
+ gtk_range_set_inverted( m_scrollBar[ScrollDir_Horz], TRUE );
m_wxwindow = gtk_pizza_new();
int dh = 0;
if (m_hasScrolling)
- {
GetScrollbarWidth(m_widget, dw, dh);
- }
#ifndef __WXUNIVERSAL__
if (HasFlag(wxRAISED_BORDER) || HasFlag(wxSUNKEN_BORDER))
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
// Clip to paint region in wxClientDC
m_clipPaintRegion = true;
- wxRegion maybe_rtl_region = m_updateRegion;
-
-#if 0
+ m_nativeUpdateRegion = m_updateRegion;
+
if (GetLayoutDirection() == wxLayout_RightToLeft)
{
- maybe_rtl_region.Clear();
+ // Transform m_updateRegion under RTL
+ m_updateRegion.Clear();
gint width;
gdk_window_get_geometry( GTK_PIZZA(m_wxwindow)->bin_window,
NULL, NULL, &width, NULL, NULL );
- wxRegionIterator upd( m_updateRegion );
+ wxRegionIterator upd( m_nativeUpdateRegion );
while (upd)
{
wxRect rect;
rect.height = upd.GetHeight();
rect.x = width - rect.x - rect.width;
- maybe_rtl_region.Union( rect );
+ m_updateRegion.Union( rect );
++upd;
}
}
-#endif
// widget to draw on
GtkPizza *pizza = GTK_PIZZA (m_wxwindow);
if (GTK_WIDGET_MAPPED(parent->m_widget))
{
- wxRegionIterator upd( m_updateRegion );
+ wxRegionIterator upd( m_nativeUpdateRegion );
while (upd)
{
GdkRectangle rect;
}
else
{
- m_updateRegion = maybe_rtl_region;
-
wxWindowDC dc( (wxWindow*)this );
dc.SetClippingRegion( m_updateRegion );
GetEventHandler()->ProcessEvent(erase_event);
}
- m_updateRegion = maybe_rtl_region;
-
wxNcPaintEvent nc_paint_event( GetId() );
nc_paint_event.SetEventObject( this );
GetEventHandler()->ProcessEvent( nc_paint_event );
m_clipPaintRegion = false;
m_updateRegion.Clear();
+ m_nativeUpdateRegion.Clear();
}
void wxWindowGTK::SetDoubleBuffered( bool on )
gtk_widget_set_double_buffered( m_wxwindow, on );
}
+bool wxWindowGTK::IsDoubleBuffered() const
+{
+ return GTK_WIDGET_DOUBLE_BUFFERED( m_wxwindow );
+}
+
void wxWindowGTK::ClearBackground()
{
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
pos = max;
if (pos < 0)
pos = 0;
- m_scrollPos[dir] =
- adj->value = pos;
+ m_scrollPos[dir] = adj->value = pos;
+
// If a "value_changed" signal emission is not already in progress
if (!m_blockValueChanged[dir])
{
const int barIndex = range == m_scrollBar[1];
GtkAdjustment* adj = range->adjustment;
+
const int value = int(adj->value + 0.5);
+
// save previous position
const double oldPos = m_scrollPos[barIndex];
// update current position
m_clipPaintRegion = true;
- gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy );
+ if (GetLayoutDirection() == wxLayout_RightToLeft)
+ gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), dx, -dy );
+ else
+ gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy );
m_clipPaintRegion = false;
}