annotate org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Layout.d @ 0:6dd524f61e62

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