Commit Graph

59827 Commits

Author SHA1 Message Date
Matthias Clasen
8be0e358af docs: Add GtkDirectoryList to gtk4.types.in 2019-12-12 18:55:23 -05:00
Benjamin Otte
6856085742 fontchooserwidget: Port to listmodels
The port is kind of evil, in that it stores either a PangoFontFamily or a
PangoFontFace in the list, depending on if the fontchooser is configured
to select fonts or faces.
It also does not cache the font description anymore, so more calls to
pango_font_describe() may happen.

If both of these issues turn out problematic, the fontchooser would need
to resurrect GtkDelayedFontDescription again and put objects of that
type through the model.

These changes depend on Pango 1.46's introduction of listmodels and
various new getters, so the dependency has been upgraded.
2019-12-12 07:47:45 +01:00
Benjamin Otte
f24ae53a06 expression: Allow passing a this object to bind()
This gives a bit more control over the arguments passed to expressions.
2019-12-12 07:47:45 +01:00
Benjamin Otte
3e90537969 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-12 07:47:45 +01:00
Benjamin Otte
75b1804e30 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-12 07:47:45 +01:00
Benjamin Otte
43e6db5c0d xxx: Add a hack to make paintables transform to/from objects
See also: https://gitlab.gnome.org/GNOME/glib/merge_requests/1251
2019-12-12 07:47:45 +01:00
Benjamin Otte
426e13efc6 inspector: Remove private struct for prop editor 2019-12-12 07:47:45 +01:00
Benjamin Otte
3eb8f1ddd3 inspector: Make Controller page a GtkWidget 2019-12-12 07:47:45 +01:00
Benjamin Otte
fed52d2fc6 inspector: Remove private struct from controllers 2019-12-12 07:47:45 +01:00
Benjamin Otte
79e2774d2c 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-12 07:47:45 +01:00
Benjamin Otte
6f92aa0de6 tests: Add testcolumnview 2019-12-12 07:47:44 +01:00
Benjamin Otte
da06abeca1 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-12 07:47:44 +01:00
Benjamin Otte
f59f1f6af2 constraint-editor: Don't poke around in widget internals 2019-12-12 07:47:44 +01:00
Benjamin Otte
adee03adac columnview: Fix styling with Adwaita
- Use "treeview" as the node name
- Add .view style class
2019-12-12 07:47:44 +01:00
Benjamin Otte
3da5c972de inspector: Port object tree to GtkColumnView 2019-12-12 07:47:44 +01:00
Benjamin Otte
250d3db4f4 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-12 07:47:44 +01:00
Benjamin Otte
7baa3ce14d 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-12 07:47:44 +01:00
Benjamin Otte
914a7fe871 columnview: Implement GtkScrollable
Just forward it to the listview for now.
2019-12-12 07:47:44 +01:00
Benjamin Otte
798dded3c3 columnview: Add listitems for the columns
They are not aligned in columns yet, but they do exist.
2019-12-12 07:47:44 +01:00
Benjamin Otte
3ccfd3fb61 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-12 07:47:44 +01:00
Benjamin Otte
2b6bfc48f9 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-12 07:47:44 +01:00
Benjamin Otte
beb70382b2 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-12 07:47:44 +01:00
Benjamin Otte
36c695513b 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-12 07:47:44 +01:00
Benjamin Otte
14f117a974 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-12 07:47:44 +01:00
Benjamin Otte
aa6f1e0505 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-12 07:47:44 +01:00
Benjamin Otte
abb2db33e7 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-12 07:47:44 +01:00
Benjamin Otte
7a0af35491 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-12 07:47:44 +01:00
Benjamin Otte
e0573c5859 Add GtkSignalListItemFactory
So the poor Rust users can actually use this.

I would totally not use this ever!
2019-12-12 07:47:44 +01:00
Benjamin Otte
9427fc2660 columnview: Allow adding/removing columns
... and make that work in UI files via <child>, too.
2019-12-12 07:47:44 +01:00
Benjamin Otte
4ec11dd5fa 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-12 07:47:44 +01:00
Benjamin Otte
2334858a00 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-12 07:47:44 +01:00
Benjamin Otte
5d6e2144e7 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-12 07:47:44 +01:00
Benjamin Otte
84ef6ae62b listbase: Take over anchor handling
With that, pretty much all code but allocating the widgets is gone from
the gridview and listview.
2019-12-12 07:47:44 +01:00
Benjamin Otte
2f3233e62a 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-12 07:47:44 +01:00
Benjamin Otte
df4a5944ce 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-12 07:47:44 +01:00
Benjamin Otte
10ea8705b6 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-12 07:47:44 +01:00
Benjamin Otte
73e5bdb818 listbase: Move orientable implementation here 2019-12-12 07:47:44 +01:00
Benjamin Otte
236c2a7d51 listbase: Move selection handling here 2019-12-12 07:47:44 +01:00
Benjamin Otte
238b719909 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).
2019-12-12 07:47:44 +01:00
Benjamin Otte
95027800cc listbase: Move GtkScrollable implementation
Shared code between GtkGridView and GtkListView.
2019-12-12 07:47:44 +01:00
Benjamin Otte
114f41ea6a Add GtkListBase
This is a base item for GTK's list widgets so they can share some (read:
hopefully a lot of) code.
2019-12-12 07:47:44 +01:00
Benjamin Otte
3388ad138a gridview: Simplify allocation code
It doesn't fix the bug I'm after, but it looks a lot better.
2019-12-12 07:47:44 +01:00
Benjamin Otte
5838521879 listview: Port various gridview improvements
- Handle anchor as align + top/bottom
  This fixes behavior for cells that are higher than the view
- Add gtk_list_view_adjustment_is_flipped()
  This should fix RTL handling of horizontal lists
- Fix scrolling
  This should make scrolling more reliable, particularly on short lists
  that are only a few pages long.
2019-12-12 07:47:44 +01:00
Benjamin Otte
db7b885f90 demo: Add a file browser demo 2019-12-12 07:47:44 +01:00
Benjamin Otte
6f1572e5d2 gridview: Add move keybindings 2019-12-12 07:47:44 +01:00
Benjamin Otte
1582df5294 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.
2019-12-12 07:47:44 +01:00
Benjamin Otte
5732157dbd gridview: Add a focus tracker
... and use that to properly update selections when moving around with
the arrow keys.
2019-12-12 07:47:44 +01:00
Benjamin Otte
470ce922a0 gridview: Implement list.scroll-to action 2019-12-12 07:47:44 +01:00
Benjamin Otte
e374b5abef gridview: Add activation 2019-12-12 07:47:44 +01:00
Benjamin Otte
f89a7b01ce 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.
2019-12-12 07:47:44 +01:00