From 3793394f225a1d3b36382f5b50bd2e3c8214ff0d Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Thu, 22 Jul 2021 07:34:40 +0200 Subject: [PATCH] Introduce noSpaceRowLayout. --- .../src/org/argeo/cms/ui/util/CmsUiUtils.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/org.argeo.cms.ui/src/org/argeo/cms/ui/util/CmsUiUtils.java b/org.argeo.cms.ui/src/org/argeo/cms/ui/util/CmsUiUtils.java index c305fa0db..edf1ba3ef 100644 --- a/org.argeo.cms.ui/src/org/argeo/cms/ui/util/CmsUiUtils.java +++ b/org.argeo.cms.ui/src/org/argeo/cms/ui/util/CmsUiUtils.java @@ -33,6 +33,7 @@ import org.eclipse.swt.layout.FormData; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.RowData; +import org.eclipse.swt.layout.RowLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -150,6 +151,7 @@ public class CmsUiUtils implements CmsConstants { return noSpaceGridLayout(new GridLayout(columns, false)); } + /** @return the same layout, with spaces removed. */ public static GridLayout noSpaceGridLayout(GridLayout layout) { layout.horizontalSpacing = 0; layout.verticalSpacing = 0; @@ -181,6 +183,20 @@ public class CmsUiUtils implements CmsConstants { /* * ROW LAYOUT */ + /** @return the same layout, with space and margins removed. */ + public static RowLayout noSpaceRowLayout(RowLayout rowLayout) { + rowLayout.marginTop = 0; + rowLayout.marginBottom = 0; + rowLayout.marginLeft = 0; + rowLayout.marginRight = 0; + rowLayout.spacing = 0; + return rowLayout; + } + + public static RowLayout noSpaceRowLayout(int type) { + return noSpaceRowLayout(new RowLayout(type)); + } + public static RowData rowData16px() { return new RowData(16, 16); } -- 2.30.2