-static void
-assistant_paint_colored_box (GtkWidget *widget,
- cairo_t *cr)
-{
- GtkAssistant *assistant = GTK_ASSISTANT (widget);
- GtkAssistantPrivate *priv = assistant->priv;
- GtkAllocation allocation, action_area_allocation, header_image_allocation;
- GtkStyle *style;
- gint border_width, header_padding, content_padding;
- gint content_x, content_width;
- gboolean rtl;
-
- rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
- border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
-
- gtk_widget_style_get (widget,
- "header-padding", &header_padding,
- "content-padding", &content_padding,
- NULL);
-
- style = gtk_widget_get_style (widget);
- gtk_widget_get_allocation (widget, &allocation);
- gtk_widget_get_allocation (priv->action_area, &action_area_allocation);
- gtk_widget_get_allocation (priv->header_image, &header_image_allocation);
-
- /* colored box */
- gdk_cairo_set_source_color (cr, &style->bg[GTK_STATE_SELECTED]);
- cairo_rectangle (cr,
- border_width,
- border_width,
- allocation.width - 2 * border_width,
- allocation.height - action_area_allocation.height - 2 * border_width - ACTION_AREA_SPACING);
- cairo_fill (cr);
-
- /* content box */
- content_x = content_padding + border_width;
- content_width = allocation.width - 2 * content_padding - 2 * border_width;
-
- if (gtk_widget_get_visible (priv->sidebar_image))
- {
- GtkAllocation sidebar_image_allocation;
-
- gtk_widget_get_allocation (priv->sidebar_image, &sidebar_image_allocation);
-
- if (!rtl)
- content_x += sidebar_image_allocation.width;
- content_width -= sidebar_image_allocation.width;
- }
-
- gdk_cairo_set_source_color (cr, &style->bg[GTK_STATE_NORMAL]);
-
- cairo_rectangle (cr,
- content_x,
- header_image_allocation.height + content_padding + 2 * header_padding + border_width,
- content_width,
- allocation.height - 2 * border_width - action_area_allocation.height -
- header_image_allocation.height - 2 * content_padding - 2 * header_padding - ACTION_AREA_SPACING);
- cairo_fill (cr);
-}
-
-static gboolean
-gtk_assistant_draw (GtkWidget *widget,
- cairo_t *cr)
-{
- GtkAssistant *assistant = GTK_ASSISTANT (widget);
- GtkAssistantPrivate *priv = assistant->priv;
- GtkContainer *container = GTK_CONTAINER (widget);
-
- if (GTK_WIDGET_CLASS (gtk_assistant_parent_class)->draw)
- GTK_WIDGET_CLASS (gtk_assistant_parent_class)->draw (widget, cr);
-
- assistant_paint_colored_box (widget, cr);
-
- gtk_container_propagate_draw (container, priv->header_image, cr);
- gtk_container_propagate_draw (container, priv->sidebar_image, cr);
- gtk_container_propagate_draw (container, priv->action_area, cr);
-
- if (priv->current_page)
- {
- gtk_container_propagate_draw (container, priv->current_page->page, cr);
- gtk_container_propagate_draw (container, priv->current_page->title, cr);
- }
-
- return FALSE;
-}
-
-static gboolean
-gtk_assistant_focus (GtkWidget *widget,
- GtkDirectionType direction)
-{
- GtkAssistantPrivate *priv;
- GtkContainer *container;
-
- container = GTK_CONTAINER (widget);
- priv = GTK_ASSISTANT (widget)->priv;
-
- /* we only have to care about 2 widgets, action area and the current page */
- if (gtk_container_get_focus_child (container) == priv->action_area)
- {
- if (!gtk_widget_child_focus (priv->action_area, direction) &&
- (priv->current_page == NULL ||
- !gtk_widget_child_focus (priv->current_page->page, direction)))
- {
- /* if we're leaving the action area and the current page hasn't
- any focusable widget, clear focus and go back to the action area */
- gtk_container_set_focus_child (GTK_CONTAINER (priv->action_area), NULL);
- gtk_widget_child_focus (priv->action_area, direction);
- }
- }
- else
- {
- if ((priv->current_page == NULL ||
- !gtk_widget_child_focus (priv->current_page->page, direction)) &&
- !gtk_widget_child_focus (priv->action_area, direction))
- {
- /* if we're leaving the current page and there isn't nothing focusable
- in the action area, try to clear focus and go back to the page */
- gtk_window_set_focus (GTK_WINDOW (widget), NULL);
- if (priv->current_page != NULL)
- gtk_widget_child_focus (priv->current_page->page, direction);
- }
- }
-
- return TRUE;
-}
-