]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/LayoutUtils.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.utils.ui / src / org / simantics / utils / ui / LayoutUtils.java
diff --git a/bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/LayoutUtils.java b/bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/LayoutUtils.java
new file mode 100644 (file)
index 0000000..510f04a
--- /dev/null
@@ -0,0 +1,57 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+/*\r
+ * 4.7.2006\r
+ */\r
+package org.simantics.utils.ui;\r
+\r
+import org.eclipse.swt.layout.GridData;\r
+import org.eclipse.swt.layout.GridLayout;\r
+\r
+/**\r
+ * LayoutUtils\r
+ * \r
+ * @author Toni Kalajainen\r
+ */\r
+public class LayoutUtils {\r
+\r
+    public static GridLayout createNoBorderGridLayout(int numColumns) {\r
+        return createNoBorderGridLayout(numColumns, true);\r
+    }\r
+\r
+    public static GridLayout createNoBorderGridLayout(int numColumns, boolean makeColumnsEqualWidth) {\r
+        GridLayout gl = new GridLayout(numColumns, makeColumnsEqualWidth);\r
+        gl.marginBottom = 0;\r
+        gl.marginLeft = 0;\r
+        gl.marginTop = 0;\r
+        gl.marginRight = 0;\r
+        gl.marginHeight = 0;\r
+        gl.marginTop = 0;\r
+        gl.horizontalSpacing = 0;\r
+        gl.verticalSpacing = 0;\r
+        gl.marginWidth = 0;\r
+        return gl;\r
+    }\r
+\r
+    public static GridData createNoBorderGridData() {\r
+        return new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL\r
+                | GridData.GRAB_VERTICAL);\r
+    }\r
+\r
+    public static GridData createNoBorderGridData(int numColumns) {\r
+        GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL\r
+                | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);\r
+        gd.horizontalSpan = numColumns;\r
+        return gd;\r
+    }\r
+\r
+}\r