diff options
author | Benjamin Otte <otte@redhat.com> | 2023-02-22 23:33:16 +0100 |
---|---|---|
committer | Benjamin Otte <otte.benjamin@googlemail.com> | 2023-03-05 15:23:20 +0000 |
commit | 3ca4acdc1a7ba7f1b018834236f41dbbd5b9d2c0 (patch) | |
tree | bbad1c66edce2c7f1e8dd5f9e77aa54b39ee9c98 /gtk/gtklistitemmanagerprivate.h | |
parent | c705dba2eef98513763835c644f31ec528df5eeb (diff) | |
download | gtk+-3ca4acdc1a7ba7f1b018834236f41dbbd5b9d2c0.tar.gz |
list: Allow storing size in the ListTile
... and use it to handle ListView allocations.
Nothing spectacular, just proof of concept.
The code introduces the idea that every tile stores its area (others
would call it "allocation", but I avoided that because tiles aren't
widgets). This should allow moving lots of code into gtklistbase.c and
not require special handling inside ListView and GridView.
And that in turn hopefully makes it easier to add more features (like
sections and so on.)
Diffstat (limited to 'gtk/gtklistitemmanagerprivate.h')
-rw-r--r-- | gtk/gtklistitemmanagerprivate.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gtk/gtklistitemmanagerprivate.h b/gtk/gtklistitemmanagerprivate.h index d241412e07..37a49ce83d 100644 --- a/gtk/gtklistitemmanagerprivate.h +++ b/gtk/gtklistitemmanagerprivate.h @@ -47,11 +47,15 @@ struct _GtkListTile { GtkWidget *widget; guint n_items; + /* area occupied by tile. May be empty if tile has no allcoation */ + cairo_rectangle_int_t area; }; struct _GtkListTileAugment { guint n_items; + /* union of all areas of tile and children */ + cairo_rectangle_int_t area; }; @@ -81,6 +85,17 @@ guint gtk_list_tile_get_position (GtkListItemMana GtkListTile *tile); gpointer gtk_list_tile_get_augment (GtkListItemManager *self, GtkListTile *tile); +void gtk_list_tile_set_area (GtkListItemManager *self, + GtkListTile *tile, + const cairo_rectangle_int_t *area); +void gtk_list_tile_set_area_position (GtkListItemManager *self, + GtkListTile *tile, + int x, + int y); +void gtk_list_tile_set_area_size (GtkListItemManager *self, + GtkListTile *tile, + int width, + int height); void gtk_list_item_manager_set_factory (GtkListItemManager *self, GtkListItemFactory *factory); |