comparison org.eclipse.jface/src/org/eclipse/jface/action/Separator.d @ 12:bc29606a740c

Added dwt-addons in original directory structure of eclipse.org
author Frank Benoit <benoit@tionex.de>
date Sat, 14 Mar 2009 18:23:29 +0100
parents
children
comparison
equal deleted inserted replaced
11:43904fec5dca 12:bc29606a740c
1 /*******************************************************************************
2 * Copyright (c) 2000, 2008 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 org.eclipse.jface.action.Separator;
14
15 import org.eclipse.jface.action.AbstractGroupMarker;
16
17 import org.eclipse.swt.SWT;
18 import org.eclipse.swt.widgets.Menu;
19 import org.eclipse.swt.widgets.MenuItem;
20 import org.eclipse.swt.widgets.ToolBar;
21 import org.eclipse.swt.widgets.ToolItem;
22
23 import java.lang.all;
24
25 /**
26 * A separator is a special kind of contribution item which acts
27 * as a visual separator and, optionally, acts as a group marker.
28 * Unlike group markers, separators do have a visual representation for
29 * menus and toolbars.
30 * <p>
31 * This class may be instantiated; it is not intended to be
32 * subclassed outside the framework.
33 * </p>
34 * @noextend This class is not intended to be subclassed by clients.
35 */
36 public class Separator : AbstractGroupMarker {
37 alias AbstractGroupMarker.fill fill;
38 /**
39 * Creates a separator which does not start a new group.
40 */
41 public this() {
42 super();
43 }
44
45 /**
46 * Creates a new separator which also defines a new group having the given group name.
47 * The group name must not be <code>null</code> or the empty string.
48 * The group name is also used as the item id.
49 *
50 * @param groupName the group name of the separator
51 */
52 public this(String groupName) {
53 super(groupName);
54 }
55
56 /* (non-Javadoc)
57 * Method declared on IContributionItem.
58 * Fills the given menu with a SWT separator MenuItem.
59 */
60 public override void fill(Menu menu, int index) {
61 if (index >= 0) {
62 new MenuItem(menu, SWT.SEPARATOR, index);
63 } else {
64 new MenuItem(menu, SWT.SEPARATOR);
65 }
66 }
67
68 /* (non-Javadoc)
69 * Method declared on IContributionItem.
70 * Fills the given tool bar with a SWT separator ToolItem.
71 */
72 public override void fill(ToolBar toolbar, int index) {
73 if (index >= 0) {
74 new ToolItem(toolbar, SWT.SEPARATOR, index);
75 } else {
76 new ToolItem(toolbar, SWT.SEPARATOR);
77 }
78 }
79
80 /**
81 * The <code>Separator</code> implementation of this <code>IContributionItem</code>
82 * method returns <code>true</code>
83 */
84 public override bool isSeparator() {
85 return true;
86 }
87 }