01: /*******************************************************************************
02: * Copyright (c) 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: ******************************************************************************/package org.eclipse.ui.internal;
11:
12: /**
13: * The layout data class used by the <code>WorkbenchLayout</code> to arrange
14: * trim around the workbench edges.
15: * <p>
16: * NOTE: This class is a part of a 'work in progress' and should not be used
17: * without consulting the Platform UI group. No guarantees are made as to the
18: * stability of the API (except that the javadoc will get better...;-).
19: * </p>
20: *
21: * @since 3.2
22: *
23: */
24: public class TrimLayoutData {
25:
26: // Constants
27: /**
28: * The trim element will grow unbounded based on the amount of unused space
29: * in its TrimArea but will never be smaller than it's preferred size. Only
30: * one of <code>GROWABLE</code> or <code>SHRINKABLE</code> should be
31: * specified.
32: */
33: public static final int GROWABLE = 0x1;
34:
35: /**
36: * The trim element will shrink to the <code>shrinkableSize</code> if
37: * needed to fit the element into the trim but will never grow larger than
38: */
39: public static final int SHRINKABLE = 0x2;
40:
41: /**
42: * The trim element will grow in its 'minor' dimension (i.e. in Y if the
43: * trim is oriented horizontally) to match the size of the TrimArea that it
44: * is in.
45: */
46: public static final int GRAB_EXCESS_MINOR = 0x4;
47:
48: // Fields
49: public String trimId;
50:
51: public String areaId;
52:
53: public int flags;
54:
55: public ITrimAreaChangeListener listener;
56:
57: public int shrinkableSize;
58:
59: public TrimLayoutData(String trimId, String areaId, int flags,
60: ITrimAreaChangeListener listener) {
61: this .trimId = trimId;
62: this .areaId = areaId;
63: this .flags = flags;
64: this .listener = listener;
65: }
66:
67: public TrimLayoutData(String trimId, String areaId, int flags) {
68: this (trimId, areaId, flags, null);
69: }
70:
71: public TrimLayoutData(String trimId, String areaId) {
72: this (trimId, areaId, 0);
73: }
74:
75: public void setAreaId(String newAreaId) {
76: if (listener != null) {
77: listener.areaChanged(
78: WorkbenchLayout.getOrientation(areaId),
79: WorkbenchLayout.getOrientation(newAreaId));
80: }
81:
82: areaId = newAreaId;
83: }
84: }
|