KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > layout > IWindowTrim


1 /*******************************************************************************
2  * Copyright (c) 2005, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ui.internal.layout;
12
13 import org.eclipse.swt.widgets.Control;
14
15 /**
16  * Interface for trim controls that can be docked to the edge of a Workbench
17  * window using drag-and-drop.
18  *
19  * <p>
20  * <b>Note:</b> This interface is highly experimental, and will probably change
21  * between M4 and M5. For example, it will support a "lifecycle" that allows the
22  * {@link ITrimManager} to update its modifiers (like SWT.TOP or SWT.LEFT) so the
23  * IWindowTrim can dispose and re-create its control. This will likely effect
24  * methods like {@link #dock(int) }, {@link #getControl() },
25  * {@link #getValidSides() }, etc.
26  * </p>
27  *
28  * @since 3.2
29  */

30 public interface IWindowTrim {
31     /**
32      * Returns the control representing this trim widget, or null if it has not
33      * yet been created.
34      *
35      * @return the control for the trim widget.
36      */

37     Control getControl();
38
39     /**
40      * Returns the set of sides that this trim can be docked onto.
41      *
42      * @return bitwise OR of one or more of SWT.TOP, SWT.BOTTOM, SWT.LEFT, and
43      * SWT.RIGHT
44      */

45     int getValidSides();
46
47     /**
48      * Called to notify the trim object that it has been docked on the given
49      * side of the layout
50      *
51      * @param dropSide
52      * the trim drop area
53      *
54      */

55     void dock(int dropSide);
56
57     /**
58      * Each piece of window trim must have a unique ID to participate fully as
59      * trim.
60      *
61      * @return The unique id
62      * @since 3.2
63      */

64     public String JavaDoc getId();
65
66     /**
67      * Returns the (localized) display name for this trim. This is used, for
68      * example, to construct menu items...
69      *
70      * @return The display name for this trim
71      *
72      * @since 3.2
73      */

74     public String JavaDoc getDisplayName();
75
76     /**
77      * Determines whether a particular trim can be 'closed' using the common
78      * Trim UI.
79      *
80      * @return true if the UI should profer the close affordance; false
81      * otherwise
82      *
83      * @since 3.2
84      */

85     public boolean isCloseable();
86
87     /**
88      * This method is called when the trim UI has closed (hidden) the trim. The
89      * controls associated with the trim will have already been removed from the
90      * trim layout. The implementor should take any necessary clean up actions
91      * here.
92      *
93      * @since 3.2
94      */

95     public void handleClose();
96
97     /**
98      * Overrides the preferred width of the control (pixels). If SWT.DEFAULT,
99      * then the control's preferred width will be used. This has no effect for
100      * horizontally resizable controls.
101      *
102      * @return pixels, or SWT.DEFAULT
103      * @since 3.2
104      */

105     public int getWidthHint();
106
107     /**
108      * Overrides the preferred height of the control (pixels). If SWT.DEFAULT,
109      * then the control's preferred height will be used. This has no effect for
110      * vertically resizable controls.
111      *
112      * @return pixels, or SWT.DEFAULT
113      * @since 3.2
114      */

115     public int getHeightHint();
116
117     /**
118      * If true, the control will be resized with the layout. If there is more
119      * than one resizable control on the same side of the layout, the available
120      * space will be divided equally among all the resizeable controls.
121      *
122      * @return <code>true</code> or <code>false</code>.
123      * @since 3.2
124      */

125     public boolean isResizeable();
126 }
127
Popular Tags