Commit Graph

32 Commits

Author SHA1 Message Date
Corey Berla
c541de3e05 list: Remove active state handling in listitemwidget and treeexpander
Active state is handled by main now.  It appears that listitem and
treeexpander handled it manually (probably before main did).  This
is unnecessary now, so let's remove it.
2022-11-30 10:48:14 -08:00
Corey Berla
fdfd76774e treeexpander: Scroll to expanded item
If the anchor is below the expanded item, the expanded item will
go out of view if there are sufficient children items.  This is not
ideal, so make sure to scroll to the item to ensure it remains in
view.
2022-11-30 09:43:20 -08:00
Corey Berla
847b3261fc treeexpander: Toggle expand on release instead of pressed
With the introduction of the hide-expander property, I noticed that
the active state would persist in many cases because the release
signal was never emitted.  In gtk3 tree expanders, expanded
on release.  gtk4 expanded on press to match window explorer.
Per irc chat, the designers didn't have a strong preference
for press or release.  In order to keep consistency and
fix this bug, let's move back to release.
2022-11-30 09:41:18 -08:00
Corey Berla
63a655e345 treeexpander: Fix typo and GestureClick type
"canceled" should be "cancelled".  Also, "cancel" is a signal on
GtkGesture.
2022-11-29 20:52:46 -08:00
Emmanuele Bassi
9bce5f0462 docs: Fix property cross-links in GtkTreeExpander 2022-11-29 13:49:35 +00:00
Corey Berla
72bc97fff5 treeexpander: Minor formatting changes 2022-11-27 19:39:20 -08:00
Corey Berla
648b38761c treeexpander: Add indent-for-depth property
When set to TRUE, indent-for-depth indents each level of
depth with an additional indent
2022-11-27 19:36:20 -08:00
Corey Berla
2b578a24e4 treeexpander: Add hide-expander property
When set to TRUE hide-expander hides the expander icon in a
GtkTreeListRow.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4969
2022-11-27 19:36:11 -08:00
Matthias Clasen
e499a09759 Drop gtkintl.h
Include gtkprivate.h for I_() and glib-i18n.h for
gettext macros.
2022-09-24 10:03:37 -04:00
Sophie Herold
a546ae32d7 Remove all nicks and blurbs from param specs
Those property features don't seem to be in use anywhere.
They are redundant since the docs cover the same information
and more. They also created unnecessary translation work.

Closes #4904
2022-05-11 18:16:29 +02:00
Jan Lukas Gernert
318160d836 GtkTreeExpander: claim expander-icon gestures
Claim the pressed, released and canceled gestures
meant for the expander-icon of the TreeExpander.
This avoids selecting the row when expanding or collapsing it.

Closes #4199
2021-08-25 17:50:12 +02:00
Jan Lukas Gernert
1cb17d8613 GtkTreeExpander: indent-for-icon property
A property to determine if the TreeExpander should indent the child
by the width of an expander-icon when it is not expandable.

Closes #4175
2021-08-23 07:54:45 +02:00
Matthias Clasen
19b534f7de Avoid copying static debug strings
The g_source_set_name calls were showing up as a
major source of strdups in our profiles. Avoid that
by using new GLib api when available.
2021-07-28 22:42:46 -04:00
Matthias Clasen
825ffb9422 Merge branch 'ebassi/issue-3892' into 'master'
a11y: Update the level property for tree expanders

Closes #3892

See merge request GNOME/gtk!3470
2021-06-07 18:10:12 +00:00
Matthias Clasen
eb61f0fc63 treeexpander: Use focusable where we mean it
This does not fix keyboard activation for tree expanders,
but it is more correct than using can-focus.
2021-05-23 11:20:00 -04:00
Matthias Clasen
4a0d3d7acc docs: Reduce redundancy
Remove a boatload of "or %NULL" from nullable parameters
and return values. gi-docgen generates suitable text from
the annotation that we don't need to duplicate.

This adds a few missing nullable annotations too.
2021-05-20 20:45:06 -04:00
Emmanuele Bassi
8789e78796 a11y: Update the level property for tree expanders
We already have the depth of a tree expander in order to compute the
indentation.

Fixes: #3892
2021-04-22 14:40:35 +01:00
Emmanuele Bassi
b24fedda49 a11y: Update the labelled-by relation of GtkTreeExpander
Whenever we change the :child property, we need to update the
labelled-by relation.
2021-04-21 11:43:16 +01:00
Emmanuele Bassi
57cc2c4918 a11y: Set state on the GtkTreeExpander widget
Instead of setting it on its internal child.
2021-04-21 11:43:11 +01:00
Matthias Clasen
d0b1e2f7de treeexpander: Convert docs 2021-03-11 16:37:37 +00:00
Emmanuele Bassi
0c8de4e561 Fix transfer of GtkTreeExpander.get_item()
We return a full reference to the item.

Fixes: #3428
2020-12-02 19:10:13 +00:00
Emmanuele Bassi
4f12df5f1c Annotate the return type for GtkTreeExpander.get_item()
We use gpointer for C convenience, but the returned value is really a
GObject.
2020-11-17 13:54:22 +00:00
Emmanuele Bassi
0d7fcdda28 a11y: Add more accessible data to GtkTreeExpander
Document the role of the GtkTreeExpander, and the behaviour of the
expander button.

Additionally, improve the label of the expander button, by adding a
fixed "Expand" label, and setting the "labelled-by" relation to the
child of the GtkTreeExpander.
2020-11-12 21:46:06 +00:00
Emmanuele Bassi
c5dc0e2e4c a11y: Use proper role and state for tree expander image
The "expander" image is a button, and it controls the expansion of the
row, so it has a state associated to it that we must update.
2020-11-05 13:46:43 +00:00
Emmanuele Bassi
88116712f6 a11y: Use "presentation" role instead of "hidden" state
The intended use case of the "presentation" role is

| […] when an element is used to change the look of the page but does not
| have all the functional, interactive, or structural relevance implied
| by the element type, or may be used to provide for an accessible
| fallback in older browsers that do not support WAI-ARIA.

One of the examples is, literally:

| An element whose content is completely presentational (like a spacer
| image, decorative graphic, or clearing element);

Which fits perfectly for the GtkTreeExpander's "indent" builtin icon
widget.
2020-11-05 13:25:53 +00:00
Emmanuele Bassi
1dde54b872 a11y: Hide the "indent" in GtkTreeExpander
It's just padding.
2020-11-04 19:38:14 +00:00
Björn Daase
6315cd977c *: Fix spelling mistakes found by codespell 2020-08-21 15:29:34 +02:00
Matthias Clasen
125ea5ee4a treeexpander: Be focusable
We need to be focusable so that we can take focus
if the child doesn't.
2020-07-13 15:06:35 -04:00
Matthias Clasen
9555e611e1 treeexpander: Auto-expand during DND
When hovering over a tree expander during DND,
expand the tree after a timeout. This matches
the behavior of GtkTreeView and GtkExpander.
2020-06-19 15:26:47 -04:00
Benjamin Otte
1dbd017766 treeexpander: Implement input support
This implements all the keybindings from GtkTreeView that can be
supported.

It does not implement expand-all, because supporting that means
causing the TreeListModel to emit lots of create_model vfuncs which in
turn would cause many items-changed signal which in turn would cause
many signal handlers to run which in turn would make "expand-all" very
reentrant, and I'm uneasy about supporting that.

For the mouse, just add a click gesture to the expander icon that toggles
expanded state.
2020-05-30 19:26:45 -04:00
Benjamin Otte
d7b5966fa7 inspector: Make the recorder node list use a ListView
It's quite a bit faster now, but the code is also a bit more awkward.

Pain points:

- GtkTreeListModel cannot be created in UI files because it needs
  a CreateModelFunc.
  Using a signal for this doesn't work because autoexpand wants to
  expand the model before the signal handler is connected.

- The list item factory usage is still awkward. It's bearable here
  because the list items are very simple, but still.
2020-05-30 19:26:45 -04:00
Benjamin Otte
7451e51619 Add GtkTreeExpander
This is a container widget that takes over all the duties of tree
expanding and collapsing.
It has to be a container so it can capture keybindings while focus is
inside the listitem.

So far, this widget does not allow interacting with it, but it shows the
expander arrow in its correct state.

Also, testlistview uses this widget now instead of implementing
expanding itself.
2020-05-30 19:26:45 -04:00