widget: Make _gtk_set_simple_clip() take an optional content clip

This commit is contained in:
Benjamin Otte 2014-08-20 23:49:00 +02:00
parent e643ddfd16
commit b5a8b7ef3b
14 changed files with 23 additions and 16 deletions

View File

@ -803,7 +803,7 @@ gtk_box_size_allocate_no_center (GtkWidget *widget,
}
}
_gtk_widget_set_simple_clip (widget);
_gtk_widget_set_simple_clip (widget, NULL);
}
static void
@ -1172,7 +1172,7 @@ gtk_box_size_allocate_with_center (GtkWidget *widget,
}
gtk_widget_size_allocate_with_baseline (priv->center->widget, &child_allocation, baseline);
_gtk_widget_set_simple_clip (widget);
_gtk_widget_set_simple_clip (widget, NULL);
}
static void

View File

@ -1773,7 +1773,7 @@ gtk_button_size_allocate (GtkWidget *widget,
gtk_widget_size_allocate_with_baseline (child, &child_allocation, baseline);
}
_gtk_widget_set_simple_clip (widget);
_gtk_widget_set_simple_clip (widget, NULL);
}
static gboolean

View File

@ -645,7 +645,7 @@ swatch_size_allocate (GtkWidget *widget,
allocation->width,
allocation->height);
_gtk_widget_set_simple_clip (widget);
_gtk_widget_set_simple_clip (widget, NULL);
}
static gboolean

View File

@ -2768,7 +2768,7 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
gtk_widget_size_allocate (child_widget, &child);
}
_gtk_widget_set_simple_clip (widget);
_gtk_widget_set_simple_clip (widget, NULL);
}
#undef GTK_COMBO_BOX_ALLOCATE_BUTTON

View File

@ -3715,7 +3715,7 @@ gtk_entry_size_allocate (GtkWidget *widget,
_gtk_entry_completion_resize_popup (completion);
}
_gtk_widget_set_simple_clip (widget);
_gtk_widget_set_simple_clip (widget, NULL);
}
static gboolean

View File

@ -1681,7 +1681,7 @@ gtk_grid_size_allocate (GtkWidget *widget,
gtk_grid_request_allocate_children (&request);
_gtk_widget_set_simple_clip (widget);
_gtk_widget_set_simple_clip (widget, NULL);
}
static gboolean

View File

@ -581,7 +581,7 @@ gtk_level_bar_size_allocate (GtkWidget *widget,
{
GTK_WIDGET_CLASS (gtk_level_bar_parent_class)->size_allocate (widget, allocation);
_gtk_widget_set_simple_clip (widget);
_gtk_widget_set_simple_clip (widget, NULL);
}
static void

View File

@ -3137,7 +3137,7 @@ gtk_list_box_row_size_allocate (GtkWidget *widget,
gtk_widget_size_allocate (child, &child_allocation);
}
_gtk_widget_set_simple_clip (widget);
_gtk_widget_set_simple_clip (widget, NULL);
}
/**

View File

@ -551,7 +551,7 @@ gtk_path_bar_size_allocate (GtkWidget *widget,
/* No path is set; we don't have to allocate anything. */
if (path_bar->priv->button_list == NULL)
{
_gtk_widget_set_simple_clip (widget);
_gtk_widget_set_simple_clip (widget, NULL);
return;
}
@ -773,7 +773,7 @@ gtk_path_bar_size_allocate (GtkWidget *widget,
if (needs_reorder)
child_ordering_changed (path_bar);
_gtk_widget_set_simple_clip (widget);
_gtk_widget_set_simple_clip (widget, NULL);
}
static void

View File

@ -450,7 +450,7 @@ gtk_progress_bar_size_allocate (GtkWidget *widget,
{
GTK_WIDGET_CLASS (gtk_progress_bar_parent_class)->size_allocate (widget, allocation);
_gtk_widget_set_simple_clip (widget);
_gtk_widget_set_simple_clip (widget, NULL);
}
static void

View File

@ -480,7 +480,7 @@ gtk_switch_size_allocate (GtkWidget *widget,
else
priv->handle_x = 0;
_gtk_widget_set_simple_clip (widget);
_gtk_widget_set_simple_clip (widget, NULL);
}
static void

View File

@ -1835,7 +1835,7 @@ gtk_toolbar_size_allocate (GtkWidget *widget,
g_free (allocations);
g_free (new_states);
_gtk_widget_set_simple_clip (widget);
_gtk_widget_set_simple_clip (widget, NULL);
}
static void

View File

@ -15548,6 +15548,8 @@ union_with_clip (GtkWidget *widget,
/*
* _gtk_widget_set_simple_clip:
* @widget: a #GtkWidget
* @content_clip: Clipping area of the contents or %NULL, if the contents
* do not extent the allocation.
*
* This is a convenience function for gtk_widget_set_clip(), if you
* just want to set the clip for @widget based on its allocation,
@ -15562,7 +15564,8 @@ union_with_clip (GtkWidget *widget,
* function and must call gtk_widget_set_clip() yourself.
**/
void
_gtk_widget_set_simple_clip (GtkWidget *widget)
_gtk_widget_set_simple_clip (GtkWidget *widget,
GtkAllocation *content_clip)
{
GtkStyleContext *context;
GtkAllocation clip;
@ -15580,6 +15583,9 @@ _gtk_widget_set_simple_clip (GtkWidget *widget)
clip.width += extents.left + extents.right;
clip.height += extents.top + extents.bottom;
if (content_clip)
gdk_rectangle_union (content_clip, &clip, &clip);
if (GTK_IS_CONTAINER (widget))
gtk_container_forall (GTK_CONTAINER (widget), union_with_clip, &clip);

View File

@ -134,7 +134,8 @@ GtkStyle * _gtk_widget_get_style (GtkWidget *widget);
void _gtk_widget_set_style (GtkWidget *widget,
GtkStyle *style);
gboolean _gtk_widget_supports_clip (GtkWidget *widget);
void _gtk_widget_set_simple_clip (GtkWidget *widget);
void _gtk_widget_set_simple_clip (GtkWidget *widget,
GtkAllocation *content_clip);
typedef gboolean (*GtkCapturedEventHandler) (GtkWidget *widget, GdkEvent *event);