diff options
author | Benjamin Otte <otte@redhat.com> | 2023-03-02 03:53:56 +0100 |
---|---|---|
committer | Benjamin Otte <otte.benjamin@googlemail.com> | 2023-03-05 15:23:20 +0000 |
commit | d949afb80e3e80dfb798d49d7927df14f87258de (patch) | |
tree | 7fe92fb2fc59a575fa60a6d879260538448c1894 /gtk/gtklistbaseprivate.h | |
parent | 08c583b1b331bd0263c5f9360ce3848aa56f54c5 (diff) | |
download | gtk+-d949afb80e3e80dfb798d49d7927df14f87258de.tar.gz |
listitemmanager: Add a split vfunc and use it
Instead of randomly changing tiles, the listitemmanager gains a split
vfunc that listview and gridview implement so they can keep their tile
areas intact. The listitemmanager will now conform to these rules:
1. Never delete a tile.
This ensures that all areas stay intact.
2. Never change the n_items of a tile other than setting them to 0.
This causes "empty" areas to appear, but listview/gridview can
easily check for them by checking for tile->n_items == 0.
gtk_list_tile_gc() will get rid of them.
3. Adding items always creates new tiles that are added with empty area.
That way they don't interrupt any existing machinery until the next
allocation.
4. Adding/removing widgets has no effect on areas
This is useful in particular when scrolling where new widgets are
moving between tiles. When the manager moves the widgets, it may
split some areas, but will not remove any existing tiles, so the
whole area stays intact and the list can deal with further scroll
events before an allocation.
This improve the situation for #3334
Diffstat (limited to 'gtk/gtklistbaseprivate.h')
-rw-r--r-- | gtk/gtklistbaseprivate.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gtk/gtklistbaseprivate.h b/gtk/gtklistbaseprivate.h index af70843c40..e6047a758c 100644 --- a/gtk/gtklistbaseprivate.h +++ b/gtk/gtklistbaseprivate.h @@ -37,6 +37,10 @@ struct _GtkListBaseClass const char * list_item_name; GtkAccessibleRole list_item_role; + GtkListTile * (* split) (GtkListBase *self, + GtkListTile *tile, + guint n_items); + void (* adjustment_value_changed) (GtkListBase *self, GtkOrientation orientation); gboolean (* get_allocation_along) (GtkListBase *self, |