001: /*******************************************************************************
002: * Copyright (c) 2005, 2006 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: *******************************************************************************/package org.eclipse.ui.internal.layout;
011:
012: import org.eclipse.swt.widgets.Control;
013:
014: /**
015: * Interface for trim controls that can be docked to the edge of a Workbench
016: * window using drag-and-drop.
017: *
018: * <p>
019: * <b>Note:</b> This interface is highly experimental, and will probably change
020: * between M4 and M5. For example, it will support a "lifecycle" that allows the
021: * {@link ITrimManager} to update its modifiers (like SWT.TOP or SWT.LEFT) so the
022: * IWindowTrim can dispose and re-create its control. This will likely effect
023: * methods like {@link #dock(int) }, {@link #getControl() },
024: * {@link #getValidSides() }, etc.
025: * </p>
026: *
027: * @since 3.2
028: */
029: public interface IWindowTrim {
030: /**
031: * Returns the control representing this trim widget, or null if it has not
032: * yet been created.
033: *
034: * @return the control for the trim widget.
035: */
036: Control getControl();
037:
038: /**
039: * Returns the set of sides that this trim can be docked onto.
040: *
041: * @return bitwise OR of one or more of SWT.TOP, SWT.BOTTOM, SWT.LEFT, and
042: * SWT.RIGHT
043: */
044: int getValidSides();
045:
046: /**
047: * Called to notify the trim object that it has been docked on the given
048: * side of the layout
049: *
050: * @param dropSide
051: * the trim drop area
052: *
053: */
054: void dock(int dropSide);
055:
056: /**
057: * Each piece of window trim must have a unique ID to participate fully as
058: * trim.
059: *
060: * @return The unique id
061: * @since 3.2
062: */
063: public String getId();
064:
065: /**
066: * Returns the (localized) display name for this trim. This is used, for
067: * example, to construct menu items...
068: *
069: * @return The display name for this trim
070: *
071: * @since 3.2
072: */
073: public String getDisplayName();
074:
075: /**
076: * Determines whether a particular trim can be 'closed' using the common
077: * Trim UI.
078: *
079: * @return true if the UI should profer the close affordance; false
080: * otherwise
081: *
082: * @since 3.2
083: */
084: public boolean isCloseable();
085:
086: /**
087: * This method is called when the trim UI has closed (hidden) the trim. The
088: * controls associated with the trim will have already been removed from the
089: * trim layout. The implementor should take any necessary clean up actions
090: * here.
091: *
092: * @since 3.2
093: */
094: public void handleClose();
095:
096: /**
097: * Overrides the preferred width of the control (pixels). If SWT.DEFAULT,
098: * then the control's preferred width will be used. This has no effect for
099: * horizontally resizable controls.
100: *
101: * @return pixels, or SWT.DEFAULT
102: * @since 3.2
103: */
104: public int getWidthHint();
105:
106: /**
107: * Overrides the preferred height of the control (pixels). If SWT.DEFAULT,
108: * then the control's preferred height will be used. This has no effect for
109: * vertically resizable controls.
110: *
111: * @return pixels, or SWT.DEFAULT
112: * @since 3.2
113: */
114: public int getHeightHint();
115:
116: /**
117: * If true, the control will be resized with the layout. If there is more
118: * than one resizable control on the same side of the layout, the available
119: * space will be divided equally among all the resizeable controls.
120: *
121: * @return <code>true</code> or <code>false</code>.
122: * @since 3.2
123: */
124: public boolean isResizeable();
125: }
|