Matthias Clasen
eb5c76210e
gridview: Revise constructors
...
Make both gtk_grid_view_new and gtk_grid_view_new_with_factory
take a model as first argument, and make all arguments
allow-none and transfer full.
Update all callers.
2020-07-26 18:50:50 -04:00
Matthias Clasen
2ff3e3d1e4
gtk: Improve struct packing in places
...
Plug some holes in our structs by rearranging
a few fields. This is was done looking at
pahole output.
2020-07-25 11:57:37 -04:00
Matthias Clasen
353d4d161c
Cosmetic docs change
2020-07-16 22:08:15 -04:00
Timm Bäder
f1b010af66
Add .view to view widgets
2020-06-27 10:51:06 +02:00
Benjamin Otte
a5949960bc
listbase: Compute rubberband region on-demand
...
Instead of storing the active items as we go, compute the affected items
whenever the rubberband changes and in particular when the rubberband
ends.
That way, the rubberband is guaranteed to select a rectangle even
after scrolling very far.
This is achieved by having a get_items_in_rect() vfunc that selects all
the items in the rubberbanded rectangle and returns them as a bitset.
2020-06-26 07:13:32 +02:00
Benjamin Otte
ec4a489093
listview: Allocate rubberband at end of size_allocate()
...
Otherwise the rubberband uses the wrong scroll offsets.
2020-06-26 07:13:32 +02:00
Benjamin Otte
c2b0330c56
listbase: Move a common function from the children into GtkListBase
...
We want to use it for the rubberband later.
2020-06-26 07:13:32 +02:00
Matthias Clasen
2842030e59
gridview: Don't assert on a condition that can happen
...
We are currently not robust against model changes or
widget invalidations, so we can actually end up in
situations where we run out of items here. Handle
the failure a bit more gracefully, by returning NULL.
This is good enough to make scrolling work okish most
of the time. We still need a proper fix to handle
other situations.
2020-06-20 12:11:59 -04:00
Benjamin Otte
7c2d21892f
gridview: Compute right amount of items to skip
...
We only want to skip the remaining items in the current row, not since
the start of the widget.
2020-06-20 12:08:46 -04:00
Matthias Clasen
ed985640e8
docs: Expand list widget docs
...
Begin to flesh out the long descriptions for GtkListView,
GtkGridView and GtkColumnView.
2020-06-04 15:33:53 -04:00
Matthias Clasen
51c6ce1734
list widgets: Document css structure
...
We didn't fill in this expected part of the widget
documentation yet.
2020-06-04 10:05:17 -04:00
Matthias Clasen
f9287941b4
Change css names of list widget
...
The new names are
GtkListView - listview row
GtkGridView - gridview child
GtkColumView - columnview header
columnview listview row
Adwaita css has been updated to preserve
existing styles.
Fixes : #2818
2020-06-04 09:51:49 -04:00
Matthias Clasen
03c2202942
Add rubberband api
...
Add an ::enable-rubberband property to GtkListView,
GtkGridView and GtkColumnView.
2020-06-03 13:34:27 -04:00
Matthias Clasen
14d11ebcab
listbase: Use a widget for the rubberband
...
We no longer need to juggle manual css nodes. Just create
a widget for the rubberband, and update its allocation
as we rubberband.
2020-06-03 13:32:57 -04:00
Matthias Clasen
f611d55f16
Spread single-click-activate api
...
This makes sense to have in all the views,
not just GtkListView.
2020-05-30 19:30:14 -04:00
Benjamin Otte
e46fa81927
listbase: Take over anchor handling
...
With that, pretty much all code but allocating the widgets is gone from
the gridview and listview.
2020-05-30 19:26:46 -04:00
Benjamin Otte
33c6b428f7
listbase: Add vfuncs to convert positions to/from coordinates
...
... and use that to implement PageUp/PageDown.
With that, all keyboard handling has been moved to GtkListBase.
2020-05-30 19:26:46 -04:00
Benjamin Otte
12331e3376
listbase: Move focus moving keybindings here
...
The focus tracker is not yet moved because that depends on scroll_to()
support and we don't have that yet.
Whoops.
So we use a hack.
2020-05-30 19:26:46 -04:00
Benjamin Otte
2541037ec2
listbase: Move orientable implementation here
2020-05-30 19:26:46 -04:00
Benjamin Otte
9d6aa7d88e
listbase: Move selection handling here
2020-05-30 19:26:46 -04:00
Benjamin Otte
0bd16308d6
listbase: Move item manager here
...
Nothing really changes, because both ListView and GridView still keep
self->item_manager around, but it's set up to point at the base's item
manager.
This way we can slowly move things to GtkListBase that need the item
manager (like trackers).
2020-05-30 19:26:46 -04:00
Benjamin Otte
0011ce949c
listbase: Move GtkScrollable implementation
...
Shared code between GtkGridView and GtkListView.
2020-05-30 19:26:46 -04:00
Benjamin Otte
cc987b31ae
Add GtkListBase
...
This is a base item for GTK's list widgets so they can share some (read:
hopefully a lot of) code.
2020-05-30 19:26:46 -04:00
Benjamin Otte
c092d0a616
gridview: Simplify allocation code
...
It doesn't fix the bug I'm after, but it looks a lot better.
2020-05-30 19:26:46 -04:00
Benjamin Otte
f57afe51af
gridview: Add move keybindings
2020-05-30 19:26:46 -04:00
Benjamin Otte
bc22d04737
gridview: Implement (un)select all
...
Adds listitem.select-all and listitem.unselect-all actions and installs
the same keybindings as the treeview for those actions.
2020-05-30 19:26:46 -04:00
Benjamin Otte
093677b0f8
gridview: Add a focus tracker
...
... and use that to properly update selections when moving around with
the arrow keys.
2020-05-30 19:26:46 -04:00
Benjamin Otte
c38e050cc7
gridview: Implement list.scroll-to action
2020-05-30 19:26:46 -04:00
Benjamin Otte
ba0122fd02
gridview: Add activation
2020-05-30 19:26:46 -04:00
Benjamin Otte
affd2737d5
gridview: Implement minimum row height
...
We only allocate a certain amount of widgets - and we don't want to run
out of them. So we make all widgets high enough for this to never
happen.
2020-05-30 19:26:46 -04:00
Benjamin Otte
cc68073af0
gridview: Implement the list.select-item action
2020-05-30 19:26:46 -04:00
Benjamin Otte
1b105cdbef
gridview: Implement anchors and scrolling
2020-05-30 19:26:45 -04:00
Benjamin Otte
ea93e18081
gridview: Actually do something
...
Implement measuring and allocating items - which makes the items appear
when drawing and allows interacting with the items.
However, the gridview still does not allow any user interaction
(including scrolling).
2020-05-30 19:26:45 -04:00
Benjamin Otte
443e44853a
listview: Pass the CSS name of listitems to the manager
...
... instead of hardcoding "row".
2020-05-30 19:26:45 -04:00
Benjamin Otte
b73e95655d
gridview: Implement GtkOrientable
...
Again, this is just the skeleton, because the Gridview does nothing yet.
2020-05-30 19:26:45 -04:00
Benjamin Otte
e8bb84e0e2
gridview: Add factory handling
...
Just copy the listview APIs.
Code still doesn't do anything with it.
2020-05-30 19:26:45 -04:00
Benjamin Otte
368f04e06b
gridview: Implement GtkScrollable
...
We can now scroll all the nothing we display.
We also clip it properly.
2020-05-30 19:26:45 -04:00
Benjamin Otte
86a75abe51
gridview: Add API for setting number of columns
...
The API isn't used yet.
2020-05-30 19:26:45 -04:00
Benjamin Otte
70aaecc937
gtk: Add a GtkGridView skeleton
2020-05-30 19:26:45 -04:00