annotate dwt/widgets/Shell.d @ 42:787b5413b0ce

accessibility package
author Frank Benoit <benoit@tionex.de>
date Fri, 11 Jan 2008 05:07:22 +0100
parents 7fb1ab011933
children 8f049b136add
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1 /*******************************************************************************
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
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
10 *******************************************************************************/
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
11 module dwt.widgets.Shell;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
12
30
5e5d1c9cffdb ATK, Control
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
13 import dwt.widgets.Composite;
5e5d1c9cffdb ATK, Control
Frank Benoit <benoit@tionex.de>
parents: 27
diff changeset
14 import dwt.widgets.Control;
33
27324bbbac70 changed to regenerated BCD bindings
Frank Benoit <benoit@tionex.de>
parents: 30
diff changeset
15 import dwt.internal.c.gtk;
26
09f5459a5014 Display in work
Frank Benoit <benoit@tionex.de>
parents: 25
diff changeset
16
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
17 import dwt.SWT;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
18 import dwt.internal.gtk.OS;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
19 import dwt.events.ShellListener;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
20 import dwt.graphics.Cursor;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
21 import dwt.graphics.Image;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
22 import dwt.graphics.Point;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
23 import dwt.graphics.Rectangle;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
24 import dwt.graphics.Region;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
25 import dwt.internal.Converter;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
26 import dwt.internal.SWTEventListener;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
27 import dwt.widgets.Composite;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
28 import dwt.widgets.Control;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
29 import dwt.widgets.Decorations;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
30 import dwt.widgets.Display;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
31 import dwt.widgets.Event;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
32 import dwt.widgets.EventTable;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
33 import dwt.widgets.Layout;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
34 import dwt.widgets.Listener;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
35 import dwt.widgets.Menu;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
36 import dwt.widgets.Monitor;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
37 import dwt.widgets.TypedListener;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
38 import dwt.widgets.Widget;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
39
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
40 import Unicode = tango.text.Unicode;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
41 import tango.stdc.stringz;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
42
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
43 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
44 * Instances of this class represent the "windows"
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
45 * which the desktop or "window manager" is managing.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
46 * Instances that do not have a parent (that is, they
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
47 * are built using the constructor, which takes a
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
48 * <code>Display</code> as the argument) are described
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
49 * as <em>top level</em> shells. Instances that do have
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
50 * a parent are described as <em>secondary</em> or
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
51 * <em>dialog</em> shells.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
52 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
53 * Instances are always displayed in one of the maximized,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
54 * minimized or normal states:
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
55 * <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
56 * <li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
57 * When an instance is marked as <em>maximized</em>, the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
58 * window manager will typically resize it to fill the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
59 * entire visible area of the display, and the instance
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
60 * is usually put in a state where it can not be resized
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
61 * (even if it has style <code>RESIZE</code>) until it is
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
62 * no longer maximized.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
63 * </li><li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
64 * When an instance is in the <em>normal</em> state (neither
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
65 * maximized or minimized), its appearance is controlled by
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
66 * the style constants which were specified when it was created
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
67 * and the restrictions of the window manager (see below).
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
68 * </li><li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
69 * When an instance has been marked as <em>minimized</em>,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
70 * its contents (client area) will usually not be visible,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
71 * and depending on the window manager, it may be
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
72 * "iconified" (that is, replaced on the desktop by a small
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
73 * simplified representation of itself), relocated to a
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
74 * distinguished area of the screen, or hidden. Combinations
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
75 * of these changes are also possible.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
76 * </li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
77 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
78 * </p><p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
79 * The <em>modality</em> of an instance may be specified using
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
80 * style bits. The modality style bits are used to determine
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
81 * whether input is blocked for other shells on the display.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
82 * The <code>PRIMARY_MODAL</code> style allows an instance to block
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
83 * input to its parent. The <code>APPLICATION_MODAL</code> style
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
84 * allows an instance to block input to every other shell in the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
85 * display. The <code>SYSTEM_MODAL</code> style allows an instance
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
86 * to block input to all shells, including shells belonging to
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
87 * different applications.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
88 * </p><p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
89 * Note: The styles supported by this class are treated
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
90 * as <em>HINT</em>s, since the window manager for the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
91 * desktop on which the instance is visible has ultimate
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
92 * control over the appearance and behavior of decorations
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
93 * and modality. For example, some window managers only
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
94 * support resizable windows and will always assume the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
95 * RESIZE style, even if it is not set. In addition, if a
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
96 * modality style is not supported, it is "upgraded" to a
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
97 * more restrictive modality style that is supported. For
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
98 * example, if <code>PRIMARY_MODAL</code> is not supported,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
99 * it would be upgraded to <code>APPLICATION_MODAL</code>.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
100 * A modality style may also be "downgraded" to a less
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
101 * restrictive style. For example, most operating systems
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
102 * no longer support <code>SYSTEM_MODAL</code> because
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
103 * it can freeze up the desktop, so this is typically
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
104 * downgraded to <code>APPLICATION_MODAL</code>.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
105 * <dl>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
106 * <dt><b>Styles:</b></dt>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
107 * <dd>BORDER, CLOSE, MIN, MAX, NO_TRIM, RESIZE, TITLE, ON_TOP, TOOL</dd>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
108 * <dd>APPLICATION_MODAL, MODELESS, PRIMARY_MODAL, SYSTEM_MODAL</dd>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
109 * <dt><b>Events:</b></dt>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
110 * <dd>Activate, Close, Deactivate, Deiconify, Iconify</dd>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
111 * </dl>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
112 * Class <code>SWT</code> provides two "convenience constants"
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
113 * for the most commonly required style combinations:
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
114 * <dl>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
115 * <dt><code>SHELL_TRIM</code></dt>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
116 * <dd>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
117 * the result of combining the constants which are required
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
118 * to produce a typical application top level shell: (that
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
119 * is, <code>CLOSE | TITLE | MIN | MAX | RESIZE</code>)
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
120 * </dd>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
121 * <dt><code>DIALOG_TRIM</code></dt>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
122 * <dd>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
123 * the result of combining the constants which are required
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
124 * to produce a typical application dialog shell: (that
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
125 * is, <code>TITLE | CLOSE | BORDER</code>)
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
126 * </dd>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
127 * </dl>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
128 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
129 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
130 * Note: Only one of the styles APPLICATION_MODAL, MODELESS,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
131 * PRIMARY_MODAL and SYSTEM_MODAL may be specified.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
132 * </p><p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
133 * IMPORTANT: This class is not intended to be subclassed.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
134 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
135 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
136 * @see Decorations
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
137 * @see SWT
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
138 */
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
139 public class Shell : Decorations {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
140 GtkWidget* shellHandle, tooltipsHandle, tooltipWindow;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
141 bool mapped, moved, resized, opened;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
142 int oldX, oldY, oldWidth, oldHeight;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
143 int minWidth, minHeight;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
144 Control lastActive;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
145 Region region;
42
787b5413b0ce accessibility package
Frank Benoit <benoit@tionex.de>
parents: 40
diff changeset
146 CallbackData filterProcCallbackData;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
147
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
148 static final int MAXIMUM_TRIM = 128;
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 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
151 * Constructs a new instance of this class. This is equivalent
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
152 * to calling <code>Shell((Display) null)</code>.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
153 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
154 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
155 * <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
156 * <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
157 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
158 */
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
159 public this () {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
160 this (cast(Display) null);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
161 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
162 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
163 * Constructs a new instance of this class given only the style
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
164 * value describing its behavior and appearance. This is equivalent
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
165 * to calling <code>Shell((Display) null, style)</code>.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
166 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
167 * The style value is either one of the style constants defined in
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
168 * class <code>SWT</code> which is applicable to instances of this
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
169 * 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
170 * (that is, using the <code>int</code> "|" operator) two or more
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
171 * of those <code>SWT</code> style constants. The class description
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
172 * 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
173 * 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
174 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
175 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
176 * @param style the style of control to construct
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 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
179 * <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
180 * <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
181 * </ul>
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 * @see SWT#BORDER
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
184 * @see SWT#CLOSE
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
185 * @see SWT#MIN
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
186 * @see SWT#MAX
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
187 * @see SWT#RESIZE
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
188 * @see SWT#TITLE
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
189 * @see SWT#NO_TRIM
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
190 * @see SWT#SHELL_TRIM
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
191 * @see SWT#DIALOG_TRIM
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
192 * @see SWT#MODELESS
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
193 * @see SWT#PRIMARY_MODAL
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
194 * @see SWT#APPLICATION_MODAL
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
195 * @see SWT#SYSTEM_MODAL
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
196 */
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
197 public this (int style) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
198 this (cast(Display) null, style);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
199 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
200
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
201 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
202 * Constructs a new instance of this class given only the display
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
203 * to create it on. It is created with style <code>SWT.SHELL_TRIM</code>.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
204 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
205 * Note: Currently, null can be passed in for the display argument.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
206 * This has the effect of creating the shell on the currently active
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
207 * display if there is one. If there is no current display, the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
208 * shell is created on a "default" display. <b>Passing in null as
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
209 * the display argument is not considered to be good coding style,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
210 * and may not be supported in a future release of SWT.</b>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
211 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
212 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
213 * @param display the display to create the shell on
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
214 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
215 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
216 * <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
217 * <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
218 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
219 */
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
220 public this (Display display) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
221 this (display, SWT.SHELL_TRIM);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
222 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
223 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
224 * Constructs a new instance of this class given the display
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
225 * to create it on and a style value describing its behavior
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
226 * and appearance.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
227 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
228 * The style value is either one of the style constants defined in
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
229 * class <code>SWT</code> which is applicable to instances of this
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
230 * 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
231 * (that is, using the <code>int</code> "|" operator) two or more
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
232 * of those <code>SWT</code> style constants. The class description
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
233 * 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
234 * 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
235 * </p><p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
236 * Note: Currently, null can be passed in for the display argument.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
237 * This has the effect of creating the shell on the currently active
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
238 * display if there is one. If there is no current display, the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
239 * shell is created on a "default" display. <b>Passing in null as
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
240 * the display argument is not considered to be good coding style,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
241 * and may not be supported in a future release of SWT.</b>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
242 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
243 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
244 * @param display the display to create the shell on
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
245 * @param style the style of control to construct
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
246 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
247 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
248 * <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
249 * <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
250 * </ul>
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 * @see SWT#BORDER
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
253 * @see SWT#CLOSE
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
254 * @see SWT#MIN
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
255 * @see SWT#MAX
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
256 * @see SWT#RESIZE
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
257 * @see SWT#TITLE
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
258 * @see SWT#NO_TRIM
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
259 * @see SWT#SHELL_TRIM
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
260 * @see SWT#DIALOG_TRIM
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
261 * @see SWT#MODELESS
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
262 * @see SWT#PRIMARY_MODAL
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
263 * @see SWT#APPLICATION_MODAL
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
264 * @see SWT#SYSTEM_MODAL
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
265 */
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
266 public this (Display display, int style) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
267 this (display, null, style, null, false);
25
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
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
270 this (Display display, Shell parent, int style, GtkWidget* handle, bool embedded) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
271 super ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
272 checkSubclass ();
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
273 if (display is null) display = Display.getCurrent ();
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
274 if (display is null) display = Display.getDefault ();
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
275 if (!display.isValidThread ()) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
276 error (SWT.ERROR_THREAD_INVALID_ACCESS);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
277 }
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
278 if (parent !is null && parent.isDisposed ()) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
279 error (SWT.ERROR_INVALID_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
280 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
281 this.style = checkStyle (style);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
282 this.parent = parent;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
283 this.display = display;
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
284 if (handle !is null) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
285 if (embedded) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
286 this.handle = handle;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
287 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
288 shellHandle = handle;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
289 state |= FOREIGN_HANDLE;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
290 }
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 createWidget (0);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
293 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
294
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
295 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
296 * Constructs a new instance of this class given only its
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
297 * parent. It is created with style <code>SWT.DIALOG_TRIM</code>.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
298 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
299 * Note: Currently, null can be passed in for the parent.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
300 * This has the effect of creating the shell on the currently active
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
301 * display if there is one. If there is no current display, the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
302 * shell is created on a "default" display. <b>Passing in null as
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
303 * the parent is not considered to be good coding style,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
304 * and may not be supported in a future release of SWT.</b>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
305 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
306 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
307 * @param parent a shell which will be the parent of the new instance
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
308 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
309 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
310 * <li>ERROR_INVALID_ARGUMENT - if the parent is disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
311 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
312 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
313 * <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
314 * <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
315 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
316 */
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
317 public this (Shell parent) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
318 this (parent, SWT.DIALOG_TRIM);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
319 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
320
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 * 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
323 * and a style value describing its behavior and appearance.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
324 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
325 * The style value is either one of the style constants defined in
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
326 * class <code>SWT</code> which is applicable to instances of this
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
327 * 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
328 * (that is, using the <code>int</code> "|" operator) two or more
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
329 * of those <code>SWT</code> style constants. The class description
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
330 * 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
331 * 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
332 * </p><p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
333 * Note: Currently, null can be passed in for the parent.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
334 * This has the effect of creating the shell on the currently active
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
335 * display if there is one. If there is no current display, the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
336 * shell is created on a "default" display. <b>Passing in null as
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
337 * the parent is not considered to be good coding style,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
338 * and may not be supported in a future release of SWT.</b>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
339 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
340 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
341 * @param parent a shell which will be the parent of the new instance
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
342 * @param style the style of control to construct
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
343 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
344 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
345 * <li>ERROR_INVALID_ARGUMENT - if the parent is disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
346 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
347 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
348 * <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
349 * <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
350 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
351 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
352 * @see SWT#BORDER
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
353 * @see SWT#CLOSE
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
354 * @see SWT#MIN
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
355 * @see SWT#MAX
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
356 * @see SWT#RESIZE
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
357 * @see SWT#TITLE
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
358 * @see SWT#NO_TRIM
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
359 * @see SWT#SHELL_TRIM
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
360 * @see SWT#DIALOG_TRIM
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
361 * @see SWT#ON_TOP
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
362 * @see SWT#TOOL
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
363 * @see SWT#MODELESS
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
364 * @see SWT#PRIMARY_MODAL
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
365 * @see SWT#APPLICATION_MODAL
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
366 * @see SWT#SYSTEM_MODAL
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
367 */
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
368 public this (Shell parent, int style) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
369 this (parent !is null ? parent.display : null, parent, style, null, false);
25
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
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
372 public static Shell gtk_new (Display display, GtkWidget* handle) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
373 return new Shell (display, null, SWT.NO_TRIM, handle, true);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
374 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
375
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
376 public static Shell internal_new (Display display, GtkWidget* handle) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
377 return new Shell (display, null, SWT.NO_TRIM, handle, false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
378 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
379
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
380 static int checkStyle (int style) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
381 style = Decorations.checkStyle (style);
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
382 if ((style & SWT.ON_TOP) !is 0) style &= ~SWT.SHELL_TRIM;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
383 int mask = SWT.SYSTEM_MODAL | SWT.APPLICATION_MODAL | SWT.PRIMARY_MODAL;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
384 int bits = style & ~mask;
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
385 if ((style & SWT.SYSTEM_MODAL) !is 0) return bits | SWT.SYSTEM_MODAL;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
386 if ((style & SWT.APPLICATION_MODAL) !is 0) return bits | SWT.APPLICATION_MODAL;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
387 if ((style & SWT.PRIMARY_MODAL) !is 0) return bits | SWT.PRIMARY_MODAL;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
388 return bits;
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 * 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
393 * be notified when operations are performed on the receiver,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
394 * by sending the listener 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
395 * <code>ShellListener</code> interface.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
396 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
397 * @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
398 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
399 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
400 * <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
401 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
402 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
403 * <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
404 * <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
405 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
406 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
407 * @see ShellListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
408 * @see #removeShellListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
409 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
410 public void addShellListener (ShellListener listener) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
411 checkWidget();
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
412 if (listener is null) error (SWT.ERROR_NULL_ARGUMENT);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
413 TypedListener typedListener = new TypedListener (listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
414 addListener (SWT.Close,typedListener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
415 addListener (SWT.Iconify,typedListener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
416 addListener (SWT.Deiconify,typedListener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
417 addListener (SWT.Activate, typedListener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
418 addListener (SWT.Deactivate, typedListener);
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 void adjustTrim () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
422 if (display.ignoreTrim) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
423 int width = OS.GTK_WIDGET_WIDTH (shellHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
424 int height = OS.GTK_WIDGET_HEIGHT (shellHandle);
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
425 auto window = OS.GTK_WIDGET_WINDOW (shellHandle);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
426 GdkRectangle* rect = new GdkRectangle ();
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
427 OS.gdk_window_get_frame_extents (window, rect);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
428 int trimWidth = Math.max (0, rect.width - width);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
429 int trimHeight = Math.max (0, rect.height - height);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
430 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
431 * Bug in GTK. gdk_window_get_frame_extents() fails for various window
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
432 * managers, causing a large incorrect value to be returned as the trim.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
433 * The fix is to ignore the returned trim values if they are too large.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
434 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
435 if (trimWidth > MAXIMUM_TRIM || trimHeight > MAXIMUM_TRIM) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
436 display.ignoreTrim = true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
437 return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
438 }
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
439 bool hasTitle = false, hasResize = false, hasBorder = false;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
440 if ((style & SWT.NO_TRIM) is 0) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
441 hasTitle = (style & (SWT.MIN | SWT.MAX | SWT.TITLE | SWT.MENU)) !is 0;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
442 hasResize = (style & SWT.RESIZE) !is 0;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
443 hasBorder = (style & SWT.BORDER) !is 0;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
444 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
445 if (hasTitle) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
446 if (hasResize) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
447 display.titleResizeTrimWidth = trimWidth;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
448 display.titleResizeTrimHeight = trimHeight;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
449 return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
450 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
451 if (hasBorder) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
452 display.titleBorderTrimWidth = trimWidth;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
453 display.titleBorderTrimHeight = trimHeight;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
454 return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
455 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
456 display.titleTrimWidth = trimWidth;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
457 display.titleTrimHeight = trimHeight;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
458 return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
459 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
460 if (hasResize) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
461 display.resizeTrimWidth = trimWidth;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
462 display.resizeTrimHeight = trimHeight;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
463 return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
464 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
465 if (hasBorder) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
466 display.borderTrimWidth = trimWidth;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
467 display.borderTrimHeight = trimHeight;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
468 return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
469 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
470 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
471
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
472 void bringToTop (bool force) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
473 if (!OS.GTK_WIDGET_VISIBLE (shellHandle)) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
474 Display display = this.display;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
475 Shell activeShell = display.activeShell;
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
476 if (activeShell is this) return;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
477 if (!force) {
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
478 if (activeShell is null) return;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
479 if (!display.activePending) {
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
480 auto focusHandle = OS.gtk_window_get_focus (cast(GtkWindow*)activeShell.shellHandle);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
481 if (focusHandle !is null && !OS.GTK_WIDGET_HAS_FOCUS (focusHandle)) return;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
482 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
483 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
484 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
485 * Bug in GTK. When a shell that is not managed by the window
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
486 * manage is given focus, GTK gets stuck in "focus follows pointer"
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
487 * mode when the pointer is within the shell and its parent when
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
488 * the shell is hidden or disposed. The fix is to use XSetInputFocus()
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
489 * to assign focus when ever the active shell has not managed by
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
490 * the window manager.
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 * NOTE: This bug is fixed in GTK+ 2.6.8 and above.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
493 */
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
494 bool xFocus = false;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
495 if (activeShell !is null) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
496 if (OS.GTK_VERSION < OS.buildVERSION (2, 6, 8)) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
497 xFocus = activeShell.isUndecorated ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
498 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
499 display.activeShell = null;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
500 display.activePending = true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
501 }
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 * Feature in GTK. When the shell is an override redirect
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
504 * window, gdk_window_focus() does not give focus to the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
505 * window. The fix is to use XSetInputFocus() to force
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
506 * the focus.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
507 */
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
508 auto window = OS.GTK_WIDGET_WINDOW (shellHandle);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
509 if ((xFocus || (style & SWT.ON_TOP) !is 0) && OS.GDK_WINDOWING_X11 ()) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
510 auto xDisplay = OS.gdk_x11_drawable_get_xdisplay (window);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
511 auto xWindow = OS.gdk_x11_drawable_get_xid (window);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
512 OS.gdk_error_trap_push ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
513 /* Use CurrentTime instead of the last event time to ensure that the shell becomes active */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
514 OS.XSetInputFocus (xDisplay, xWindow, OS.RevertToParent, OS.CurrentTime);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
515 OS.gdk_error_trap_pop ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
516 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
517 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
518 * Bug in metacity. Calling gdk_window_focus() with a timestamp more
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
519 * recent than the last user interaction time can cause windows not
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
520 * to come forward in versions > 2.10.0. The fix is to use the last
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
521 * user event time.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
522 */
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
523 if ( Unicode.toLower( display.windowManager ) ==/*eq*/ "metacity") {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
524 OS.gdk_window_focus (window, display.lastUserEventTime);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
525 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
526 OS.gdk_window_focus (window, OS.GDK_CURRENT_TIME);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
527 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
528 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
529 display.activeShell = this;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
530 display.activePending = true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
531 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
532
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
533 void checkBorder () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
534 /* Do nothing */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
535 }
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 void checkOpen () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
538 if (!opened) resized = false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
539 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
540
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
541 override GtkStyle* childStyle () {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
542 return null;
25
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
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
545 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
546 * Requests that the window manager close the receiver in
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
547 * the same way it would be closed when the user clicks on
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
548 * the "close box" or performs some other platform specific
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
549 * key or mouse combination that indicates the window
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
550 * should be removed.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
551 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
552 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
553 * <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
554 * <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
555 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
556 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
557 * @see SWT#Close
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
558 * @see #dispose
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
559 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
560 public void close () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
561 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
562 closeWidget ();
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 void closeWidget () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
565 Event event = new Event ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
566 sendEvent (SWT.Close, event);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
567 if (event.doit && !isDisposed ()) dispose ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
568 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
569
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
570 public Rectangle computeTrim (int x, int y, int width, int height) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
571 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
572 Rectangle trim = super.computeTrim (x, y, width, height);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
573 int border = 0;
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
574 if ((style & (SWT.NO_TRIM | SWT.BORDER | SWT.SHELL_TRIM)) is 0) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
575 border = OS.gtk_container_get_border_width (cast(GtkContainer*)shellHandle);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
576 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
577 int trimWidth = trimWidth (), trimHeight = trimHeight ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
578 trim.x -= (trimWidth / 2) + border;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
579 trim.y -= trimHeight - (trimWidth / 2) + border;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
580 trim.width += trimWidth + border * 2;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
581 trim.height += trimHeight + border * 2;
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
582 if (menuBar !is null) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
583 forceResize ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
584 int menuBarHeight = OS.GTK_WIDGET_HEIGHT (menuBar.handle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
585 trim.y -= menuBarHeight;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
586 trim.height += menuBarHeight;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
587 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
588 return trim;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
589 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
590
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
591 alias Decorations.createHandle createHandle;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
592 void createHandle (int index) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
593 state |= HANDLE | CANVAS;
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
594 if (shellHandle is null) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
595 if (handle is null) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
596 int type = OS.GTK_WINDOW_TOPLEVEL;
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
597 if ((style & SWT.ON_TOP) !is 0) type = OS.GTK_WINDOW_POPUP;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
598 shellHandle = cast(GtkWidget*)OS.gtk_window_new (type);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
599 } else {
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
600 shellHandle = cast(GtkWidget*) OS.gtk_plug_new (cast(uint)handle);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
601 }
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
602 if (shellHandle is null) error (SWT.ERROR_NO_HANDLES);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
603 if (parent !is null) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
604 OS.gtk_window_set_transient_for (cast(GtkWindow*)shellHandle, cast(GtkWindow*)parent.topHandle ());
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
605 OS.gtk_window_set_destroy_with_parent (cast(GtkWindow*)shellHandle, true);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
606 if (!isUndecorated ()) {
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
607 OS.gtk_window_set_type_hint (cast(GtkWindow*)shellHandle, OS.GDK_WINDOW_TYPE_HINT_DIALOG);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
608 } else {
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
609 if (OS.GTK_VERSION >= OS.buildVERSION (2, 2, 0)) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
610 OS.gtk_window_set_skip_taskbar_hint (cast(GtkWindow*)shellHandle, true);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
611 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
612 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
613 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
614 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
615 * Feature in GTK. The window size must be set when the window
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
616 * is created or it will not be allowed to be resized smaller that the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
617 * initial size by the user. The fix is to set the size to zero.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
618 */
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
619 if ((style & SWT.RESIZE) !is 0) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
620 OS.gtk_widget_set_size_request (shellHandle, 0, 0);
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
621 OS.gtk_window_set_resizable (cast(GtkWindow*)shellHandle, true);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
622 } else {
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
623 OS.gtk_window_set_resizable (cast(GtkWindow*)shellHandle, false);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
624 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
625 vboxHandle = OS.gtk_vbox_new (false, 0);
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
626 if (vboxHandle is null) error (SWT.ERROR_NO_HANDLES);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
627 createHandle (index, false, true);
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
628 OS.gtk_container_add (cast(GtkContainer*)vboxHandle, scrolledHandle);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
629 OS.gtk_box_set_child_packing (cast(GtkBox*)vboxHandle, scrolledHandle, true, true, 0, OS.GTK_PACK_END);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
630 char[] dummy = "a";
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
631 OS.gtk_window_set_title (cast(GtkWindow*)shellHandle, dummy.ptr );
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
632 if ((style & (SWT.NO_TRIM | SWT.BORDER | SWT.SHELL_TRIM)) is 0) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
633 OS.gtk_container_set_border_width (cast(GtkContainer*)shellHandle, 1);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
634 GdkColor* color = new GdkColor ();
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
635 OS.gtk_style_get_black (OS.gtk_widget_get_style (shellHandle), color);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
636 OS.gtk_widget_modify_bg (shellHandle, OS.GTK_STATE_NORMAL, color);
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 int bits = SWT.PRIMARY_MODAL | SWT.APPLICATION_MODAL | SWT.SYSTEM_MODAL;
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
639 bool modal = (style & bits) !is 0;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
640 //TEMPORARY CODE
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
641 if ((style & SWT.ON_TOP) is 0) modal |= (parent !is null && (parent.style & bits) !is 0);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
642 OS.gtk_window_set_modal (cast(GtkWindow*)shellHandle, modal);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
643 } else {
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
644 vboxHandle = OS.gtk_bin_get_child (cast(GtkBin*)shellHandle);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
645 if (vboxHandle is null) error (SWT.ERROR_NO_HANDLES);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
646 auto children = OS.gtk_container_get_children (cast(GtkContainer*)vboxHandle);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
647 if (OS.g_list_length (children) > 0) {
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
648 scrolledHandle = cast(GtkWidget*)OS.g_list_data (children);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
649 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
650 OS.g_list_free (children);
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
651 if (scrolledHandle is null) error (SWT.ERROR_NO_HANDLES);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
652 handle = OS.gtk_bin_get_child (cast(GtkBin*)scrolledHandle);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
653 if (handle is null) error (SWT.ERROR_NO_HANDLES);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
654 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
655 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
656 * Feature in GTK. Realizing the shell triggers a size allocate event,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
657 * which may be confused for a resize event from the window manager if
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
658 * received too late. The fix is to realize the window during creation
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
659 * to avoid confusion.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
660 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
661 OS.gtk_widget_realize (shellHandle);
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
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
664 override int /*long*/ filterProc ( XEvent* xEvent, GdkEvent* gdkEvent, void* data2) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
665 int eventType = OS.X_EVENT_TYPE (xEvent);
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
666 if (eventType !is OS.FocusOut && eventType !is OS.FocusIn) return 0;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
667 XFocusChangeEvent* xFocusEvent = cast(XFocusChangeEvent*)xEvent;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
668 switch (eventType) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
669 case OS.FocusIn:
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
670 if (xFocusEvent.mode is OS.NotifyNormal || xFocusEvent.mode is OS.NotifyWhileGrabbed) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
671 switch (xFocusEvent.detail) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
672 case OS.NotifyNonlinear:
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
673 case OS.NotifyNonlinearVirtual:
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
674 case OS.NotifyAncestor:
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
675 if (tooltipsHandle !is null) OS.gtk_tooltips_enable (cast(GtkTooltips*)tooltipsHandle);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
676 display.activeShell = this;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
677 display.activePending = false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
678 sendEvent (SWT.Activate);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
679 break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
680 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
681 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
682 break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
683 case OS.FocusOut:
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
684 if (xFocusEvent.mode is OS.NotifyNormal || xFocusEvent.mode is OS.NotifyWhileGrabbed) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
685 switch (xFocusEvent.detail) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
686 case OS.NotifyNonlinear:
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
687 case OS.NotifyNonlinearVirtual:
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
688 case OS.NotifyVirtual:
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
689 if (tooltipsHandle !is null) OS.gtk_tooltips_disable (cast(GtkTooltips*)tooltipsHandle);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
690 Display display = this.display;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
691 sendEvent (SWT.Deactivate);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
692 setActiveControl (null);
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
693 if (display.activeShell is this) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
694 display.activeShell = null;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
695 display.activePending = false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
696 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
697 break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
698 }
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 break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
701 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
702 return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
703 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
704
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
705 Control findBackgroundControl () {
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
706 return (state & BACKGROUND) !is 0 || backgroundImage !is null ? this : null;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
707 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
708
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
709 Composite findDeferredControl () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
710 return layoutCount > 0 ? this : null;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
711 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
712
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
713 bool hasBorder () {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
714 return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
715 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
716
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
717 void hookEvents () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
718 super.hookEvents ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
719 OS.g_signal_connect_closure_by_id (shellHandle, display.signalIds [KEY_PRESS_EVENT], 0, display.closures [KEY_PRESS_EVENT], false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
720 OS.g_signal_connect_closure_by_id (shellHandle, display.signalIds [MAP_EVENT], 0, display.closures [MAP_EVENT], false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
721 OS.g_signal_connect_closure_by_id (shellHandle, display.signalIds [UNMAP_EVENT], 0, display.closures [UNMAP_EVENT], false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
722 OS.g_signal_connect_closure_by_id (shellHandle, display.signalIds [WINDOW_STATE_EVENT], 0, display.closures [WINDOW_STATE_EVENT], false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
723 OS.g_signal_connect_closure_by_id (shellHandle, display.signalIds [SIZE_ALLOCATE], 0, display.closures [SIZE_ALLOCATE], false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
724 OS.g_signal_connect_closure_by_id (shellHandle, display.signalIds [CONFIGURE_EVENT], 0, display.closures [CONFIGURE_EVENT], false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
725 OS.g_signal_connect_closure_by_id (shellHandle, display.signalIds [DELETE_EVENT], 0, display.closures [DELETE_EVENT], false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
726 OS.g_signal_connect_closure_by_id (shellHandle, display.signalIds [MAP_EVENT], 0, display.shellMapProcClosure, false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
727 OS.g_signal_connect_closure_by_id (shellHandle, display.signalIds [ENTER_NOTIFY_EVENT], 0, display.closures [ENTER_NOTIFY_EVENT], false);
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
728 OS.g_signal_connect_closure (shellHandle, OS.move_focus.ptr, display.closures [MOVE_FOCUS], false);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
729 auto window = OS.GTK_WIDGET_WINDOW (shellHandle);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
730 display.doWindowAddFilter( &filterProcCallbackData, window, shellHandle );
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
731 //OS.gdk_window_add_filter (window, display.filterProc, shellHandle);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
732 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
733
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
734 public bool isEnabled () {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
735 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
736 return getEnabled ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
737 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
738
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
739 bool isUndecorated () {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
740 return
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
741 (style & (SWT.SHELL_TRIM | SWT.BORDER)) is SWT.NONE ||
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
742 (style & (SWT.NO_TRIM | SWT.ON_TOP)) !is 0;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
743 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
744
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
745 public bool isVisible () {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
746 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
747 return getVisible ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
748 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
749
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
750 void register () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
751 super.register ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
752 display.addWidget (shellHandle, this);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
753 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
754
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
755 void releaseParent () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
756 /* Do nothing */
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
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
759 GtkWidget* topHandle () {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
760 return shellHandle;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
761 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
762
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
763 void fixActiveShell () {
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
764 if (display.activeShell is this) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
765 Shell shell = null;
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
766 if (parent !is null && parent.isVisible ()) shell = parent.getShell ();
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
767 if (shell is null && isUndecorated ()) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
768 Shell [] shells = display.getShells ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
769 for (int i = 0; i < shells.length; i++) {
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
770 if (shells [i] !is null && shells [i].isVisible ()) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
771 shell = shells [i];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
772 break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
773 }
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 }
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
776 if (shell !is null) shell.bringToTop (false);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
777 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
778 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
779
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
780 void fixShell (Shell newShell, Control control) {
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
781 if (this is newShell) return;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
782 if (control is lastActive) setActiveControl (null);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
783 char[] toolTipText = control.toolTipText;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
784 if (toolTipText !is null) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
785 control.setToolTipText (this, null);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
786 control.setToolTipText (newShell, toolTipText);
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 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
789
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
790 alias Decorations.fixStyle fixStyle;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
791 void fixStyle (int /*long*/ handle) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
792 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
793
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
794 void forceResize () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
795 forceResize (OS.GTK_WIDGET_WIDTH (vboxHandle), OS.GTK_WIDGET_HEIGHT (vboxHandle));
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
796 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
797
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
798 void forceResize (int width, int height) {
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
799 GtkRequisition* requisition = new GtkRequisition ();
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
800 OS.gtk_widget_size_request (vboxHandle, requisition);
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
801 GtkAllocation* allocation = new GtkAllocation ();
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
802 int border = OS.gtk_container_get_border_width (cast(GtkContainer*)shellHandle);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
803 allocation.x = border;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
804 allocation.y = border;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
805 allocation.width = width;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
806 allocation.height = height;
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
807 OS.gtk_widget_size_allocate (cast(GtkWidget*)vboxHandle, allocation);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
808 }
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 public Point getLocation () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
811 checkWidget ();
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
812 int x, y;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
813 OS.gtk_window_get_position (cast(GtkWindow*)shellHandle, &x,&y);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
814 return new Point (x, y);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
815 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
816
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 * Returns a point describing the minimum receiver's size. The
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
819 * x coordinate of the result is the minimum width of the receiver.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
820 * The y coordinate of the result is the minimum height of the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
821 * receiver.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
822 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
823 * @return the receiver's size
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
824 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
825 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
826 * <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
827 * <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
828 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
829 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
830 * @since 3.1
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
831 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
832 public Point getMinimumSize () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
833 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
834 int width = Math.max (1, minWidth + trimWidth ());
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
835 int height = Math.max (1, minHeight + trimHeight ());
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
836 return new Point (width, height);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
837 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
838
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
839 public Point getSize () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
840 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
841 int width = OS.GTK_WIDGET_WIDTH (vboxHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
842 int height = OS.GTK_WIDGET_HEIGHT (vboxHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
843 int border = 0;
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
844 if ((style & (SWT.NO_TRIM | SWT.BORDER | SWT.SHELL_TRIM)) is 0) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
845 border = OS.gtk_container_get_border_width (cast(GtkContainer*)shellHandle);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
846 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
847 return new Point (width + trimWidth () + 2*border, height + trimHeight () + 2*border);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
848 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
849
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
850 public bool getVisible () {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
851 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
852 return OS.GTK_WIDGET_VISIBLE (shellHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
853 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
854
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 * Returns the region that defines the shape of the shell,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
857 * or null if the shell has the default shape.
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 * @return the region that defines the shape of the shell (or null)
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 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
862 * <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
863 * <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
864 * </ul>
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 * @since 3.0
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
867 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
868 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
869 public Region getRegion () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
870 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
871 return region;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
872 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
873
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
874 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
875 * Returns the receiver's input method editor mode. This
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
876 * will be the result of bitwise OR'ing together one or
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
877 * more of the following constants defined in class
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
878 * <code>SWT</code>:
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
879 * <code>NONE</code>, <code>ROMAN</code>, <code>DBCS</code>,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
880 * <code>PHONETIC</code>, <code>NATIVE</code>, <code>ALPHA</code>.
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 * @return the IME mode
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
883 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
884 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
885 * <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
886 * <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
887 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
888 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
889 * @see SWT
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
890 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
891 public int getImeInputMode () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
892 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
893 return SWT.NONE;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
894 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
895
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
896 Shell _getShell () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
897 return this;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
898 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
899 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
900 * Returns an array containing all shells which are
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
901 * descendants of the receiver.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
902 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
903 * @return the dialog shells
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
904 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
905 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
906 * <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
907 * <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
908 * </ul>
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 public Shell [] getShells () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
911 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
912 int count = 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
913 Shell [] shells = display.getShells ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
914 for (int i=0; i<shells.length; i++) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
915 Control shell = shells [i];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
916 do {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
917 shell = shell.getParent ();
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
918 } while (shell !is null && shell !is this);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
919 if (shell is this) count++;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
920 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
921 int index = 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
922 Shell [] result = new Shell [count];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
923 for (int i=0; i<shells.length; i++) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
924 Control shell = shells [i];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
925 do {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
926 shell = shell.getParent ();
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
927 } while (shell !is null && shell !is this);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
928 if (shell is this) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
929 result [index++] = shells [i];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
930 }
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 return result;
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
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
935 override int /*long*/ gtk_configure_event (GtkWidget* widget, int /*long*/ event) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
936 int x, y;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
937 OS.gtk_window_get_position (cast(GtkWindow*)shellHandle, &x, &y);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
938 if (!moved || oldX !is x || oldY !is y) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
939 moved = true;
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
940 oldX = x;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
941 oldY = y;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
942 sendEvent (SWT.Move);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
943 // widget could be disposed at this point
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 return 0;
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
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
948 override int /*long*/ gtk_delete_event (GtkWidget* widget, int /*long*/ event) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
949 if (isEnabled()) closeWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
950 return 1;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
951 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
952
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
953 override int /*long*/ gtk_enter_notify_event (GtkWidget* widget, GdkEventCrossing* event) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
954 if (widget !is shellHandle) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
955 return super.gtk_enter_notify_event (widget, event);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
956 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
957 return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
958 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
959
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
960 override int /*long*/ gtk_focus (GtkWidget* widget, int directionType) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
961 switch (cast(int)/*64*/directionType) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
962 case OS.GTK_DIR_TAB_FORWARD:
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
963 case OS.GTK_DIR_TAB_BACKWARD:
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
964 Control control = display.getFocusControl ();
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
965 if (control !is null) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
966 if ((control.state & CANVAS) !is 0 && (control.style & SWT.EMBEDDED) !is 0) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
967 int traversal = directionType is OS.GTK_DIR_TAB_FORWARD ? SWT.TRAVERSE_TAB_NEXT : SWT.TRAVERSE_TAB_PREVIOUS;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
968 control.traverse (traversal);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
969 return 1;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
970 }
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 break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
973 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
974 return super.gtk_focus (widget, directionType);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
975 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
976
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
977 override int /*long*/ gtk_move_focus (GtkWidget* widget, int directionType) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
978 Control control = display.getFocusControl ();
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
979 if (control !is null) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
980 auto focusHandle = control.focusHandle ();
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
981 OS.gtk_widget_child_focus (focusHandle, directionType);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
982 }
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
983 OS.g_signal_stop_emission_by_name (shellHandle, OS.move_focus.ptr );
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
984 return 1;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
985 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
986
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
987 override int /*long*/ gtk_key_press_event (GtkWidget* widget, GdkEventKey* event) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
988 /* Stop menu mnemonics when the shell is disabled */
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
989 if (widget is shellHandle) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
990 return (state & DISABLED) !is 0 ? 1 : 0;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
991 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
992 return super.gtk_key_press_event (widget, event);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
993 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
994
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
995 override int /*long*/ gtk_map_event (GtkWidget* widget, int /*long*/ event) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
996 minimized = false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
997 sendEvent (SWT.Deiconify);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
998 return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
999 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1000
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1001 override int /*long*/ gtk_size_allocate (GtkWidget* widget, int /*long*/ allocation) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1002 int width = OS.GTK_WIDGET_WIDTH (shellHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1003 int height = OS.GTK_WIDGET_HEIGHT (shellHandle);
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1004 if (!resized || oldWidth !is width || oldHeight !is height) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1005 oldWidth = width;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1006 oldHeight = height;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1007 resizeBounds (width, height, true);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1008 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1009 return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1010 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1011
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1012 override int /*long*/ gtk_realize (GtkWidget* widget) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1013 auto result = super.gtk_realize (widget);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1014 auto window = OS.GTK_WIDGET_WINDOW (shellHandle);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1015 if ((style & SWT.SHELL_TRIM) !is SWT.SHELL_TRIM) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1016 int decorations = 0;
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1017 if ((style & SWT.NO_TRIM) is 0) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1018 if ((style & SWT.MIN) !is 0) decorations |= OS.GDK_DECOR_MINIMIZE;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1019 if ((style & SWT.MAX) !is 0) decorations |= OS.GDK_DECOR_MAXIMIZE;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1020 if ((style & SWT.RESIZE) !is 0) decorations |= OS.GDK_DECOR_RESIZEH;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1021 if ((style & SWT.BORDER) !is 0) decorations |= OS.GDK_DECOR_BORDER;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1022 if ((style & SWT.MENU) !is 0) decorations |= OS.GDK_DECOR_MENU;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1023 if ((style & SWT.TITLE) !is 0) decorations |= OS.GDK_DECOR_TITLE;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1024 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1025 * Feature in GTK. Under some Window Managers (Sawmill), in order
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1026 * to get any border at all from the window manager it is necessary to
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1027 * set GDK_DECOR_BORDER. The fix is to force these bits when any
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1028 * kind of border is requested.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1029 */
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1030 if ((style & SWT.RESIZE) !is 0) decorations |= OS.GDK_DECOR_BORDER;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1031 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1032 OS.gdk_window_set_decorations (window, decorations);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1033 }
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1034 if ((style & SWT.ON_TOP) !is 0) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1035 OS.gdk_window_set_override_redirect (window, true);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1036 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1037 return result;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1038 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1039
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1040 override int /*long*/ gtk_unmap_event (GtkWidget* widget, int /*long*/ event) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1041 minimized = true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1042 sendEvent (SWT.Iconify);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1043 return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1044 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1045
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1046 override int /*long*/ gtk_window_state_event (GtkWidget* widget, GdkEventWindowState* event) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1047 minimized = (event.new_window_state & OS.GDK_WINDOW_STATE_ICONIFIED) !is 0;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1048 maximized = (event.new_window_state & OS.GDK_WINDOW_STATE_MAXIMIZED) !is 0;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1049 return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1050 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1051
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1052 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1053 * Moves the receiver to the top of the drawing order for
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1054 * the display on which it was created (so that all other
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1055 * shells on that display, which are not the receiver's
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1056 * children will be drawn behind it), marks it visible,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1057 * sets the focus and asks the window manager to make the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1058 * shell active.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1059 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1060 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1061 * <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
1062 * <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
1063 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1064 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1065 * @see Control#moveAbove
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1066 * @see Control#setFocus
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1067 * @see Control#setVisible
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1068 * @see Display#getActiveShell
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1069 * @see Decorations#setDefaultButton(Button)
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1070 * @see Shell#setActive
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1071 * @see Shell#forceActive
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1072 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1073 public void open () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1074 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1075 bringToTop (false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1076 setVisible (true);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1077 if (isDisposed ()) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1078 if (!restoreFocus () && !traverseGroup (true)) setFocus ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1079 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1080
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1081 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1082 * 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
1083 * be notified when operations are performed on the receiver.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1084 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1085 * @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
1086 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1087 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1088 * <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
1089 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1090 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1091 * <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
1092 * <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
1093 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1094 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1095 * @see ShellListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1096 * @see #addShellListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1097 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1098 public void removeShellListener (ShellListener listener) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1099 checkWidget();
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1100 if (listener is null) error (SWT.ERROR_NULL_ARGUMENT);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1101 if (eventTable is null) return;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1102 eventTable.unhook (SWT.Close, listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1103 eventTable.unhook (SWT.Iconify,listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1104 eventTable.unhook (SWT.Deiconify,listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1105 eventTable.unhook (SWT.Activate, listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1106 eventTable.unhook (SWT.Deactivate, listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1107 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1108
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1109 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1110 * If the receiver is visible, moves it to the top of the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1111 * drawing order for the display on which it was created
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1112 * (so that all other shells on that display, which are not
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1113 * the receiver's children will be drawn behind it) and asks
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1114 * the window manager to make the shell active
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1115 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1116 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1117 * <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
1118 * <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
1119 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1120 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1121 * @since 2.0
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1122 * @see Control#moveAbove
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1123 * @see Control#setFocus
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1124 * @see Control#setVisible
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1125 * @see Display#getActiveShell
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1126 * @see Decorations#setDefaultButton(Button)
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1127 * @see Shell#open
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1128 * @see Shell#setActive
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1129 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1130 public void setActive () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1131 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1132 bringToTop (false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1133 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1134
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1135 void setActiveControl (Control control) {
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1136 if (control !is null && control.isDisposed ()) control = null;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1137 if (lastActive !is null && lastActive.isDisposed ()) lastActive = null;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1138 if (lastActive is control) return;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1139
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1140 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1141 * Compute the list of controls to be activated and
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1142 * deactivated by finding the first common parent
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1143 * control.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1144 */
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1145 Control [] activate = (control is null) ? new Control[0] : control.getPath ();
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1146 Control [] deactivate = (lastActive is null) ? new Control[0] : lastActive.getPath ();
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1147 lastActive = control;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1148 int index = 0, length = Math.min (activate.length, deactivate.length);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1149 while (index < length) {
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1150 if (activate [index] !is deactivate [index]) break;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1151 index++;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1152 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1153
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1154 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1155 * It is possible (but unlikely), that application
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1156 * code could have destroyed some of the widgets. If
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1157 * this happens, keep processing those widgets that
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1158 * are not disposed.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1159 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1160 for (int i=deactivate.length-1; i>=index; --i) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1161 if (!deactivate [i].isDisposed ()) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1162 deactivate [i].sendEvent (SWT.Deactivate);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1163 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1164 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1165 for (int i=activate.length-1; i>=index; --i) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1166 if (!activate [i].isDisposed ()) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1167 activate [i].sendEvent (SWT.Activate);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1168 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1169 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1170 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1171
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1172 void resizeBounds (int width, int height, bool notify) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1173 if (redrawWindow !is null) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1174 OS.gdk_window_resize (redrawWindow, width, height);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1175 }
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1176 if (enableWindow !is null) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1177 OS.gdk_window_resize (enableWindow, width, height);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1178 }
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1179 int border = OS.gtk_container_get_border_width (cast(GtkContainer*)shellHandle);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1180 int boxWidth = width - 2*border;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1181 int boxHeight = height - 2*border;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1182 OS.gtk_widget_set_size_request (vboxHandle, boxWidth, boxHeight);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1183 forceResize (boxWidth, boxHeight);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1184 if (notify) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1185 resized = true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1186 sendEvent (SWT.Resize);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1187 if (isDisposed ()) return;
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1188 if (layout_ !is null) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1189 markLayout (false, false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1190 updateLayout (false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1191 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1192 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1193 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1194
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1195 int setBounds (int x, int y, int width, int height, bool move, bool resize) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1196 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1197 * Bug in GTK. When either of the location or size of
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1198 * a shell is changed while the shell is maximized, the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1199 * shell is moved to (0, 0). The fix is to explicitly
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1200 * unmaximize the shell before setting the bounds to
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1201 * anything different from the current bounds.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1202 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1203 if (getMaximized ()) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1204 Rectangle rect = getBounds ();
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1205 bool sameOrigin = !move || (rect.x is x && rect.y is y);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1206 bool sameExtent = !resize || (rect.width is width && rect.height is height);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1207 if (sameOrigin && sameExtent) return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1208 setMaximized (false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1209 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1210 int result = 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1211 if (move) {
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1212 int x_pos, y_pos;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1213 OS.gtk_window_get_position (cast(GtkWindow*)shellHandle, &x_pos, &y_pos);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1214 OS.gtk_window_move (cast(GtkWindow*)shellHandle, x, y);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1215 if (x_pos !is x || y_pos !is y) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1216 moved = true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1217 oldX = x;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1218 oldY = y;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1219 sendEvent (SWT.Move);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1220 if (isDisposed ()) return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1221 result |= MOVED;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1222 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1223 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1224 if (resize) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1225 width = Math.max (1, Math.max (minWidth, width - trimWidth ()));
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1226 height = Math.max (1, Math.max (minHeight, height - trimHeight ()));
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1227 if ((style & SWT.RESIZE) !is 0) OS.gtk_window_resize (cast(GtkWindow*)shellHandle, width, height);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1228 bool changed = width !is oldWidth || height !is oldHeight;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1229 if (changed) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1230 oldWidth = width;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1231 oldHeight = height;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1232 result |= RESIZED;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1233 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1234 resizeBounds (width, height, changed);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1235 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1236 return result;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1237 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1238
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1239 void setCursor (GdkCursor* cursor) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1240 if (enableWindow !is null) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1241 OS.gdk_window_set_cursor (cast(GdkDrawable*)enableWindow, cursor);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1242 if (!OS.GDK_WINDOWING_X11 ()) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1243 OS.gdk_flush ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1244 } else {
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1245 auto xDisplay = OS.GDK_DISPLAY ();
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1246 OS.XFlush (xDisplay);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1247 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1248 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1249 super.setCursor (cursor);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1250 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1251
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1252 public void setEnabled (bool enabled) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1253 checkWidget();
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1254 if (((state & DISABLED) is 0) is enabled) return;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1255 Display display = this.display;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1256 Control control = null;
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1257 bool fixFocus_ = false;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1258 if (!enabled) {
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1259 if (display.focusEvent !is SWT.FocusOut) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1260 control = display.getFocusControl ();
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1261 fixFocus_ = isFocusAncestor (control);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1262 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1263 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1264 if (enabled) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1265 state &= ~DISABLED;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1266 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1267 state |= DISABLED;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1268 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1269 enableWidget (enabled);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1270 if (isDisposed ()) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1271 if (enabled) {
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1272 if (enableWindow !is null) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1273 OS.gdk_window_set_user_data (enableWindow, null);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1274 OS.gdk_window_destroy (enableWindow);
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1275 enableWindow = null;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1276 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1277 } else {
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1278 auto parentHandle = shellHandle;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1279 OS.gtk_widget_realize (parentHandle);
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1280 auto window = OS.GTK_WIDGET_WINDOW (parentHandle);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1281 Rectangle rect = getBounds ();
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1282 GdkWindowAttr* attributes = new GdkWindowAttr ();
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1283 attributes.width = rect.width;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1284 attributes.height = rect.height;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1285 attributes.event_mask = (0xFFFFFFFF & ~OS.ExposureMask);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1286 attributes.wclass = OS.GDK_INPUT_ONLY;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1287 attributes.window_type = OS.GDK_WINDOW_CHILD;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1288 enableWindow = OS.gdk_window_new (window, attributes, 0);
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1289 if (enableWindow !is null) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1290 if (cursor !is null) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1291 OS.gdk_window_set_cursor (enableWindow, cursor.handle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1292 if (!OS.GDK_WINDOWING_X11 ()) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1293 OS.gdk_flush ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1294 } else {
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1295 auto xDisplay = OS.GDK_DISPLAY ();
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1296 OS.XFlush (xDisplay);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1297 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1298 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1299 OS.gdk_window_set_user_data (enableWindow, parentHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1300 OS.gdk_window_show (enableWindow);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1301 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1302 }
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1303 if (fixFocus_) fixFocus (control);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1304 if (enabled && display.activeShell is this) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1305 if (!restoreFocus ()) traverseGroup (false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1306 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1307 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1308
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1309 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1310 * Sets the input method editor mode to the argument which
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1311 * should be the result of bitwise OR'ing together one or more
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1312 * of the following constants defined in class <code>SWT</code>:
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1313 * <code>NONE</code>, <code>ROMAN</code>, <code>DBCS</code>,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1314 * <code>PHONETIC</code>, <code>NATIVE</code>, <code>ALPHA</code>.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1315 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1316 * @param mode the new IME mode
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1317 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1318 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1319 * <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
1320 * <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
1321 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1322 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1323 * @see SWT
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1324 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1325 public void setImeInputMode (int mode) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1326 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1327 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1328
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1329 void setInitialBounds () {
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1330 if ((state & FOREIGN_HANDLE) !is 0) return;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1331 dwt.widgets.Monitor.Monitor monitor = getMonitor ();
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1332 Rectangle rect = monitor.getClientArea ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1333 int width = rect.width * 5 / 8;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1334 int height = rect.height * 5 / 8;
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1335 if ((style & SWT.RESIZE) !is 0) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1336 OS.gtk_window_resize (cast(GtkWindow*)shellHandle, width, height);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1337 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1338 resizeBounds (width, height, false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1339 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1340
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1341 public void setMaximized (bool maximized) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1342 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1343 super.setMaximized (maximized);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1344 if (maximized) {
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1345 OS.gtk_window_maximize (cast(GtkWindow*)shellHandle);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1346 } else {
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1347 OS.gtk_window_unmaximize (cast(GtkWindow*)shellHandle);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1348 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1349 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1350
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1351 public void setMenuBar (Menu menu) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1352 checkWidget();
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1353 if (menuBar is menu) return;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1354 bool both = menu !is null && menuBar !is null;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1355 if (menu !is null) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1356 if ((menu.style & SWT.BAR) is 0) error (SWT.ERROR_MENU_NOT_BAR);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1357 if (menu.parent !is this) error (SWT.ERROR_INVALID_PARENT);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1358 }
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1359 if (menuBar !is null) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1360 auto menuHandle = menuBar.handle;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1361 OS.gtk_widget_hide (menuHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1362 destroyAccelGroup ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1363 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1364 menuBar = menu;
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1365 if (menuBar !is null) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1366 auto menuHandle = menu.handle;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1367 OS.gtk_widget_show (menuHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1368 createAccelGroup ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1369 menuBar.addAccelerators (accelGroup);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1370 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1371 int width = OS.GTK_WIDGET_WIDTH (vboxHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1372 int height = OS.GTK_WIDGET_HEIGHT (vboxHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1373 resizeBounds (width, height, !both);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1374 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1375
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1376 public void setMinimized (bool minimized) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1377 checkWidget();
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1378 if (this.minimized is minimized) return;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1379 super.setMinimized (minimized);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1380 if (minimized) {
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1381 OS.gtk_window_iconify (cast(GtkWindow*)shellHandle);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1382 } else {
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1383 OS.gtk_window_deiconify (cast(GtkWindow*)shellHandle);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1384 bringToTop (false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1385 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1386 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1387
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1388 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1389 * Sets the receiver's minimum size to the size specified by the arguments.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1390 * If the new minimum size is larger than the current size of the receiver,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1391 * the receiver is resized to the new minimum size.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1392 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1393 * @param width the new minimum width for the receiver
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1394 * @param height the new minimum height for the receiver
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1395 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1396 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1397 * <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
1398 * <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
1399 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1400 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1401 * @since 3.1
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1402 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1403 public void setMinimumSize (int width, int height) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1404 checkWidget ();
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1405 GdkGeometry* geometry = new GdkGeometry ();
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1406 minWidth = geometry.min_width = Math.max (width, trimWidth ()) - trimWidth ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1407 minHeight = geometry.min_height = Math.max (height, trimHeight ()) - trimHeight ();
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1408 OS.gtk_window_set_geometry_hints (cast(GtkWindow*)shellHandle, null, geometry, OS.GDK_HINT_MIN_SIZE);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1409 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1410
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1411 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1412 * Sets the receiver's minimum size to the size specified by the argument.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1413 * If the new minimum size is larger than the current size of the receiver,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1414 * the receiver is resized to the new minimum size.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1415 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1416 * @param size the new minimum size for the receiver
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1417 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1418 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1419 * <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
1420 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1421 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1422 * <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
1423 * <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
1424 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1425 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1426 * @since 3.1
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1427 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1428 public void setMinimumSize (Point size) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1429 checkWidget ();
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1430 if (size is null) error (SWT.ERROR_NULL_ARGUMENT);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1431 setMinimumSize (size.x, size.y);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1432 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1433
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1434 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1435 * Sets the shape of the shell to the region specified
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1436 * by the argument. When the argument is null, the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1437 * default shape of the shell is restored. The shell
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1438 * must be created with the style SWT.NO_TRIM in order
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1439 * to specify a region.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1440 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1441 * @param region the region that defines the shape of the shell (or null)
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1442 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1443 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1444 * <li>ERROR_INVALID_ARGUMENT - if the region has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1445 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1446 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1447 * <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
1448 * <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
1449 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1450 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1451 * @since 3.0
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1452 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1453 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1454 public void setRegion (Region region) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1455 checkWidget ();
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1456 if ((style & SWT.NO_TRIM) is 0) return;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1457 if (region !is null && region.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1458 auto window = OS.GTK_WIDGET_WINDOW (shellHandle);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1459 auto shape_region = (region is null) ? null : region.handle;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1460 OS.gdk_window_shape_combine_region (window, shape_region, 0, 0);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1461 this.region = region;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1462 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1463
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1464 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1465 * Shells are never labelled by other widgets, so no initialization is needed.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1466 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1467 void setRelations() {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1468 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1469
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1470 public void setText (char[] string) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1471 super.setText (string);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1472
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1473 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1474 * GTK bug 82013. For some reason, if the title string
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1475 * is less than 7 bytes long and is not terminated by
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1476 * a space, some window managers occasionally draw
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1477 * garbage after the last character in the title.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1478 * The fix is to pad the title.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1479 */
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1480 int length_ = string.length;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1481 char [] chars = new char [Math.max (6, length_) + 1];
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1482 chars = string[ 0 .. length_];
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1483 for (int i=length_; i<chars.length; i++) chars [i] = ' ';
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1484 OS.gtk_window_set_title (cast(GtkWindow*)shellHandle, toStringz( chars ) );
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1485 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1486
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1487 public void setVisible (bool visible) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1488 checkWidget();
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1489 if ((OS.GTK_WIDGET_MAPPED (shellHandle) is visible)) return;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1490 if (visible) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1491 sendEvent (SWT.Show);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1492 if (isDisposed ()) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1493
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1494 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1495 * In order to ensure that the shell is visible
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1496 * and fully painted, dispatch events such as
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1497 * GDK_MAP and GDK_CONFIGURE, until the GDK_MAP
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1498 * event for the shell is received.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1499 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1500 * Note that if the parent is minimized or withdrawn
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1501 * from the desktop, this should not be done since
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1502 * the shell not will be mapped until the parent is
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1503 * unminimized or shown on the desktop.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1504 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1505 OS.gtk_widget_show (shellHandle);
40
7fb1ab011933 made macro implementations active, one compile problem in OS.d:2554
Frank Benoit <benoit@tionex.de>
parents: 38
diff changeset
1506 if (!OS.GTK_IS_PLUG (cast(GTypeInstance*)shellHandle)) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1507 mapped = false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1508 if (isDisposed ()) return;
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1509 display.dispatchEvents = [
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1510 OS.GDK_EXPOSE,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1511 OS.GDK_FOCUS_CHANGE,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1512 OS.GDK_CONFIGURE,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1513 OS.GDK_MAP,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1514 OS.GDK_UNMAP,
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1515 OS.GDK_NO_EXPOSE
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1516 ];
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1517 Display display = this.display;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1518 display.putGdkEvents();
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1519 bool iconic = false;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1520 Shell shell = parent !is null ? parent.getShell() : null;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1521 do {
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1522 OS.g_main_context_iteration (null, false);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1523 if (isDisposed ()) break;
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1524 iconic = minimized || (shell !is null && shell.minimized);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1525 } while (!mapped && !iconic);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1526 display.dispatchEvents = null;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1527 if (isDisposed ()) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1528 if (!iconic) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1529 update (true, true);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1530 if (isDisposed ()) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1531 adjustTrim ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1532 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1533 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1534 mapped = true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1535
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1536 int mask = SWT.PRIMARY_MODAL | SWT.APPLICATION_MODAL | SWT.SYSTEM_MODAL;
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1537 if ((style & mask) !is 0) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1538 OS.gdk_pointer_ungrab (OS.GDK_CURRENT_TIME);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1539 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1540 opened = true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1541 if (!moved) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1542 moved = true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1543 Point location = getLocation();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1544 oldX = location.x;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1545 oldY = location.y;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1546 sendEvent (SWT.Move);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1547 if (isDisposed ()) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1548 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1549 if (!resized) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1550 resized = true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1551 Point size = getSize ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1552 oldWidth = size.x - trimWidth ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1553 oldHeight = size.y - trimHeight ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1554 sendEvent (SWT.Resize);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1555 if (isDisposed ()) return;
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1556 if (layout_ !is null) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1557 markLayout (false, false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1558 updateLayout (false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1559 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1560 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1561 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1562 fixActiveShell ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1563 OS.gtk_widget_hide (shellHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1564 sendEvent (SWT.Hide);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1565 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1566 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1567
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1568 alias Decorations.setZOrder setZOrder;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1569 void setZOrder (Control sibling, bool above, bool fixRelations) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1570 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1571 * Bug in GTK+. Changing the toplevel window Z-order causes
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1572 * X to send a resize event. Before the shell is mapped, these
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1573 * resize events always have a size of 200x200, causing extra
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1574 * layout work to occur. The fix is to modify the Z-order only
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1575 * if the shell has already been mapped at least once.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1576 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1577 /* Shells are never included in labelled-by relations */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1578 if (mapped) setZOrder (sibling, above, false, false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1579 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1580
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1581 override int /*long*/ shellMapProc (GtkWidget* handle, int /*long*/ arg0, int /*long*/ user_data) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1582 mapped = true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1583 display.dispatchEvents = null;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1584 return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1585 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1586
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1587 void showWidget () {
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1588 if ((state & FOREIGN_HANDLE) !is 0) return;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1589 OS.gtk_container_add (cast(GtkContainer*)shellHandle, vboxHandle);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1590 if (scrolledHandle !is null) OS.gtk_widget_show (scrolledHandle);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1591 if (handle !is null) OS.gtk_widget_show (handle);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1592 if (vboxHandle !is null) OS.gtk_widget_show (vboxHandle);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1593 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1594
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1595 override int /*long*/ sizeAllocateProc (GtkWidget* handle, int /*long*/ arg0, int /*long*/ user_data) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1596 int offset = 16;
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1597 int x, y;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1598 OS.gdk_window_get_pointer (null, &x, &y, null);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1599 y += offset;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1600 auto screen = OS.gdk_screen_get_default ();
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1601 if (screen !is null) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1602 int monitorNumber = OS.gdk_screen_get_monitor_at_point (screen, x, y);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1603 GdkRectangle* dest = new GdkRectangle ();
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1604 OS.gdk_screen_get_monitor_geometry (screen, monitorNumber, dest);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1605 int width = OS.GTK_WIDGET_WIDTH (handle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1606 int height = OS.GTK_WIDGET_HEIGHT (handle);
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1607 if (x + width > dest.x + dest.width) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1608 x = (dest.x + dest.width) - width;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1609 }
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1610 if (y + height > dest.y + dest.height) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1611 y = (dest.y + dest.height) - height;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1612 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1613 }
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1614 OS.gtk_window_move (cast(GtkWindow*)handle, x, y);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1615 return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1616 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1617
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1618 override int /*long*/ sizeRequestProc (GtkWidget* handle, int /*long*/ arg0, int /*long*/ user_data) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1619 OS.gtk_widget_hide (handle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1620 return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1621 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1622
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1623 bool traverseEscape () {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1624 if (parent is null) return false;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1625 if (!isVisible () || !isEnabled ()) return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1626 close ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1627 return true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1628 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1629 int trimHeight () {
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1630 if ((style & SWT.NO_TRIM) !is 0) return 0;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1631 bool hasTitle = false, hasResize = false, hasBorder = false;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1632 hasTitle = (style & (SWT.MIN | SWT.MAX | SWT.TITLE | SWT.MENU)) !is 0;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1633 hasResize = (style & SWT.RESIZE) !is 0;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1634 hasBorder = (style & SWT.BORDER) !is 0;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1635 if (hasTitle) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1636 if (hasResize) return display.titleResizeTrimHeight;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1637 if (hasBorder) return display.titleBorderTrimHeight;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1638 return display.titleTrimHeight;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1639 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1640 if (hasResize) return display.resizeTrimHeight;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1641 if (hasBorder) return display.borderTrimHeight;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1642 return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1643 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1644
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1645 int trimWidth () {
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1646 if ((style & SWT.NO_TRIM) !is 0) return 0;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1647 bool hasTitle = false, hasResize = false, hasBorder = false;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1648 hasTitle = (style & (SWT.MIN | SWT.MAX | SWT.TITLE | SWT.MENU)) !is 0;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1649 hasResize = (style & SWT.RESIZE) !is 0;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1650 hasBorder = (style & SWT.BORDER) !is 0;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1651 if (hasTitle) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1652 if (hasResize) return display.titleResizeTrimWidth;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1653 if (hasBorder) return display.titleBorderTrimWidth;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1654 return display.titleTrimWidth;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1655 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1656 if (hasResize) return display.resizeTrimWidth;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1657 if (hasBorder) return display.borderTrimWidth;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1658 return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1659 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1660
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1661 void deregister () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1662 super.deregister ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1663 display.removeWidget (shellHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1664 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1665
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1666 public void dispose () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1667 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1668 * Note: It is valid to attempt to dispose a widget
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1669 * more than once. If this happens, fail silently.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1670 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1671 if (isDisposed()) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1672 fixActiveShell ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1673 OS.gtk_widget_hide (shellHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1674 super.dispose ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1675 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1676
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1677 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1678 * If the receiver is visible, moves it to the top of the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1679 * drawing order for the display on which it was created
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1680 * (so that all other shells on that display, which are not
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1681 * the receiver's children will be drawn behind it) and forces
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1682 * the window manager to make the shell active.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1683 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1684 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1685 * <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
1686 * <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
1687 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1688 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1689 * @since 2.0
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1690 * @see Control#moveAbove
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1691 * @see Control#setFocus
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1692 * @see Control#setVisible
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1693 * @see Display#getActiveShell
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1694 * @see Decorations#setDefaultButton(Button)
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1695 * @see Shell#open
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1696 * @see Shell#setActive
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1697 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1698 public void forceActive () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1699 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1700 bringToTop (true);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1701 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1702
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1703 public Rectangle getBounds () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1704 checkWidget ();
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1705 int x, y ;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1706 OS.gtk_window_get_position (cast(GtkWindow*)shellHandle, &x, &y);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1707 int width = OS.GTK_WIDGET_WIDTH (vboxHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1708 int height = OS.GTK_WIDGET_HEIGHT (vboxHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1709 int border = 0;
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1710 if ((style & (SWT.NO_TRIM | SWT.BORDER | SWT.SHELL_TRIM)) is 0) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1711 border = OS.gtk_container_get_border_width (cast(GtkContainer*)shellHandle);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1712 }
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1713 return new Rectangle (x, y, width + trimWidth () + 2*border, height + trimHeight () + 2*border);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1714 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1715
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1716 void releaseHandle () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1717 super.releaseHandle ();
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1718 shellHandle = null;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1719 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1720
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1721 void releaseChildren (bool destroy) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1722 Shell [] shells = getShells ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1723 for (int i=0; i<shells.length; i++) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1724 Shell shell = shells [i];
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1725 if (shell !is null && !shell.isDisposed ()) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1726 shell.release (false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1727 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1728 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1729 super.releaseChildren (destroy);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1730 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1731
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1732 void releaseWidget () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1733 super.releaseWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1734 destroyAccelGroup ();
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1735 if (display.activeShell is this) display.activeShell = null;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1736 if (tooltipsHandle !is null) OS.g_object_unref (tooltipsHandle);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1737 tooltipsHandle = null;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1738 auto window = OS.GTK_WIDGET_WINDOW (shellHandle);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1739 display.doWindowRemoveFilter( &filterProcCallbackData, window, shellHandle );
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1740 region = null;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1741 lastActive = null;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1742 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1743
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1744 void setToolTipText (GtkWidget* widget, char[] string) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1745 //PORTING_LEFT
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1746 /+
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1747 char* buffer = toStringz( string );
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1748 if (tooltipsHandle is null) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1749 tooltipsHandle = cast(GtkWidget*)OS.gtk_tooltips_new ();
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1750 if (tooltipsHandle is null) error (SWT.ERROR_NO_HANDLES);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1751 OS.g_object_ref (tooltipsHandle);
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1752 OS.gtk_object_sink (cast(GtkObject*)tooltipsHandle);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1753 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1754
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1755 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1756 * Feature in GTK. There is no API to position a tooltip.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1757 * The fix is to connect to the size_allocate signal for
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1758 * the tooltip window and position it before it is mapped.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1759 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1760 * Bug in Solaris-GTK. Invoking gtk_tooltips_force_window()
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1761 * can cause a crash in older versions of GTK. The fix is
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1762 * to avoid this call if the GTK version is older than 2.2.x.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1763 */
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1764 if (OS.GTK_VERSION >= OS.buildVERSION (2, 2, 1)) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1765 OS.gtk_tooltips_force_window (cast(GtkTooltips*)tooltipsHandle);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1766 }
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1767 auto tipWindow = OS.GTK_TOOLTIPS_TIP_WINDOW (cast(GtkTooltips*)tooltipsHandle);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1768 if (tipWindow !is null && tipWindow !is tooltipWindow) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1769 OS.g_signal_connect (tipWindow, OS.size_allocate, display.sizeAllocateProc, shellHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1770 tooltipWindow = tipWindow;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1771 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1772
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1773 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1774 * Bug in GTK. If the cursor is inside the window when a new
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1775 * tooltip is set and the old tooltip is hidden, the new tooltip
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1776 * is not displayed until the mouse re-enters the window. The
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1777 * fix is force the new tooltip to be active.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1778 */
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1779 bool set = true;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1780 if (tipWindow !is null) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1781 if ((OS.GTK_WIDGET_FLAGS (widget) & (OS.GTK_REALIZED | OS.GTK_VISIBLE)) !is 0) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1782 int [] x = new int [1], y = new int [1];
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1783 auto window = OS.gdk_window_at_pointer (x, y);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1784 if (window !is null) {
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1785 GtkWidget* user_data;
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1786 OS.gdk_window_get_user_data (window, &user_data);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1787 if (widget is user_data) {
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1788 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1789 * Feature in GTK. Calling gtk_tooltips_set_tip() positions and
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1790 * shows the tooltip. If the tooltip is already visible, moving
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1791 * it to a new location in the size_allocate signal causes flashing.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1792 * The fix is to hide the tip window in the size_request signal
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1793 * and before the new tooltip is forced to be active.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1794 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1795 set = false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1796 int handler_id = OS.g_signal_connect (tipWindow, OS.size_request, display.sizeRequestProc, shellHandle);
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1797 OS.gtk_tooltips_set_tip (cast(GtkTooltips*)tooltipsHandle, widget, buffer, null);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1798 OS.gtk_widget_hide (tipWindow);
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1799 auto data = OS.gtk_tooltips_data_get (cast(GtkTooltips*)widget);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1800 OS.GTK_TOOLTIPS_SET_ACTIVE (tooltipsHandle, data);
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1801 OS.gtk_tooltips_set_tip (cast(GtkTooltips*)tooltipsHandle, widget, buffer, null);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1802 if (handler_id !is 0) OS.g_signal_handler_disconnect (tipWindow, handler_id);
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1803 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1804 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1805 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1806 }
38
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1807 if (set) OS.gtk_tooltips_set_tip (cast(GtkTooltips*)tooltipsHandle, widget, buffer, null);
6e625fa1612d Shell, some code left
Frank Benoit <benoit@tionex.de>
parents: 33
diff changeset
1808 +/
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1809 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1810 }