Commit Graph

24 Commits

Author SHA1 Message Date
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
Benjamin Otte
515b1f5292 boxlayout: Do not infloop
if the loop for determining max width grows too big, print an error and
abort assuming that a satisfactory value was reached.

This will cause wrong layout and might cause widgets to overlap, but it
will not infloop.

It actually works around and doesn't really fix the primary cause of the
following bugs, but good enough to close them:

Fixes: #4252
Fixes: #4517
2022-04-26 19:56:01 +02:00
Benjamin Otte
76c4673944 boxlayout: Fix broken min-size-for-opposite-size
Assume a vbox with 2 wrapping labels saying
  Hello World
  Hi Ho
being measured for their minimum width for 3 rows of text.
This should be layouted like
  Hello
  World
  Hi Ho
and measured accordingly.

However, previously this was layouted as
  Hello World
  Hi Ho
with 1.5 lines being assigned to both labels.
That will obviously not compute the above wrapping which clearly
results in a smaller min width.

A reftest testing exactly this was included.
2021-11-09 03:41:43 +01:00
Benjamin Otte
0a31201c88 boxlayout: Split loop into if statmement
Turns it into 2 loops, one for the homogeneous part and one for the
complicated part.
2021-11-09 03:41:43 +01:00
Benjamin Otte
afe94e303a boxlayout: Don't listen to comments
... when they are wrong.

Instead, remove them.

Or in other words: GTK4 does not have a fill child property anymore, so
we don't need to run the measuring loop above to determine the size.
2021-11-09 03:41:43 +01:00
Benjamin Otte
4ffa60be50 boxlayout: Be more careful with what to consider natural size
Don't just use the natural size as the max size, the natural size
is the ideal size, not necessarily the maximum size.

Also check the nat size for opposite min size.
2021-11-06 00:56:55 +01:00
Benjamin Otte
5c9ae28937 boxlayout: Compute opposite size properly
For size -1 in the opposite orientation, GtkBoxLayout used to measure
the children based on their min size in the box's orientation instead of
-1. That wasn't really intended, but was a side effect of how the sizing
code did (not) distribute extra size above the minimum size.

This is clearly not what we want.
What we want is measuring the orientation as is for size -1. Then we
want to just take the maximum of all children and use that.

A reftest is incldued that ensures a vbox wraps a label just like an
hbox does.
2021-11-05 20:30:49 +01:00
Matthias Clasen
b408dc0706 boxlayout: Convert docs 2021-03-11 16:37:34 +00:00
Matthias Clasen
2d0d579735 Unify border-spacing handling
Avoid using GtkStyleContext unnecessarily, just go
to the css node directly.
2021-01-28 12:27:07 -05:00
Benjamin Otte
d7266b25ba Replace "gint" with "int" 2020-07-25 00:47:36 +02:00
Timm Bäder
c1f5153f6d boxlayout: Remove unnecessary checks
The pointers passed to GtkLayoutManager::measure() are never NULL. The
ones passed to gtk_layout_manager_measure() can be, however.
2020-07-17 06:31:57 +02:00
Timm Bäder
2bd87ce771 boxlayout: Remove unused include 2020-07-17 06:27:50 +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
Timm Bäder
b471158e38 {box,grid}layout: Access border spacing directly
Instead of going through the style context
2020-02-07 13:16:32 -05:00
Matthias Clasen
21a5c7f0eb layout managers: Handle native children
Add a convenience api to skip children
that should not be included in the layout,
and call gtk_native_check_resize on all
native children outside of the vfunc.
2019-06-11 14:52:30 -04:00
Matthias Clasen
59ed4da717 box layout: Handle native children
These need to be skipped in measuring,
and we need to call gtk_native_check_resize
on them during allocation.

This was showing up as the new-style
context menu in widget-factory forcing
its relative-to box to grow when its
shown.
2019-06-09 17:38:53 +00:00
Matthias Clasen
7b1201cd4d box layout: Documentation additions 2019-05-01 23:24:14 -04:00
Emmanuele Bassi
a27737b04e Add default GtkLayoutManagerClass.get_request_mode()
Just like GtkContainer provides a default implementation of
GtkWidgetClass.get_request_mode(), we can do the same inside
GtkLayoutManager.

A default implementation preserves the behavior of existing widgets that
moved, or will move, to a GtkLayoutManager.
2019-04-12 17:10:30 +01:00
Benjamin Otte
637bd13f3f boxlayout: Remove unused variable 2019-04-12 16:32:00 +02:00
Emmanuele Bassi
b91fbfd5a0 Fix get_request_mode for GtkBoxLayout
The default GtkWidgetClass.get_request_mode() is implemented by
GtkContainer; now that GtkBox uses a GtkBoxLayout, we need to implement
it inside the layout manager to preserve the same behavior as the old
GtkBox.

Fixes #1821
2019-04-12 13:14:44 +01:00
Georges Basile Stavracas Neto
56d420c06e
boxlayout: Notify orientation changes
This was missing from the initial implementation, and
breaks the tests.
2019-03-27 23:34:03 -03:00
Emmanuele Bassi
65965bed16 Changes after review
- Rename GtkLegacyLayout to GtkCustomLayout
 - Use for() to iterate over children in GtkBinLayout
 - Whitespace fixes for code imported from GtkBox
 - Store the GtkLayoutChild instances inside LayoutManager
 - Simplify the GtkLayoutManager API by dropping unnecessary arguments
 - Fix the ownership model of GtkLayoutManager
2019-03-26 00:11:27 +00:00
Emmanuele Bassi
ef9863ab63 Add GtkBoxLayout
The same layout policy of GtkBox, without all the GtkContainer calories.
2019-03-26 00:11:27 +00:00