KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > menus > IWidget


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
12 package org.eclipse.jface.menus;
13
14 import org.eclipse.swt.widgets.Composite;
15 import org.eclipse.swt.widgets.CoolBar;
16 import org.eclipse.swt.widgets.Menu;
17 import org.eclipse.swt.widgets.ToolBar;
18
19 /**
20  * <p>
21  * Provides a hook by which third-party code can contribute SWT widgets to a
22  * menu, tool bar or status line. This can be used, for example, to add a combo
23  * box to the status line, or a "Location" bar to the tool bar.
24  * </p>
25  * <p>
26  * It is possible for fill and dispose to be called multiple times for a single
27  * instance of <code>IWidget</code>.
28  * </p>
29  * <p>
30  * Clients may implement, but must not extend.
31  * </p>
32  *
33  * @since 3.2
34  */

35 public interface IWidget {
36
37     /**
38      * Disposes of the underlying widgets. This can be called when the widget is
39      * becoming hidden.
40      */

41     public void dispose();
42
43     /**
44      * Fills the given composite control with controls representing this widget.
45      *
46      * @param parent
47      * the parent control
48      */

49     public void fill(Composite parent);
50
51     /**
52      * Fills the given menu with controls representing this widget.
53      *
54      * @param parent
55      * the parent menu
56      * @param index
57      * the index where the controls are inserted, or <code>-1</code>
58      * to insert at the end
59      */

60     public void fill(Menu parent, int index);
61
62     /**
63      * Fills the given tool bar with controls representing this contribution
64      * item.
65      *
66      * @param parent
67      * the parent tool bar
68      * @param index
69      * the index where the controls are inserted, or <code>-1</code>
70      * to insert at the end
71      */

72     public void fill(ToolBar parent, int index);
73
74     /**
75      * Fills the given cool bar with controls representing this contribution
76      * item.
77      *
78      * @param parent
79      * the parent cool bar
80      * @param index
81      * the index where the controls are inserted, or <code>-1</code>
82      * to insert at the end
83      */

84     public void fill(CoolBar parent, int index);
85 }
86
Popular Tags