org.eclipse.jface.menus.IWidget Maven / Gradle / Ivy
/*******************************************************************************
* Copyright (c) 2005, 2015 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jface.menus;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.CoolBar;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.ToolBar;
/**
*
* Provides a hook by which third-party code can contribute SWT widgets to a
* menu, tool bar or status line. This can be used, for example, to add a combo
* box to the status line, or a "Location" bar to the tool bar.
*
*
* It is possible for fill and dispose to be called multiple times for a single
* instance of IWidget
.
*
*
* Clients may implement, but must not extend.
*
*
* @since 3.2
*/
public interface IWidget {
/**
* Disposes of the underlying widgets. This can be called when the widget is
* becoming hidden.
*/
public void dispose();
/**
* Fills the given composite control with controls representing this widget.
*
* @param parent
* the parent control
*/
public void fill(Composite parent);
/**
* Fills the given menu with controls representing this widget.
*
* @param parent
* the parent menu
* @param index
* the index where the controls are inserted, or -1
* to insert at the end
*/
public void fill(Menu parent, int index);
/**
* Fills the given tool bar with controls representing this contribution
* item.
*
* @param parent
* the parent tool bar
* @param index
* the index where the controls are inserted, or -1
* to insert at the end
*/
public void fill(ToolBar parent, int index);
/**
* Fills the given cool bar with controls representing this contribution
* item.
*
* @param parent
* the parent cool bar
* @param index
* the index where the controls are inserted, or -1
* to insert at the end
*/
public void fill(CoolBar parent, int index);
}