Commit Graph

296 Commits

Author SHA1 Message Date
Matthias Clasen
07a2b60f45 box: Convert docs
Convert link format, add an example image, add
property annotations. General cleanup.
2021-03-11 16:37:33 +00:00
Matthias Clasen
10d5705b70 Reduce use of GtkStyleContext
Remove some unnecessary uses of GtkStyleContext where
we can directly go to the GtkCssStyle, and and drop
unnnecessary includes.
2021-01-28 12:27:07 -05:00
Timm Bäder
114f0bd8d6 box: Replace tabs with spaces 2021-01-03 11:01:29 +01:00
Yetizone
c4a8c0893b box: improve documentation
Rephrase a function parameter description and remove "." from all function parameters descriptions

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3499
2020-12-21 17:26:23 +02:00
Emmanuele Bassi
08d59d3f68 docs: Add "Accessibility" section to various widgets
There are a few widgets that gained an accessible role, which means
adding an "Accessibility" section in their description.
2020-11-12 00:36:32 +00:00
Emmanuele Bassi
40c0826921 a11y: Mark more containers as structural elements
Widgets that just provide grouping and layout to other widgets should
not be relevant to the accessible tree.
2020-11-11 18:33:15 +00:00
Benjamin Otte
d77902365d box: Remove unnecessary code
gtk_widget_insert_after() reorders CSS nodes properly.
2020-10-20 04:50:12 +02:00
Emmanuele Bassi
c63087a563 Remove ATK
To build a better world sometimes means having to tear the old one down.
        -- Alexander Pierce, "Captain America: The Winter Soldier"

ATK served us well for nearly 20 years, but the world has changed, and
GTK has changed with it. Now ATK is mostly a hindrance towards improving
the accessibility stack:

 - it maps to a very specific implementation, AT-SPI, which is Linux and
   Unix specific
 - it requires implementing the same functionality in three different
   layers of the stack: AT-SPI, ATK, and GTK
 - only GTK uses it; every other Linux and Unix toolkit and application
   talks to AT-SPI directly, including assistive technologies

Sadly, we cannot incrementally port GTK to a new accessibility stack;
since ATK insulates us entirely from the underlying implementation, we
cannot replace it piecemeal. Instead, we're going to remove everything
and then incrementally build on a clean slate:

 - add an "accessible" interface, implemented by GTK objects directly,
   which describe the accessible role and state changes for every UI
   element
 - add an "assistive technology context" to proxy a native accessibility
   API, and assign it to every widget
 - implement the AT context depending on the platform

For more information, see: https://gitlab.gnome.org/GNOME/gtk/-/issues/2833
2020-07-26 20:31:14 +01:00
Benjamin Otte
d375dce9f5 Replace "gchar" with "char" 2020-07-25 00:47:36 +02:00
Benjamin Otte
d7266b25ba Replace "gint" with "int" 2020-07-25 00:47:36 +02:00
Emmanuele Bassi
6e52ef96a4 Move orientable style classes into GtkWidget
It feels slightly wrong to have GtkOrientable operate on widgets, but at
least what happens when an orientable widget changes orientation should
be part of GtkWidget.

This will allow to add more state changes without accessing widget state
from the outside of gtkwidget.c.
2020-06-05 20:35:09 +01:00
Matthias Clasen
5f642f8096 box: Derive from GtkWidget 2020-05-11 22:38:21 -04:00
Matthias Clasen
665edcba53 box: Add gtk_box_append/prepend/remove
Add replacement api for gtk_container_add/remove.
2020-05-11 22:38:21 -04:00
Timm Bäder
2a46d5960d box: Move vfunc implementations before class_init
Just like we do everywhere else. This way we can also get rid of all the
prototypes.
2020-02-07 13:16:32 -05:00
Benjamin Otte
af6128b3ab Remove gtkwidgetpath.h include where no longer needed 2020-01-28 02:17:02 +01:00
Benjamin Otte
563ad2db1b containter: Remove gtk_container_get_path_for_child() 2020-01-21 12:47:16 +01:00
Timm Bäder
cbc3ce5b03 box: Don't do casts before preconditions 2019-09-09 17:36:25 +02:00
Matthias Clasen
18788c2a86 Remove gtk_widget_get/set_has_surface
These serve no purpose anymore - widgets don't
have surfaces, unless they're a GtkNative.
2019-05-28 20:25:15 +00:00
Emmanuele Bassi
59c6862a03 Use gtk_widget_class_set_layout_manager_type()
Instead of manually creating the layout manager inside the instance
initialization function, we can let GtkWidget do that for us.
2019-05-06 12:06:27 +01:00
Emmanuele Bassi
1fed357752 Port GtkBox to GtkBoxLayout
We can delegate all the layout management to a GtkBoxLayout, now that we
have one.
2019-03-26 00:11:27 +00:00
Matthias Clasen
32e61b955a Drop gtkboxprivate.h
Not needed anymore.
2019-02-05 07:54:35 -05:00
Matthias Clasen
f3f5a896de box: Avoid position in the reorder api
Change the reorder api to insert after a sibling,
so that moving to first place becomes reorder (... NULL).

And add a insert_after api that can replace the common
container_add / reorder_after (... NULL) combination.

Update all callers.
2019-01-23 19:30:47 -05:00
Matthias Clasen
883d5d8584 box: Remove the position child property
The position child property is problematic, since it
requires us to emit notification for all children when
inserting a child early in the list of children.

Remove the property from all ui files.
2019-01-23 19:30:47 -05:00
Timm Bäder
e9e40ddb42 box: Remove gtk_box_pack_start 2019-01-23 19:30:46 -05:00
Timm Bäder
a543ed84f6 box: Remove gtk_box_pack_end 2019-01-23 19:30:46 -05:00
Timm Bäder
3d34b91453 box: Simplify documentation
Remove all references to any sort of "packing".
2019-01-23 19:30:46 -05:00
Timm Bäder
1ccba26de9 box: Remove children list
GtkWidget saves a widget list for us, so we don't need to keep track of
them ourselves. This is okay now that we don't have a pack-type child
property anymore.
2019-01-23 19:30:46 -05:00
Timm Bäder
28c51175d8 box: Remove pack-type child property 2019-01-23 19:30:46 -05:00
Daniel Boles
72d09d22e9 Box, Grid: Improve various bits of documentation
Issue #1495 showed that the docs of GtkGrid retain outdated implications
that (as was once, but is no longer, the case) it is intended to replace
GtkBox, by discussing HfW and widget properties in a way that suggests
GtkBox can't handle them. But of course it does, and it's preferable for
simple single-row/column cases. Worse, we said GtkGrid “provides exactly
the same functionality” for the latter case, but the original point of
that Issues was that it doesn’t, at least for CSS positional selectors!

Box:
• Use an actually meaningful @Short_description.
• Remove unhelpful @See_also references to unrelated containers.
• Remove references to “rectangular area”: it might be another shape
  via CSS, or “rectangular” might falsely imply 2 dimensions of children.
• Mention Orientable:orientation.
• Emphasise usefulness of :[hv]align for allocating in the other axis.
• Don’t say that Grid “provides exactly the same functionality” for a
  single row or column, since (A) it is overkill for that case and (B)
  said Issue proved that it *doesn’t* for CSS child order, for example.

Grid:
• Don’t dwell on widget properties and height-for-width in a way that
  wrongly implies that Box can’t handle those (or Grid can better). In
  fact, just get rid of that bit altogether: Box handles them fine, and
  such wording was only needed years ago for migration from GTK+ 2 to 3.
• Point to GtkBox as being preferred for the simple row/column use case.
2018-12-04 20:43:19 +00:00
Timm Bäder
ade171a2ed widget: Don't pass a position to ->size_allocate
The values have been 0/0 for a long time now, so just drop the
GtkAllocation argument and replace it with width and height.
2018-11-13 16:28:54 +01:00
Timm Bäder
00a27c1e28 box: Remove gtk_box_get_size
One function to measure the box in the opposite of its internal
direction is enough.
2018-08-27 18:53:56 +02:00
Timm Bäder
f5f6597abc box: Rename avail_size to for_size everywhere
So we call it like we call it everywhere else.
2018-08-27 18:48:09 +02:00
Timm Bäder
fade0afbef box: Simplify compute_size_for_orientation 2018-08-27 18:45:03 +02:00
Timm Bäder
01d4538223 box: Don't reorder children based on text direction
Make :first-child always be the first child, i.e. the leftest one in LTR
and the rightest one in RTL.
2018-06-18 17:35:02 +02:00
Benjamin Otte
169203951b widget: Remove clip from size-allocate vfunc
As the clip is no longer needed, get rid of it.
2018-04-05 14:56:38 +02:00
Alexander Larsson
63e060a21d GtkWidget: Start renaming widget->window
This is an automated change doing these command:

git sed -f g gtk_widget_set_has_window gtk_widget_set_has_surface
git sed -f g gtk_widget_get_has_window gtk_widget_get_has_surface
git sed -f g gtk_widget_set_parent_window gtk_widget_set_parent_surface
git sed -f g gtk_widget_get_parent_window gtk_widget_get_parent_surface
git sed -f g gtk_widget_set_window gtk_widget_set_surface
git sed -f g gtk_widget_get_window gtk_widget_get_surface
git sed -f g gtk_widget_register_window gtk_widget_register_surface
git sed -f g gtk_widget_unregister_window gtk_widget_unregister_surface

git checkout NEWS*
2018-03-20 15:21:12 +01:00
Timm Bäder
1362609120 box: Remove an unnecessary include 2018-02-09 11:36:53 +01:00
Timm Bäder
89ac1d6197 box: Rename private pointers to "priv"
Which is the style we use everywhere else.
2018-02-09 11:36:53 +01:00
Timm Bäder
1cfbe9c3d0 box: Simplify size_allocate
Stop looking at the box allocation position since both x and y are 0.
2018-02-09 11:36:53 +01:00
Timm Bäder
3a4c6c18b3 box: Use widget child list when computing size request
Contrary to what the comments in this function might suggest, it does
not actually do anything about child positions, child child sizes. So,
packing doesn't matter and we don't need to iterate over all child
widgets twice.
2018-02-09 11:36:53 +01:00
Timm Bäder
5e9f5c17b5 box: Use widget child list in compute_size_for_orientation
And remove the non-NULL checks for minimum_size and natural_size since
these are non-NULL by definition since this function is only called from
measure().
2018-02-09 11:36:53 +01:00
Matthias Clasen
4c150d8eb5 The big versioning cleanup
Remove all the old 2.x and 3.x version annotations.
GTK+ 4 is a new start, and from the perspective of a
GTK+ 4 developer all these APIs have been around since
the beginning.
2018-02-06 01:16:32 -05:00
Timm Bäder
27c76db956 box: Simplify some code
All out varibles in measure implementations must be non-null and -1 is
the default value for the baseline parameters.
2018-01-17 21:57:20 +01:00
Timm Bäder
e763dac72e box: Remove self assignment 2018-01-17 21:57:19 +01:00
Timm Bäder
8ab2c79b77 box: Remove useless if statement
We already check right before this one whether child->pack != packing
and if so, we continue to the next iteration. So, no need to check again
whether the inverted condition child->pack == packing is true, because
it is.
2018-01-17 21:57:19 +01:00
Timm Bäder
c2d4f05ce0 box: Remove some unneeded checks
We only call this function from the measure implementation and we should
never get NULL pointers there.
2018-01-17 21:57:19 +01:00
Timm Bäder
c475047501 box: Remove an unnecessary local variable 2018-01-17 21:57:19 +01:00
Timm Bäder
3604816b9c box: Use GtkWidget's widget list in get_size 2018-01-17 21:57:19 +01:00
Matthias Clasen
ffd6baec42 gtk: Intern css names
This avoids a bunch of strdups at startup.
2017-11-17 22:49:57 -05:00
Benjamin Otte
43c212ac28 build: Enable -Wswitch-enum and -Wswitch-default
This patch makes that work using 1 of 2 options:

1. Add all missing enums to the switch statement
  or
2. Cast the switch argument to a uint to avoid having to do that (mostly
   for GdkEventType).

I even found a bug while doing that: clearing a GtkImage with a surface
did not notify thae surface property.

The reason for enabling this flag even though it is tedious at times is
that it is very useful when adding values to an enum, because it makes
GTK immediately warn about all the switch statements where this enum is
relevant.
And I expect changes to enums to be frequent during the GTK4 development
cycle.
2017-10-06 21:23:39 +02:00