comparison dwtx/jface/action/IMenuCreator.d @ 4:c87617952847

some JFace modules
author Frank Benoit <benoit@tionex.de>
date Fri, 28 Mar 2008 17:08:33 +0100
parents
children
comparison
equal deleted inserted replaced
3:6518c18a01f7 4:c87617952847
1 /*******************************************************************************
2 * Copyright (c) 2000, 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 * Port to the D programming language:
11 * Frank Benoit <benoit@tionex.de>
12 *******************************************************************************/
13 module dwtx.jface.action.IMenuCreator;
14
15 import dwt.widgets.Control;
16 import dwt.widgets.Menu;
17
18 /**
19 * Interface for something that creates and disposes of DWT menus. Note that
20 * it is the responsibility of the implementor to dispose of DWT menus it
21 * creates.
22 */
23 public interface IMenuCreator {
24 /**
25 * Disposes the menu returned by <code>getMenu</code>. Does nothing
26 * if there is no menu. This method will be executed only when the
27 * parent of the menu is disposed.
28 */
29 public void dispose();
30
31 /**
32 * Returns the DWT menu, created as a pop up menu parented by the
33 * given control. In most cases, this menu can be created once, cached and reused
34 * when the pop-up/drop-down action occurs. If the menu must be dynamically
35 * created (i.e., each time it is popped up or dropped down), the old menu
36 * should be disposed of before replacing it with the new menu.
37 *
38 * @param parent the parent control
39 * @return the menu, or <code>null</code> if the menu could not
40 * be created
41 */
42 public Menu getMenu(Control parent);
43
44 /**
45 * Returns an DWT menu created as a drop down menu parented by the
46 * given menu. In most cases, this menu can be created once, cached and reused
47 * when the pop-up/drop-down action occurs. If the menu must be dynamically
48 * created (i.e., each time it is popped up or dropped down), the old menu
49 * should be disposed of before replacing it with the new menu.
50 *
51 * @param parent the parent menu
52 * @return the menu, or <code>null</code> if the menu could not
53 * be created
54 */
55 public Menu getMenu(Menu parent);
56 }