mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-14 06:10:21 +00:00
listitemmanager: Augment header/footer info
This commit is contained in:
parent
e680abc723
commit
8bf6498265
@ -101,11 +101,36 @@ gtk_list_item_manager_augment_node (GtkRbTree *tree,
|
||||
aug->n_items = tile->n_items;
|
||||
aug->area = tile->area;
|
||||
|
||||
switch (tile->type)
|
||||
{
|
||||
case GTK_LIST_TILE_HEADER:
|
||||
case GTK_LIST_TILE_UNMATCHED_HEADER:
|
||||
aug->has_header = TRUE;
|
||||
aug->has_footer = FALSE;
|
||||
break;
|
||||
case GTK_LIST_TILE_FOOTER:
|
||||
case GTK_LIST_TILE_UNMATCHED_FOOTER:
|
||||
aug->has_header = FALSE;
|
||||
aug->has_footer = TRUE;
|
||||
break;
|
||||
case GTK_LIST_TILE_ITEM:
|
||||
case GTK_LIST_TILE_FILLER:
|
||||
case GTK_LIST_TILE_REMOVED:
|
||||
aug->has_header = FALSE;
|
||||
aug->has_footer = FALSE;
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
|
||||
if (left)
|
||||
{
|
||||
GtkListTileAugment *left_aug = gtk_rb_tree_get_augment (tree, left);
|
||||
|
||||
aug->n_items += left_aug->n_items;
|
||||
aug->has_header |= left_aug->has_header;
|
||||
aug->has_footer |= left_aug->has_footer;
|
||||
potentially_empty_rectangle_union (&aug->area, &left_aug->area);
|
||||
}
|
||||
|
||||
@ -114,6 +139,8 @@ gtk_list_item_manager_augment_node (GtkRbTree *tree,
|
||||
GtkListTileAugment *right_aug = gtk_rb_tree_get_augment (tree, right);
|
||||
|
||||
aug->n_items += right_aug->n_items;
|
||||
aug->has_header |= right_aug->has_header;
|
||||
aug->has_footer |= right_aug->has_footer;
|
||||
potentially_empty_rectangle_union (&aug->area, &right_aug->area);
|
||||
}
|
||||
}
|
||||
|
@ -66,6 +66,10 @@ struct _GtkListTile
|
||||
struct _GtkListTileAugment
|
||||
{
|
||||
guint n_items;
|
||||
|
||||
guint has_header :1;
|
||||
guint has_footer :1;
|
||||
|
||||
/* union of all areas of tile and children */
|
||||
cairo_rectangle_int_t area;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user