]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.eclipse.swt.win32.win32.x86_64/src/org/eclipse/swt/widgets/Layout.java
Remove invalid SHA-256-Digests
[simantics/platform.git] / bundles / org.eclipse.swt.win32.win32.x86_64 / src / org / eclipse / swt / widgets / Layout.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2011 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *     IBM Corporation - initial API and implementation
13  *******************************************************************************/
14 package org.eclipse.swt.widgets;
15
16
17 import org.eclipse.swt.graphics.*;
18
19 /**
20  * A layout controls the position and size
21  * of the children of a composite widget.
22  * This class is the abstract base class for
23  * layouts.
24  *
25  * @see Composite#setLayout(Layout)
26  * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
27  */
28 public abstract class Layout {
29
30 /**
31  * Computes and returns the size of the specified
32  * composite's client area according to this layout.
33  * <p>
34  * This method computes the size that the client area
35  * of the composite must be in order to position all
36  * children at their preferred size inside the
37  * composite according to the layout algorithm
38  * encoded by this layout.
39  * </p>
40  * <p>
41  * When a width or height hint is supplied, it is
42  * used to constrain the result. For example, if a
43  * width hint is provided that is less than the
44  * width of the client area, the layout may choose
45  * to wrap and increase height, clip, overlap, or
46  * otherwise constrain the children.
47  * </p>
48  *
49  * @param composite a composite widget using this layout
50  * @param wHint width (<code>SWT.DEFAULT</code> for preferred size)
51  * @param hHint height (<code>SWT.DEFAULT</code> for preferred size)
52  * @param flushCache <code>true</code> means flush cached layout values
53  * @return a point containing the computed size (width, height)
54  *
55  * @see #layout
56  * @see Control#getBorderWidth
57  * @see Control#getBounds
58  * @see Control#getSize
59  * @see Control#pack(boolean)
60  * @see "computeTrim, getClientArea for controls that implement them"
61  */
62 protected abstract Point computeSize (Composite composite, int wHint, int hHint, boolean flushCache);
63
64 /**
65  * Instruct the layout to flush any cached values
66  * associated with the control specified in the argument
67  * <code>control</code>.
68  *
69  * @param control a control managed by this layout
70  * @return true if the Layout has flushed all cached information associated with control
71  *
72  * @since 3.1
73  */
74 protected boolean flushCache (Control control) {
75         return false;
76 }
77
78 /**
79  * Lays out the children of the specified composite
80  * according to this layout.
81  * <p>
82  * This method positions and sizes the children of a
83  * composite using the layout algorithm encoded by this
84  * layout. Children of the composite are positioned in
85  * the client area of the composite. The position of
86  * the composite is not altered by this method.
87  * </p>
88  * <p>
89  * When the flush cache hint is true, the layout is
90  * instructed to flush any cached values associated
91  * with the children. Typically, a layout will cache
92  * the preferred sizes of the children to avoid the
93  * expense of computing these values each time the
94  * widget is laid out.
95  * </p>
96  * <p>
97  * When layout is triggered explicitly by the programmer
98  * the flush cache hint is true. When layout is triggered
99  * by a resize, either caused by the programmer or by the
100  * user, the hint is false.
101  * </p>
102  *
103  * @param composite a composite widget using this layout
104  * @param flushCache <code>true</code> means flush cached layout values
105  */
106 protected abstract void layout (Composite composite, boolean flushCache);
107 }