Commit graph

11 commits

Author SHA1 Message Date
FrHun
e29314f837 LibGUI: Refactor BoxLayout for minor readability improvements 2022-06-28 17:52:42 +01:00
Karol Kosek
ea99589d04 LibGUI: Take only valid sizes when calculating BoxLayout preferred size
We ran a min() function to clamp child widgets to their maximum size,
but if it wasn't set, it got -1 and made the widget able to shrink
completely.
2022-05-11 20:24:38 +02:00
FrHun
70e5a77794 LibGUI: Consider content_margins for BoxLayout 2021-11-03 16:13:19 +01:00
FrHun
72139e1262 LibGUI: Add content margins
Introduce the basic interface through which widgets can define a
rect relative to which Layout margins are now applied.
2021-11-03 16:13:19 +01:00
thislooksfun
416988cc7f LibGUI: Register layouts with inheritance 2021-11-02 17:53:22 +01:00
Mart G
07e3934f01 LibGUI: Distribute remaining pixels in BoxLayout to fill the entire area
Previously, the layout algorithm preferred to give every item an equally
sized slice of the remaining space. This meant that not the entire area
was used when the remaining size did not divide evenly by the number of
items. This caused, for example, the ResizeCorner in HexEditor to be a
couple of pixels left of the actual corner for some sizes of the window.

Now, the remaining pixels are distributed on a first come, first served
basis. However, only one pixel is distributed at a time. This means
items towards the left might me a pixel larger than their siblings
towards the right.
2021-05-29 15:50:04 +02:00
Tom
3aaffa2c47 LibGUI: Move widget registration to LibCore
This also moves Widget::load_from_json into Core::Object as a virtual
function in order to allow loading non-widget objects in GML (e.g.
BoxLayout).

Co-authored-by: Gunnar Beutner <gbeutner@serenityos.org>
2021-05-06 08:50:39 +02:00
Brian Gianforcaro
1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
Andreas Kling
6ba00ae5b9 LibGUI: Subtract layout margin when placing items along secondary axis
While space distribution along the primary axis of a BoxLayout is
pretty sophisticated, the secondary axis is very simple: we simply
center the widget.

However, this doesn't always look very nice if we don't take margins
into account, so make sure we subtract them from the rect we do all
the centering within.
2021-04-02 23:33:17 +02:00
asynts
acdcf59a33 Everywhere: Remove unnecessary debug comments.
It would be tempting to uncomment these statements, but that won't work
with the new changes.

This was done with the following commands:

    find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec awk -i inplace '$0 !~ /\/\/#define/ { if (!toggle) { print; } else { toggle = !toggle } } ; $0 ~/\/\/#define/ { toggle = 1 }' {} \;

    find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec awk -i inplace '$0 !~ /\/\/ #define/ { if (!toggle) { print; } else { toggle = !toggle } } ; $0 ~/\/\/ #define/ { toggle = 1 }' {} \;
2021-01-25 09:47:36 +01:00
Andreas Kling
13d7c09125 Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
Renamed from Libraries/LibGUI/BoxLayout.cpp (Browse further)