Commit Graph

59799 Commits

Author SHA1 Message Date
Matthias Clasen
54ded2a284 column view column: Add a sorter property
This will be used to implement sort by header click.
2019-12-09 00:03:48 -05:00
Matthias Clasen
fdcc452fd6 column view: Add a sorter property
The sorter is where the column view combines the sorters of
individual columns, as the user clicks on headers. To make
sorting take effect, the sorter needs to be associated with
a sort model underneath the model thats shown in the view.
2019-12-09 00:03:48 -05:00
Matthias Clasen
376bf3789b Add 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 - whenever
a header is clicked, that columns 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.
2019-12-09 00:03:48 -05:00
Matthias Clasen
0e59cc5e22 column view: Add some helpers
These functions will be used in updating sort indicators
in column headers.
2019-12-09 00:03:48 -05:00
Matthias Clasen
3f4b8d269e Redo sort list model with GtkSorter
Reshuffle the api to take full advantage
of GtkSorter. Update all callers.
2019-12-09 00:03:48 -05:00
Matthias Clasen
4471171a6a sorter: Add tests
Some basic tests for GtkSorter.
2019-12-09 00:03:48 -05:00
Matthias Clasen
93e2e5e171 Add GtkNumericSorter
This sorter compares numbers obtained from items
by evaluating an expression.
2019-12-09 00:03:48 -05:00
Matthias Clasen
a55d300357 Add GtkMultiSorter
This is a sorter that tries multiple sorters in turn.
2019-12-09 00:03:48 -05:00
Matthias Clasen
3c409a61fd Add GtkSorter, GtkStringSorter, GtkCustomSorter
This is a helper object for sorting. Also add
two implementations, GtkStringSorter for collating
strings, and GtkCustomSorter, which uses a GCompareDataFunc.
2019-12-09 00:03:48 -05:00
Matthias Clasen
59a6a3e056 list item factory: Small correction
The vfuncs for signals in GtkSignalListItemFactory
had the wrong 'this' type.
2019-12-09 00:03:44 -05:00
Matthias Clasen
e1ab8db88d filter: Add a missing precondition 2019-12-08 14:00:11 -05:00
Matthias Clasen
08beaa6448 filter: Small doc tweaks 2019-12-08 13:56:15 -05:00
Matthias Clasen
65ef4b6bc8 filter: Update tests 2019-12-08 13:56:15 -05:00
Matthias Clasen
dea0397e63 Add missing listmodel and selection types to the docs 2019-12-08 13:56:15 -05:00
Benjamin Otte
c246671634 xxx: WIP fontchooser conversion
It compiles, and no longer crashes insantly. But more work needed.

These changes depend on Pango 1.46's introduction of listmodels, so we
depend on that now.
2019-12-08 06:27:40 +01:00
Benjamin Otte
98c25a449d expression: Allow passing a this object to bind()
This gives a bit more control over the arguments passed to expressions.
2019-12-08 06:27:40 +01:00
Benjamin Otte
71fd74c88f widget: Do parent_class handling properly
The previous cosde did not actually query the parent class, it just did
a very complicated C cast.
2019-12-08 06:27:40 +01:00
Benjamin Otte
8efe92ec69 gtk-demo: Add a Clocks demo
This demo is meant to showcase expressions.

It also needs the fixes in glib 2.64 to work properly.
2019-12-08 06:27:40 +01:00
Benjamin Otte
2f10212e7d xxx: Add a hack to make paintables transform to/from objects
See also: https://gitlab.gnome.org/GNOME/glib/merge_requests/1251
2019-12-08 06:27:40 +01:00
Benjamin Otte
13eb49c525 inspector: Remove private struct for prop editor 2019-12-08 06:27:39 +01:00
Benjamin Otte
531dc407e3 inspector: Make Controller page a GtkWidget 2019-12-08 06:27:39 +01:00
Benjamin Otte
fddd7c9fad inspector: Remove private struct from controllers 2019-12-08 06:27:39 +01:00
Benjamin Otte
1cbfdddb76 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.
2019-12-08 06:27:39 +01:00
Benjamin Otte
24df6869a3 tests: Add testcolumnview 2019-12-08 06:27:39 +01:00
Benjamin Otte
ffbc361c30 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.
2019-12-08 06:27:39 +01:00
Benjamin Otte
48f44e87ab constraint-editor: Don't poke around in widget internals 2019-12-08 06:27:39 +01:00
Benjamin Otte
6ed9df3058 columnview: Fix styling with Adwaita
- Use "treeview" as the node name
- Add .view style class
2019-12-08 06:27:39 +01:00
Benjamin Otte
47ee4bc223 inspector: Port object tree to GtkColumnView 2019-12-08 06:27:39 +01:00
Benjamin Otte
02096df981 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.
2019-12-08 06:27:39 +01:00
Benjamin Otte
63afc41eb8 widget: Add a hook for resizes
It's private, no APIs, we don't talk about it. But we will start using
it very soon, so we can do size request caching in columns and avoid
sizegroups...
2019-12-08 06:27:39 +01:00
Benjamin Otte
5822d13763 columnview: Implement GtkScrollable
Just forward it to the listview for now.
2019-12-08 06:27:39 +01:00
Benjamin Otte
55018bc21a columnview: Add listitems for the columns
They are not aligned in columns yet, but they do exist.
2019-12-08 06:27:39 +01:00
Benjamin Otte
78e055c080 listitemwidget: Lazily create listitems
We only create them in root/unroot (they should be created in
appear/disappear, but that vfunc doesn't exist yet), that way we can
avoid expensive work while the widget isn't used for anything.
2019-12-08 06:27:39 +01:00
Benjamin Otte
77b7c56de2 listitem: Move position/item/selected tracking to widget
This way, we can ensure it's always there when we need it (before the
item gets created) and gone when we don't (if some GC language holds on
to the item after we've destroyed the widget).
2019-12-08 06:27:39 +01:00
Benjamin Otte
804e253f80 listitemwidget: Add a private struct
I had to rename the item property to list_item anyway, so I could just
do the next step with it.
2019-12-08 06:27:39 +01:00
Benjamin Otte
534fda92fa listitemfactory: Simplify
Instead of 6 vfuncs, we now have 3 and rely on the factory keeping track
of what it needs to do.

We're doing lots of dancing from one object to another here, but this
will hopefully get simpler with further commits.
2019-12-08 06:27:39 +01:00
Benjamin Otte
0c1336f959 listitemfactory: Reorganize vfuncs
Instead of bind/rebind/update/unbind, we now just have update, and the
factories get to interpret that in the way they want.
2019-12-08 06:27:39 +01:00
Benjamin Otte
093c37a046 listitem: Make this a GObject
This splits GtkListItem into 2 parts:

1. GtkListItem
   This is purely a GObject with public API for developers who want to
   populate lists. There is no chance to cause conflict with GtkWidget
   properties that the list implementation assumed control over and
   defines a clear boundary.
2. GtkListItemWidget
   The widget part of the listitem. This is not only fully in control of
   the list machinery, the machinery can also use different widget
   implementations for different list widgets like I inted to for
   GtkColumnView.
2019-12-08 06:27:39 +01:00
Benjamin Otte
567548c11d builder: Make gtk_builder_extend_with_template() work with objects
This will be relevant later when we introduce GtkListItem which is not a
GtkWidget.
2019-12-08 06:27:39 +01:00
Benjamin Otte
b4a6262b70 gtk-demo: Add a Coverflow application launcher
This is roughly the simplest demo I could come up with.

But I documented it, so there's your tutorial.

Related: #2214
2019-12-08 06:27:39 +01:00
Benjamin Otte
81264fa7ad Add GtkSignalListItemFactory
So the poor Rust users can actually use this.

I would totally not use this ever!
2019-12-08 06:27:39 +01:00
Benjamin Otte
002fafc160 columnview: Allow adding/removing columns
... and make that work in UI files via <child>, too.
2019-12-08 06:27:39 +01:00
Benjamin Otte
4c7d053db9 gtk-demo: Add a minesweeper demo
The demo shows creating ones own listmodel and using it to fill a grid.

I am totally getting the hang of React btw:
500 lines of logic with no UI code and 100 lines of GtkBuilder XML and
I get a sweet UI.
2019-12-08 06:27:39 +01:00
Benjamin Otte
2b3f716ec3 Add GtkColumnView skeleton
It's just a copy/paste of the listview code with all the internals
gutted. The code doesn't do anything.
2019-12-08 06:27:39 +01:00
Benjamin Otte
a11c5e7741 wip: Add GtkCoverFlow
The widget mostly works out of the box, but some tweaking may be
necessary (in particular in the theme) and the gtk-demo changes might
require removing before this is production-ready.
2019-12-08 06:27:39 +01:00
Benjamin Otte
35c177bae9 listbase: Take over anchor handling
With that, pretty much all code but allocating the widgets is gone from
the gridview and listview.
2019-12-08 06:27:39 +01:00
Benjamin Otte
c25dc91fab 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.
2019-12-08 06:27:39 +01:00
Benjamin Otte
52194f94dd 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.
2019-12-08 06:27:39 +01:00
Benjamin Otte
87ae1d94df Remove gtk_selection_model_user_select_item() again
This reverts commit 6a164ab306dad9096bde736c907494c71086d3c4.

The function was awkward and we now have only one caller again, so we
can fold it back into it.
2019-12-08 06:27:39 +01:00
Benjamin Otte
1717d30416 listbase: Move orientable implementation here 2019-12-08 06:27:39 +01:00