annotate dwt/widgets/Menu.d @ 240:ce446666f5a2

Update to SWT 3.4M7
author Frank Benoit <benoit@tionex.de>
date Mon, 12 May 2008 19:13:01 +0200
parents 380bad9f6852
children 5a30aa9820f3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
72
5899e0b43e5d porting notice
Frank Benoit <benoit@tionex.de>
parents: 71
diff changeset
1 /*******************************************************************************
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2 * Copyright (c) 2000, 2007 IBM Corporation and others.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3 * All rights reserved. This program and the accompanying materials
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4 * are made available under the terms of the Eclipse Public License v1.0
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
5 * which accompanies this distribution, and is available at
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
6 * http://www.eclipse.org/legal/epl-v10.html
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
7 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
8 * Contributors:
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
9 * IBM Corporation - initial API and implementation
72
5899e0b43e5d porting notice
Frank Benoit <benoit@tionex.de>
parents: 71
diff changeset
10 * Port to the D programming language:
5899e0b43e5d porting notice
Frank Benoit <benoit@tionex.de>
parents: 71
diff changeset
11 * Frank Benoit <benoit@tionex.de>
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
12 *******************************************************************************/
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
13 module dwt.widgets.Menu;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
14
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
15 import dwt.DWT;
48
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
16 import dwt.internal.gtk.OS;
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
17 import dwt.events.MenuListener;
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
18 import dwt.events.HelpListener;
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
19 import dwt.graphics.Point;
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
20 import dwt.graphics.Rectangle;
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
21 import dwt.widgets.ImageList;
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
22 import dwt.widgets.TypedListener;
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
23 import dwt.widgets.Event;
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
24 import dwt.widgets.MenuItem;
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
25 import dwt.widgets.Widget;
30
5e5d1c9cffdb ATK, Control
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
26 import dwt.widgets.Control;
37
c86fc3d50cfa Decorations
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
27 import dwt.widgets.Decorations;
48
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
28 import dwt.widgets.Shell;
200
08789b28bdf3 import dwt.dwthelper.utils now explicit
Frank Benoit <benoit@tionex.de>
parents: 152
diff changeset
29 import dwt.dwthelper.utils;
30
5e5d1c9cffdb ATK, Control
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
30
48
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
31 import tango.stdc.stringz;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
32
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
33 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
34 * Instances of this class are user interface objects that contain
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
35 * menu items.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
36 * <dl>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
37 * <dt><b>Styles:</b></dt>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
38 * <dd>BAR, DROP_DOWN, POP_UP, NO_RADIO_GROUP</dd>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
39 * <dd>LEFT_TO_RIGHT, RIGHT_TO_LEFT</dd>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
40 * <dt><b>Events:</b></dt>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
41 * <dd>Help, Hide, Show </dd>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
42 * </dl>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
43 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
44 * Note: Only one of BAR, DROP_DOWN and POP_UP may be specified.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
45 * Only one of LEFT_TO_RIGHT or RIGHT_TO_LEFT may be specified.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
46 * </p><p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
47 * IMPORTANT: This class is <em>not</em> intended to be subclassed.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
48 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
49 */
48
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
50 public class Menu : Widget {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
51 int x, y;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
52 bool hasLocation;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
53 MenuItem cascade, selectedItem;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
54 Decorations parent;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
55 GtkWidget* imItem;
48
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
56 GtkWidget* imSeparator;
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
57 GtkIMContext* imHandle;
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
58 ImageList imageList;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
59
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
60 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
61 * Constructs a new instance of this class given its parent,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
62 * and sets the style for the instance so that the instance
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
63 * will be a popup menu on the given parent's shell.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
64 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
65 * @param parent a control which will be the parent of the new instance (cannot be null)
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
66 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
67 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
68 * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
69 * </ul>
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
70 * @exception DWTException <ul>
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
71 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
72 * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
73 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
74 *
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
75 * @see DWT#POP_UP
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
76 * @see Widget#checkSubclass
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
77 * @see Widget#getStyle
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
78 */
48
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
79 public this (Control parent) {
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
80 this (checkNull (parent).menuShell (), DWT.POP_UP);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
81 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
82
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
83 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
84 * Constructs a new instance of this class given its parent
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
85 * (which must be a <code>Decorations</code>) and a style value
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
86 * describing its behavior and appearance.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
87 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
88 * The style value is either one of the style constants defined in
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
89 * class <code>DWT</code> which is applicable to instances of this
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
90 * class, or must be built by <em>bitwise OR</em>'ing together
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
91 * (that is, using the <code>int</code> "|" operator) two or more
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
92 * of those <code>DWT</code> style constants. The class description
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
93 * lists the style constants that are applicable to the class.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
94 * Style bits are also inherited from superclasses.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
95 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
96 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
97 * @param parent a decorations control which will be the parent of the new instance (cannot be null)
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
98 * @param style the style of menu to construct
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
99 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
100 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
101 * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
102 * </ul>
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
103 * @exception DWTException <ul>
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
104 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
105 * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
106 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
107 *
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
108 * @see DWT#BAR
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
109 * @see DWT#DROP_DOWN
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
110 * @see DWT#POP_UP
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
111 * @see Widget#checkSubclass
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
112 * @see Widget#getStyle
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
113 */
48
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
114 public this (Decorations parent, int style) {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
115 super (parent, checkStyle (style));
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
116 this.parent = parent;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
117 createWidget (0);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
118 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
119
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
120 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
121 * Constructs a new instance of this class given its parent
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
122 * (which must be a <code>Menu</code>) and sets the style
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
123 * for the instance so that the instance will be a drop-down
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
124 * menu on the given parent's parent.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
125 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
126 * @param parentMenu a menu which will be the parent of the new instance (cannot be null)
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
127 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
128 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
129 * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
130 * </ul>
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
131 * @exception DWTException <ul>
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
132 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
133 * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
134 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
135 *
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
136 * @see DWT#DROP_DOWN
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
137 * @see Widget#checkSubclass
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
138 * @see Widget#getStyle
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
139 */
48
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
140 public this (Menu parentMenu) {
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
141 this (checkNull (parentMenu).parent, DWT.DROP_DOWN);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
142 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
143
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
144 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
145 * Constructs a new instance of this class given its parent
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
146 * (which must be a <code>MenuItem</code>) and sets the style
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
147 * for the instance so that the instance will be a drop-down
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
148 * menu on the given parent's parent menu.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
149 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
150 * @param parentItem a menu item which will be the parent of the new instance (cannot be null)
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
151 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
152 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
153 * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
154 * </ul>
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
155 * @exception DWTException <ul>
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
156 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
157 * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
158 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
159 *
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
160 * @see DWT#DROP_DOWN
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
161 * @see Widget#checkSubclass
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
162 * @see Widget#getStyle
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
163 */
48
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
164 public this (MenuItem parentItem) {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
165 this (checkNull (parentItem).parent);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
166 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
167
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
168 static Control checkNull (Control control) {
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
169 if (control is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
170 return control;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
171 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
172
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
173 static Menu checkNull (Menu menu) {
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
174 if (menu is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
175 return menu;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
176 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
177
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
178 static MenuItem checkNull (MenuItem item) {
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
179 if (item is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
180 return item;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
181 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
182
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
183 static int checkStyle (int style) {
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
184 return checkBits (style, DWT.POP_UP, DWT.BAR, DWT.DROP_DOWN, 0, 0, 0);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
185 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
186
48
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
187 void _setVisible (bool visible) {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
188 if (visible is OS.GTK_WIDGET_MAPPED (handle)) return;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
189 if (visible) {
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
190 sendEvent (DWT.Show);
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
191 if (getItemCount () !is 0) {
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
192 if ((OS.GTK_VERSION >= OS.buildVERSION (2, 8, 0))) {
240
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
193 /*
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
194 * Feature in GTK. ON_TOP shells will send out
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
195 * DWT.Deactivate whenever a context menu is shown.
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
196 * The fix is to prevent the menu from taking focus
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
197 * when it is being shown in an ON_TOP shell.
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
198 */
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
199 if ((parent._getShell ().style & DWT.ON_TOP) !is 0) {
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
200 OS.gtk_menu_shell_set_take_focus (cast(GtkMenuShell*)handle, false);
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
201 }
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
202 }
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
203 /*
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
204 * Bug in GTK. The timestamp passed into gtk_menu_popup is used
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
205 * to perform an X pointer grab. It cannot be zero, else the grab
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
206 * will fail. The fix is to ensure that the timestamp of the last
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
207 * event processed is used.
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
208 */
48
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
209 getDisplay().doMenuPositionProc( cast(GtkMenu*)handle, hasLocation );
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
210 } else {
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
211 sendEvent (DWT.Hide);
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
212 }
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
213 } else {
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
214 OS.gtk_menu_popdown (cast(GtkMenu*)handle);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
215 }
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
216 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
217
48
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
218 void addAccelerators (GtkAccelGroup* accelGroup) {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
219 MenuItem [] items = getItems ();
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
220 for (int i = 0; i < items.length; i++) {
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
221 MenuItem item = items[i];
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
222 item.addAccelerators (accelGroup);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
223 }
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
224 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
225
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
226 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
227 * Adds the listener to the collection of listeners who will
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
228 * be notified when menus are hidden or shown, by sending it
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
229 * one of the messages defined in the <code>MenuListener</code>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
230 * interface.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
231 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
232 * @param listener the listener which should be notified
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
233 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
234 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
235 * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
236 * </ul>
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
237 * @exception DWTException <ul>
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
238 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
239 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
240 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
241 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
242 * @see MenuListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
243 * @see #removeMenuListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
244 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
245 public void addMenuListener (MenuListener listener) {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
246 checkWidget();
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
247 if (listener is null) error (DWT.ERROR_NULL_ARGUMENT);
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
248 TypedListener typedListener = new TypedListener (listener);
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
249 addListener (DWT.Hide,typedListener);
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
250 addListener (DWT.Show,typedListener);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
251 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
252
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
253 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
254 * Adds the listener to the collection of listeners who will
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
255 * be notified when help events are generated for the control,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
256 * by sending it one of the messages defined in the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
257 * <code>HelpListener</code> interface.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
258 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
259 * @param listener the listener which should be notified
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
260 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
261 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
262 * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
263 * </ul>
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
264 * @exception DWTException <ul>
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
265 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
266 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
267 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
268 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
269 * @see HelpListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
270 * @see #removeHelpListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
271 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
272 public void addHelpListener (HelpListener listener) {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
273 checkWidget();
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
274 if (listener is null) error (DWT.ERROR_NULL_ARGUMENT);
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
275 TypedListener typedListener = new TypedListener (listener);
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
276 addListener (DWT.Help, typedListener);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
277 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
278
152
17f8449522fd overloads second walkthrough
Frank Benoit <benoit@tionex.de>
parents: 124
diff changeset
279 override void createHandle (int index) {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
280 state |= HANDLE;
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
281 if ((style & DWT.BAR) !is 0) {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
282 handle = OS.gtk_menu_bar_new ();
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
283 if (handle is null) error (DWT.ERROR_NO_HANDLES);
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
284 auto vboxHandle = parent.vboxHandle;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
285 OS.gtk_container_add (cast(GtkContainer*)vboxHandle, handle);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
286 OS.gtk_box_set_child_packing (cast(GtkBox*)vboxHandle, handle, false, true, 0, OS.GTK_PACK_START);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
287 } else {
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
288 handle = OS.gtk_menu_new ();
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
289 if (handle is null) error (DWT.ERROR_NO_HANDLES);
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
290 }
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
291 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
292
48
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
293 void createIMMenu (GtkIMContext* imHandle) {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
294 if (this.imHandle is imHandle) return;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
295 this.imHandle = imHandle;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
296 if (imHandle is null) {
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
297 if (imItem !is null) {
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
298 OS.gtk_widget_destroy (imItem);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
299 imItem = null;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
300 }
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
301 if (imSeparator !is null) {
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
302 OS.gtk_widget_destroy (imSeparator);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
303 imSeparator = null;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
304 }
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
305 return;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
306 }
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
307 if (imSeparator is null) {
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
308 imSeparator = OS.gtk_separator_menu_item_new ();
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
309 OS.gtk_widget_show (imSeparator);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
310 OS.gtk_menu_shell_insert (cast(GtkMenuShell*)handle, imSeparator, -1);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
311 }
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
312 if (imItem is null) {
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
313 char* buffer = toStringz( DWT.getMessage("SWT_InputMethods"));
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
314 imItem = OS.gtk_image_menu_item_new_with_label (buffer);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
315 OS.gtk_widget_show (imItem);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
316 OS.gtk_menu_shell_insert (cast(GtkMenuShell*)handle, imItem, -1);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
317 }
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
318 auto imSubmenu = OS.gtk_menu_new ();
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
319 OS.gtk_im_multicontext_append_menuitems (cast(GtkIMMulticontext*)imHandle, cast(GtkMenuShell*)imSubmenu);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
320 OS.gtk_menu_item_set_submenu (cast(GtkMenuItem*)imItem, imSubmenu);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
321 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
322
152
17f8449522fd overloads second walkthrough
Frank Benoit <benoit@tionex.de>
parents: 124
diff changeset
323 override void createWidget (int index) {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
324 checkOrientation (parent);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
325 super.createWidget (index);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
326 parent.addMenu (this);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
327 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
328
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
329 void fixMenus (Decorations newParent) {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
330 MenuItem [] items = getItems ();
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
331 for (int i=0; i<items.length; i++) {
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
332 items [i].fixMenus (newParent);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
333 }
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
334 parent.removeMenu (this);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
335 newParent.addMenu (this);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
336 this.parent = newParent;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
337 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
338
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
339 /*public*/ Rectangle getBounds () {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
340 checkWidget();
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
341 if (!OS.GTK_WIDGET_MAPPED (handle)) {
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
342 return new Rectangle (0, 0, 0, 0);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
343 }
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
344 auto window = OS.GTK_WIDGET_WINDOW (handle);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
345 int origin_x, origin_y;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
346 OS.gdk_window_get_origin (window, &origin_x, &origin_y);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
347 int x = origin_x + OS.GTK_WIDGET_X (handle);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
348 int y = origin_y + OS.GTK_WIDGET_Y (handle);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
349 int width = OS.GTK_WIDGET_WIDTH (handle);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
350 int height = OS.GTK_WIDGET_HEIGHT (handle);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
351 return new Rectangle (x, y, width, height);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
352 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
353
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
354 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
355 * Returns the default menu item or null if none has
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
356 * been previously set.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
357 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
358 * @return the default menu item.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
359 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
360 * </ul>
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
361 * @exception DWTException <ul>
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
362 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
363 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
364 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
365 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
366 public MenuItem getDefaultItem () {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
367 checkWidget();
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
368 return null;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
369 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
370
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
371 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
372 * Returns <code>true</code> if the receiver is enabled, and
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
373 * <code>false</code> otherwise. A disabled menu is typically
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
374 * not selectable from the user interface and draws with an
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
375 * inactive or "grayed" look.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
376 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
377 * @return the receiver's enabled state
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
378 *
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
379 * @exception DWTException <ul>
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
380 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
381 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
382 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
383 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
384 * @see #isEnabled
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
385 */
48
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
386 public bool getEnabled () {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
387 checkWidget();
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
388 return OS.GTK_WIDGET_SENSITIVE (handle);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
389 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
390
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
391 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
392 * Returns the item at the given, zero-relative index in the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
393 * receiver. Throws an exception if the index is out of range.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
394 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
395 * @param index the index of the item to return
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
396 * @return the item at the given index
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
397 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
398 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
399 * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
400 * </ul>
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
401 * @exception DWTException <ul>
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
402 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
403 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
404 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
405 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
406 public MenuItem getItem (int index) {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
407 checkWidget();
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
408 auto list = OS.gtk_container_get_children (cast(GtkContainer*)handle);
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
409 if (list is null) error (DWT.ERROR_CANNOT_GET_ITEM);
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
410 int count = OS.g_list_length (list);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
411 if (imSeparator !is null) count--;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
412 if (imItem !is null) count--;
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
413 if (!(0 <= index && index < count)) error (DWT.ERROR_INVALID_RANGE);
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
414 auto data = cast(GtkWidget*)OS.g_list_nth_data (list, index);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
415 OS.g_list_free (list);
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
416 if (data is null) error (DWT.ERROR_CANNOT_GET_ITEM);
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
417 return cast(MenuItem) display.getWidget (data);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
418 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
419
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
420 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
421 * Returns the number of items contained in the receiver.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
422 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
423 * @return the number of items
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
424 *
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
425 * @exception DWTException <ul>
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
426 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
427 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
428 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
429 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
430 public int getItemCount () {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
431 checkWidget();
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
432 auto list = OS.gtk_container_get_children (cast(GtkContainer*)handle);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
433 if (list is null) return 0;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
434 int count = OS.g_list_length (list);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
435 OS.g_list_free (list);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
436 if (imSeparator !is null) count--;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
437 if (imItem !is null) count--;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
438 return count;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
439 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
440
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
441 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
442 * Returns a (possibly empty) array of <code>MenuItem</code>s which
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
443 * are the items in the receiver.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
444 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
445 * Note: This is not the actual structure used by the receiver
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
446 * to maintain its list of items, so modifying the array will
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
447 * not affect the receiver.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
448 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
449 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
450 * @return the items in the receiver
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
451 *
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
452 * @exception DWTException <ul>
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
453 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
454 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
455 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
456 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
457 public MenuItem [] getItems () {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
458 checkWidget();
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
459 auto list = OS.gtk_container_get_children (cast(GtkContainer*)handle);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
460 if (list is null) return new MenuItem [0];
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
461 int count = OS.g_list_length (list);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
462 if (imSeparator !is null) count--;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
463 if (imItem !is null) count--;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
464 MenuItem [] items = new MenuItem [count];
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
465 int index = 0;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
466 for (int i=0; i<count; i++) {
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
467 auto data = cast(GtkWidget*)OS.g_list_nth_data (list, i);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
468 MenuItem item = cast(MenuItem) display.getWidget (data);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
469 if (item !is null) items [index++] = item;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
470 }
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
471 OS.g_list_free (list);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
472 if (index !is items.length) {
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
473 MenuItem [] newItems = new MenuItem[index];
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
474 System.arraycopy(items, 0, newItems, 0, index);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
475 items = newItems;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
476 }
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
477 return items;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
478 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
479
238
380bad9f6852 reverted char[] to String
Frank Benoit <benoit@tionex.de>
parents: 200
diff changeset
480 override String getNameText () {
380bad9f6852 reverted char[] to String
Frank Benoit <benoit@tionex.de>
parents: 200
diff changeset
481 String result = "";
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
482 MenuItem [] items = getItems ();
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
483 int length_ = items.length;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
484 if (length_ > 0) {
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
485 for (int i=0; i<length_-1; i++) {
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
486 result = result ~ items [i].getNameText() ~ ", ";
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
487 }
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
488 result = result ~ items [length_-1].getNameText ();
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
489 }
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
490 return result;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
491 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
492
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
493 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
494 * Returns the receiver's parent, which must be a <code>Decorations</code>.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
495 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
496 * @return the receiver's parent
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
497 *
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
498 * @exception DWTException <ul>
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
499 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
500 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
501 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
502 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
503 public Decorations getParent () {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
504 checkWidget();
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
505 return parent;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
506 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
507
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
508 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
509 * Returns the receiver's parent item, which must be a
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
510 * <code>MenuItem</code> or null when the receiver is a
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
511 * root.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
512 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
513 * @return the receiver's parent item
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
514 *
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
515 * @exception DWTException <ul>
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
516 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
517 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
518 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
519 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
520 public MenuItem getParentItem () {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
521 checkWidget();
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
522 return cascade;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
523 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
524
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
525 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
526 * Returns the receiver's parent item, which must be a
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
527 * <code>Menu</code> or null when the receiver is a
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
528 * root.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
529 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
530 * @return the receiver's parent item
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
531 *
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
532 * @exception DWTException <ul>
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
533 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
534 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
535 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
536 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
537 public Menu getParentMenu () {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
538 checkWidget();
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
539 if (cascade is null) return null;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
540 return cascade.getParent ();
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
541 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
542
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
543 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
544 * Returns the receiver's shell. For all controls other than
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
545 * shells, this simply returns the control's nearest ancestor
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
546 * shell. Shells return themselves, even if they are children
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
547 * of other shells.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
548 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
549 * @return the receiver's shell
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
550 *
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
551 * @exception DWTException <ul>
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
552 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
553 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
554 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
555 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
556 * @see #getParent
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
557 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
558 public Shell getShell () {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
559 checkWidget();
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
560 return parent.getShell ();
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
561 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
562
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
563 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
564 * Returns <code>true</code> if the receiver is visible, and
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
565 * <code>false</code> otherwise.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
566 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
567 * If one of the receiver's ancestors is not visible or some
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
568 * other condition makes the receiver not visible, this method
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
569 * may still indicate that it is considered visible even though
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
570 * it may not actually be showing.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
571 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
572 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
573 * @return the receiver's visibility state
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
574 *
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
575 * @exception DWTException <ul>
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
576 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
577 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
578 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
579 */
48
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
580 public bool getVisible () {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
581 checkWidget();
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
582 if ((style & DWT.POP_UP) !is 0) {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
583 Menu [] popups = display.popups;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
584 if (popups !is null) {
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
585 for (int i=0; i<popups.length; i++) {
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
586 if (popups [i] is this) return true;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
587 }
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
588 }
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
589 }
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
590 return OS.GTK_WIDGET_MAPPED (handle);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
591 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
592
48
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
593 override int /*long*/ gtk_hide (GtkWidget* widget) {
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
594 if ((style & DWT.POP_UP) !is 0) {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
595 display.activeShell = getShell ();
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
596 }
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
597 if (OS.GTK_VERSION >= OS.buildVERSION (2, 6, 0)) {
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
598 sendEvent (DWT.Hide);
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
599 } else {
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
600 /*
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
601 * Bug in GTK. In GTK 2.4 and earlier
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
602 * a crash could occur if a menu item
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
603 * was disposed within gtk_hide. The
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
604 * workaroud is to post the event instead
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
605 * of send it on these platforms
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
606 */
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
607 postEvent (DWT.Hide);
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
608 }
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
609 return 0;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
610 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
611
48
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
612 override int /*long*/ gtk_show (GtkWidget* widget) {
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
613 if ((style & DWT.POP_UP) !is 0) {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
614 display.activeShell = getShell ();
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
615 return 0;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
616 }
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
617 sendEvent (DWT.Show);
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
618 return 0;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
619 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
620
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
621
48
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
622 override int /*long*/ gtk_show_help (GtkWidget* widget, int /*long*/ helpType) {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
623 if (sendHelpEvent (helpType)) {
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
624 OS.gtk_menu_shell_deactivate (cast(GtkMenuShell*)handle);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
625 return 1;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
626 }
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
627 return 0;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
628 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
629
152
17f8449522fd overloads second walkthrough
Frank Benoit <benoit@tionex.de>
parents: 124
diff changeset
630 override void hookEvents () {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
631 super.hookEvents ();
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
632 OS.g_signal_connect_closure_by_id (handle, display.signalIds [SHOW], 0, display.closures [SHOW], false);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
633 OS.g_signal_connect_closure_by_id (handle, display.signalIds [HIDE], 0, display.closures [HIDE], false);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
634 OS.g_signal_connect_closure_by_id (handle, display.signalIds [SHOW_HELP], 0, display.closures [SHOW_HELP], false);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
635 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
636
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
637 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
638 * Searches the receiver's list starting at the first item
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
639 * (index 0) until an item is found that is equal to the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
640 * argument, and returns the index of that item. If no item
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
641 * is found, returns -1.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
642 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
643 * @param item the search item
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
644 * @return the index of the item
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
645 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
646 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
647 * <li>ERROR_NULL_ARGUMENT - if the item is null</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
648 * </ul>
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
649 * @exception DWTException <ul>
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
650 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
651 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
652 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
653 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
654 public int indexOf (MenuItem item) {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
655 checkWidget();
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
656 if (item is null) error (DWT.ERROR_NULL_ARGUMENT);
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
657 MenuItem [] items = getItems ();
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
658 for (int i=0; i<items.length; i++) {
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
659 if (items [i] is item) return i;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
660 }
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
661 return -1;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
662 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
663
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
664 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
665 * Returns <code>true</code> if the receiver is enabled and all
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
666 * of the receiver's ancestors are enabled, and <code>false</code>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
667 * otherwise. A disabled menu is typically not selectable from the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
668 * user interface and draws with an inactive or "grayed" look.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
669 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
670 * @return the receiver's enabled state
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
671 *
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
672 * @exception DWTException <ul>
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
673 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
674 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
675 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
676 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
677 * @see #getEnabled
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
678 */
48
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
679 public bool isEnabled () {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
680 checkWidget();
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
681 Menu parentMenu = getParentMenu ();
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
682 if (parentMenu is null) {
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
683 return getEnabled () && parent.isEnabled ();
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
684 }
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
685 return getEnabled () && parentMenu.isEnabled ();
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
686 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
687
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
688 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
689 * Returns <code>true</code> if the receiver is visible and all
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
690 * of the receiver's ancestors are visible and <code>false</code>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
691 * otherwise.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
692 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
693 * @return the receiver's visibility state
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
694 *
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
695 * @exception DWTException <ul>
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
696 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
697 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
698 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
699 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
700 * @see #getVisible
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
701 */
48
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
702 public bool isVisible () {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
703 checkWidget();
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
704 return getVisible ();
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
705 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
706
48
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
707 override void menuPositionProc (GtkMenu* menu, int* x, int* y, int* push_in, void* user_data) {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
708 /*
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
709 * Feature in GTK. The menu position function sets the position of the
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
710 * top-left pixel of the menu. If the menu would be off-screen, GTK will
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
711 * add a scroll arrow at the bottom and position the first menu entry at
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
712 * the specified position. The fix is to flip the menu location to be
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
713 * completely inside the screen.
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
714 *
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
715 * NOTE: This code doesn't work for multiple monitors.
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
716 */
124
11b0a1324732 Fix various stack access from anon-class
Frank Benoit <benoit@tionex.de>
parents: 72
diff changeset
717 GtkRequisition requisition;
11b0a1324732 Fix various stack access from anon-class
Frank Benoit <benoit@tionex.de>
parents: 72
diff changeset
718 OS.gtk_widget_size_request (cast(GtkWidget*)menu, &requisition);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
719 int screenHeight = OS.gdk_screen_height ();
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
720 int reqy = this.y;
240
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
721 if (reqy + requisition.height > screenHeight) {
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
722 reqy = Math.max (0, reqy - requisition.height);
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
723 }
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
724 int screenWidth = OS.gdk_screen_width ();
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
725 int reqx = this.x;
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
726 if ((style & DWT.RIGHT_TO_LEFT) !is 0) {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
727 if (reqx - requisition.width >= 0) reqx -= requisition.width;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
728 } else {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
729 if (reqx + requisition.width > screenWidth) reqx -= requisition.width;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
730 }
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
731 if (x !is null) *x = reqx;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
732 if (y !is null) *y = reqy;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
733 if (push_in !is null) *push_in = 1;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
734 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
735
152
17f8449522fd overloads second walkthrough
Frank Benoit <benoit@tionex.de>
parents: 124
diff changeset
736 override void releaseChildren (bool destroy) {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
737 MenuItem [] items = getItems ();
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
738 for (int i=0; i<items.length; i++) {
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
739 MenuItem item = items [i];
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
740 if (item !is null && !item.isDisposed ()) {
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
741 item.release (false);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
742 }
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
743 }
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
744 super.releaseChildren (destroy);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
745 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
746
152
17f8449522fd overloads second walkthrough
Frank Benoit <benoit@tionex.de>
parents: 124
diff changeset
747 override void releaseParent () {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
748 super.releaseParent ();
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
749 if (cascade !is null) cascade.setMenu (null);
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
750 if ((style & DWT.BAR) !is 0 && this is parent.menuBar) {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
751 parent.setMenuBar (null);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
752 } else {
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
753 if ((style & DWT.POP_UP) !is 0) {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
754 display.removePopup (this);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
755 }
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
756 }
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
757 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
758
152
17f8449522fd overloads second walkthrough
Frank Benoit <benoit@tionex.de>
parents: 124
diff changeset
759 override void releaseWidget () {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
760 super.releaseWidget ();
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
761 if (parent !is null) parent.removeMenu (this);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
762 parent = null;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
763 cascade = null;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
764 imItem = null;
48
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
765 imSeparator = null;
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
766 imHandle = null;
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
767 if (imageList !is null) imageList.dispose ();
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
768 imageList = null;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
769 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
770
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
771 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
772 * Removes the listener from the collection of listeners who will
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
773 * be notified when the menu events are generated for the control.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
774 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
775 * @param listener the listener which should no longer be notified
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
776 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
777 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
778 * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
779 * </ul>
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
780 * @exception DWTException <ul>
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
781 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
782 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
783 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
784 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
785 * @see MenuListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
786 * @see #addMenuListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
787 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
788 public void removeMenuListener (MenuListener listener) {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
789 checkWidget();
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
790 if (listener is null) error (DWT.ERROR_NULL_ARGUMENT);
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
791 if (eventTable is null) return;
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
792 eventTable.unhook (DWT.Hide, listener);
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
793 eventTable.unhook (DWT.Show, listener);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
794 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
795
48
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
796 void removeAccelerators (GtkAccelGroup* accelGroup) {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
797 MenuItem [] items = getItems ();
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
798 for (int i = 0; i < items.length; i++) {
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
799 MenuItem item = items[i];
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
800 item.removeAccelerators (accelGroup);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
801 }
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
802 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
803
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
804 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
805 * Removes the listener from the collection of listeners who will
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
806 * be notified when the help events are generated for the control.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
807 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
808 * @param listener the listener which should no longer be notified
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
809 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
810 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
811 * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
812 * </ul>
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
813 * @exception DWTException <ul>
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
814 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
815 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
816 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
817 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
818 * @see HelpListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
819 * @see #addHelpListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
820 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
821 public void removeHelpListener (HelpListener listener) {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
822 checkWidget();
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
823 if (listener is null) error (DWT.ERROR_NULL_ARGUMENT);
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
824 if (eventTable is null) return;
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
825 eventTable.unhook (DWT.Help, listener);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
826 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
827
48
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
828 bool sendHelpEvent (int /*long*/ helpType) {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
829 if (selectedItem !is null && !selectedItem.isDisposed()) {
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
830 if (selectedItem.hooks (DWT.Help)) {
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
831 selectedItem.postEvent (DWT.Help);
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
832 return true;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
833 }
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
834 }
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
835 if (hooks (DWT.Help)) {
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
836 postEvent (DWT.Help);
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
837 return true;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
838 }
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
839 return parent.sendHelpEvent (helpType);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
840 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
841
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
842 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
843 * Sets the default menu item to the argument or removes
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
844 * the default emphasis when the argument is <code>null</code>.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
845 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
846 * @param item the default menu item or null
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
847 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
848 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
849 * <li>ERROR_INVALID_ARGUMENT - if the menu item has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
850 * </ul>
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
851 * @exception DWTException <ul>
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
852 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
853 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
854 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
855 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
856 public void setDefaultItem (MenuItem item) {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
857 checkWidget();
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
858 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
859
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
860 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
861 * Enables the receiver if the argument is <code>true</code>,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
862 * and disables it otherwise. A disabled menu is typically
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
863 * not selectable from the user interface and draws with an
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
864 * inactive or "grayed" look.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
865 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
866 * @param enabled the new enabled state
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
867 *
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
868 * @exception DWTException <ul>
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
869 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
870 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
871 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
872 */
48
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
873 public void setEnabled (bool enabled) {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
874 checkWidget();
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
875 if (enabled) {
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
876 OS.GTK_WIDGET_SET_FLAGS (handle, OS.GTK_SENSITIVE);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
877 } else {
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
878 OS.GTK_WIDGET_UNSET_FLAGS (handle, OS.GTK_SENSITIVE);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
879 }
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
880 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
881
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
882 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
883 * Sets the location of the receiver, which must be a popup,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
884 * to the point specified by the arguments which are relative
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
885 * to the display.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
886 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
887 * Note that this is different from most widgets where the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
888 * location of the widget is relative to the parent.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
889 * </p><p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
890 * Note that the platform window manager ultimately has control
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
891 * over the location of popup menus.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
892 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
893 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
894 * @param x the new x coordinate for the receiver
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
895 * @param y the new y coordinate for the receiver
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
896 *
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
897 * @exception DWTException <ul>
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
898 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
899 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
900 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
901 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
902 public void setLocation (int x, int y) {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
903 checkWidget();
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
904 if ((style & (DWT.BAR | DWT.DROP_DOWN)) !is 0) return;
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
905 this.x = x;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
906 this.y = y;
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
907 hasLocation = true;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
908 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
909
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
910 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
911 * Sets the location of the receiver, which must be a popup,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
912 * to the point specified by the argument which is relative
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
913 * to the display.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
914 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
915 * Note that this is different from most widgets where the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
916 * location of the widget is relative to the parent.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
917 * </p><p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
918 * Note that the platform window manager ultimately has control
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
919 * over the location of popup menus.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
920 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
921 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
922 * @param location the new location for the receiver
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
923 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
924 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
925 * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
926 * </ul>
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
927 * @exception DWTException <ul>
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
928 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
929 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
930 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
931 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
932 * @since 2.1
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
933 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
934 public void setLocation (Point location) {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
935 checkWidget();
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
936 if (location is null) error (DWT.ERROR_NULL_ARGUMENT);
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
937 setLocation (location.x, location.y);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
938 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
939
152
17f8449522fd overloads second walkthrough
Frank Benoit <benoit@tionex.de>
parents: 124
diff changeset
940 override void setOrientation() {
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
941 if ((parent.style & DWT.RIGHT_TO_LEFT) !is 0) {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
942 if (handle !is null) OS.gtk_widget_set_direction (handle, OS.GTK_TEXT_DIR_RTL);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
943 }
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
944 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
945
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
946 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
947 * Marks the receiver as visible if the argument is <code>true</code>,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
948 * and marks it invisible otherwise.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
949 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
950 * If one of the receiver's ancestors is not visible or some
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
951 * other condition makes the receiver not visible, marking
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
952 * it visible may not actually cause it to be displayed.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
953 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
954 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
955 * @param visible the new visibility state
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
956 *
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
957 * @exception DWTException <ul>
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
958 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
959 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
960 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
961 */
48
8e9ea24111fd Menu, MenuItem
Frank Benoit <benoit@tionex.de>
parents: 37
diff changeset
962 public void setVisible (bool visible) {
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
963 checkWidget();
71
295b29fc7d13 Renamed SWT to DWT
Frank Benoit <benoit@tionex.de>
parents: 59
diff changeset
964 if ((style & (DWT.BAR | DWT.DROP_DOWN)) !is 0) return;
59
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
965 if (visible) {
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
966 display.addPopup (this);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
967 } else {
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
968 display.removePopup (this);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
969 _setVisible (false);
8cec8f536af3 All D sources complete gvim retab (4 spaces), bug with Composite moveAbove/moveBelow fixed.
Frank Benoit <benoit@tionex.de>
parents: 48
diff changeset
970 }
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
971 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
972 }