From 537c9fbde4afff75fb442897ad7ec15e6c33d9ef Mon Sep 17 00:00:00 2001 From: Deepika Udayagiri Date: Tue, 13 Aug 2024 15:21:08 +0530 Subject: [PATCH] Moving TabFolderLayout into SWT. Updated as per review comments. Fixes https://github.com/eclipse-platform/eclipse.platform.swt/issues/1317 --- .../eclipse/swt/layout/TabFolderLayout.java | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/TabFolderLayout.java diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/TabFolderLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/TabFolderLayout.java new file mode 100644 index 00000000000..f73d3e6c666 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/layout/TabFolderLayout.java @@ -0,0 +1,68 @@ +/******************************************************************************* + * Copyright (c) 2000, 2005 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.swt.layout; + +import org.eclipse.swt.*; +import org.eclipse.swt.graphics.*; +import org.eclipse.swt.widgets.*; + +/** + * This layout controls the position and size + * of the children of a tab folder. + * + * @since 3.127 + */ +class TabFolderLayout extends Layout { + + /* + * @see org.eclipse.swt.widgets.Layout#computeSize(org.eclipse.swt.widgets.Composite, int, int, boolean) + */ + @Override + protected Point computeSize (Composite composite, int wHint, int hHint, boolean flushCache) { + if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT) + return new Point(wHint, hHint); + + Control [] children = composite.getChildren (); + int count = children.length; + int maxWidth = 0, maxHeight = 0; + for (int i=0; i