Commit Graph

69 Commits

Author SHA1 Message Date
Matthias Clasen
c58eb9c276 columnview: Allow to cancel reorder with Escape
The treeview does this too.
2020-06-03 13:31:39 -04:00
Matthias Clasen
5d4893b3f0 columnview: Interactive column reordering
Allow rearranging columns by dragging, in the same
way the treeview does.

We add the "dnd" style class to the header while
it is dragged, and we move the header of the dragged
column to the end of its parents children, so that
it gets drawn on top.
2020-06-03 13:31:39 -04:00
Matthias Clasen
11b4e0d4c0 columnview: Add a GtkColumnView:reorderable property
This property controls if users can reorder columns
by drag-and-drop. It defaults to TRUE.
2020-06-03 13:31:39 -04:00
Matthias Clasen
f65f9591a1 columnview: Interactive column resizing
This copies just enough of the treeview code to
get columns moving.
2020-06-03 12:49:40 -04:00
Matthias Clasen
aa2d339508 columnview: Add a helper
The column code needs to get access to the
listitem widgets that are children of the listview,
so add a getter.
2020-06-03 12:48:56 -04:00
Matthias Clasen
f0a0e20b2f columnview: Implement horizontal scrolling
The listview inside always thinks it gets its full size,
and updates its horizontal adjustment accordingly.

So keep our own adjustment, and update it when allocating.
2020-06-03 12:48:20 -04:00
Matthias Clasen
befdd8bb66 columnview: Revise scroll-minimum handling
Tweak the behavior slightly. We don't show
a scrollbar as long as we have at least
min-size available, but we still give the
entire size to the child, up to nat-size.

This matches how viewports handle scroll-minimum.
2020-06-03 12:48:20 -04:00
Matthias Clasen
c6c8263704 columnview: Add column reordering
Add an API to allow reordering columns.
2020-05-31 21:56:30 -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
Matthias Clasen
2945430ad7 columnview: Add a sort-by api 2020-05-30 19:28:28 -04:00
Matthias Clasen
66500a6882 columnview: Add sorting
This is a somewhat large commit that:

- Adds GtkColumnViewSorter
This is a special-purpose, private sorter implementation which sorts
according to multiple sorters, allowing each individual sorter to be
inverted. This will be used with clickable column view headers.

- Adds a read-only GtkColumnView::sorter property
The GtkColumnView creates a GtkColumnViewSorter at startup that it uses
for this property.

- Adds a writable GtkColumnViewColumn::sorter property
This allows defining per-column sorters. Whenever an application sets a
sorter for a column, the header becomes clickable and whenever
a header is clicked, that column's sorter is prepended to the list of
sorters, unless it is already the first sorter, in which case we invert
its order. No column can be in the list more than once.
2020-05-30 19:26:46 -04:00
Benjamin Otte
efcb3a9d67 columnview: Add header
This uses a custom GtkColumnViewTitle widget. So far that widget is
pretty boring, but that will change once we added
resizing, reordering, dnd, sorting, hiding/showing of columns or
whatever UIs we want.
2020-05-30 19:26:46 -04:00
Benjamin Otte
326cb1148b columnview: Add a custom LayoutManager
The ColumnView now allocates column widths first and then the individual
rows use the new layout manager which looks at the column allocations to
allocate their children.
2020-05-30 19:26:46 -04:00
Benjamin Otte
084725e280 columnview: Fix styling with Adwaita
- Use "treeview" as the node name
- Add .view style class
2020-05-30 19:26:46 -04:00
Benjamin Otte
9927d9bda2 columnview: Add GtkColumnViewCell
It's a GtkListItemWidget subclass that tracks the column it belongs to
and allows the column to track it.

We also use this subclass to implement sizing support so columns share
the same size and get resized in sync.
2020-05-30 19:26:46 -04:00
Benjamin Otte
8af3e407c2 columnview: Implement GtkScrollable
Just forward it to the listview for now.
2020-05-30 19:26:46 -04:00
Benjamin Otte
8736343544 columnview: Add listitems for the columns
They are not aligned in columns yet, but they do exist.
2020-05-30 19:26:46 -04:00
Benjamin Otte
03e5c6e32d columnview: Allow adding/removing columns
... and make that work in UI files via <child>, too.
2020-05-30 19:26:46 -04:00
Benjamin Otte
0e1632d002 Add GtkColumnView skeleton
It's just a copy/paste of the listview code with all the internals
gutted. The code doesn't do anything.
2020-05-30 19:26:46 -04:00