Commit Graph

38 Commits

Author SHA1 Message Date
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
b93631164f Remove lots of focus vfuncs
In many cases, the default widget vfuncs work just fine,
combined with setting focusable.
2020-05-11 00:11:37 -04:00
Matthias Clasen
632524f679 Reinstate expected focus behavior
After the :can-focus change in the previous commit, widgets
need to set suitable focus and grab_focus implementations
to implement the desired focus behavior.

This commit does that for all widgets.
2020-04-09 17:50:29 -04:00
Timm Bäder
a7b9a33efc Add GtkCenterLayout
And use it in GtkCenterBox, different widgets following.
2019-09-13 11:07:54 +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
Timm Bäder
359d874ddb Use g_clear_pointer to unparent widgets 2018-11-13 20:53:14 +01: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
85e49a1051 center box: Don't reorder css nodes in RTL
So widget order matches css order. We will do the same thing with GtkBox
eventually.
2018-06-18 17:35:02 +02:00
Timm Bäder
0b12fd9c1b center box: Remove snapshot implementation 2018-06-16 10:09:12 +02:00
Benjamin Otte
9c0acf62b4 widget: Allow adding event controllers in ui files 2018-04-26 17:59:41 +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
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
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
Timm Bäder
3fc1cafec0 centerbox: Unparent widgets in dispose 2017-09-01 19:05:30 +02:00
Daniel Boles
7dd9f212ad CenterBox: minor tweaks to doc blurb 2017-08-05 18:57:08 +01:00
Daniel Boles
cbe53fec07 CenterBox: Add missing nullable annotations
https://bugzilla.gnome.org/show_bug.cgi?id=785280
2017-08-05 18:56:01 +01:00
Timm Bäder
36ab70ddf5 widget: Add baseline and out_clip parameters to size-allocate
Since setting a clip is mandatory for almost all widgets, we can as well
change the size-allocate signature to include a out_clip parameter, just
like GtkCssGadget did. And since we now always propagate baselines, we
might as well pass that one on to size-allocate.

This way we can also make sure to transform the clip returned from
size-allocate to parent-coordinates, i.e. the same coordinate space
priv->allocation is in.
2017-07-19 21:27:16 -04:00
Timm Bäder
23f90e3d67 centerbox: Add some missing return value annotations 2017-07-19 21:27:15 -04:00
Timm Bäder
82eafb8a2c centerbox: Avoid accessing unset widgets 2017-07-19 21:27:15 -04:00
Matthias Clasen
29e8a07ddd Avoid compiler warnings
Initialize these variables, so gcc doesn't complain.
2017-07-19 20:45:52 -04:00
Matthias Clasen
114f23cec7 center box: Take baseline-position fully into account
We need to take baseline-position into account during measure
as well.
2017-06-10 14:45:10 -04:00
Matthias Clasen
f135b2527f center box: complete the baseline support
When there is no externally allocated baseline, we should
do the same thing that GtkBox does, and determine one from
the children that want baseline alignment.

This commit adds a GtkCenterBox::baseline-position property
with setters and getters.
2017-06-10 09:14:16 -04:00
Matthias Clasen
8316ec85f5 center box: Fix size allocation
This missing pair of parens was causing expanding children
to overlap.
2017-06-10 07:53:06 -04:00
Matthias Clasen
389535c572 center box: Drop a useless line
This is just a leftover that has no effect whatsoever.
2017-06-10 07:53:06 -04:00
Matthias Clasen
5e69fe17ae center box: Add more documentation 2017-06-04 21:48:41 -04:00
Matthias Clasen
c35604cfcb center box: add baseline support
This is copied more or less directly from GtkBoxGadget.
2017-06-04 21:40:20 -04:00
Matthias Clasen
f8737a6d8a center box : implement GtkOrientable
This is generally expected of containers where it makes sense.
2017-06-04 21:40:20 -04:00
Matthias Clasen
141e053e87 center box: support height-for-width
Implement request modes fully.
2017-06-04 21:21:00 -04:00
Matthias Clasen
42921750ff center box: Support expand property
We expand the center child first, but only as far
as we can keep it centered.
2017-06-04 21:21:00 -04:00
Matthias Clasen
60cd5b9b4c center box: implement GtkBuildable
Make it possible to fill the slots by using the
type attribute on child nodes. This is necessary
since GtkCenterBox does not derive from GtkContainer.
2017-06-04 21:21:00 -04:00
Matthias Clasen
b4cb05ace9 center box: implement natural size and rtl flipping
We prefer to give the center widget its natural size,
and we center it as long as possible.
2017-06-04 21:20:57 -04:00
Matthias Clasen
f8059f3040 center box: handle missing start or end widgets
Any slot may be unfilled, not just the center one.
2017-06-04 21:20:33 -04:00
Matthias Clasen
e936a35d66 Make GtkCenterBox public
It provides functionality that GtkBox used to have,
and is generally useful.
2017-06-04 21:20:27 -04:00
Timm Bäder
066c1983ba actionbar: Add explicit center widget
The center widget in GtkBox was only introduced to use it in
GtkActionBar. However, the implementation there is much more complex
than it needs to be, so move the center widget into GtkActionBar instead
and later remove it from GtkBox.
2017-04-25 20:30:37 +02:00
Matthias Clasen
8bfa5e4611 Drop GtkCenterBox
Its functionality has been subsumed in GtkBox.
2014-02-16 23:05:21 -05:00
William Jon McCann
c86ee0558c Rename GtkActionBar to GtkCenterBox
https://bugzilla.gnome.org/show_bug.cgi?id=723929
2014-02-12 08:08:03 -05:00