+ wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") );
+
+ wxASSERT_MSG( (child != NULL), wxT("invalid child window") );
+
+ wxASSERT_MSG( (m_insertCallback != NULL), wxT("invalid child insertion function") );
+
+ /* add to list */
+ AddChild( child );
+
+ /* insert GTK representation */
+ (*m_insertCallback)(this, child);
+}
+
+void wxWindow::Raise()
+{
+ wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
+
+ if (!m_widget->window) return;
+
+ gdk_window_raise( m_widget->window );
+}
+
+void wxWindow::Lower()
+{
+ wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
+
+ if (!m_widget->window) return;
+
+ gdk_window_lower( m_widget->window );
+}
+
+bool wxWindow::SetCursor( const wxCursor &cursor )
+{
+ wxCHECK_MSG( (m_widget != NULL), FALSE, wxT("invalid window") );
+
+ if (cursor == m_cursor)
+ return FALSE;
+
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+ if (cursor == wxNullCursor)
+ return wxWindowBase::SetCursor( *wxSTANDARD_CURSOR );
+ else
+ return wxWindowBase::SetCursor( cursor );
+}
+
+void wxWindow::WarpPointer( int x, int y )
+{
+ wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
+
+ /* we provide this function ourselves as it is
+ missing in GDK (top of this file) */
+
+ GdkWindow *window = (GdkWindow*) NULL;
+ if (m_wxwindow)
+ window = GTK_PIZZA(m_wxwindow)->bin_window;
+ else
+ window = GetConnectWidget()->window;
+
+ if (window)
+ gdk_window_warp_pointer( window, x, y );
+}
+
+void wxWindow::Refresh( bool eraseBackground, const wxRect *rect )
+{
+ if (!m_widget) return;
+ if (!m_widget->window) return;
+
+ if (eraseBackground && m_wxwindow && m_wxwindow->window)
+ {
+ if (rect)
+ {
+ gdk_window_clear_area( GTK_PIZZA(m_wxwindow)->bin_window,
+ rect->x, rect->y,
+ rect->width, rect->height );
+ }
+ else
+ {
+ gdk_window_clear( GTK_PIZZA(m_wxwindow)->bin_window );
+ }
+ }
+
+ /* there is no GTK equivalent of "draw only, don't clear" so we
+ invent our own in the GtkPizza widget */
+
+ if (!rect)
+ {
+ if (m_wxwindow)
+ {
+
+/*
+ GtkPizza *pizza = GTK_PIZZA(m_wxwindow);
+ gboolean old_clear = pizza->clear_on_draw;
+ gtk_pizza_set_clear( pizza, FALSE );
+ gtk_widget_draw( m_wxwindow, (GdkRectangle*) NULL );
+ gtk_pizza_set_clear( pizza, old_clear );
+*/
+ GdkEventExpose gdk_event;
+ gdk_event.type = GDK_EXPOSE;
+ gdk_event.window = GTK_PIZZA(m_wxwindow)->bin_window;
+ gdk_event.count = 0;
+ gdk_event.area.x = 0;
+ gdk_event.area.y = 0;
+ gdk_event.area.width = m_wxwindow->allocation.width;
+ gdk_event.area.height = m_wxwindow->allocation.height;
+ gtk_window_expose_callback( m_wxwindow, &gdk_event, this );
+
+ }
+ else
+ {
+ gtk_widget_draw( m_widget, (GdkRectangle*) NULL );
+ }
+ }
+ else
+ {
+
+ if (m_wxwindow)
+ {
+/*
+ GtkPizza *pizza = GTK_PIZZA(m_wxwindow);
+ gboolean old_clear = pizza->clear_on_draw;
+ gtk_pizza_set_clear( pizza, FALSE );
+
+ GdkRectangle gdk_rect;
+ gdk_rect.x = rect->x;
+ gdk_rect.y = rect->y;
+ gdk_rect.width = rect->width;
+ gdk_rect.height = rect->height;
+ gtk_widget_draw( m_wxwindow, &gdk_rect );
+ gtk_window_draw_callback( m_wxwindow, &gdk_rect, this );
+
+ gtk_pizza_set_clear( pizza, old_clear );
+*/
+ GdkEventExpose gdk_event;
+ gdk_event.type = GDK_EXPOSE;
+ gdk_event.window = GTK_PIZZA(m_wxwindow)->bin_window;
+ gdk_event.count = 0;
+ gdk_event.area.x = rect->x;
+ gdk_event.area.y = rect->y;
+ gdk_event.area.width = rect->width;
+ gdk_event.area.height = rect->height;
+ gtk_window_expose_callback( m_wxwindow, &gdk_event, this );
+ }
+ else
+ {
+ GdkRectangle gdk_rect;
+ gdk_rect.x = rect->x;
+ gdk_rect.y = rect->y;
+ gdk_rect.width = rect->width;
+ gdk_rect.height = rect->height;
+ gtk_widget_draw( m_widget, &gdk_rect );
+ }
+ }
+}
+
+void wxWindow::Clear()
+{
+ wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
+
+ if (!m_widget->window) return;
+
+ if (m_wxwindow && m_wxwindow->window)
+ {
+// gdk_window_clear( m_wxwindow->window );
+ }
+}
+
+#if wxUSE_TOOLTIPS
+void wxWindow::DoSetToolTip( wxToolTip *tip )
+{
+ wxWindowBase::DoSetToolTip(tip);
+
+ if (m_tooltip)
+ m_tooltip->Apply( this );
+}
+
+void wxWindow::ApplyToolTip( GtkTooltips *tips, const wxChar *tip )
+{
+ gtk_tooltips_set_tip( tips, GetConnectWidget(), wxConvCurrent->cWX2MB(tip), (gchar*) NULL );
+}
+#endif // wxUSE_TOOLTIPS
+
+bool wxWindow::SetBackgroundColour( const wxColour &colour )
+{
+ wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid window") );
+
+ if (!wxWindowBase::SetBackgroundColour(colour))
+ {
+ // don't leave if the GTK widget has just
+ // been realized
+ if (!m_delayedBackgroundColour) return FALSE;
+ }
+
+ GdkWindow *window = (GdkWindow*) NULL;
+ if (m_wxwindow)
+ window = GTK_PIZZA(m_wxwindow)->bin_window;
+ else
+ window = GetConnectWidget()->window;
+
+ if (!window)
+ {
+ // indicate that a new style has been set
+ // but it couldn't get applied as the
+ // widget hasn't been realized yet.
+ m_delayedBackgroundColour = TRUE;
+ }
+
+ if ((m_wxwindow) &&
+ (m_wxwindow->window) &&
+ (m_backgroundColour != wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNFACE)))
+ {
+ /* wxMSW doesn't clear the window here. I don't do that either to
+ provide compatibility. call Clear() to do the job. */
+
+ m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
+ gdk_window_set_background( window, m_backgroundColour.GetColor() );
+ }
+
+ ApplyWidgetStyle();
+
+ return TRUE;