#undef HAVE_XIM
#endif
-extern GtkContainerClass *pizza_parent_class;
-
//-----------------------------------------------------------------------------
// documentation on internals
//-----------------------------------------------------------------------------
GdkEventExpose *gdk_event,
wxWindowGTK *win )
{
- if (gdk_event->count > 0) return FALSE;
-
- draw_frame( widget, win );
-
- (* GTK_WIDGET_CLASS (pizza_parent_class)->expose_event) (widget, gdk_event);
-
- return TRUE;
+ if (gdk_event->count == 0)
+ draw_frame(widget, win);
+ return false;
}
}
GtkPizza *pizza = GTK_PIZZA( widget );
if (gdk_event->window != pizza->bin_window) return FALSE;
+
#if 0
if (win->GetName())
{
win->GtkSendPaintEvents();
-
// Let parent window draw window-less widgets
- (* GTK_WIDGET_CLASS (pizza_parent_class)->expose_event) (widget, gdk_event);
-
return FALSE;
}
}
wxPoint pt = win->GetClientAreaOrigin();
event.m_x = (wxCoord)gdk_event->x - pt.x;
event.m_y = (wxCoord)gdk_event->y - pt.y;
+
+ if ((win->m_wxwindow) && (win->GetLayoutDirection() == wxLayout_RightToLeft))
+ {
+ // origin in the upper right corner
+ int window_width = gtk_pizza_get_rtl_offset( GTK_PIZZA(win->m_wxwindow) );
+ event.m_x = window_width - event.m_x;
+ }
event.SetEventObject( win );
event.SetId( win->GetId() );
if (win->m_wxwindow)
{
GtkPizza *pizza = GTK_PIZZA(win->m_wxwindow);
- xx += pizza->xoffset;
- yy += pizza->yoffset;
+ xx += gtk_pizza_get_xoffset( pizza );
+ yy += gtk_pizza_get_yoffset( pizza );
}
wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst();
static
void gtk_window_size_callback( GtkWidget *WXUNUSED(widget),
- GtkAllocation *WXUNUSED(alloc),
+ GtkAllocation *alloc,
wxWindow *win )
{
if (g_isIdle)
if ((client_width == win->m_oldClientWidth) && (client_height == win->m_oldClientHeight))
return;
+#if 0
+ wxPrintf( wxT("size_allocate ") );
+ if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
+ wxPrintf( win->GetClassInfo()->GetClassName() );
+ wxPrintf( wxT(" %d %d %d %d\n"),
+ alloc->x,
+ alloc->y,
+ alloc->width,
+ alloc->height );
+#endif
+
+ GTK_PIZZA(win->m_wxwindow)->m_width = win->GetClientSize().x;
+
win->m_oldClientWidth = client_width;
win->m_oldClientHeight = client_height;
/* the window might have been scrolled already, do we
have to adapt the position */
GtkPizza *pizza = GTK_PIZZA(parent->m_wxwindow);
- child->m_x += pizza->xoffset;
- child->m_y += pizza->yoffset;
+ child->m_x += gtk_pizza_get_xoffset( pizza );
+ child->m_y += gtk_pizza_get_yoffset( pizza );
gtk_pizza_put( GTK_PIZZA(parent->m_wxwindow),
GTK_WIDGET(child->m_widget),
#ifndef __WXUNIVERSAL__
GtkPizza *pizza = GTK_PIZZA(m_wxwindow);
-
+
if (HasFlag(wxRAISED_BORDER))
{
gtk_pizza_set_shadow_type( pizza, GTK_MYSHADOW_OUT );
{
// these get reported to wxWidgets -> wxPaintEvent
- gtk_pizza_set_external( GTK_PIZZA(m_wxwindow), TRUE );
-
g_signal_connect (m_wxwindow, "expose_event",
G_CALLBACK (gtk_window_expose_callback), this);
- gtk_widget_set_redraw_on_allocate( GTK_WIDGET(m_wxwindow), HasFlag( wxFULL_REPAINT_ON_RESIZE ) );
+ if (GetLayoutDirection() == wxLayout_LeftToRight)
+ gtk_widget_set_redraw_on_allocate( GTK_WIDGET(m_wxwindow), HasFlag( wxFULL_REPAINT_ON_RESIZE ) );
}
// Create input method handler
this);
}
#ifdef GTK_IS_FILE_CHOOSER_BUTTON
- else if (GTK_IS_FILE_CHOOSER_BUTTON(m_widget))
+ else if (!gtk_check_version(2,6,0) && GTK_IS_FILE_CHOOSER_BUTTON(m_widget))
{
// If we connect to the "size_request" signal of a GtkFileChooserButton
// then that control won't be sized properly when placed inside sizers
InheritAttributes();
m_hasVMT = true;
-
+
SetLayoutDirection(wxLayout_Default);
// unless the window was created initially hidden (i.e. Hide() had been
void wxWindowGTK::DoMoveWindow(int x, int y, int width, int height)
{
+ // inform the parent to perform the move
gtk_pizza_set_size( GTK_PIZZA(m_parent->m_wxwindow), m_widget, x, y, width, height );
+
}
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;
GtkPizza *pizza = GTK_PIZZA(m_parent->m_wxwindow);
if ((sizeFlags & wxSIZE_ALLOW_MINUS_ONE) == 0)
{
- if (x != -1) m_x = x + pizza->xoffset;
- if (y != -1) m_y = y + pizza->yoffset;
+ if (x != -1) m_x = x + gtk_pizza_get_xoffset( pizza );
+ if (y != -1) m_y = y + gtk_pizza_get_yoffset( pizza );
}
else
{
- m_x = x + pizza->xoffset;
- m_y = y + pizza->yoffset;
+ m_x = x + gtk_pizza_get_xoffset( pizza );
+ m_y = y + gtk_pizza_get_yoffset( pizza );
}
int left_border = 0;
if (m_parent && m_parent->m_wxwindow)
{
GtkPizza *pizza = GTK_PIZZA(m_parent->m_wxwindow);
- dx = pizza->xoffset;
- dy = pizza->yoffset;
+ dx = gtk_pizza_get_xoffset( pizza );
+ dy = gtk_pizza_get_yoffset( pizza );
+ }
+
+ if (m_x == -1 && m_y == -1)
+ {
+ GdkWindow *source = (GdkWindow *) NULL;
+ if (m_wxwindow)
+ source = GTK_PIZZA(m_wxwindow)->bin_window;
+ else
+ source = m_widget->window;
+
+ if (source)
+ {
+ int org_x = 0;
+ int org_y = 0;
+ gdk_window_get_origin( source, &org_x, &org_y );
+
+ if (GetParent())
+ GetParent()->ScreenToClient(&org_x, &org_y);
+
+ ((wxWindowGTK*) this)->m_x = org_x;
+ ((wxWindowGTK*) this)->m_y = org_y;
+ }
}
if (x) (*x) = m_x - dx;
}
}
- 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;
}
}
}
- 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;
}
/* reverse: prevent GTK from deleting the widget arbitrarily */
gtk_widget_unref( m_widget );
-
+
SetLayoutDirection(wxLayout_Default);
return true;
return;
GTKSetLayout(m_widget, dir);
+
+ if (m_wxwindow)
+ GTKSetLayout(m_wxwindow, dir);
+}
+
+wxCoord
+wxWindowGTK::AdjustForLayoutDirection(wxCoord x,
+ wxCoord WXUNUSED(width),
+ wxCoord WXUNUSED(widthTotal)) const
+{
+ // We now mirrors the coordinates of RTL windows in GtkPizza
+ return x;
}
void wxWindowGTK::DoMoveInTabOrder(wxWindow *win, MoveKind move)
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
{
p = NULL;
}
-
+
gdk_window_invalidate_rect( GTK_PIZZA(m_wxwindow)->bin_window, p, TRUE );
}
}
}
}
+bool wxWindowGTK::DoIsExposed( int x, int y ) const
+{
+ return m_updateRegion.Contains(x, y) != wxOutRegion;
+}
+
+
+bool wxWindowGTK::DoIsExposed( int x, int y, int w, int h ) const
+{
+ if (GetLayoutDirection() == wxLayout_RightToLeft)
+ return m_updateRegion.Contains(x-w, y, w, h) != wxOutRegion;
+ else
+ return m_updateRegion.Contains(x, y, w, h) != wxOutRegion;
+}
+
void wxWindowGTK::GtkSendPaintEvents()
{
if (!m_wxwindow)
// Clip to paint region in wxClientDC
m_clipPaintRegion = true;
+ wxRegion maybe_rtl_region = m_updateRegion;
+
+#if 0
+ if (GetLayoutDirection() == wxLayout_RightToLeft)
+ {
+ maybe_rtl_region.Clear();
+
+ gint width;
+ gdk_window_get_geometry( GTK_PIZZA(m_wxwindow)->bin_window,
+ NULL, NULL, &width, NULL, NULL );
+
+ wxRegionIterator upd( m_updateRegion );
+ while (upd)
+ {
+ wxRect rect;
+ rect.x = upd.GetX();
+ rect.y = upd.GetY();
+ rect.width = upd.GetWidth();
+ rect.height = upd.GetHeight();
+
+ rect.x = width - rect.x - rect.width;
+ maybe_rtl_region.Union( rect );
+
+ ++upd;
+ }
+ }
+#endif
+
// widget to draw on
GtkPizza *pizza = GTK_PIZZA (m_wxwindow);
}
}
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 );