Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 8dd79a6ac567e4b4db7715659f788d32748e9693 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*******************************************************************************
 * Copyright (c) 2006, 2015 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 ******************************************************************************/
package org.eclipse.ui.internal;

/**
 * The layout data class used by the <code>WorkbenchLayout</code> to arrange
 * trim around the workbench edges.
 * <p>
 * NOTE: This class is a part of a 'work in progress' and should not be used
 * without consulting the Platform UI group. No guarantees are made as to the
 * stability of the API (except that the javadoc will get better...;-).
 * </p>
 *
 * @since 3.2
 *
 */
public class TrimLayoutData {

	// Constants
	/**
	 * The trim element will grow unbounded based on the amount of unused space
	 * in its TrimArea but will never be smaller than it's preferred size. Only
	 * one of <code>GROWABLE</code> or <code>SHRINKABLE</code> should be
	 * specified.
	 */
	public static final int GROWABLE = 0x1;

	/**
	 * The trim element will shrink to the <code>shrinkableSize</code> if
	 * needed to fit the element into the trim but will never grow larger than
	 */
	public static final int SHRINKABLE = 0x2;

	/**
	 * The trim element will grow in its 'minor' dimension (i.e. in Y if the
	 * trim is oriented horizontally) to match the size of the TrimArea that it
	 * is in.
	 */
	public static final int GRAB_EXCESS_MINOR = 0x4;

	// Fields
	public String trimId;

	public String areaId;

	public int flags;

	public ITrimAreaChangeListener listener;

	public int shrinkableSize;

	public TrimLayoutData(String trimId, String areaId, int flags,
			ITrimAreaChangeListener listener) {
		this.trimId = trimId;
		this.areaId = areaId;
		this.flags = flags;
		this.listener = listener;
	}

	public TrimLayoutData(String trimId, String areaId, int flags) {
		this(trimId, areaId, flags, null);
	}

	public TrimLayoutData(String trimId, String areaId) {
		this(trimId, areaId, 0);
	}

	public void setAreaId(String newAreaId) {
		if (listener != null) {
			listener.areaChanged(WorkbenchLayout.getOrientation(areaId),
					WorkbenchLayout.getOrientation(newAreaId));
		}

		areaId = newAreaId;
	}
}

Back to the top