comparison dwtx/jface/menus/AbstractTrimWidget.d @ 33:f25582573129

menus
author Frank Benoit <benoit@tionex.de>
date Thu, 03 Apr 2008 20:41:52 +0200
parents
children
comparison
equal deleted inserted replaced
32:5802cda3813d 33:f25582573129
1 /*******************************************************************************
2 * Copyright (c) 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
14 module dwtx.jface.menus.AbstractTrimWidget;
15
16 import dwtx.jface.menus.IWidget;
17
18 import dwt.DWT;
19 import dwt.widgets.Composite;
20 import dwt.widgets.CoolBar;
21 import dwt.widgets.Menu;
22 import dwt.widgets.ToolBar;
23
24 import dwt.dwthelper.utils;
25
26 /**
27 * This extension to the {@link IWidget} interface allows clients adding
28 * elements to the trim to receive notifications if the User moves the widget to
29 * another trim area.
30 * <p>
31 * This class is intended to be the base for any trim contributions.
32 * </p>
33 * @since 3.2
34 *
35 */
36 public abstract class AbstractTrimWidget : IWidget {
37 /**
38 * This method is called to initially construct the widget and is also
39 * called whenever the widget's composite has been moved to a trim area on a
40 * different side of the workbench. It is the client's responsibility to
41 * control the life-cycle of the Control it manages.
42 * <p>
43 * For example: If the implementation is constructing a {@link ToolBar} and
44 * the orientation were to change from horizontal to vertical it would have
45 * to <code>dispose</code> its old ToolBar and create a new one with the
46 * correct orientation.
47 * </p>
48 * <p>
49 * The sides can be one of:
50 * <ul>
51 * <li>{@link DWT#TOP}</li>
52 * <li>{@link DWT#BOTTOM}</li>
53 * <li>{@link DWT#LEFT}</li>
54 * <li>{@link DWT#RIGHT}</li>
55 * </ul>
56 * </p>
57 * <p>
58 *
59 * @param parent
60 * The parent to (re)create the widget under
61 *
62 * @param oldSide
63 * The previous side ({@link DWT#DEFAULT} on the initial fill)
64 * @param newSide
65 * The current side
66 */
67 public abstract void fill(Composite parent, int oldSide, int newSide);
68
69 /* (non-Javadoc)
70 * @see dwtx.jface.menus.IWidget#dispose()
71 */
72 public abstract void dispose();
73
74 /* (non-Javadoc)
75 * @see dwtx.jface.menus.IWidget#fill(dwt.widgets.Composite)
76 */
77 public void fill(Composite parent) {
78 }
79
80 /* (non-Javadoc)
81 * @see dwtx.jface.menus.IWidget#fill(dwt.widgets.Menu, int)
82 */
83 public void fill(Menu parent, int index) {
84 }
85
86 /* (non-Javadoc)
87 * @see dwtx.jface.menus.IWidget#fill(dwt.widgets.ToolBar, int)
88 */
89 public void fill(ToolBar parent, int index) {
90 }
91
92 /* (non-Javadoc)
93 * @see dwtx.jface.menus.IWidget#fill(dwt.widgets.CoolBar, int)
94 */
95 public void fill(CoolBar parent, int index) {
96 }
97 }