annotate dwt/widgets/Control.d @ 27:ffa3c27c4328

Display
author Frank Benoit <benoit@tionex.de>
date Wed, 09 Jan 2008 01:08:22 +0100
parents 09f5459a5014
children 5e5d1c9cffdb
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.Control;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
12
26
09f5459a5014 Display in work
Frank Benoit <benoit@tionex.de>
parents: 25
diff changeset
13 import dwt.internal.gtk.c.gtktypes;
09f5459a5014 Display in work
Frank Benoit <benoit@tionex.de>
parents: 25
diff changeset
14 import dwt.widgets.Widget;
09f5459a5014 Display in work
Frank Benoit <benoit@tionex.de>
parents: 25
diff changeset
15 import dwt.widgets.Shell;
27
ffa3c27c4328 Display
Frank Benoit <benoit@tionex.de>
parents: 26
diff changeset
16 import dwt.graphics.Point;
26
09f5459a5014 Display in work
Frank Benoit <benoit@tionex.de>
parents: 25
diff changeset
17
09f5459a5014 Display in work
Frank Benoit <benoit@tionex.de>
parents: 25
diff changeset
18 class Control : Widget {
09f5459a5014 Display in work
Frank Benoit <benoit@tionex.de>
parents: 25
diff changeset
19 GdkWindow* paintWindow () { return null; };
09f5459a5014 Display in work
Frank Benoit <benoit@tionex.de>
parents: 25
diff changeset
20 public Shell getShell();
09f5459a5014 Display in work
Frank Benoit <benoit@tionex.de>
parents: 25
diff changeset
21 bool isEnabled();
27
ffa3c27c4328 Display
Frank Benoit <benoit@tionex.de>
parents: 26
diff changeset
22 bool isDisposed();
ffa3c27c4328 Display
Frank Benoit <benoit@tionex.de>
parents: 26
diff changeset
23 GdkWindow* eventWindow ();
ffa3c27c4328 Display
Frank Benoit <benoit@tionex.de>
parents: 26
diff changeset
24 GtkIMContext * imHandle();
ffa3c27c4328 Display
Frank Benoit <benoit@tionex.de>
parents: 26
diff changeset
25 Control findBackgroundControl ();
ffa3c27c4328 Display
Frank Benoit <benoit@tionex.de>
parents: 26
diff changeset
26 GdkColor* getBackgroundColor () ;
ffa3c27c4328 Display
Frank Benoit <benoit@tionex.de>
parents: 26
diff changeset
27 GdkColor* getForegroundColor () ;
ffa3c27c4328 Display
Frank Benoit <benoit@tionex.de>
parents: 26
diff changeset
28 PangoFontDescription* getFontDescription ();
ffa3c27c4328 Display
Frank Benoit <benoit@tionex.de>
parents: 26
diff changeset
29 public Point toDisplay (int x, int y);
ffa3c27c4328 Display
Frank Benoit <benoit@tionex.de>
parents: 26
diff changeset
30 public Point toDisplay (Point point) ;
ffa3c27c4328 Display
Frank Benoit <benoit@tionex.de>
parents: 26
diff changeset
31 Point getIMCaretPos () ;
25
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
32 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
33 /+++
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
34 import dwt.*;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
35 import dwt.internal.Converter;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
36 import dwt.internal.accessibility.gtk.ATK;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
37 import dwt.graphics.*;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
38 import dwt.events.*;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
39 import dwt.accessibility.*;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
40
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
41 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
42 * Control is the abstract superclass of all windowed user interface classes.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
43 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
44 * <dl>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
45 * <dt><b>Styles:</b>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
46 * <dd>BORDER</dd>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
47 * <dd>LEFT_TO_RIGHT, RIGHT_TO_LEFT</dd>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
48 * <dt><b>Events:</b>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
49 * <dd>DragDetect, FocusIn, FocusOut, Help, KeyDown, KeyUp, MenuDetect, MouseDoubleClick, MouseDown, MouseEnter,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
50 * MouseExit, MouseHover, MouseUp, MouseMove, Move, Paint, Resize, Traverse</dd>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
51 * </dl>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
52 * </p><p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
53 * Only one of LEFT_TO_RIGHT or RIGHT_TO_LEFT may be specified.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
54 * </p><p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
55 * IMPORTANT: This class is intended to be subclassed <em>only</em>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
56 * within the SWT implementation.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
57 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
58 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
59 public abstract class Control extends Widget implements Drawable {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
60 int /*long*/ fixedHandle;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
61 int /*long*/ redrawWindow, enableWindow;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
62 int drawCount;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
63 Composite parent;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
64 Cursor cursor;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
65 Menu menu;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
66 Image backgroundImage;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
67 Font font;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
68 String toolTipText;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
69 Object layoutData;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
70 Accessible accessible;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
71
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
72 Control () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
73 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
74
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
75 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
76 * 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
77 * 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
78 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
79 * 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
80 * 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
81 * 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
82 * (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
83 * 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
84 * 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
85 * 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
86 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
87 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
88 * @param parent a composite control which will be the parent of the new instance (cannot be null)
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
89 * @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
90 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
91 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
92 * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
93 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
94 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
95 * <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
96 * <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
97 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
98 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
99 * @see SWT#BORDER
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
100 * @see Widget#checkSubclass
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
101 * @see Widget#getStyle
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
102 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
103 public Control (Composite parent, int style) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
104 super (parent, style);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
105 this.parent = parent;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
106 createWidget (0);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
107 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
108
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
109 int /*long*/ defaultFont () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
110 return display.getSystemFont ().handle;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
111 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
112
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
113 void deregister () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
114 super.deregister ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
115 if (fixedHandle != 0) display.removeWidget (fixedHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
116 int /*long*/ imHandle = imHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
117 if (imHandle != 0) display.removeWidget (imHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
118 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
119
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
120 boolean drawGripper (int x, int y, int width, int height, boolean vertical) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
121 int /*long*/ paintHandle = paintHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
122 int /*long*/ window = OS.GTK_WIDGET_WINDOW (paintHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
123 if (window == 0) return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
124 int orientation = vertical ? OS.GTK_ORIENTATION_HORIZONTAL : OS.GTK_ORIENTATION_VERTICAL;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
125 OS.gtk_paint_handle (OS.gtk_widget_get_style (paintHandle), window, OS.GTK_STATE_NORMAL, OS.GTK_SHADOW_OUT, null, paintHandle, new byte [1], x, y, width, height, orientation);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
126 return true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
127 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
128
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
129 void enableWidget (boolean enabled) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
130 OS.gtk_widget_set_sensitive (handle, enabled);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
131 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
132
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
133 int /*long*/ enterExitHandle () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
134 return eventHandle ();
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
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
137 int /*long*/ eventHandle () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
138 return handle;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
139 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
140
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
141 int /*long*/ eventWindow () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
142 int /*long*/ eventHandle = eventHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
143 OS.gtk_widget_realize (eventHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
144 return OS.GTK_WIDGET_WINDOW (eventHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
145 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
146
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
147 void fixFocus (Control focusControl) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
148 Shell shell = getShell ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
149 Control control = this;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
150 while (control != shell && (control = control.parent) != null) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
151 if (control.setFocus ()) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
152 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
153 shell.setSavedFocus (focusControl);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
154 int /*long*/ focusHandle = shell.vboxHandle;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
155 OS.GTK_WIDGET_SET_FLAGS (focusHandle, OS.GTK_CAN_FOCUS);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
156 OS.gtk_widget_grab_focus (focusHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
157 OS.GTK_WIDGET_UNSET_FLAGS (focusHandle, OS.GTK_CAN_FOCUS);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
158 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
159
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
160 void fixStyle () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
161 if (fixedHandle != 0) fixStyle (fixedHandle);
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
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
164 void fixStyle (int /*long*/ handle) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
165 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
166 * Feature in GTK. Some GTK themes apply a different background to
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
167 * the contents of a GtkNotebook. However, in an SWT TabFolder, the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
168 * children are not parented below the GtkNotebook widget, and usually
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
169 * have their own GtkFixed. The fix is to look up the correct style
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
170 * for a child of a GtkNotebook and apply its background to any GtkFixed
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
171 * widgets that are direct children of an SWT TabFolder.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
172 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
173 * Note that this has to be when the theme settings changes and that it
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
174 * should not override the application background.
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 if ((state & BACKGROUND) != 0) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
177 int /*long*/ childStyle = parent.childStyle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
178 if (childStyle != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
179 GdkColor color = new GdkColor();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
180 OS.gtk_style_get_bg (childStyle, 0, color);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
181 OS.gtk_widget_modify_bg (handle, 0, color);
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 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
184
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
185 int /*long*/ focusHandle () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
186 return handle;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
187 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
188
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
189 int /*long*/ fontHandle () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
190 return handle;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
191 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
192
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
193 boolean hasFocus () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
194 return this == display.getFocusControl();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
195 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
196
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
197 void hookEvents () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
198 /* Connect the keyboard signals */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
199 int /*long*/ focusHandle = focusHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
200 int focusMask = OS.GDK_KEY_PRESS_MASK | OS.GDK_KEY_RELEASE_MASK | OS.GDK_FOCUS_CHANGE_MASK;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
201 OS.gtk_widget_add_events (focusHandle, focusMask);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
202 OS.g_signal_connect_closure_by_id (focusHandle, display.signalIds [POPUP_MENU], 0, display.closures [POPUP_MENU], false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
203 OS.g_signal_connect_closure_by_id (focusHandle, display.signalIds [SHOW_HELP], 0, display.closures [SHOW_HELP], false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
204 OS.g_signal_connect_closure_by_id (focusHandle, 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
205 OS.g_signal_connect_closure_by_id (focusHandle, display.signalIds [KEY_RELEASE_EVENT], 0, display.closures [KEY_RELEASE_EVENT], false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
206 OS.g_signal_connect_closure_by_id (focusHandle, display.signalIds [FOCUS], 0, display.closures [FOCUS], false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
207 OS.g_signal_connect_closure_by_id (focusHandle, display.signalIds [FOCUS_IN_EVENT], 0, display.closures [FOCUS_IN_EVENT], false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
208 OS.g_signal_connect_closure_by_id (focusHandle, display.signalIds [FOCUS_OUT_EVENT], 0, display.closures [FOCUS_OUT_EVENT], false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
209
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
210 /* Connect the mouse signals */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
211 int /*long*/ eventHandle = eventHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
212 int eventMask = OS.GDK_POINTER_MOTION_MASK | OS.GDK_BUTTON_PRESS_MASK |
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
213 OS.GDK_BUTTON_RELEASE_MASK;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
214 OS.gtk_widget_add_events (eventHandle, eventMask);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
215 OS.g_signal_connect_closure_by_id (eventHandle, display.signalIds [BUTTON_PRESS_EVENT], 0, display.closures [BUTTON_PRESS_EVENT], false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
216 OS.g_signal_connect_closure_by_id (eventHandle, display.signalIds [BUTTON_RELEASE_EVENT], 0, display.closures [BUTTON_RELEASE_EVENT], false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
217 OS.g_signal_connect_closure_by_id (eventHandle, display.signalIds [MOTION_NOTIFY_EVENT], 0, display.closures [MOTION_NOTIFY_EVENT], false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
218 OS.g_signal_connect_closure_by_id (eventHandle, display.signalIds [SCROLL_EVENT], 0, display.closures [SCROLL_EVENT], false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
219
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
220 /* Connect enter/exit signals */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
221 int /*long*/ enterExitHandle = enterExitHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
222 int enterExitMask = OS.GDK_ENTER_NOTIFY_MASK | OS.GDK_LEAVE_NOTIFY_MASK;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
223 OS.gtk_widget_add_events (enterExitHandle, enterExitMask);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
224 OS.g_signal_connect_closure_by_id (enterExitHandle, display.signalIds [ENTER_NOTIFY_EVENT], 0, display.closures [ENTER_NOTIFY_EVENT], false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
225 OS.g_signal_connect_closure_by_id (enterExitHandle, display.signalIds [LEAVE_NOTIFY_EVENT], 0, display.closures [LEAVE_NOTIFY_EVENT], false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
226
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
227 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
228 * Feature in GTK. Events such as mouse move are propagate up
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
229 * the widget hierarchy and are seen by the parent. This is the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
230 * correct GTK behavior but not correct for SWT. The fix is to
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
231 * hook a signal after and stop the propagation using a negative
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
232 * event number to distinguish this case.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
233 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
234 * The signal is hooked to the fixedHandle to catch events sent to
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
235 * lightweight widgets.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
236 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
237 int /*long*/ blockHandle = fixedHandle != 0 ? fixedHandle : eventHandle;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
238 OS.g_signal_connect_closure_by_id (blockHandle, display.signalIds [BUTTON_PRESS_EVENT], 0, display.closures [BUTTON_PRESS_EVENT_INVERSE], true);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
239 OS.g_signal_connect_closure_by_id (blockHandle, display.signalIds [BUTTON_RELEASE_EVENT], 0, display.closures [BUTTON_RELEASE_EVENT_INVERSE], true);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
240 OS.g_signal_connect_closure_by_id (blockHandle, display.signalIds [MOTION_NOTIFY_EVENT], 0, display.closures [MOTION_NOTIFY_EVENT_INVERSE], true);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
241
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
242 /* Connect the event_after signal for both key and mouse */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
243 OS.g_signal_connect_closure_by_id (eventHandle, display.signalIds [EVENT_AFTER], 0, display.closures [EVENT_AFTER], false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
244 if (focusHandle != eventHandle) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
245 OS.g_signal_connect_closure_by_id (focusHandle, display.signalIds [EVENT_AFTER], 0, display.closures [EVENT_AFTER], false);
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
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
248 /* Connect the paint signal */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
249 int /*long*/ paintHandle = paintHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
250 int paintMask = OS.GDK_EXPOSURE_MASK | OS.GDK_VISIBILITY_NOTIFY_MASK;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
251 OS.gtk_widget_add_events (paintHandle, paintMask);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
252 OS.g_signal_connect_closure_by_id (paintHandle, display.signalIds [EXPOSE_EVENT], 0, display.closures [EXPOSE_EVENT_INVERSE], false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
253 OS.g_signal_connect_closure_by_id (paintHandle, display.signalIds [VISIBILITY_NOTIFY_EVENT], 0, display.closures [VISIBILITY_NOTIFY_EVENT], false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
254 OS.g_signal_connect_closure_by_id (paintHandle, display.signalIds [EXPOSE_EVENT], 0, display.closures [EXPOSE_EVENT], true);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
255
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
256 /* Connect the Input Method signals */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
257 OS.g_signal_connect_closure_by_id (handle, display.signalIds [REALIZE], 0, display.closures [REALIZE], true);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
258 OS.g_signal_connect_closure_by_id (handle, display.signalIds [UNREALIZE], 0, display.closures [UNREALIZE], false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
259 int /*long*/ imHandle = imHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
260 if (imHandle != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
261 OS.g_signal_connect_closure (imHandle, OS.commit, display.closures [COMMIT], false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
262 OS.g_signal_connect_closure (imHandle, OS.preedit_changed, display.closures [PREEDIT_CHANGED], false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
263 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
264
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
265 OS.g_signal_connect_closure_by_id (paintHandle, display.signalIds [STYLE_SET], 0, display.closures [STYLE_SET], false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
266
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
267 int /*long*/ topHandle = topHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
268 OS.g_signal_connect_closure_by_id (topHandle, display.signalIds [MAP], 0, display.closures [MAP], true);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
269 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
270
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
271 int /*long*/ hoverProc (int /*long*/ widget) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
272 int [] x = new int [1], y = new int [1], mask = new int [1];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
273 OS.gdk_window_get_pointer (0, x, y, mask);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
274 sendMouseEvent (SWT.MouseHover, 0, /*time*/0, x [0], y [0], false, mask [0]);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
275 /* Always return zero in order to cancel the hover timer */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
276 return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
277 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
278
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
279 int /*long*/ topHandle() {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
280 if (fixedHandle != 0) return fixedHandle;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
281 return super.topHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
282 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
283
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
284 int /*long*/ paintHandle () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
285 int /*long*/ topHandle = topHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
286 int /*long*/ paintHandle = handle;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
287 while (paintHandle != topHandle) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
288 if ((OS.GTK_WIDGET_FLAGS (paintHandle) & OS.GTK_NO_WINDOW) == 0) break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
289 paintHandle = OS.gtk_widget_get_parent (paintHandle);
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 return paintHandle;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
292 }
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 int /*long*/ paintWindow () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
295 int /*long*/ paintHandle = paintHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
296 OS.gtk_widget_realize (paintHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
297 return OS.GTK_WIDGET_WINDOW (paintHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
298 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
299
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
300 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
301 * Returns the preferred size of the receiver.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
302 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
303 * The <em>preferred size</em> of a control is the size that it would
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
304 * best be displayed at. The width hint and height hint arguments
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
305 * allow the caller to ask a control questions such as "Given a particular
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
306 * width, how high does the control need to be to show all of the contents?"
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
307 * To indicate that the caller does not wish to constrain a particular
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
308 * dimension, the constant <code>SWT.DEFAULT</code> is passed for the hint.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
309 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
310 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
311 * @param wHint the width hint (can be <code>SWT.DEFAULT</code>)
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
312 * @param hHint the height hint (can be <code>SWT.DEFAULT</code>)
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
313 * @return the preferred size of the control
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
314 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
315 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
316 * <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
317 * <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
318 * </ul>
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 * @see Layout
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
321 * @see #getBorderWidth
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
322 * @see #getBounds
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
323 * @see #getSize
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
324 * @see #pack(boolean)
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
325 * @see "computeTrim, getClientArea for controls that implement them"
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
326 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
327 public Point computeSize (int wHint, int hHint) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
328 return computeSize (wHint, hHint, true);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
329 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
330
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
331 Control computeTabGroup () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
332 if (isTabGroup()) return this;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
333 return parent.computeTabGroup ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
334 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
335
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
336 Control[] computeTabList() {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
337 if (isTabGroup()) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
338 if (getVisible() && getEnabled()) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
339 return new Control[] {this};
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 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
342 return new Control[0];
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
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
345 Control computeTabRoot () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
346 Control[] tabList = parent._getTabList();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
347 if (tabList != null) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
348 int index = 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
349 while (index < tabList.length) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
350 if (tabList [index] == this) break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
351 index++;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
352 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
353 if (index == tabList.length) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
354 if (isTabGroup ()) return this;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
355 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
356 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
357 return parent.computeTabRoot ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
358 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
359
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
360 void checkBuffered () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
361 style |= SWT.DOUBLE_BUFFERED;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
362 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
363
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
364 void checkBackground () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
365 Shell shell = getShell ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
366 if (this == shell) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
367 state &= ~PARENT_BACKGROUND;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
368 Composite composite = parent;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
369 do {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
370 int mode = composite.backgroundMode;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
371 if (mode != SWT.INHERIT_NONE) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
372 if (mode == SWT.INHERIT_DEFAULT) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
373 Control control = this;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
374 do {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
375 if ((control.state & THEME_BACKGROUND) == 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
376 return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
377 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
378 control = control.parent;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
379 } while (control != composite);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
380 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
381 state |= PARENT_BACKGROUND;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
382 return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
383 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
384 if (composite == shell) break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
385 composite = composite.parent;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
386 } while (true);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
387 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
388
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
389 void checkBorder () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
390 if (getBorderWidth () == 0) style &= ~SWT.BORDER;
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
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
393 int /*long*/ childStyle () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
394 return parent.childStyle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
395 }
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 void createWidget (int index) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
398 state |= DRAG_DETECT;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
399 checkOrientation (parent);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
400 super.createWidget (index);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
401 checkBackground ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
402 if ((state & PARENT_BACKGROUND) != 0) setBackground ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
403 checkBuffered ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
404 showWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
405 setInitialBounds ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
406 setZOrder (null, false, false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
407 setRelations ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
408 checkBorder ();
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
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
411 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
412 * Returns the preferred size of the receiver.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
413 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
414 * The <em>preferred size</em> of a control is the size that it would
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
415 * best be displayed at. The width hint and height hint arguments
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
416 * allow the caller to ask a control questions such as "Given a particular
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
417 * width, how high does the control need to be to show all of the contents?"
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
418 * To indicate that the caller does not wish to constrain a particular
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
419 * dimension, the constant <code>SWT.DEFAULT</code> is passed for the hint.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
420 * </p><p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
421 * If the changed flag is <code>true</code>, it indicates that the receiver's
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
422 * <em>contents</em> have changed, therefore any caches that a layout manager
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
423 * containing the control may have been keeping need to be flushed. When the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
424 * control is resized, the changed flag will be <code>false</code>, so layout
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
425 * manager caches can be retained.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
426 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
427 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
428 * @param wHint the width hint (can be <code>SWT.DEFAULT</code>)
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
429 * @param hHint the height hint (can be <code>SWT.DEFAULT</code>)
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
430 * @param changed <code>true</code> if the control's contents have changed, and <code>false</code> otherwise
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
431 * @return the preferred size of the control.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
432 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
433 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
434 * <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
435 * <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
436 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
437 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
438 * @see Layout
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
439 * @see #getBorderWidth
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
440 * @see #getBounds
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
441 * @see #getSize
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
442 * @see #pack(boolean)
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
443 * @see "computeTrim, getClientArea for controls that implement them"
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 public Point computeSize (int wHint, int hHint, boolean changed) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
446 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
447 if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
448 if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
449 return computeNativeSize (handle, wHint, hHint, changed);
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
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
452 Point computeNativeSize (int /*long*/ h, int wHint, int hHint, boolean changed) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
453 int width = wHint, height = hHint;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
454 if (wHint == SWT.DEFAULT && hHint == SWT.DEFAULT) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
455 GtkRequisition requisition = new GtkRequisition ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
456 gtk_widget_size_request (h, requisition);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
457 width = OS.GTK_WIDGET_REQUISITION_WIDTH (h);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
458 height = OS.GTK_WIDGET_REQUISITION_HEIGHT (h);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
459 } else if (wHint == SWT.DEFAULT || hHint == SWT.DEFAULT) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
460 int [] reqWidth = new int [1], reqHeight = new int [1];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
461 OS.gtk_widget_get_size_request (h, reqWidth, reqHeight);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
462 OS.gtk_widget_set_size_request (h, wHint, hHint);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
463 GtkRequisition requisition = new GtkRequisition ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
464 gtk_widget_size_request (h, requisition);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
465 OS.gtk_widget_set_size_request (h, reqWidth [0], reqHeight [0]);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
466 width = wHint == SWT.DEFAULT ? requisition.width : wHint;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
467 height = hHint == SWT.DEFAULT ? requisition.height : hHint;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
468 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
469 return new Point (width, height);
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
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
472 void forceResize () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
473 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
474 * Force size allocation on all children of this widget's
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
475 * topHandle. Note that all calls to gtk_widget_size_allocate()
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
476 * must be preceded by a call to gtk_widget_size_request().
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
477 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
478 int /*long*/ topHandle = topHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
479 GtkRequisition requisition = new GtkRequisition ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
480 gtk_widget_size_request (topHandle, requisition);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
481 GtkAllocation allocation = new GtkAllocation ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
482 allocation.x = OS.GTK_WIDGET_X (topHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
483 allocation.y = OS.GTK_WIDGET_Y (topHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
484 allocation.width = OS.GTK_WIDGET_WIDTH (topHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
485 allocation.height = OS.GTK_WIDGET_HEIGHT (topHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
486 OS.gtk_widget_size_allocate (topHandle, allocation);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
487 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
488
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
489 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
490 * Returns the accessible object for the receiver.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
491 * If this is the first time this object is requested,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
492 * then the object is created and returned.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
493 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
494 * @return the accessible object
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
495 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
496 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
497 * <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
498 * <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
499 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
500 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
501 * @see Accessible#addAccessibleListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
502 * @see Accessible#addAccessibleControlListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
503 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
504 * @since 2.0
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
505 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
506 public Accessible getAccessible () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
507 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
508 if (accessible == null) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
509 accessible = Accessible.internal_new_Accessible (this);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
510 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
511 return accessible;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
512 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
513
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
514 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
515 * Returns a rectangle describing the receiver's size and location
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
516 * relative to its parent (or its display if its parent is null),
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
517 * unless the receiver is a shell. In this case, the location is
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
518 * relative to the display.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
519 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
520 * @return the receiver's bounding rectangle
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
521 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
522 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
523 * <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
524 * <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
525 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
526 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
527 public Rectangle getBounds () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
528 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
529 int /*long*/ topHandle = topHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
530 int x = OS.GTK_WIDGET_X (topHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
531 int y = OS.GTK_WIDGET_Y (topHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
532 int width = (state & ZERO_WIDTH) != 0 ? 0 : OS.GTK_WIDGET_WIDTH (topHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
533 int height = (state & ZERO_HEIGHT) != 0 ? 0 : OS.GTK_WIDGET_HEIGHT (topHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
534 return new Rectangle (x, y, width, height);
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 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
538 * Sets the receiver's size and location to the rectangular
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
539 * area specified by the argument. The <code>x</code> and
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
540 * <code>y</code> fields of the rectangle are relative to
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
541 * the receiver's parent (or its display if its parent is null).
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
542 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
543 * Note: Attempting to set the width or height of the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
544 * receiver to a negative number will cause that
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
545 * value to be set to zero instead.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
546 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
547 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
548 * @param rect the new bounds for the receiver
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
549 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
550 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
551 * <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
552 * <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
553 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
554 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
555 public void setBounds (Rectangle rect) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
556 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
557 if (rect == null) error (SWT.ERROR_NULL_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
558 setBounds (rect.x, rect.y, Math.max (0, rect.width), Math.max (0, rect.height), true, true);
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
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
561 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
562 * Sets the receiver's size and location to the rectangular
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
563 * area specified by the arguments. The <code>x</code> and
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
564 * <code>y</code> arguments are relative to the receiver's
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
565 * parent (or its display if its parent is null), unless
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
566 * the receiver is a shell. In this case, the <code>x</code>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
567 * and <code>y</code> arguments are relative to the display.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
568 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
569 * Note: Attempting to set the width or height of the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
570 * receiver to a negative number will cause that
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
571 * value to be set to zero instead.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
572 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
573 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
574 * @param x the new x coordinate for the receiver
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
575 * @param y the new y coordinate for the receiver
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
576 * @param width the new width for the receiver
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
577 * @param height the new height for the receiver
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
578 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
579 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
580 * <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
581 * <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
582 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
583 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
584 public void setBounds (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
585 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
586 setBounds (x, y, Math.max (0, width), Math.max (0, height), true, true);
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
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
589 void markLayout (boolean changed, boolean all) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
590 /* Do nothing */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
591 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
592
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
593 void moveHandle (int x, int y) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
594 int /*long*/ topHandle = topHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
595 int /*long*/ parentHandle = parent.parentingHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
596 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
597 * Feature in GTK. Calling gtk_fixed_move() to move a child causes
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
598 * the whole parent to redraw. This is a performance problem. The
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
599 * fix is temporarily make the parent not visible during the move.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
600 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
601 * NOTE: Because every widget in SWT has an X window, the new and
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
602 * old bounds of the child are correctly redrawn.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
603 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
604 int flags = OS.GTK_WIDGET_FLAGS (parentHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
605 OS.GTK_WIDGET_UNSET_FLAGS (parentHandle, OS.GTK_VISIBLE);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
606 OS.gtk_fixed_move (parentHandle, topHandle, x, y);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
607 if ((flags & OS.GTK_VISIBLE) != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
608 OS.GTK_WIDGET_SET_FLAGS (parentHandle, OS.GTK_VISIBLE);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
609 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
610 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
611
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
612 void resizeHandle (int width, int height) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
613 int /*long*/ topHandle = topHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
614 OS.gtk_widget_set_size_request (topHandle, width, height);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
615 if (topHandle != handle) OS.gtk_widget_set_size_request (handle, width, height);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
616 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
617
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
618 int setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
619 int /*long*/ topHandle = topHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
620 boolean sameOrigin = true, sameExtent = true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
621 if (move) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
622 int oldX = OS.GTK_WIDGET_X (topHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
623 int oldY = OS.GTK_WIDGET_Y (topHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
624 sameOrigin = x == oldX && y == oldY;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
625 if (!sameOrigin) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
626 if (enableWindow != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
627 OS.gdk_window_move (enableWindow, x, y);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
628 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
629 moveHandle (x, y);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
630 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
631 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
632 if (resize) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
633 int oldWidth = (state & ZERO_WIDTH) != 0 ? 0 : OS.GTK_WIDGET_WIDTH (topHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
634 int oldHeight = (state & ZERO_HEIGHT) != 0 ? 0 : OS.GTK_WIDGET_HEIGHT (topHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
635 sameExtent = width == oldWidth && height == oldHeight;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
636 if (!sameExtent && !(width == 0 && height == 0)) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
637 int newWidth = Math.max (1, width);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
638 int newHeight = Math.max (1, height);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
639 if (redrawWindow != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
640 OS.gdk_window_resize (redrawWindow, newWidth, newHeight);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
641 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
642 if (enableWindow != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
643 OS.gdk_window_resize (enableWindow, newWidth, newHeight);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
644 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
645 resizeHandle (newWidth, newHeight);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
646 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
647 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
648 if (!sameOrigin || !sameExtent) {
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 * Cause a size allocation this widget's topHandle. Note that
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
651 * all calls to gtk_widget_size_allocate() must be preceded by
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
652 * a call to gtk_widget_size_request().
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
653 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
654 GtkRequisition requisition = new GtkRequisition ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
655 gtk_widget_size_request (topHandle, requisition);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
656 GtkAllocation allocation = new GtkAllocation ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
657 if (move) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
658 allocation.x = x;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
659 allocation.y = y;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
660 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
661 allocation.x = OS.GTK_WIDGET_X (topHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
662 allocation.y = OS.GTK_WIDGET_Y (topHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
663 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
664 if (resize) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
665 allocation.width = width;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
666 allocation.height = height;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
667 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
668 allocation.width = OS.GTK_WIDGET_WIDTH (topHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
669 allocation.height = OS.GTK_WIDGET_HEIGHT (topHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
670 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
671 OS.gtk_widget_size_allocate (topHandle, allocation);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
672 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
673 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
674 * Bug in GTK. Widgets cannot be sized smaller than 1x1.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
675 * The fix is to hide zero-sized widgets and show them again
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
676 * when they are resized larger.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
677 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
678 if (!sameExtent) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
679 state = (width == 0) ? state | ZERO_WIDTH : state & ~ZERO_WIDTH;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
680 state = (height == 0) ? state | ZERO_HEIGHT : state & ~ZERO_HEIGHT;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
681 if ((state & (ZERO_WIDTH | ZERO_HEIGHT)) != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
682 if (enableWindow != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
683 OS.gdk_window_hide (enableWindow);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
684 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
685 OS.gtk_widget_hide (topHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
686 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
687 if ((state & HIDDEN) == 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
688 if (enableWindow != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
689 OS.gdk_window_show_unraised (enableWindow);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
690 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
691 OS.gtk_widget_show (topHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
692 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
693 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
694 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
695 int result = 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
696 if (move && !sameOrigin) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
697 Control control = findBackgroundControl ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
698 if (control != null && control.backgroundImage != null) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
699 if (isVisible ()) redrawWidget (0, 0, 0, 0, true, true, true);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
700 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
701 sendEvent (SWT.Move);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
702 result |= MOVED;
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 if (resize && !sameExtent) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
705 sendEvent (SWT.Resize);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
706 result |= RESIZED;
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 return result;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
709 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
710
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 * Returns a point describing the receiver's location relative
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
713 * to its parent (or its display if its parent is null), unless
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
714 * the receiver is a shell. In this case, the point is
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
715 * relative to the display.
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 * @return the receiver's location
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
718 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
719 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
720 * <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
721 * <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
722 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
723 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
724 public Point getLocation () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
725 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
726 int /*long*/ topHandle = topHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
727 int x = OS.GTK_WIDGET_X (topHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
728 int y = OS.GTK_WIDGET_Y (topHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
729 return new Point (x, y);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
730 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
731
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 * Sets the receiver's location to the point specified by
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
734 * the arguments which are relative to the receiver's
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
735 * parent (or its display if its parent is null), unless
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
736 * the receiver is a shell. In this case, the point is
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
737 * relative to the display.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
738 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
739 * @param location the new location for the receiver
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
740 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
741 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
742 * <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
743 * <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
744 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
745 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
746 public void setLocation (Point location) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
747 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
748 if (location == null) error (SWT.ERROR_NULL_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
749 setBounds (location.x, location.y, 0, 0, true, false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
750 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
751
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
752 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
753 * Sets the receiver's location to the point specified by
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
754 * the arguments which are relative to the receiver's
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
755 * parent (or its display if its parent is null), unless
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
756 * the receiver is a shell. In this case, the point is
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
757 * relative to the display.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
758 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
759 * @param x the new x coordinate for the receiver
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
760 * @param y the new y coordinate for the receiver
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
761 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
762 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
763 * <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
764 * <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
765 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
766 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
767 public void setLocation(int x, int y) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
768 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
769 setBounds (x, y, 0, 0, true, false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
770 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
771
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
772 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
773 * Returns a point describing the receiver's size. The
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
774 * x coordinate of the result is the width of the receiver.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
775 * The y coordinate of the result is the height of the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
776 * receiver.
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 * @return the receiver's size
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 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
781 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
782 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
783 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
784 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
785 public Point getSize () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
786 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
787 int /*long*/ topHandle = topHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
788 int width = (state & ZERO_WIDTH) != 0 ? 0 : OS.GTK_WIDGET_WIDTH (topHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
789 int height = (state & ZERO_HEIGHT) != 0 ? 0 : OS.GTK_WIDGET_HEIGHT (topHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
790 return new Point (width, height);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
791 }
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 * Sets the receiver's size to the point specified by the argument.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
795 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
796 * Note: Attempting to set the width or height of the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
797 * receiver to a negative number will cause them to be
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
798 * set to zero instead.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
799 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
800 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
801 * @param size the new size for the receiver
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
802 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
803 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
804 * <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
805 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
806 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
807 * <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
808 * <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
809 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
810 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
811 public void setSize (Point size) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
812 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
813 if (size == null) error (SWT.ERROR_NULL_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
814 setBounds (0, 0, Math.max (0, size.x), Math.max (0, size.y), false, true);
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 void setRelations () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
818 int /*long*/ parentHandle = parent.parentingHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
819 int /*long*/ list = OS.gtk_container_get_children (parentHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
820 if (list == 0) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
821 int count = OS.g_list_length (list);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
822 if (count > 1) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
823 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
824 * the receiver is the last item in the list, so its predecessor will
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
825 * be the second-last item in the list
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
826 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
827 int /*long*/ handle = OS.g_list_nth_data (list, count - 2);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
828 if (handle != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
829 Widget widget = display.getWidget (handle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
830 if (widget != null && widget != this) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
831 if (widget instanceof Control) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
832 Control sibling = (Control)widget;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
833 sibling.addRelation (this);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
834 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
835 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
836 }
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 OS.g_list_free (list);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
839 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
840
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
841 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
842 * Sets the receiver's size to the point specified by the arguments.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
843 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
844 * Note: Attempting to set the width or height of the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
845 * receiver to a negative number will cause that
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
846 * value to be set to zero instead.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
847 * </p>
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 * @param width the new width for the receiver
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
850 * @param height the new height for the receiver
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
851 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
852 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
853 * <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
854 * <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
855 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
856 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
857 public void setSize (int width, int height) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
858 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
859 setBounds (0, 0, Math.max (0, width), Math.max (0, height), false, true);
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
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
862 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
863 * Answers a boolean indicating whether a Label that precedes the receiver in
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
864 * a layout should be read by screen readers as the recevier's label.
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 boolean isDescribedByLabel () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
867 return true;
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
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
870 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
871 * Moves the receiver above the specified control in the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
872 * drawing order. If the argument is null, then the receiver
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
873 * is moved to the top of the drawing order. The control at
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
874 * the top of the drawing order will not be covered by other
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
875 * controls even if they occupy intersecting areas.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
876 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
877 * @param control the sibling control (or null)
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
878 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
879 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
880 * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
881 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
882 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
883 * <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
884 * <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
885 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
886 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
887 * @see Control#moveBelow
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
888 * @see Composite#getChildren
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
889 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
890 public void moveAbove (Control control) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
891 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
892 if (control != null) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
893 if (control.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
894 if (parent != control.parent) return;
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 setZOrder (control, true, true);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
897 }
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 * Moves the receiver below the specified control in the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
901 * drawing order. If the argument is null, then the receiver
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
902 * is moved to the bottom of the drawing order. The control at
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
903 * the bottom of the drawing order will be covered by all other
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
904 * controls which occupy intersecting areas.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
905 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
906 * @param control the sibling control (or null)
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
907 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
908 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
909 * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
910 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
911 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
912 * <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
913 * <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
914 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
915 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
916 * @see Control#moveAbove
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
917 * @see Composite#getChildren
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
918 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
919 public void moveBelow (Control control) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
920 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
921 if (control != null) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
922 if (control.isDisposed ()) error(SWT.ERROR_INVALID_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
923 if (parent != control.parent) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
924 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
925 setZOrder (control, false, true);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
926 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
927
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
928 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
929 * Causes the receiver to be resized to its preferred size.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
930 * For a composite, this involves computing the preferred size
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
931 * from its layout, if there is one.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
932 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
933 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
934 * <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
935 * <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
936 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
937 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
938 * @see #computeSize(int, int, boolean)
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
939 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
940 public void pack () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
941 pack (true);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
942 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
943
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 * Causes the receiver to be resized to its preferred size.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
946 * For a composite, this involves computing the preferred size
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
947 * from its layout, if there is one.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
948 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
949 * If the changed flag is <code>true</code>, it indicates that the receiver's
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
950 * <em>contents</em> have changed, therefore any caches that a layout manager
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
951 * containing the control may have been keeping need to be flushed. When the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
952 * control is resized, the changed flag will be <code>false</code>, so layout
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
953 * manager caches can be retained.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
954 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
955 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
956 * @param changed whether or not the receiver's contents have changed
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
957 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
958 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
959 * <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
960 * <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
961 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
962 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
963 * @see #computeSize(int, int, boolean)
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
964 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
965 public void pack (boolean changed) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
966 setSize (computeSize (SWT.DEFAULT, SWT.DEFAULT, changed));
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
967 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
968
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
969 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
970 * Sets the layout data associated with the receiver to the argument.
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 * @param layoutData the new layout data for the receiver.
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 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
975 * <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
976 * <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
977 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
978 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
979 public void setLayoutData (Object layoutData) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
980 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
981 this.layoutData = layoutData;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
982 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
983
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
984 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
985 * Returns a point which is the result of converting the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
986 * argument, which is specified in display relative coordinates,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
987 * to coordinates relative to the receiver.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
988 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
989 * @param x the x coordinate to be translated
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
990 * @param y the y coordinate to be translated
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
991 * @return the translated coordinates
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
992 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
993 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
994 * <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
995 * <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
996 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
997 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
998 * @since 2.1
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 public Point toControl (int x, int y) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1001 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1002 int /*long*/ window = eventWindow ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1003 int [] origin_x = new int [1], origin_y = new int [1];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1004 OS.gdk_window_get_origin (window, origin_x, origin_y);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1005 return new Point (x - origin_x [0], y - origin_y [0]);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1006 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1007
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 * Returns a point which is the result of converting the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1010 * argument, which is specified in display relative coordinates,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1011 * to coordinates relative to the receiver.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1012 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1013 * @param point the point to be translated (must not be null)
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1014 * @return the translated coordinates
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1015 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1016 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1017 * <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
1018 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1019 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1020 * <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
1021 * <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
1022 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1023 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1024 public Point toControl (Point point) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1025 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1026 if (point == null) error (SWT.ERROR_NULL_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1027 return toControl (point.x, point.y);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1028 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1029
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1030 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1031 * Returns a point which is the result of converting the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1032 * argument, which is specified in coordinates relative to
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1033 * the receiver, to display relative coordinates.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1034 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1035 * @param x the x coordinate to be translated
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1036 * @param y the y coordinate to be translated
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1037 * @return the translated coordinates
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 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1040 * <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
1041 * <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
1042 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1043 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1044 * @since 2.1
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1045 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1046 public Point toDisplay (int x, int y) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1047 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1048 int /*long*/ window = eventWindow ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1049 int [] origin_x = new int [1], origin_y = new int [1];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1050 OS.gdk_window_get_origin (window, origin_x, origin_y);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1051 return new Point (origin_x [0] + x, origin_y [0] + y);
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
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1054 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1055 * Returns a point which is the result of converting the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1056 * argument, which is specified in coordinates relative to
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1057 * the receiver, to display relative coordinates.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1058 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1059 * @param point the point to be translated (must not be null)
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1060 * @return the translated coordinates
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1061 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1062 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1063 * <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
1064 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1065 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1066 * <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
1067 * <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
1068 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1069 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1070 public Point toDisplay (Point point) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1071 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1072 if (point == null) error (SWT.ERROR_NULL_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1073 return toDisplay (point.x, point.y);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1074 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1075
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1076 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1077 * 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
1078 * be notified when the control is moved or resized, by sending
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1079 * it one of the messages defined in the <code>ControlListener</code>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1080 * interface.
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 * @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
1083 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1084 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1085 * <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
1086 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1087 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1088 * <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
1089 * <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
1090 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1091 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1092 * @see ControlListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1093 * @see #removeControlListener
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 public void addControlListener(ControlListener listener) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1096 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1097 if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1098 TypedListener typedListener = new TypedListener (listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1099 addListener (SWT.Resize,typedListener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1100 addListener (SWT.Move,typedListener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1101 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1102
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1103 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1104 * 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
1105 * be notified when a drag gesture occurs, by sending it
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1106 * one of the messages defined in the <code>DragDetectListener</code>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1107 * interface.
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 * @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
1110 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1111 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1112 * <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
1113 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1114 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1115 * <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
1116 * <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
1117 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1118 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1119 * @see DragDetectListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1120 * @see #removeDragDetectListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1121 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1122 * @since 3.3
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1123 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1124 public void addDragDetectListener (DragDetectListener listener) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1125 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1126 if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1127 TypedListener typedListener = new TypedListener (listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1128 addListener (SWT.DragDetect,typedListener);
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
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1131 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1132 * 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
1133 * be notified when the control gains or loses focus, by sending
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1134 * it one of the messages defined in the <code>FocusListener</code>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1135 * interface.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1136 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1137 * @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
1138 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1139 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1140 * <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
1141 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1142 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1143 * <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
1144 * <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
1145 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1146 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1147 * @see FocusListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1148 * @see #removeFocusListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1149 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1150 public void addFocusListener(FocusListener listener) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1151 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1152 if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1153 TypedListener typedListener = new TypedListener (listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1154 addListener(SWT.FocusIn,typedListener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1155 addListener(SWT.FocusOut,typedListener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1156 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1157
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1158 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1159 * 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
1160 * be notified when help events are generated for the control,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1161 * by sending it one of the messages defined in the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1162 * <code>HelpListener</code> interface.
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 * @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
1165 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1166 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1167 * <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
1168 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1169 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1170 * <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
1171 * <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
1172 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1173 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1174 * @see HelpListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1175 * @see #removeHelpListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1176 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1177 public void addHelpListener (HelpListener listener) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1178 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1179 if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1180 TypedListener typedListener = new TypedListener (listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1181 addListener (SWT.Help, typedListener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1182 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1183
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1184 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1185 * 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
1186 * be notified when keys are pressed and released on the system keyboard, by sending
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1187 * it one of the messages defined in the <code>KeyListener</code>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1188 * interface.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1189 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1190 * When a key listener is added to a control, the control
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1191 * will take part in widget traversal. By default, all
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1192 * traversal keys (such as the tab key and so on) are
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1193 * delivered to the control. In order for a control to take
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1194 * part in traversal, it should listen for traversal events.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1195 * Otherwise, the user can traverse into a control but not
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1196 * out. Note that native controls such as table and tree
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1197 * implement key traversal in the operating system. It is
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1198 * not necessary to add traversal listeners for these controls,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1199 * unless you want to override the default traversal.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1200 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1201 * @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
1202 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1203 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1204 * <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
1205 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1206 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1207 * <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
1208 * <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
1209 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1210 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1211 * @see KeyListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1212 * @see #removeKeyListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1213 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1214 public void addKeyListener(KeyListener listener) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1215 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1216 if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1217 TypedListener typedListener = new TypedListener (listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1218 addListener(SWT.KeyUp,typedListener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1219 addListener(SWT.KeyDown,typedListener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1220 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1221
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 * 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
1224 * be notified when the platform-specific context menu trigger
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1225 * has occurred, by sending it one of the messages defined in
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1226 * the <code>MenuDetectListener</code> interface.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1227 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1228 * @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
1229 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1230 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1231 * <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
1232 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1233 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1234 * <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
1235 * <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
1236 * </ul>
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 * @see MenuDetectListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1239 * @see #removeMenuDetectListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1240 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1241 * @since 3.3
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1242 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1243 public void addMenuDetectListener (MenuDetectListener listener) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1244 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1245 if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1246 TypedListener typedListener = new TypedListener (listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1247 addListener (SWT.MenuDetect, typedListener);
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
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 * 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
1252 * be notified when mouse buttons are pressed and released, by sending
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1253 * it one of the messages defined in the <code>MouseListener</code>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1254 * interface.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1255 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1256 * @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
1257 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1258 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1259 * <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
1260 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1261 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1262 * <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
1263 * <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
1264 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1265 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1266 * @see MouseListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1267 * @see #removeMouseListener
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 public void addMouseListener(MouseListener listener) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1270 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1271 if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1272 TypedListener typedListener = new TypedListener (listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1273 addListener(SWT.MouseDown,typedListener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1274 addListener(SWT.MouseUp,typedListener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1275 addListener(SWT.MouseDoubleClick,typedListener);
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
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1278 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1279 * 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
1280 * be notified when the mouse moves, by sending it one of the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1281 * messages defined in the <code>MouseMoveListener</code>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1282 * interface.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1283 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1284 * @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
1285 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1286 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1287 * <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
1288 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1289 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1290 * <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
1291 * <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
1292 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1293 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1294 * @see MouseMoveListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1295 * @see #removeMouseMoveListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1296 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1297 public void addMouseMoveListener(MouseMoveListener listener) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1298 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1299 if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1300 TypedListener typedListener = new TypedListener (listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1301 addListener(SWT.MouseMove,typedListener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1302 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1303
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1304 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1305 * 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
1306 * be notified when the mouse passes or hovers over controls, by sending
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1307 * it one of the messages defined in the <code>MouseTrackListener</code>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1308 * interface.
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 * @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
1311 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1312 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1313 * <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
1314 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1315 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1316 * <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
1317 * <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
1318 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1319 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1320 * @see MouseTrackListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1321 * @see #removeMouseTrackListener
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 public void addMouseTrackListener (MouseTrackListener listener) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1324 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1325 if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1326 TypedListener typedListener = new TypedListener (listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1327 addListener (SWT.MouseEnter,typedListener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1328 addListener (SWT.MouseExit,typedListener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1329 addListener (SWT.MouseHover,typedListener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1330 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1331
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1332 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1333 * 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
1334 * be notified when the mouse wheel is scrolled, by sending
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1335 * it one of the messages defined in the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1336 * <code>MouseWheelListener</code> interface.
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 * @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
1339 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1340 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1341 * <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
1342 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1343 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1344 * <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
1345 * <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
1346 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1347 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1348 * @see MouseWheelListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1349 * @see #removeMouseWheelListener
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 * @since 3.3
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1352 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1353 public void addMouseWheelListener (MouseWheelListener listener) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1354 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1355 if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1356 TypedListener typedListener = new TypedListener (listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1357 addListener (SWT.MouseWheel, typedListener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1358 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1359
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1360 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1361 * 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
1362 * be notified when the receiver needs to be painted, by sending it
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1363 * one of the messages defined in the <code>PaintListener</code>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1364 * interface.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1365 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1366 * @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
1367 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1368 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1369 * <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
1370 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1371 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1372 * <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
1373 * <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
1374 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1375 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1376 * @see PaintListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1377 * @see #removePaintListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1378 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1379 public void addPaintListener(PaintListener listener) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1380 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1381 if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1382 TypedListener typedListener = new TypedListener (listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1383 addListener(SWT.Paint,typedListener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1384 }
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 void addRelation (Control control) {
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 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1390 * 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
1391 * be notified when traversal events occur, by sending it
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1392 * one of the messages defined in the <code>TraverseListener</code>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1393 * interface.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1394 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1395 * @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
1396 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1397 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1398 * <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
1399 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1400 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1401 * <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
1402 * <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
1403 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1404 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1405 * @see TraverseListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1406 * @see #removeTraverseListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1407 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1408 public void addTraverseListener (TraverseListener listener) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1409 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1410 if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1411 TypedListener typedListener = new TypedListener (listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1412 addListener (SWT.Traverse,typedListener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1413 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1414
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 * 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
1417 * be notified when the control is moved or resized.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1418 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1419 * @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
1420 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1421 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1422 * <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
1423 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1424 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1425 * <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
1426 * <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
1427 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1428 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1429 * @see ControlListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1430 * @see #addControlListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1431 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1432 public void removeControlListener (ControlListener listener) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1433 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1434 if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1435 if (eventTable == null) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1436 eventTable.unhook (SWT.Move, listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1437 eventTable.unhook (SWT.Resize, listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1438 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1439
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 * 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
1442 * be notified when a drag gesture occurs.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1443 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1444 * @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
1445 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1446 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1447 * <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
1448 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1449 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1450 * <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
1451 * <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
1452 * </ul>
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 * @see DragDetectListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1455 * @see #addDragDetectListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1456 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1457 * @since 3.3
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1458 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1459 public void removeDragDetectListener(DragDetectListener listener) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1460 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1461 if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1462 if (eventTable == null) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1463 eventTable.unhook (SWT.DragDetect, listener);
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
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 * 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
1468 * be notified when the control gains or loses focus.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1469 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1470 * @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
1471 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1472 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1473 * <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
1474 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1475 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1476 * <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
1477 * <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
1478 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1479 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1480 * @see FocusListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1481 * @see #addFocusListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1482 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1483 public void removeFocusListener(FocusListener listener) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1484 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1485 if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1486 if (eventTable == null) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1487 eventTable.unhook (SWT.FocusIn, listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1488 eventTable.unhook (SWT.FocusOut, listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1489 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1490 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1491 * 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
1492 * be notified when the help events are generated for the control.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1493 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1494 * @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
1495 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1496 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1497 * <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
1498 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1499 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1500 * <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
1501 * <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
1502 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1503 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1504 * @see HelpListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1505 * @see #addHelpListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1506 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1507 public void removeHelpListener (HelpListener listener) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1508 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1509 if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1510 if (eventTable == null) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1511 eventTable.unhook (SWT.Help, listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1512 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1513 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1514 * 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
1515 * be notified when keys are pressed and released on the system keyboard.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1516 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1517 * @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
1518 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1519 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1520 * <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
1521 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1522 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1523 * <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
1524 * <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
1525 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1526 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1527 * @see KeyListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1528 * @see #addKeyListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1529 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1530 public void removeKeyListener(KeyListener listener) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1531 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1532 if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1533 if (eventTable == null) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1534 eventTable.unhook (SWT.KeyUp, listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1535 eventTable.unhook (SWT.KeyDown, listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1536 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1537 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1538 * 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
1539 * be notified when the platform-specific context menu trigger has
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1540 * occurred.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1541 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1542 * @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
1543 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1544 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1545 * <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
1546 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1547 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1548 * <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
1549 * <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
1550 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1551 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1552 * @see MenuDetectListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1553 * @see #addMenuDetectListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1554 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1555 * @since 3.3
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1556 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1557 public void removeMenuDetectListener (MenuDetectListener listener) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1558 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1559 if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1560 if (eventTable == null) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1561 eventTable.unhook (SWT.MenuDetect, listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1562 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1563 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1564 * 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
1565 * be notified when mouse buttons are pressed and released.
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 * @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
1568 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1569 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1570 * <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
1571 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1572 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1573 * <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
1574 * <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
1575 * </ul>
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 * @see MouseListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1578 * @see #addMouseListener
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 public void removeMouseListener (MouseListener listener) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1581 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1582 if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1583 if (eventTable == null) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1584 eventTable.unhook (SWT.MouseDown, listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1585 eventTable.unhook (SWT.MouseUp, listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1586 eventTable.unhook (SWT.MouseDoubleClick, listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1587 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1588 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1589 * 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
1590 * be notified when the mouse moves.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1591 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1592 * @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
1593 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1594 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1595 * <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
1596 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1597 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1598 * <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
1599 * <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
1600 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1601 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1602 * @see MouseMoveListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1603 * @see #addMouseMoveListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1604 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1605 public void removeMouseMoveListener(MouseMoveListener listener) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1606 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1607 if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1608 if (eventTable == null) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1609 eventTable.unhook (SWT.MouseMove, listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1610 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1611
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 * 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
1614 * be notified when the mouse passes or hovers over controls.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1615 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1616 * @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
1617 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1618 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1619 * <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
1620 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1621 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1622 * <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
1623 * <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
1624 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1625 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1626 * @see MouseTrackListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1627 * @see #addMouseTrackListener
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 public void removeMouseTrackListener(MouseTrackListener listener) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1630 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1631 if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1632 if (eventTable == null) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1633 eventTable.unhook (SWT.MouseEnter, listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1634 eventTable.unhook (SWT.MouseExit, listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1635 eventTable.unhook (SWT.MouseHover, listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1636 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1637
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1638 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1639 * 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
1640 * be notified when the mouse wheel is scrolled.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1641 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1642 * @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
1643 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1644 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1645 * <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
1646 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1647 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1648 * <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
1649 * <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
1650 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1651 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1652 * @see MouseWheelListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1653 * @see #addMouseWheelListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1654 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1655 * @since 3.3
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1656 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1657 public void removeMouseWheelListener (MouseWheelListener listener) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1658 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1659 if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1660 if (eventTable == null) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1661 eventTable.unhook (SWT.MouseWheel, listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1662 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1663
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 * 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
1666 * be notified when the receiver needs to be painted.
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 * @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
1669 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1670 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1671 * <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
1672 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1673 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1674 * <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
1675 * <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
1676 * </ul>
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 * @see PaintListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1679 * @see #addPaintListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1680 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1681 public void removePaintListener(PaintListener listener) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1682 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1683 if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1684 if (eventTable == null) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1685 eventTable.unhook(SWT.Paint, listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1686 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1687
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 * Remove "Labelled by" relations from the receiver.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1690 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1691 void removeRelation () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1692 if (!isDescribedByLabel ()) return; /* there will not be any */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1693 int /*long*/ accessible = OS.gtk_widget_get_accessible (handle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1694 if (accessible == 0) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1695 int /*long*/ set = ATK.atk_object_ref_relation_set (accessible);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1696 int count = ATK.atk_relation_set_get_n_relations (set);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1697 for (int i = 0; i < count; i++) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1698 int /*long*/ relation = ATK.atk_relation_set_get_relation (set, 0);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1699 ATK.atk_relation_set_remove (set, relation);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1700 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1701 OS.g_object_unref (set);
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
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1704 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1705 * 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
1706 * be notified when traversal events occur.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1707 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1708 * @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
1709 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1710 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1711 * <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
1712 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1713 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1714 * <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
1715 * <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
1716 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1717 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1718 * @see TraverseListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1719 * @see #addTraverseListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1720 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1721 public void removeTraverseListener(TraverseListener listener) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1722 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1723 if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1724 if (eventTable == null) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1725 eventTable.unhook (SWT.Traverse, listener);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1726 }
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 * Detects a drag and drop gesture. This method is used
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1730 * to detect a drag gesture when called from within a mouse
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1731 * down listener.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1732 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1733 * <p>By default, a drag is detected when the gesture
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1734 * occurs anywhere within the client area of a control.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1735 * Some controls, such as tables and trees, override this
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1736 * behavior. In addition to the operating system specific
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1737 * drag gesture, they require the mouse to be inside an
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1738 * item. Custom widget writers can use <code>setDragDetect</code>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1739 * to disable the default detection, listen for mouse down,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1740 * and then call <code>dragDetect()</code> from within the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1741 * listener to conditionally detect a drag.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1742 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1743 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1744 * @param event the mouse down event
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1745 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1746 * @return <code>true</code> if the gesture occurred, and <code>false</code> otherwise.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1747 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1748 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1749 * <li>ERROR_NULL_ARGUMENT when the event is null</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1750 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1751 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1752 * <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
1753 * <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
1754 * </ul>
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 * @see DragDetectListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1757 * @see #addDragDetectListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1758 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1759 * @see #getDragDetect
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1760 * @see #setDragDetect
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1761 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1762 * @since 3.3
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1763 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1764 public boolean dragDetect (Event event) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1765 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1766 if (event == null) error (SWT.ERROR_NULL_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1767 return dragDetect (event.button, event.count, event.stateMask, event.x, event.y);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1768 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1769
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1770 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1771 * Detects a drag and drop gesture. This method is used
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1772 * to detect a drag gesture when called from within a mouse
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1773 * down listener.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1774 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1775 * <p>By default, a drag is detected when the gesture
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1776 * occurs anywhere within the client area of a control.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1777 * Some controls, such as tables and trees, override this
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1778 * behavior. In addition to the operating system specific
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1779 * drag gesture, they require the mouse to be inside an
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1780 * item. Custom widget writers can use <code>setDragDetect</code>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1781 * to disable the default detection, listen for mouse down,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1782 * and then call <code>dragDetect()</code> from within the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1783 * listener to conditionally detect a drag.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1784 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1785 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1786 * @param event the mouse down event
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1787 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1788 * @return <code>true</code> if the gesture occurred, and <code>false</code> otherwise.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1789 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1790 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1791 * <li>ERROR_NULL_ARGUMENT when the event is null</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1792 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1793 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1794 * <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
1795 * <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
1796 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1797 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1798 * @see DragDetectListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1799 * @see #addDragDetectListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1800 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1801 * @see #getDragDetect
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1802 * @see #setDragDetect
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 * @since 3.3
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 public boolean dragDetect (MouseEvent event) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1807 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1808 if (event == null) error (SWT.ERROR_NULL_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1809 return dragDetect (event.button, event.count, event.stateMask, event.x, event.y);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1810 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1811
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1812 boolean dragDetect (int button, int count, int stateMask, int x, int y) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1813 if (button != 1 || count != 1) return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1814 if (!dragDetect (x, y, false, null)) return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1815 return sendDragEvent (button, stateMask, x, y, true);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1816 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1817
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1818 boolean dragDetect (int x, int y, boolean filter, boolean [] consume) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1819 boolean quit = false, dragging = false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1820 while (!quit) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1821 int /*long*/ eventPtr = 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1822 while (true) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1823 eventPtr = OS.gdk_event_get ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1824 if (eventPtr != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1825 break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1826 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1827 try {Thread.sleep(50);} catch (Exception ex) {}
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1828 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1829 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1830 switch (OS.GDK_EVENT_TYPE (eventPtr)) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1831 case OS.GDK_MOTION_NOTIFY: {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1832 GdkEventMotion gdkMotionEvent = new GdkEventMotion ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1833 OS.memmove (gdkMotionEvent, eventPtr, GdkEventMotion.sizeof);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1834 if ((gdkMotionEvent.state & OS.GDK_BUTTON1_MASK) != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1835 if (OS.gtk_drag_check_threshold (handle, x, y, (int) gdkMotionEvent.x, (int) gdkMotionEvent.y)) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1836 dragging = true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1837 quit = true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1838 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1839 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1840 quit = true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1841 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1842 int [] newX = new int [1], newY = new int [1];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1843 OS.gdk_window_get_pointer (gdkMotionEvent.window, newX, newY, null);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1844 break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1845 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1846 case OS.GDK_KEY_PRESS:
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1847 case OS.GDK_KEY_RELEASE: {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1848 GdkEventKey gdkEvent = new GdkEventKey ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1849 OS.memmove (gdkEvent, eventPtr, GdkEventKey.sizeof);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1850 if (gdkEvent.keyval == OS.GDK_Escape) quit = true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1851 break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1852 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1853 case OS.GDK_BUTTON_RELEASE:
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1854 case OS.GDK_BUTTON_PRESS:
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1855 case OS.GDK_2BUTTON_PRESS:
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1856 case OS.GDK_3BUTTON_PRESS: {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1857 OS.gdk_event_put (eventPtr);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1858 quit = true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1859 break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1860 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1861 default:
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1862 OS.gtk_main_do_event (eventPtr);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1863 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1864 OS.gdk_event_free (eventPtr);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1865 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1866 return dragging;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1867 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1868
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1869 boolean filterKey (int keyval, int /*long*/ event) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1870 int /*long*/ imHandle = imHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1871 if (imHandle != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1872 return OS.gtk_im_context_filter_keypress (imHandle, event);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1873 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1874 return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1875 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1876
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1877 Control findBackgroundControl () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1878 if ((state & BACKGROUND) != 0 || backgroundImage != null) return this;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1879 return (state & PARENT_BACKGROUND) != 0 ? parent.findBackgroundControl () : null;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1880 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1881
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1882 Menu [] findMenus (Control control) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1883 if (menu != null && this != control) return new Menu [] {menu};
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1884 return new Menu [0];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1885 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1886
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1887 void fixChildren (Shell newShell, Shell oldShell, Decorations newDecorations, Decorations oldDecorations, Menu [] menus) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1888 oldShell.fixShell (newShell, this);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1889 oldDecorations.fixDecorations (newDecorations, this, menus);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1890 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1891
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1892 int /*long*/ fixedMapProc (int /*long*/ widget) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1893 OS.GTK_WIDGET_SET_FLAGS (widget, OS.GTK_MAPPED);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1894 int /*long*/ widgetList = OS.gtk_container_get_children (widget);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1895 if (widgetList != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1896 int /*long*/ widgets = widgetList;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1897 while (widgets != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1898 int /*long*/ child = OS.g_list_data (widgets);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1899 if (OS.GTK_WIDGET_VISIBLE (child) && OS.gtk_widget_get_child_visible (child) && !OS.GTK_WIDGET_MAPPED (child)) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1900 OS.gtk_widget_map (child);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1901 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1902 widgets = OS.g_list_next (widgets);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1903 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1904 OS.g_list_free (widgetList);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1905 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1906 if ((OS.GTK_WIDGET_FLAGS (widget) & OS.GTK_NO_WINDOW) == 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1907 OS.gdk_window_show_unraised (OS.GTK_WIDGET_WINDOW (widget));
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1908 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1909 return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1910 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1911
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1912 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1913 * Forces the receiver to have the <em>keyboard focus</em>, causing
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1914 * all keyboard events to be delivered to it.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1915 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1916 * @return <code>true</code> if the control got focus, and <code>false</code> if it was unable to.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1917 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1918 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1919 * <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
1920 * <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
1921 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1922 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1923 * @see #setFocus
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1924 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1925 public boolean forceFocus () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1926 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1927 if (display.focusEvent == SWT.FocusOut) return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1928 Shell shell = getShell ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1929 shell.setSavedFocus (this);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1930 if (!isEnabled () || !isVisible ()) return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1931 shell.bringToTop (false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1932 return forceFocus (focusHandle ());
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1933 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1934
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1935 boolean forceFocus (int /*long*/ focusHandle) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1936 /* When the control is zero sized it must be realized */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1937 OS.gtk_widget_realize (focusHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1938 OS.gtk_widget_grab_focus (focusHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1939 Shell shell = getShell ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1940 int /*long*/ shellHandle = shell.shellHandle;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1941 int /*long*/ handle = OS.gtk_window_get_focus (shellHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1942 while (handle != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1943 if (handle == focusHandle) return true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1944 Widget widget = display.getWidget (handle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1945 if (widget != null && widget instanceof Control) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1946 return widget == this;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1947 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1948 handle = OS.gtk_widget_get_parent (handle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1949 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1950 return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1951 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1952
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1953 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1954 * Returns the receiver's background color.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1955 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1956 * @return the background color
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1957 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1958 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1959 * <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
1960 * <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
1961 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1962 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1963 public Color getBackground () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1964 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1965 Control control = findBackgroundControl ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1966 if (control == null) control = this;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1967 return Color.gtk_new (display, control.getBackgroundColor ());
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1968 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1969
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1970 GdkColor getBackgroundColor () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1971 return getBgColor ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1972 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1973
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1974 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1975 * Returns the receiver's background image.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1976 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1977 * @return the background image
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1978 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1979 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1980 * <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
1981 * <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
1982 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1983 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1984 * @since 3.2
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1985 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1986 public Image getBackgroundImage () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1987 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1988 Control control = findBackgroundControl ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1989 if (control == null) control = this;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1990 return control.backgroundImage;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1991 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1992
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1993 GdkColor getBgColor () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1994 int /*long*/ fontHandle = fontHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1995 OS.gtk_widget_realize (fontHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1996 GdkColor color = new GdkColor ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1997 OS.gtk_style_get_bg (OS.gtk_widget_get_style (fontHandle), OS.GTK_STATE_NORMAL, color);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1998 return color;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1999 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2000
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2001 GdkColor getBaseColor () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2002 int /*long*/ fontHandle = fontHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2003 OS.gtk_widget_realize (fontHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2004 GdkColor color = new GdkColor ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2005 OS.gtk_style_get_base (OS.gtk_widget_get_style (fontHandle), OS.GTK_STATE_NORMAL, color);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2006 return color;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2007 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2008
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2009 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2010 * Returns the receiver's border width.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2011 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2012 * @return the border width
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2013 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2014 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2015 * <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
2016 * <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
2017 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2018 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2019 public int getBorderWidth () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2020 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2021 return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2022 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2023
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2024 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2025 * Returns the receiver's cursor, or null if it has not been set.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2026 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2027 * When the mouse pointer passes over a control its appearance
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2028 * is changed to match the control's cursor.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2029 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2030 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2031 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2032 * <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
2033 * <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
2034 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2035 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2036 * @since 3.3
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2037 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2038 public Cursor getCursor () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2039 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2040 return cursor;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2041 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2042
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2043 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2044 * Returns <code>true</code> if the receiver is detecting
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2045 * drag gestures, and <code>false</code> otherwise.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2046 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2047 * @return the receiver's drag detect state
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2048 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2049 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2050 * <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
2051 * <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
2052 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2053 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2054 * @since 3.3
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2055 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2056 public boolean getDragDetect () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2057 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2058 return (state & DRAG_DETECT) != 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2059 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2060
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2061 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2062 * Returns <code>true</code> if the receiver is enabled, and
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2063 * <code>false</code> otherwise. A disabled control is typically
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2064 * not selectable from the user interface and draws with an
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2065 * inactive or "grayed" look.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2066 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2067 * @return the receiver's enabled state
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2068 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2069 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2070 * <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
2071 * <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
2072 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2073 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2074 * @see #isEnabled
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2075 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2076 public boolean getEnabled () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2077 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2078 return (state & DISABLED) == 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2079 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2080
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2081 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2082 * Returns the font that the receiver will use to paint textual information.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2083 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2084 * @return the receiver's font
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2085 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2086 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2087 * <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
2088 * <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
2089 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2090 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2091 public Font getFont () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2092 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2093 if (font != null) return font;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2094 return Font.gtk_new (display, defaultFont ());
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2095 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2096
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2097 int /*long*/ getFontDescription () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2098 int /*long*/ fontHandle = fontHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2099 OS.gtk_widget_realize (fontHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2100 return OS.gtk_style_get_font_desc (OS.gtk_widget_get_style (fontHandle));
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2101 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2102
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2103 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2104 * Returns the foreground color that the receiver will use to draw.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2105 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2106 * @return the receiver's foreground color
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2107 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2108 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2109 * <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
2110 * <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
2111 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2112 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2113 public Color getForeground () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2114 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2115 return Color.gtk_new (display, getForegroundColor ());
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2116 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2117
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2118 GdkColor getForegroundColor () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2119 return getFgColor ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2120 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2121
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2122 GdkColor getFgColor () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2123 int /*long*/ fontHandle = fontHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2124 OS.gtk_widget_realize (fontHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2125 GdkColor color = new GdkColor ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2126 OS.gtk_style_get_fg (OS.gtk_widget_get_style (fontHandle), OS.GTK_STATE_NORMAL, color);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2127 return color;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2128 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2129
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2130 Point getIMCaretPos () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2131 return new Point (0, 0);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2132 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2133
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2134 GdkColor getTextColor () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2135 int /*long*/ fontHandle = fontHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2136 OS.gtk_widget_realize (fontHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2137 GdkColor color = new GdkColor ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2138 OS.gtk_style_get_text (OS.gtk_widget_get_style (fontHandle), OS.GTK_STATE_NORMAL, color);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2139 return color;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2140 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2141
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2142 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2143 * Returns layout data which is associated with the receiver.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2144 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2145 * @return the receiver's layout data
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2146 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2147 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2148 * <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
2149 * <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
2150 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2151 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2152 public Object getLayoutData () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2153 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2154 return layoutData;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2155 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2156
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2157 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2158 * Returns the receiver's pop up menu if it has one, or null
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2159 * if it does not. All controls may optionally have a pop up
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2160 * menu that is displayed when the user requests one for
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2161 * the control. The sequence of key strokes, button presses
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2162 * and/or button releases that are used to request a pop up
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2163 * menu is platform specific.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2164 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2165 * @return the receiver's menu
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2166 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2167 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2168 * <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
2169 * <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
2170 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2171 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2172 public Menu getMenu () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2173 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2174 return menu;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2175 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2176
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2177 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2178 * Returns the receiver's monitor.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2179 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2180 * @return the receiver's monitor
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2181 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2182 * @since 3.0
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2183 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2184 public Monitor getMonitor () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2185 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2186 Monitor monitor = null;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2187 int /*long*/ screen = OS.gdk_screen_get_default ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2188 if (screen != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2189 int monitorNumber = OS.gdk_screen_get_monitor_at_window (screen, paintWindow ());
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2190 GdkRectangle dest = new GdkRectangle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2191 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
2192 monitor = new Monitor ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2193 monitor.handle = monitorNumber;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2194 monitor.x = dest.x;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2195 monitor.y = dest.y;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2196 monitor.width = dest.width;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2197 monitor.height = dest.height;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2198 Rectangle workArea = null;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2199 if (monitorNumber == 0) workArea = display.getWorkArea ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2200 if (workArea != null) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2201 monitor.clientX = workArea.x;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2202 monitor.clientY = workArea.y;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2203 monitor.clientWidth = workArea.width;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2204 monitor.clientHeight = workArea.height;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2205 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2206 monitor.clientX = monitor.x;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2207 monitor.clientY = monitor.y;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2208 monitor.clientWidth = monitor.width;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2209 monitor.clientHeight = monitor.height;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2210 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2211 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2212 monitor = display.getPrimaryMonitor ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2213 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2214 return monitor;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2215 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2216
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2217 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2218 * Returns the receiver's parent, which must be a <code>Composite</code>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2219 * or null when the receiver is a shell that was created with null or
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2220 * a display for a parent.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2221 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2222 * @return the receiver's parent
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2223 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2224 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2225 * <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
2226 * <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
2227 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2228 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2229 public Composite getParent () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2230 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2231 return parent;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2232 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2233
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2234 Control [] getPath () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2235 int count = 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2236 Shell shell = getShell ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2237 Control control = this;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2238 while (control != shell) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2239 count++;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2240 control = control.parent;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2241 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2242 control = this;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2243 Control [] result = new Control [count];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2244 while (control != shell) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2245 result [--count] = control;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2246 control = control.parent;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2247 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2248 return result;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2249 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2250
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2251 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2252 * Returns the receiver's shell. For all controls other than
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2253 * shells, this simply returns the control's nearest ancestor
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2254 * shell. Shells return themselves, even if they are children
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2255 * of other shells.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2256 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2257 * @return the receiver's shell
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2258 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2259 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2260 * <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
2261 * <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
2262 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2263 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2264 * @see #getParent
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2265 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2266 public Shell getShell() {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2267 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2268 return _getShell();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2269 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2270
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2271 Shell _getShell() {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2272 return parent._getShell();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2273 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2274
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2275 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2276 * Returns the receiver's tool tip text, or null if it has
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2277 * not been set.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2278 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2279 * @return the receiver's tool tip text
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2280 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2281 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2282 * <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
2283 * <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
2284 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2285 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2286 public String getToolTipText () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2287 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2288 return toolTipText;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2289 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2290 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2291 * Returns <code>true</code> if the receiver is visible, and
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2292 * <code>false</code> otherwise.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2293 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2294 * If one of the receiver's ancestors is not visible or some
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2295 * other condition makes the receiver not visible, this method
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2296 * may still indicate that it is considered visible even though
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2297 * it may not actually be showing.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2298 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2299 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2300 * @return the receiver's visibility state
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2301 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2302 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2303 * <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
2304 * <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
2305 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2306 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2307 public boolean getVisible () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2308 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2309 return (state & HIDDEN) == 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2310 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2311
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2312 int /*long*/ gtk_button_press_event (int /*long*/ widget, int /*long*/ event) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2313 GdkEventButton gdkEvent = new GdkEventButton ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2314 OS.memmove (gdkEvent, event, GdkEventButton.sizeof);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2315 if (gdkEvent.type == OS.GDK_3BUTTON_PRESS) return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2316 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2317 * When a shell is created with SWT.ON_TOP and SWT.NO_FOCUS,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2318 * do not activate the shell when the user clicks on the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2319 * the client area or on the border or a control within the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2320 * shell that does not take focus.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2321 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2322 Shell shell = _getShell ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2323 if (((shell.style & SWT.ON_TOP) != 0) && (((shell.style & SWT.NO_FOCUS) == 0) || ((style & SWT.NO_FOCUS) == 0))) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2324 shell.forceActive();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2325 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2326 int /*long*/ result = 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2327 if (gdkEvent.type == OS.GDK_BUTTON_PRESS) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2328 display.clickCount = 1;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2329 int /*long*/ nextEvent = OS.gdk_event_peek ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2330 if (nextEvent != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2331 int eventType = OS.GDK_EVENT_TYPE (nextEvent);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2332 if (eventType == OS.GDK_2BUTTON_PRESS) display.clickCount = 2;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2333 if (eventType == OS.GDK_3BUTTON_PRESS) display.clickCount = 3;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2334 OS.gdk_event_free (nextEvent);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2335 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2336 boolean dragging = false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2337 if ((state & DRAG_DETECT) != 0 && hooks (SWT.DragDetect)) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2338 if (gdkEvent.button == 1) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2339 boolean [] consume = new boolean [1];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2340 if (dragDetect ((int) gdkEvent.x, (int) gdkEvent.y, true, consume)) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2341 dragging = true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2342 if (consume [0]) result = 1;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2343 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2344 if (isDisposed ()) return 1;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2345 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2346 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2347 if (!sendMouseEvent (SWT.MouseDown, gdkEvent.button, display.clickCount, 0, false, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state)) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2348 result = 1;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2349 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2350 if (isDisposed ()) return 1;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2351 if (dragging) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2352 sendDragEvent (gdkEvent.button, gdkEvent.state, (int) gdkEvent.x, (int) gdkEvent.y, false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2353 if (isDisposed ()) return 1;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2354 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2355 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2356 * Pop up the context menu in the button press event for widgets
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2357 * that have default operating system menus in order to stop the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2358 * operating system from displaying the menu if necessary.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2359 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2360 if ((state & MENU) != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2361 if (gdkEvent.button == 3) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2362 if (showMenu ((int)gdkEvent.x_root, (int)gdkEvent.y_root)) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2363 result = 1;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2364 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2365 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2366 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2367 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2368 display.clickCount = 2;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2369 result = sendMouseEvent (SWT.MouseDoubleClick, gdkEvent.button, display.clickCount, 0, false, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2370 if (isDisposed ()) return 1;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2371 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2372 if (!shell.isDisposed ()) shell.setActiveControl (this);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2373 return result;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2374 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2375
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2376 int /*long*/ gtk_button_release_event (int /*long*/ widget, int /*long*/ event) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2377 GdkEventButton gdkEvent = new GdkEventButton ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2378 OS.memmove (gdkEvent, event, GdkEventButton.sizeof);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2379 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2380 * Feature in GTK. When button 4, 5, 6, or 7 is released, GTK
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2381 * does not deliver a corresponding GTK event. Button 6 and 7
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2382 * are mapped to buttons 4 and 5 in SWT. The fix is to change
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2383 * the button number of the event to a negative number so that
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2384 * it gets dispatched by GTK. SWT has been modified to look
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2385 * for negative button numbers.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2386 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2387 int button = gdkEvent.button;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2388 switch (button) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2389 case -6: button = 4; break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2390 case -7: button = 5; break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2391 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2392 return sendMouseEvent (SWT.MouseUp, button, display.clickCount, 0, false, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2393 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2394
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2395 int /*long*/ gtk_commit (int /*long*/ imcontext, int /*long*/ text) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2396 if (text == 0) return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2397 int length = OS.strlen (text);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2398 if (length == 0) return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2399 byte [] buffer = new byte [length];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2400 OS.memmove (buffer, text, length);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2401 char [] chars = Converter.mbcsToWcs (null, buffer);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2402 sendIMKeyEvent (SWT.KeyDown, null, chars);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2403 return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2404 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2405
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2406 int /*long*/ gtk_enter_notify_event (int /*long*/ widget, int /*long*/ event) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2407 if (display.currentControl == this) return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2408 GdkEventCrossing gdkEvent = new GdkEventCrossing ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2409 OS.memmove (gdkEvent, event, GdkEventCrossing.sizeof);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2410 if (gdkEvent.mode != OS.GDK_CROSSING_NORMAL && gdkEvent.mode != OS.GDK_CROSSING_UNGRAB) return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2411 if ((gdkEvent.state & (OS.GDK_BUTTON1_MASK | OS.GDK_BUTTON2_MASK | OS.GDK_BUTTON3_MASK)) != 0) return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2412 if (display.currentControl != null && !display.currentControl.isDisposed ()) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2413 display.removeMouseHoverTimeout (display.currentControl.handle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2414 display.currentControl.sendMouseEvent (SWT.MouseExit, 0, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2415 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2416 if (!isDisposed ()) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2417 display.currentControl = this;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2418 return sendMouseEvent (SWT.MouseEnter, 0, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2419 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2420 return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2421 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2422
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2423 int /*long*/ gtk_event_after (int /*long*/ widget, int /*long*/ gdkEvent) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2424 GdkEvent event = new GdkEvent ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2425 OS.memmove (event, gdkEvent, GdkEvent.sizeof);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2426 switch (event.type) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2427 case OS.GDK_BUTTON_PRESS: {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2428 if (widget != eventHandle ()) break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2429 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2430 * Pop up the context menu in the event_after signal to allow
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2431 * the widget to process the button press. This allows widgets
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2432 * such as GtkTreeView to select items before a menu is shown.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2433 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2434 if ((state & MENU) == 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2435 GdkEventButton gdkEventButton = new GdkEventButton ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2436 OS.memmove (gdkEventButton, gdkEvent, GdkEventButton.sizeof);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2437 if (gdkEventButton.button == 3) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2438 showMenu ((int) gdkEventButton.x_root, (int) gdkEventButton.y_root);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2439 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2440 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2441 break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2442 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2443 case OS.GDK_FOCUS_CHANGE: {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2444 if (widget != focusHandle ()) break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2445 GdkEventFocus gdkEventFocus = new GdkEventFocus ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2446 OS.memmove (gdkEventFocus, gdkEvent, GdkEventFocus.sizeof);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2447
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2448 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2449 * Feature in GTK. The GTK combo box popup under some window managers
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2450 * is implemented as a GTK_MENU. When it pops up, it causes the combo
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2451 * box to lose focus when focus is received for the menu. The
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2452 * fix is to check the current grab handle and see if it is a GTK_MENU
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2453 * and ignore the focus event when the menu is both shown and hidden.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2454 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2455 Display display = this.display;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2456 if (gdkEventFocus.in != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2457 if (display.ignoreFocus) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2458 display.ignoreFocus = false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2459 break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2460 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2461 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2462 display.ignoreFocus = false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2463 int /*long*/ grabHandle = OS.gtk_grab_get_current ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2464 if (grabHandle != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2465 if (OS.G_OBJECT_TYPE (grabHandle) == OS.GTK_TYPE_MENU ()) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2466 display.ignoreFocus = true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2467 break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2468 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2469 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2470 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2471
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2472 sendFocusEvent (gdkEventFocus.in != 0 ? SWT.FocusIn : SWT.FocusOut);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2473 break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2474 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2475 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2476 return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2477 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2478
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2479 int /*long*/ gtk_expose_event (int /*long*/ widget, int /*long*/ eventPtr) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2480 if ((state & OBSCURED) != 0) return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2481 if (!hooks (SWT.Paint) && !filters (SWT.Paint)) return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2482 GdkEventExpose gdkEvent = new GdkEventExpose ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2483 OS.memmove(gdkEvent, eventPtr, GdkEventExpose.sizeof);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2484 Event event = new Event ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2485 event.count = gdkEvent.count;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2486 event.x = gdkEvent.area_x;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2487 event.y = gdkEvent.area_y;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2488 event.width = gdkEvent.area_width;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2489 event.height = gdkEvent.area_height;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2490 GCData data = new GCData ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2491 data.damageRgn = gdkEvent.region;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2492 GC gc = event.gc = GC.gtk_new (this, data);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2493 OS.gdk_gc_set_clip_region (gc.handle, gdkEvent.region);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2494 sendEvent (SWT.Paint, event);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2495 gc.dispose ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2496 event.gc = null;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2497 return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2498 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2499
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2500 int /*long*/ gtk_focus (int /*long*/ widget, int /*long*/ directionType) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2501 /* Stop GTK traversal for every widget */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2502 return 1;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2503 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2504
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2505 int /*long*/ gtk_focus_in_event (int /*long*/ widget, int /*long*/ event) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2506 // 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
2507 if (handle != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2508 Control oldControl = display.imControl;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2509 if (oldControl != this) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2510 if (oldControl != null && !oldControl.isDisposed ()) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2511 int /*long*/ oldIMHandle = oldControl.imHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2512 if (oldIMHandle != 0) OS.gtk_im_context_reset (oldIMHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2513 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2514 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2515 if (hooks (SWT.KeyDown) || hooks (SWT.KeyUp)) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2516 int /*long*/ imHandle = imHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2517 if (imHandle != 0) OS.gtk_im_context_focus_in (imHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2518 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2519 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2520 return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2521 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2522
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2523 int /*long*/ gtk_focus_out_event (int /*long*/ widget, int /*long*/ event) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2524 // 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
2525 if (handle != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2526 if (hooks (SWT.KeyDown) || hooks (SWT.KeyUp)) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2527 int /*long*/ imHandle = imHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2528 if (imHandle != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2529 OS.gtk_im_context_focus_out (imHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2530 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2531 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2532 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2533 return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2534 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2535
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2536 int /*long*/ gtk_key_press_event (int /*long*/ widget, int /*long*/ event) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2537 if (!hasFocus ()) return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2538 GdkEventKey gdkEvent = new GdkEventKey ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2539 OS.memmove (gdkEvent, event, GdkEventKey.sizeof);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2540
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2541 if (translateMnemonic (gdkEvent.keyval, gdkEvent)) return 1;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2542 // 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
2543 if (isDisposed ()) return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2544
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2545 if (filterKey (gdkEvent.keyval, event)) return 1;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2546 // 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
2547 if (isDisposed ()) return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2548
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2549 if (translateTraversal (gdkEvent)) return 1;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2550 // 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
2551 if (isDisposed ()) return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2552 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
2553 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2554
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2555 int /*long*/ gtk_key_release_event (int /*long*/ widget, int /*long*/ event) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2556 if (!hasFocus ()) return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2557 int /*long*/ imHandle = imHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2558 if (imHandle != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2559 if (OS.gtk_im_context_filter_keypress (imHandle, event)) return 1;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2560 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2561 return super.gtk_key_release_event (widget, event);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2562 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2563
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2564 int /*long*/ gtk_leave_notify_event (int /*long*/ widget, int /*long*/ event) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2565 if (display.currentControl != this) return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2566 display.removeMouseHoverTimeout (handle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2567 int result = 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2568 if (sendLeaveNotify () || display.getCursorControl () == null) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2569 GdkEventCrossing gdkEvent = new GdkEventCrossing ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2570 OS.memmove (gdkEvent, event, GdkEventCrossing.sizeof);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2571 if (gdkEvent.mode != OS.GDK_CROSSING_NORMAL && gdkEvent.mode != OS.GDK_CROSSING_UNGRAB) return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2572 if ((gdkEvent.state & (OS.GDK_BUTTON1_MASK | OS.GDK_BUTTON2_MASK | OS.GDK_BUTTON3_MASK)) != 0) return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2573 result = sendMouseEvent (SWT.MouseExit, 0, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2574 display.currentControl = null;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2575 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2576 return result;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2577 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2578
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2579 int /*long*/ gtk_mnemonic_activate (int /*long*/ widget, int /*long*/ arg1) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2580 int result = 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2581 int /*long*/ eventPtr = OS.gtk_get_current_event ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2582 if (eventPtr != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2583 GdkEventKey keyEvent = new GdkEventKey ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2584 OS.memmove (keyEvent, eventPtr, GdkEventKey.sizeof);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2585 if (keyEvent.type == OS.GDK_KEY_PRESS) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2586 Control focusControl = display.getFocusControl ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2587 int /*long*/ focusHandle = focusControl != null ? focusControl.focusHandle () : 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2588 if (focusHandle != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2589 display.mnemonicControl = this;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2590 OS.gtk_widget_event (focusHandle, eventPtr);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2591 display.mnemonicControl = null;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2592 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2593 result = 1;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2594 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2595 OS.gdk_event_free (eventPtr);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2596 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2597 return result;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2598 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2599
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2600 int /*long*/ gtk_motion_notify_event (int /*long*/ widget, int /*long*/ event) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2601 GdkEventMotion gdkEvent = new GdkEventMotion ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2602 OS.memmove (gdkEvent, event, GdkEventMotion.sizeof);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2603 if (this == display.currentControl && (hooks (SWT.MouseHover) || filters (SWT.MouseHover))) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2604 display.addMouseHoverTimeout (handle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2605 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2606 double x = gdkEvent.x_root, y = gdkEvent.y_root;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2607 int state = gdkEvent.state;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2608 if (gdkEvent.is_hint != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2609 int [] pointer_x = new int [1], pointer_y = new int [1], mask = new int [1];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2610 int /*long*/ window = eventWindow ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2611 OS.gdk_window_get_pointer (window, pointer_x, pointer_y, mask);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2612 x = pointer_x [0];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2613 y = pointer_y [0];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2614 state = mask [0];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2615 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2616 int result = sendMouseEvent (SWT.MouseMove, 0, gdkEvent.time, x, y, gdkEvent.is_hint != 0, state) ? 0 : 1;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2617 return result;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2618 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2619
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2620 int /*long*/ gtk_popup_menu (int /*long*/ widget) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2621 if (!hasFocus()) return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2622 int [] x = new int [1], y = new int [1];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2623 OS.gdk_window_get_pointer (0, x, y, null);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2624 return showMenu (x [0], y [0]) ? 1 : 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2625 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2626
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2627 int /*long*/ gtk_preedit_changed (int /*long*/ imcontext) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2628 display.showIMWindow (this);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2629 return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2630 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2631
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2632 int /*long*/ gtk_realize (int /*long*/ widget) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2633 int /*long*/ imHandle = imHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2634 if (imHandle != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2635 int /*long*/ window = OS.GTK_WIDGET_WINDOW (paintHandle ());
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2636 OS.gtk_im_context_set_client_window (imHandle, window);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2637 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2638 if (backgroundImage != null) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2639 int /*long*/ window = OS.GTK_WIDGET_WINDOW (paintHandle ());
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2640 if (window != 0) OS.gdk_window_set_back_pixmap (window, backgroundImage.pixmap, false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2641 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2642 return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2643 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2644
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2645 int /*long*/ gtk_scroll_event (int /*long*/ widget, int /*long*/ eventPtr) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2646 GdkEventScroll gdkEvent = new GdkEventScroll ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2647 OS.memmove (gdkEvent, eventPtr, GdkEventScroll.sizeof);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2648 switch (gdkEvent.direction) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2649 case OS.GDK_SCROLL_UP:
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2650 return sendMouseEvent (SWT.MouseWheel, 0, 3, SWT.SCROLL_LINE, true, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2651 case OS.GDK_SCROLL_DOWN:
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2652 return sendMouseEvent (SWT.MouseWheel, 0, -3, SWT.SCROLL_LINE, true, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2653 case OS.GDK_SCROLL_LEFT:
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2654 return sendMouseEvent (SWT.MouseDown, 4, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2655 case OS.GDK_SCROLL_RIGHT:
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2656 return sendMouseEvent (SWT.MouseDown, 5, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2657 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2658 return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2659 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2660
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2661 int /*long*/ gtk_show_help (int /*long*/ widget, int /*long*/ helpType) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2662 if (!hasFocus ()) return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2663 return sendHelpEvent (helpType) ? 1 : 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2664 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2665
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2666 int /*long*/ gtk_style_set (int /*long*/ widget, int /*long*/ previousStyle) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2667 if (backgroundImage != null) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2668 setBackgroundPixmap (backgroundImage.pixmap);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2669 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2670 return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2671 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2672
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2673 int /*long*/ gtk_unrealize (int /*long*/ widget) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2674 int /*long*/ imHandle = imHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2675 if (imHandle != 0) OS.gtk_im_context_set_client_window (imHandle, 0);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2676 return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2677 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2678
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2679 int /*long*/ gtk_visibility_notify_event (int /*long*/ widget, int /*long*/ event) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2680 GdkEventVisibility gdkEvent = new GdkEventVisibility ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2681 OS.memmove (gdkEvent, event, GdkEventVisibility.sizeof);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2682 int /*long*/ paintWindow = paintWindow();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2683 int /*long*/ window = gdkEvent.window;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2684 if (window == paintWindow) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2685 if (gdkEvent.state == OS.GDK_VISIBILITY_FULLY_OBSCURED) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2686 state |= OBSCURED;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2687 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2688 if ((state & OBSCURED) != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2689 int [] width = new int [1], height = new int [1];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2690 OS.gdk_drawable_get_size (window, width, height);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2691 GdkRectangle rect = new GdkRectangle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2692 rect.width = width [0];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2693 rect.height = height [0];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2694 OS.gdk_window_invalidate_rect (window, rect, false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2695 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2696 state &= ~OBSCURED;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2697 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2698 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2699 return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2700 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2701
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2702 void gtk_widget_size_request (int /*long*/ widget, GtkRequisition requisition) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2703 OS.gtk_widget_size_request (widget, requisition);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2704 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2705
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2706 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2707 * Invokes platform specific functionality to allocate a new GC handle.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2708 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2709 * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2710 * API for <code>Control</code>. It is marked public only so that it
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2711 * can be shared within the packages provided by SWT. It is not
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2712 * available on all platforms, and should never be called from
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2713 * application code.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2714 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2715 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2716 * @param data the platform specific GC data
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2717 * @return the platform specific GC handle
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2718 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2719 public int /*long*/ internal_new_GC (GCData data) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2720 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2721 int /*long*/ window = paintWindow ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2722 if (window == 0) SWT.error (SWT.ERROR_NO_HANDLES);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2723 int /*long*/ gdkGC = OS.gdk_gc_new (window);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2724 if (gdkGC == 0) error (SWT.ERROR_NO_HANDLES);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2725 if (data != null) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2726 int mask = SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2727 if ((data.style & mask) == 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2728 data.style |= style & (mask | SWT.MIRRORED);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2729 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2730 data.drawable = window;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2731 data.device = display;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2732 data.foreground = getForegroundColor ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2733 Control control = findBackgroundControl ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2734 if (control == null) control = this;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2735 data.background = control.getBackgroundColor ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2736 data.font = font != null ? font.handle : defaultFont ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2737 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2738 return gdkGC;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2739 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2740
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2741 int /*long*/ imHandle () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2742 return 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2743 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2744
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2745 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2746 * Invokes platform specific functionality to dispose a GC handle.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2747 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2748 * <b>IMPORTANT:</b> This method is <em>not</em> part of the public
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2749 * API for <code>Control</code>. It is marked public only so that it
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2750 * can be shared within the packages provided by SWT. It is not
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2751 * available on all platforms, and should never be called from
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2752 * application code.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2753 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2754 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2755 * @param hDC the platform specific GC handle
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2756 * @param data the platform specific GC data
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2757 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2758 public void internal_dispose_GC (int /*long*/ gdkGC, GCData data) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2759 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2760 OS.g_object_unref (gdkGC);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2761 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2762
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2763 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2764 * Returns <code>true</code> if the underlying operating
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2765 * system supports this reparenting, otherwise <code>false</code>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2766 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2767 * @return <code>true</code> if the widget can be reparented, otherwise <code>false</code>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2768 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2769 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2770 * <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
2771 * <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
2772 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2773 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2774 public boolean isReparentable () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2775 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2776 return true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2777 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2778 boolean isShowing () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2779 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2780 * This is not complete. Need to check if the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2781 * widget is obscurred by a parent or sibling.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2782 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2783 if (!isVisible ()) return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2784 Control control = this;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2785 while (control != null) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2786 Point size = control.getSize ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2787 if (size.x == 0 || size.y == 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2788 return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2789 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2790 control = control.parent;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2791 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2792 return true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2793 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2794 boolean isTabGroup () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2795 Control [] tabList = parent._getTabList ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2796 if (tabList != null) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2797 for (int i=0; i<tabList.length; i++) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2798 if (tabList [i] == this) return true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2799 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2800 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2801 int code = traversalCode (0, null);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2802 if ((code & (SWT.TRAVERSE_ARROW_PREVIOUS | SWT.TRAVERSE_ARROW_NEXT)) != 0) return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2803 return (code & (SWT.TRAVERSE_TAB_PREVIOUS | SWT.TRAVERSE_TAB_NEXT)) != 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2804 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2805 boolean isTabItem () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2806 Control [] tabList = parent._getTabList ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2807 if (tabList != null) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2808 for (int i=0; i<tabList.length; i++) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2809 if (tabList [i] == this) return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2810 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2811 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2812 int code = traversalCode (0, null);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2813 return (code & (SWT.TRAVERSE_ARROW_PREVIOUS | SWT.TRAVERSE_ARROW_NEXT)) != 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2814 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2815
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2816 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2817 * Returns <code>true</code> if the receiver is enabled and all
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2818 * ancestors up to and including the receiver's nearest ancestor
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2819 * shell are enabled. Otherwise, <code>false</code> is returned.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2820 * A disabled control is typically not selectable from the user
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2821 * interface and draws with an inactive or "grayed" look.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2822 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2823 * @return the receiver's enabled state
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2824 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2825 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2826 * <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
2827 * <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
2828 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2829 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2830 * @see #getEnabled
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2831 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2832 public boolean isEnabled () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2833 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2834 return getEnabled () && parent.isEnabled ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2835 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2836
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2837 boolean isFocusAncestor (Control control) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2838 while (control != null && control != this && !(control instanceof Shell)) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2839 control = control.parent;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2840 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2841 return control == this;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2842 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2843
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2844 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2845 * Returns <code>true</code> if the receiver has the user-interface
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2846 * focus, and <code>false</code> otherwise.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2847 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2848 * @return the receiver's focus state
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2849 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2850 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2851 * <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
2852 * <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
2853 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2854 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2855 public boolean isFocusControl () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2856 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2857 Control focusControl = display.focusControl;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2858 if (focusControl != null && !focusControl.isDisposed ()) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2859 return this == focusControl;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2860 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2861 return hasFocus ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2862 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2863
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2864 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2865 * Returns <code>true</code> if the receiver is visible and all
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2866 * ancestors up to and including the receiver's nearest ancestor
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2867 * shell are visible. Otherwise, <code>false</code> is returned.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2868 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2869 * @return the receiver's visibility state
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2870 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2871 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2872 * <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
2873 * <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
2874 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2875 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2876 * @see #getVisible
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2877 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2878 public boolean isVisible () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2879 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2880 return getVisible () && parent.isVisible ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2881 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2882
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2883 Decorations menuShell () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2884 return parent.menuShell ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2885 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2886
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2887 boolean mnemonicHit (char key) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2888 return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2889 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2890
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2891 boolean mnemonicMatch (char key) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2892 return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2893 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2894
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2895 void register () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2896 super.register ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2897 if (fixedHandle != 0) display.addWidget (fixedHandle, this);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2898 int /*long*/ imHandle = imHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2899 if (imHandle != 0) display.addWidget (imHandle, this);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2900 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2901
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2902 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2903 * Causes the entire bounds of the receiver to be marked
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2904 * as needing to be redrawn. The next time a paint request
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2905 * is processed, the control will be completely painted,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2906 * including the background.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2907 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2908 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2909 * <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
2910 * <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
2911 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2912 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2913 * @see #update()
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2914 * @see PaintListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2915 * @see SWT#Paint
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2916 * @see SWT#NO_BACKGROUND
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2917 * @see SWT#NO_REDRAW_RESIZE
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2918 * @see SWT#NO_MERGE_PAINTS
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2919 * @see SWT#DOUBLE_BUFFERED
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2920 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2921 public void redraw () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2922 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2923 redraw (false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2924 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2925
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2926 void redraw (boolean all) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2927 // checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2928 if (!OS.GTK_WIDGET_VISIBLE (topHandle ())) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2929 redrawWidget (0, 0, 0, 0, true, all, false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2930 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2931
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2932 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2933 * Causes the rectangular area of the receiver specified by
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2934 * the arguments to be marked as needing to be redrawn.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2935 * The next time a paint request is processed, that area of
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2936 * the receiver will be painted, including the background.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2937 * If the <code>all</code> flag is <code>true</code>, any
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2938 * children of the receiver which intersect with the specified
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2939 * area will also paint their intersecting areas. If the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2940 * <code>all</code> flag is <code>false</code>, the children
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2941 * will not be painted.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2942 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2943 * @param x the x coordinate of the area to draw
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2944 * @param y the y coordinate of the area to draw
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2945 * @param width the width of the area to draw
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2946 * @param height the height of the area to draw
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2947 * @param all <code>true</code> if children should redraw, and <code>false</code> otherwise
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2948 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2949 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2950 * <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
2951 * <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
2952 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2953 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2954 * @see #update()
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2955 * @see PaintListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2956 * @see SWT#Paint
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2957 * @see SWT#NO_BACKGROUND
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2958 * @see SWT#NO_REDRAW_RESIZE
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2959 * @see SWT#NO_MERGE_PAINTS
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2960 * @see SWT#DOUBLE_BUFFERED
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2961 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2962 public void redraw (int x, int y, int width, int height, boolean all) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2963 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2964 if (!OS.GTK_WIDGET_VISIBLE (topHandle ())) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2965 redrawWidget (x, y, width, height, false, all, false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2966 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2967
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2968 void redrawChildren () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2969 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2970
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2971 void redrawWidget (int x, int y, int width, int height, boolean redrawAll, boolean all, boolean trim) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2972 if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_REALIZED) == 0) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2973 int /*long*/ window = paintWindow ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2974 GdkRectangle rect = new GdkRectangle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2975 if (redrawAll) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2976 int [] w = new int [1], h = new int [1];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2977 OS.gdk_drawable_get_size (window, w, h);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2978 rect.width = w [0];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2979 rect.height = h [0];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2980 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2981 rect.x = x;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2982 rect.y = y;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2983 rect.width = width;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2984 rect.height = height;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2985 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2986 OS.gdk_window_invalidate_rect (window, rect, all);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2987 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2988
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2989 void release (boolean destroy) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2990 Control next = null, previous = null;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2991 if (destroy && parent != null) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2992 Control[] children = parent._getChildren ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2993 int index = 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2994 while (index < children.length) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2995 if (children [index] == this) break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2996 index++;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2997 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2998 if (0 < index && (index + 1) < children.length) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2999 next = children [index + 1];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3000 previous = children [index - 1];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3001 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3002 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3003 super.release (destroy);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3004 if (destroy) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3005 if (previous != null) previous.addRelation (next);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3006 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3007 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3008
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3009 void releaseHandle () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3010 super.releaseHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3011 fixedHandle = 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3012 parent = null;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3013 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3014
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3015 void releaseParent () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3016 parent.removeControl (this);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3017 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3018
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3019 void releaseWidget () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3020 super.releaseWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3021 if (display.currentControl == this) display.currentControl = null;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3022 display.removeMouseHoverTimeout (handle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3023 int /*long*/ imHandle = imHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3024 if (imHandle != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3025 OS.gtk_im_context_reset (imHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3026 OS.gtk_im_context_set_client_window (imHandle, 0);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3027 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3028 if (enableWindow != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3029 OS.gdk_window_set_user_data (enableWindow, 0);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3030 OS.gdk_window_destroy (enableWindow);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3031 enableWindow = 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3032 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3033 redrawWindow = 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3034 if (menu != null && !menu.isDisposed ()) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3035 menu.dispose ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3036 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3037 menu = null;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3038 cursor = null;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3039 toolTipText = null;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3040 layoutData = null;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3041 accessible = null;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3042 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3043
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3044 boolean sendDragEvent (int button, int stateMask, int x, int y, boolean isStateMask) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3045 Event event = new Event ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3046 event.button = button;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3047 event.x = x;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3048 event.y = y;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3049 if (isStateMask) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3050 event.stateMask = stateMask;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3051 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3052 setInputState (event, stateMask);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3053 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3054 postEvent (SWT.DragDetect, event);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3055 if (isDisposed ()) return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3056 return event.doit;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3057 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3058
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3059 void sendFocusEvent (int type) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3060 Shell shell = _getShell ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3061 Display display = this.display;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3062 display.focusControl = this;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3063 display.focusEvent = type;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3064 sendEvent (type);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3065 display.focusControl = null;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3066 display.focusEvent = SWT.None;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3067 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3068 * It is possible that the shell may be
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3069 * disposed at this point. If this happens
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3070 * don't send the activate and deactivate
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3071 * events.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3072 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3073 if (!shell.isDisposed ()) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3074 switch (type) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3075 case SWT.FocusIn:
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3076 shell.setActiveControl (this);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3077 break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3078 case SWT.FocusOut:
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3079 if (shell != display.activeShell) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3080 shell.setActiveControl (null);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3081 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3082 break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3083 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3084 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3085 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3086
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3087 boolean sendHelpEvent (int /*long*/ helpType) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3088 Control control = this;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3089 while (control != null) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3090 if (control.hooks (SWT.Help)) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3091 control.postEvent (SWT.Help);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3092 return true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3093 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3094 control = control.parent;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3095 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3096 return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3097 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3098
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3099 boolean sendLeaveNotify() {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3100 return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3101 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3102
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3103 boolean sendMouseEvent (int type, int button, int time, double x, double y, boolean is_hint, int state) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3104 return sendMouseEvent (type, button, 0, 0, false, time, x, y, is_hint, state);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3105 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3106
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3107 boolean sendMouseEvent (int type, int button, int count, int detail, boolean send, int time, double x, double y, boolean is_hint, int state) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3108 if (!hooks (type) && !filters (type)) return true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3109 Event event = new Event ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3110 event.time = time;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3111 event.button = button;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3112 event.detail = detail;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3113 event.count = count;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3114 if (is_hint) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3115 event.x = (int)x;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3116 event.y = (int)y;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3117 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3118 int /*long*/ window = eventWindow ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3119 int [] origin_x = new int [1], origin_y = new int [1];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3120 OS.gdk_window_get_origin (window, origin_x, origin_y);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3121 event.x = (int)x - origin_x [0];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3122 event.y = (int)y - origin_y [0];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3123 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3124 setInputState (event, state);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3125 if (send) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3126 sendEvent (type, event);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3127 if (isDisposed ()) return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3128 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3129 postEvent (type, event);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3130 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3131 return event.doit;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3132 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3133
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3134 void setBackground () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3135 if ((state & PARENT_BACKGROUND) != 0 && (state & BACKGROUND) == 0 && backgroundImage == null) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3136 setParentBackground ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3137 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3138 setWidgetBackground ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3139 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3140 redrawWidget (0, 0, 0, 0, true, false, false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3141 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3142
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3143 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3144 * Sets the receiver's background color to the color specified
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3145 * by the argument, or to the default system color for the control
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3146 * if the argument is null.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3147 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3148 * Note: This operation is a hint and may be overridden by the platform.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3149 * For example, on Windows the background of a Button cannot be changed.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3150 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3151 * @param color the new color (or null)
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3152 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3153 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3154 * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3155 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3156 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3157 * <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
3158 * <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
3159 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3160 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3161 public void setBackground (Color color) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3162 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3163 if (((state & BACKGROUND) == 0) && color == null) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3164 GdkColor gdkColor = null;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3165 if (color != null) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3166 if (color.isDisposed ()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3167 gdkColor = color.handle;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3168 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3169 boolean set = false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3170 if (gdkColor == null) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3171 int /*long*/ style = OS.gtk_widget_get_modifier_style (handle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3172 set = (OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_NORMAL) & OS.GTK_RC_BG) != 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3173 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3174 GdkColor oldColor = getBackgroundColor ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3175 set = oldColor.pixel != gdkColor.pixel;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3176 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3177 if (set) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3178 if (color == null) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3179 state &= ~BACKGROUND;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3180 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3181 state |= BACKGROUND;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3182 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3183 setBackgroundColor (gdkColor);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3184 redrawChildren ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3185 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3186 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3187
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3188 void setBackgroundColor (int /*long*/ handle, GdkColor color) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3189 int index = OS.GTK_STATE_NORMAL;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3190 int /*long*/ style = OS.gtk_widget_get_modifier_style (handle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3191 int /*long*/ ptr = OS.gtk_rc_style_get_bg_pixmap_name (style, index);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3192 if (ptr != 0) OS.g_free (ptr);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3193 String name = color == null ? "<parent>" : "<none>";
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3194 byte[] buffer = Converter.wcsToMbcs (null, name, true);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3195 ptr = OS.g_malloc (buffer.length);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3196 OS.memmove (ptr, buffer, buffer.length);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3197 OS.gtk_rc_style_set_bg_pixmap_name (style, index, ptr);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3198 OS.gtk_rc_style_set_bg (style, index, color);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3199 int flags = OS.gtk_rc_style_get_color_flags (style, index);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3200 flags = (color == null) ? flags & ~OS.GTK_RC_BG : flags | OS.GTK_RC_BG;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3201 OS.gtk_rc_style_set_color_flags (style, index, flags);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3202 OS.gtk_widget_modify_style (handle, style);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3203 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3204
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3205 void setBackgroundColor (GdkColor color) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3206 setBackgroundColor (handle, color);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3207 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3208
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3209 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3210 * Sets the receiver's background image to the image specified
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3211 * by the argument, or to the default system color for the control
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3212 * if the argument is null. The background image is tiled to fill
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3213 * the available space.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3214 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3215 * Note: This operation is a hint and may be overridden by the platform.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3216 * For example, on Windows the background of a Button cannot be changed.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3217 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3218 * @param image the new image (or null)
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3219 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3220 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3221 * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3222 * <li>ERROR_INVALID_ARGUMENT - if the argument is not a bitmap</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3223 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3224 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3225 * <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
3226 * <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
3227 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3228 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3229 * @since 3.2
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3230 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3231 public void setBackgroundImage (Image image) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3232 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3233 if (image != null && image.isDisposed ()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3234 if (image == backgroundImage) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3235 this.backgroundImage = image;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3236 if (backgroundImage != null) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3237 setBackgroundPixmap (backgroundImage.pixmap);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3238 redrawWidget (0, 0, 0, 0, true, false, false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3239 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3240 setWidgetBackground ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3241 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3242 redrawChildren ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3243 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3244
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3245 void setBackgroundPixmap (int /*long*/ pixmap) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3246 int /*long*/ window = OS.GTK_WIDGET_WINDOW (paintHandle ());
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3247 if (window != 0) OS.gdk_window_set_back_pixmap (window, backgroundImage.pixmap, false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3248 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3249
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3250 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3251 * If the argument is <code>true</code>, causes the receiver to have
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3252 * all mouse events delivered to it until the method is called with
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3253 * <code>false</code> as the argument.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3254 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3255 * @param capture <code>true</code> to capture the mouse, and <code>false</code> to release it
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3256 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3257 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3258 * <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
3259 * <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
3260 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3261 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3262 public void setCapture (boolean capture) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3263 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3264 /* FIXME !!!!! */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3265 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3266 if (capture) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3267 OS.gtk_widget_grab_focus (handle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3268 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3269 OS.gtk_widget_grab_default (handle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3270 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3271 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3272 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3273 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3274 * Sets the receiver's cursor to the cursor specified by the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3275 * argument, or to the default cursor for that kind of control
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3276 * if the argument is null.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3277 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3278 * When the mouse pointer passes over a control its appearance
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3279 * is changed to match the control's cursor.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3280 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3281 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3282 * @param cursor the new cursor (or null)
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3283 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3284 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3285 * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3286 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3287 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3288 * <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
3289 * <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
3290 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3291 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3292 public void setCursor (Cursor cursor) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3293 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3294 if (cursor != null && cursor.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3295 this.cursor = cursor;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3296 setCursor (cursor != null ? cursor.handle : 0);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3297 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3298
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3299 void setCursor (int /*long*/ cursor) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3300 int /*long*/ window = eventWindow ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3301 if (window != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3302 OS.gdk_window_set_cursor (window, cursor);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3303 if (!OS.GDK_WINDOWING_X11 ()) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3304 OS.gdk_flush ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3305 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3306 int /*long*/ xDisplay = OS.GDK_DISPLAY ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3307 OS.XFlush (xDisplay);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3308 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3309 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3310 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3311
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3312 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3313 * Sets the receiver's drag detect state. If the argument is
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3314 * <code>true</code>, the receiver will detect drag gestures,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3315 * otherwise these gestures will be ignored.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3316 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3317 * @param dragDetect the new drag detect state
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3318 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3319 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3320 * <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
3321 * <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
3322 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3323 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3324 * @since 3.3
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3325 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3326 public void setDragDetect (boolean dragDetect) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3327 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3328 if (dragDetect) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3329 state |= DRAG_DETECT;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3330 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3331 state &= ~DRAG_DETECT;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3332 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3333 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3334
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3335 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3336 * Enables the receiver if the argument is <code>true</code>,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3337 * and disables it otherwise. A disabled control is typically
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3338 * not selectable from the user interface and draws with an
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3339 * inactive or "grayed" look.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3340 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3341 * @param enabled the new enabled state
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3342 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3343 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3344 * <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
3345 * <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
3346 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3347 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3348 public void setEnabled (boolean enabled) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3349 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3350 if (((state & DISABLED) == 0) == enabled) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3351 Control control = null;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3352 boolean fixFocus = false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3353 if (!enabled) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3354 if (display.focusEvent != SWT.FocusOut) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3355 control = display.getFocusControl ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3356 fixFocus = isFocusAncestor (control);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3357 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3358 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3359 if (enabled) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3360 state &= ~DISABLED;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3361 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3362 state |= DISABLED;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3363 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3364 enableWidget (enabled);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3365 if (isDisposed ()) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3366 if (enabled) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3367 if (enableWindow != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3368 OS.gdk_window_set_user_data (enableWindow, 0);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3369 OS.gdk_window_destroy (enableWindow);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3370 enableWindow = 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3371 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3372 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3373 OS.gtk_widget_realize (handle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3374 int /*long*/ parentHandle = parent.parentingHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3375 int /*long*/ window = OS.GTK_WIDGET_WINDOW (parentHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3376 Rectangle rect = getBounds ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3377 GdkWindowAttr attributes = new GdkWindowAttr ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3378 attributes.x = rect.x;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3379 attributes.y = rect.y;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3380 attributes.width = rect.width;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3381 attributes.height = rect.height;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3382 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
3383 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
3384 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
3385 enableWindow = OS.gdk_window_new (window, attributes, OS.GDK_WA_X | OS.GDK_WA_Y);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3386 if (enableWindow != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3387 int /*long*/ topHandle = topHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3388 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
3389 if (!OS.GDK_WINDOWING_X11 ()) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3390 OS.gdk_window_raise (enableWindow);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3391 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3392 int /*long*/ topWindow = OS.GTK_WIDGET_WINDOW (topHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3393 int /*long*/ xDisplay = OS.gdk_x11_drawable_get_xdisplay (topWindow);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3394 int /*long*/ xWindow = OS.gdk_x11_drawable_get_xid (enableWindow);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3395 int xScreen = OS.XDefaultScreen (xDisplay);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3396 int flags = OS.CWStackMode | OS.CWSibling;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3397 XWindowChanges changes = new XWindowChanges ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3398 changes.sibling = OS.gdk_x11_drawable_get_xid (topWindow);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3399 changes.stack_mode = OS.Above;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3400 OS.XReconfigureWMWindow (xDisplay, xWindow, xScreen, flags, changes);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3401 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3402 if (OS.GTK_WIDGET_VISIBLE (topHandle)) OS.gdk_window_show_unraised (enableWindow);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3403 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3404 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3405 if (fixFocus) fixFocus (control);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3406 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3407
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3408 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3409 * Causes the receiver to have the <em>keyboard focus</em>,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3410 * such that all keyboard events will be delivered to it. Focus
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3411 * reassignment will respect applicable platform constraints.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3412 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3413 * @return <code>true</code> if the control got focus, and <code>false</code> if it was unable to.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3414 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3415 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3416 * <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
3417 * <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
3418 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3419 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3420 * @see #forceFocus
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3421 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3422 public boolean setFocus () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3423 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3424 if ((style & SWT.NO_FOCUS) != 0) return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3425 return forceFocus ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3426 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3427
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3428 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3429 * Sets the font that the receiver will use to paint textual information
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3430 * to the font specified by the argument, or to the default font for that
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3431 * kind of control if the argument is null.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3432 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3433 * @param font the new font (or null)
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3434 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3435 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3436 * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3437 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3438 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3439 * <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
3440 * <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
3441 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3442 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3443 public void setFont (Font font) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3444 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3445 if (((state & FONT) == 0) && font == null) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3446 this.font = font;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3447 int /*long*/ fontDesc;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3448 if (font == null) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3449 fontDesc = defaultFont ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3450 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3451 if (font.isDisposed ()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3452 fontDesc = font.handle;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3453 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3454 if (font == null) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3455 state &= ~FONT;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3456 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3457 state |= FONT;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3458 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3459 setFontDescription (fontDesc);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3460 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3461
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3462 void setFontDescription (int /*long*/ font) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3463 OS.gtk_widget_modify_font (handle, font);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3464 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3465
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3466 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3467 * Sets the receiver's foreground color to the color specified
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3468 * by the argument, or to the default system color for the control
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3469 * if the argument is null.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3470 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3471 * Note: This operation is a hint and may be overridden by the platform.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3472 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3473 * @param color the new color (or null)
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3474 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3475 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3476 * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3477 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3478 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3479 * <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
3480 * <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
3481 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3482 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3483 public void setForeground (Color color) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3484 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3485 if (((state & FOREGROUND) == 0) && color == null) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3486 GdkColor gdkColor = null;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3487 if (color != null) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3488 if (color.isDisposed ()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3489 gdkColor = color.handle;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3490 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3491 boolean set = false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3492 if (gdkColor == null) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3493 int /*long*/ style = OS.gtk_widget_get_modifier_style (handle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3494 set = (OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_NORMAL) & OS.GTK_RC_FG) != 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3495 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3496 GdkColor oldColor = getForegroundColor ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3497 set = oldColor.pixel != gdkColor.pixel;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3498 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3499 if (set) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3500 if (color == null) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3501 state &= ~FOREGROUND;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3502 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3503 state |= FOREGROUND;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3504 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3505 setForegroundColor (gdkColor);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3506 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3507 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3508
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3509 void setForegroundColor (GdkColor color) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3510 setForegroundColor (handle, color);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3511 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3512
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3513 void setInitialBounds () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3514 if ((state & ZERO_WIDTH) != 0 && (state & ZERO_HEIGHT) != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3515 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3516 * Feature in GTK. On creation, each widget's allocation is
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3517 * initialized to a position of (-1, -1) until the widget is
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3518 * first sized. The fix is to set the value to (0, 0) as
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3519 * expected by SWT.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3520 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3521 int /*long*/ topHandle = topHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3522 OS.GTK_WIDGET_SET_X (topHandle, 0);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3523 OS.GTK_WIDGET_SET_Y (topHandle, 0);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3524 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3525 resizeHandle (1, 1);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3526 forceResize ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3527 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3528 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3529
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3530 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3531 * Sets the receiver's pop up menu to the argument.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3532 * All controls may optionally have a pop up
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3533 * menu that is displayed when the user requests one for
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3534 * the control. The sequence of key strokes, button presses
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3535 * and/or button releases that are used to request a pop up
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3536 * menu is platform specific.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3537 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3538 * Note: Disposing of a control that has a pop up menu will
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3539 * dispose of the menu. To avoid this behavior, set the
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3540 * menu to null before the control is disposed.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3541 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3542 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3543 * @param menu the new pop up menu
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3544 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3545 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3546 * <li>ERROR_MENU_NOT_POP_UP - the menu is not a pop up menu</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3547 * <li>ERROR_INVALID_PARENT - if the menu is not in the same widget tree</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3548 * <li>ERROR_INVALID_ARGUMENT - if the menu has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3549 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3550 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3551 * <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
3552 * <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
3553 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3554 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3555 public void setMenu (Menu menu) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3556 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3557 if (menu != null) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3558 if ((menu.style & SWT.POP_UP) == 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3559 error (SWT.ERROR_MENU_NOT_POP_UP);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3560 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3561 if (menu.parent != menuShell ()) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3562 error (SWT.ERROR_INVALID_PARENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3563 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3564 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3565 this.menu = menu;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3566 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3567
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3568 void setOrientation () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3569 if ((style & SWT.RIGHT_TO_LEFT) != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3570 if (handle != 0) OS.gtk_widget_set_direction (handle, OS.GTK_TEXT_DIR_RTL);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3571 if (fixedHandle != 0) OS.gtk_widget_set_direction (fixedHandle, OS.GTK_TEXT_DIR_RTL);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3572 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3573 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3574
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3575 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3576 * Changes the parent of the widget to be the one provided if
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3577 * the underlying operating system supports this feature.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3578 * Returns <code>true</code> if the parent is successfully changed.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3579 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3580 * @param parent the new parent for the control.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3581 * @return <code>true</code> if the parent is changed and <code>false</code> otherwise.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3582 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3583 * @exception IllegalArgumentException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3584 * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed</li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3585 * <li>ERROR_NULL_ARGUMENT - if the parent is <code>null</code></li>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3586 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3587 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3588 * <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
3589 * <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
3590 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3591 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3592 public boolean setParent (Composite parent) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3593 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3594 if (parent == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3595 if (parent.isDisposed()) SWT.error (SWT.ERROR_INVALID_ARGUMENT);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3596 if (this.parent == parent) return true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3597 if (!isReparentable ()) return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3598 releaseParent ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3599 Shell newShell = parent.getShell (), oldShell = getShell ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3600 Decorations newDecorations = parent.menuShell (), oldDecorations = menuShell ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3601 Menu [] menus = oldShell.findMenus (this);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3602 if (oldShell != newShell || oldDecorations != newDecorations) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3603 fixChildren (newShell, oldShell, newDecorations, oldDecorations, menus);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3604 newDecorations.fixAccelGroup ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3605 oldDecorations.fixAccelGroup ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3606 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3607 int /*long*/ topHandle = topHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3608 int /*long*/ newParent = parent.parentingHandle();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3609 int x = OS.GTK_WIDGET_X (topHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3610 int y = OS.GTK_WIDGET_Y (topHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3611 OS.gtk_widget_reparent (topHandle, newParent);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3612 OS.gtk_fixed_move (newParent, topHandle, x, y);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3613 this.parent = parent;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3614 setZOrder (null, false, true);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3615 return true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3616 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3617
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3618 void setParentBackground () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3619 setBackgroundColor (handle, null);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3620 if (fixedHandle != 0) setBackgroundColor (fixedHandle, null);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3621 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3622
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3623 void setParentWindow (int /*long*/ widget) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3624 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3625
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3626 boolean setRadioSelection (boolean value) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3627 return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3628 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3629
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3630 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3631 * If the argument is <code>false</code>, causes subsequent drawing
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3632 * operations in the receiver to be ignored. No drawing of any kind
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3633 * can occur in the receiver until the flag is set to true.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3634 * Graphics operations that occurred while the flag was
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3635 * <code>false</code> are lost. When the flag is set to <code>true</code>,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3636 * the entire widget is marked as needing to be redrawn. Nested calls
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3637 * to this method are stacked.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3638 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3639 * Note: This operation is a hint and may not be supported on some
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3640 * platforms or for some widgets.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3641 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3642 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3643 * @param redraw the new redraw state
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3644 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3645 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3646 * <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
3647 * <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
3648 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3649 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3650 * @see #redraw(int, int, int, int, boolean)
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3651 * @see #update()
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3652 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3653 public void setRedraw (boolean redraw) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3654 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3655 if (redraw) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3656 if (--drawCount == 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3657 if (redrawWindow != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3658 int /*long*/ window = paintWindow ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3659 /* Explicitly hiding the window avoids flicker on GTK+ >= 2.6 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3660 OS.gdk_window_hide (redrawWindow);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3661 OS.gdk_window_destroy (redrawWindow);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3662 OS.gdk_window_set_events (window, OS.gtk_widget_get_events (paintHandle ()));
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3663 redrawWindow = 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3664 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3665 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3666 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3667 if (drawCount++ == 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3668 if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_REALIZED) != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3669 int /*long*/ window = paintWindow ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3670 Rectangle rect = getBounds ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3671 GdkWindowAttr attributes = new GdkWindowAttr ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3672 attributes.width = rect.width;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3673 attributes.height = rect.height;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3674 attributes.event_mask = OS.GDK_EXPOSURE_MASK;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3675 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
3676 redrawWindow = OS.gdk_window_new (window, attributes, 0);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3677 if (redrawWindow != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3678 int mouseMask = OS.GDK_BUTTON_PRESS_MASK | OS.GDK_BUTTON_RELEASE_MASK |
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3679 OS.GDK_ENTER_NOTIFY_MASK | OS.GDK_LEAVE_NOTIFY_MASK |
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3680 OS.GDK_POINTER_MOTION_MASK | OS.GDK_POINTER_MOTION_HINT_MASK |
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3681 OS.GDK_BUTTON_MOTION_MASK | OS.GDK_BUTTON1_MOTION_MASK |
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3682 OS.GDK_BUTTON2_MOTION_MASK | OS.GDK_BUTTON3_MOTION_MASK;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3683 OS.gdk_window_set_events (window, OS.gdk_window_get_events (window) & ~mouseMask);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3684 OS.gdk_window_set_back_pixmap (redrawWindow, 0, false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3685 OS.gdk_window_show (redrawWindow);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3686 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3687 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3688 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3689 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3690 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3691
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3692 boolean setTabGroupFocus (boolean next) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3693 return setTabItemFocus (next);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3694 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3695 boolean setTabItemFocus (boolean next) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3696 if (!isShowing ()) return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3697 return forceFocus ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3698 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3699
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3700 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3701 * Sets the receiver's tool tip text to the argument, which
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3702 * may be null indicating that no tool tip text should be shown.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3703 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3704 * @param string the new tool tip text (or null)
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3705 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3706 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3707 * <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
3708 * <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
3709 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3710 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3711 public void setToolTipText (String string) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3712 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3713 setToolTipText (_getShell (), string);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3714 toolTipText = string;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3715 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3716
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3717 void setToolTipText (Shell shell, String newString) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3718 shell.setToolTipText (eventHandle (), newString);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3719 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3720
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3721 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3722 * Marks the receiver as visible if the argument is <code>true</code>,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3723 * and marks it invisible otherwise.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3724 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3725 * If one of the receiver's ancestors is not visible or some
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3726 * other condition makes the receiver not visible, marking
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3727 * it visible may not actually cause it to be displayed.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3728 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3729 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3730 * @param visible the new visibility state
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3731 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3732 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3733 * <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
3734 * <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
3735 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3736 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3737 public void setVisible (boolean visible) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3738 checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3739 if (((state & HIDDEN) == 0) == visible) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3740 int /*long*/ topHandle = topHandle();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3741 if (visible) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3742 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3743 * 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
3744 * code could have disposed the widget in the show
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3745 * event. If this happens, just return.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3746 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3747 sendEvent (SWT.Show);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3748 if (isDisposed ()) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3749 state &= ~HIDDEN;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3750 if ((state & (ZERO_WIDTH | ZERO_HEIGHT)) == 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3751 if (enableWindow != 0) OS.gdk_window_show_unraised (enableWindow);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3752 OS.gtk_widget_show (topHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3753 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3754 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3755 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3756 * Bug in GTK. Invoking gtk_widget_hide() on a widget that has
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3757 * focus causes a focus_out_event to be sent. If the client disposes
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3758 * the widget inside the event, GTK GP's. The fix is to reassign focus
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3759 * before hiding the widget.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3760 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3761 * NOTE: In order to stop the same widget from taking focus,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3762 * temporarily clear and set the GTK_VISIBLE flag.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3763 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3764 Control control = null;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3765 boolean fixFocus = false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3766 if (display.focusEvent != SWT.FocusOut) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3767 control = display.getFocusControl ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3768 fixFocus = isFocusAncestor (control);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3769 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3770 state |= HIDDEN;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3771 if (fixFocus) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3772 OS.GTK_WIDGET_UNSET_FLAGS (topHandle, OS.GTK_VISIBLE);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3773 fixFocus (control);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3774 if (isDisposed ()) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3775 OS.GTK_WIDGET_SET_FLAGS (topHandle, OS.GTK_VISIBLE);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3776 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3777 OS.gtk_widget_hide (topHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3778 if (isDisposed ()) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3779 if (enableWindow != 0) OS.gdk_window_hide (enableWindow);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3780 sendEvent (SWT.Hide);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3781 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3782 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3783
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3784 void setZOrder (Control sibling, boolean above, boolean fixRelations) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3785 setZOrder (sibling, above, fixRelations, true);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3786 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3787
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3788 void setZOrder (Control sibling, boolean above, boolean fixRelations, boolean fixChildren) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3789 int index = 0, siblingIndex = 0, oldNextIndex = -1;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3790 Control[] children = null;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3791 if (fixRelations) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3792 /* determine the receiver's and sibling's indexes in the parent */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3793 children = parent._getChildren ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3794 while (index < children.length) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3795 if (children [index] == this) break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3796 index++;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3797 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3798 if (sibling != null) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3799 while (siblingIndex < children.length) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3800 if (children [siblingIndex] == sibling) break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3801 siblingIndex++;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3802 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3803 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3804 /* remove "Labelled by" relationships that will no longer be valid */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3805 removeRelation ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3806 if (index + 1 < children.length) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3807 oldNextIndex = index + 1;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3808 children [oldNextIndex].removeRelation ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3809 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3810 if (sibling != null) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3811 if (above) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3812 sibling.removeRelation ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3813 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3814 if (siblingIndex + 1 < children.length) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3815 children [siblingIndex + 1].removeRelation ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3816 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3817 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3818 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3819 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3820
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3821 int /*long*/ topHandle = topHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3822 int /*long*/ siblingHandle = sibling != null ? sibling.topHandle () : 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3823 int /*long*/ window = OS.GTK_WIDGET_WINDOW (topHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3824 if (window != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3825 int /*long*/ siblingWindow = 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3826 if (sibling != null) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3827 if (above && sibling.enableWindow != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3828 siblingWindow = enableWindow;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3829 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3830 siblingWindow = OS.GTK_WIDGET_WINDOW (siblingHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3831 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3832 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3833 int /*long*/ redrawWindow = fixChildren ? parent.redrawWindow : 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3834 if (!OS.GDK_WINDOWING_X11 () || (siblingWindow == 0 && (!above || redrawWindow == 0))) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3835 if (above) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3836 OS.gdk_window_raise (window);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3837 if (redrawWindow != 0) OS.gdk_window_raise (redrawWindow);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3838 if (enableWindow != 0) OS.gdk_window_raise (enableWindow);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3839 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3840 if (enableWindow != 0) OS.gdk_window_lower (enableWindow);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3841 OS.gdk_window_lower (window);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3842 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3843 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3844 XWindowChanges changes = new XWindowChanges ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3845 changes.sibling = OS.gdk_x11_drawable_get_xid (siblingWindow != 0 ? siblingWindow : redrawWindow);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3846 changes.stack_mode = above ? OS.Above : OS.Below;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3847 if (redrawWindow != 0 && siblingWindow == 0) changes.stack_mode = OS.Below;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3848 int /*long*/ xDisplay = OS.gdk_x11_drawable_get_xdisplay (window);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3849 int /*long*/ xWindow = OS.gdk_x11_drawable_get_xid (window);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3850 int xScreen = OS.XDefaultScreen (xDisplay);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3851 int flags = OS.CWStackMode | OS.CWSibling;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3852 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3853 * Feature in X. If the receiver is a top level, XConfigureWindow ()
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3854 * will fail (with a BadMatch error) for top level shells because top
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3855 * level shells are reparented by the window manager and do not share
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3856 * the same X window parent. This is the correct behavior but it is
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3857 * unexpected. The fix is to use XReconfigureWMWindow () instead.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3858 * When the receiver is not a top level shell, XReconfigureWMWindow ()
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3859 * behaves the same as XConfigureWindow ().
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3860 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3861 OS.XReconfigureWMWindow (xDisplay, xWindow, xScreen, flags, changes);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3862 if (enableWindow != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3863 changes.sibling = OS.gdk_x11_drawable_get_xid (window);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3864 changes.stack_mode = OS.Above;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3865 xWindow = OS.gdk_x11_drawable_get_xid (enableWindow);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3866 OS.XReconfigureWMWindow (xDisplay, xWindow, xScreen, flags, changes);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3867 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3868 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3869 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3870 if (fixChildren) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3871 if (above) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3872 parent.moveAbove (topHandle, siblingHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3873 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3874 parent.moveBelow (topHandle, siblingHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3875 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3876 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3877 /* Make sure that the parent internal windows are on the bottom of the stack */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3878 if (!above && fixChildren) parent.fixZOrder ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3879
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3880 if (fixRelations) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3881 /* determine the receiver's new index in the parent */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3882 if (sibling != null) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3883 if (above) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3884 index = siblingIndex - (index < siblingIndex ? 1 : 0);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3885 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3886 index = siblingIndex + (siblingIndex < index ? 1 : 0);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3887 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3888 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3889 if (above) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3890 index = 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3891 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3892 index = children.length - 1;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3893 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3894 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3895
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3896 /* add new "Labelled by" relations as needed */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3897 children = parent._getChildren ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3898 if (0 < index) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3899 children [index - 1].addRelation (this);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3900 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3901 if (index + 1 < children.length) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3902 addRelation (children [index + 1]);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3903 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3904 if (oldNextIndex != -1) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3905 if (oldNextIndex <= index) oldNextIndex--;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3906 /* the last two conditions below ensure that duplicate relations are not hooked */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3907 if (0 < oldNextIndex && oldNextIndex != index && oldNextIndex != index + 1) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3908 children [oldNextIndex - 1].addRelation (children [oldNextIndex]);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3909 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3910 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3911 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3912 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3913
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3914 void setWidgetBackground () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3915 if (fixedHandle != 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3916 int /*long*/ style = OS.gtk_widget_get_modifier_style (fixedHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3917 OS.gtk_widget_modify_style (fixedHandle, style);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3918 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3919 int /*long*/ style = OS.gtk_widget_get_modifier_style (handle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3920 OS.gtk_widget_modify_style (handle, style);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3921 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3922
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3923 boolean showMenu (int x, int y) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3924 Event event = new Event ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3925 event.x = x;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3926 event.y = y;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3927 sendEvent (SWT.MenuDetect, event);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3928 if (event.doit) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3929 if (menu != null && !menu.isDisposed ()) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3930 boolean hooksKeys = hooks (SWT.KeyDown) || hooks (SWT.KeyUp);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3931 menu.createIMMenu (hooksKeys ? imHandle() : 0);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3932 if (event.x != x || event.y != y) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3933 menu.setLocation (event.x, event.y);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3934 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3935 menu.setVisible (true);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3936 return true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3937 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3938 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3939 return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3940 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3941
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3942 void showWidget () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3943 // Comment this line to disable zero-sized widgets
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3944 state |= ZERO_WIDTH | ZERO_HEIGHT;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3945 int /*long*/ topHandle = topHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3946 int /*long*/ parentHandle = parent.parentingHandle ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3947 parent.setParentWindow (topHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3948 OS.gtk_container_add (parentHandle, topHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3949 if (handle != 0 && handle != topHandle) OS.gtk_widget_show (handle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3950 if ((state & (ZERO_WIDTH | ZERO_HEIGHT)) == 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3951 if (fixedHandle != 0) OS.gtk_widget_show (fixedHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3952 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3953 if (fixedHandle != 0) fixStyle (fixedHandle);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3954 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3955
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3956 void sort (int [] items) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3957 /* Shell Sort from K&R, pg 108 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3958 int length = items.length;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3959 for (int gap=length/2; gap>0; gap/=2) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3960 for (int i=gap; i<length; i++) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3961 for (int j=i-gap; j>=0; j-=gap) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3962 if (items [j] <= items [j + gap]) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3963 int swap = items [j];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3964 items [j] = items [j + gap];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3965 items [j + gap] = swap;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3966 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3967 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3968 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3969 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3970 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3971
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3972 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3973 * Based on the argument, perform one of the expected platform
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3974 * traversal action. The argument should be one of the constants:
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3975 * <code>SWT.TRAVERSE_ESCAPE</code>, <code>SWT.TRAVERSE_RETURN</code>,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3976 * <code>SWT.TRAVERSE_TAB_NEXT</code>, <code>SWT.TRAVERSE_TAB_PREVIOUS</code>,
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3977 * <code>SWT.TRAVERSE_ARROW_NEXT</code> and <code>SWT.TRAVERSE_ARROW_PREVIOUS</code>.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3978 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3979 * @param traversal the type of traversal
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3980 * @return true if the traversal succeeded
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3981 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3982 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3983 * <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
3984 * <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
3985 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3986 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3987 public boolean traverse (int traversal) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3988 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3989 Event event = new Event ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3990 event.doit = true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3991 event.detail = traversal;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3992 return traverse (event);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3993 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3994
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3995 boolean translateMnemonic (Event event, Control control) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3996 if (control == this) return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3997 if (!isVisible () || !isEnabled ()) return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3998 event.doit = this == display.mnemonicControl || mnemonicMatch (event.character);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3999 return traverse (event);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4000 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4001
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4002 boolean translateMnemonic (int keyval, GdkEventKey gdkEvent) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4003 int key = OS.gdk_keyval_to_unicode (keyval);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4004 if (key < 0x20) return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4005 if (gdkEvent.state == 0) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4006 int code = traversalCode (keyval, gdkEvent);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4007 if ((code & SWT.TRAVERSE_MNEMONIC) == 0) return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4008 } else {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4009 Shell shell = _getShell ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4010 int mask = OS.GDK_CONTROL_MASK | OS.GDK_SHIFT_MASK | OS.GDK_MOD1_MASK;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4011 if ((gdkEvent.state & mask) != OS.gtk_window_get_mnemonic_modifier (shell.shellHandle)) return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4012 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4013 Decorations shell = menuShell ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4014 if (shell.isVisible () && shell.isEnabled ()) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4015 Event event = new Event ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4016 event.detail = SWT.TRAVERSE_MNEMONIC;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4017 if (setKeyState (event, gdkEvent)) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4018 return translateMnemonic (event, null) || shell.translateMnemonic (event, this);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4019 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4020 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4021 return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4022 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4023
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4024 boolean translateTraversal (GdkEventKey keyEvent) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4025 int detail = SWT.TRAVERSE_NONE;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4026 int key = keyEvent.keyval;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4027 int code = traversalCode (key, keyEvent);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4028 boolean all = false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4029 switch (key) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4030 case OS.GDK_Escape: {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4031 all = true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4032 detail = SWT.TRAVERSE_ESCAPE;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4033 break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4034 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4035 case OS.GDK_KP_Enter:
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4036 case OS.GDK_Return: {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4037 all = true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4038 detail = SWT.TRAVERSE_RETURN;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4039 break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4040 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4041 case OS.GDK_ISO_Left_Tab:
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4042 case OS.GDK_Tab: {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4043 boolean next = (keyEvent.state & OS.GDK_SHIFT_MASK) == 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4044 detail = next ? SWT.TRAVERSE_TAB_NEXT : SWT.TRAVERSE_TAB_PREVIOUS;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4045 break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4046 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4047 case OS.GDK_Up:
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4048 case OS.GDK_Left:
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4049 case OS.GDK_Down:
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4050 case OS.GDK_Right: {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4051 boolean next = key == OS.GDK_Down || key == OS.GDK_Right;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4052 detail = next ? SWT.TRAVERSE_ARROW_NEXT : SWT.TRAVERSE_ARROW_PREVIOUS;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4053 break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4054 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4055 case OS.GDK_Page_Up:
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4056 case OS.GDK_Page_Down: {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4057 all = true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4058 if ((keyEvent.state & OS.GDK_CONTROL_MASK) == 0) return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4059 detail = key == OS.GDK_Page_Down ? SWT.TRAVERSE_PAGE_NEXT : SWT.TRAVERSE_PAGE_PREVIOUS;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4060 break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4061 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4062 default:
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4063 return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4064 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4065 Event event = new Event ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4066 event.doit = (code & detail) != 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4067 event.detail = detail;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4068 event.time = keyEvent.time;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4069 if (!setKeyState (event, keyEvent)) return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4070 Shell shell = getShell ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4071 Control control = this;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4072 do {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4073 if (control.traverse (event)) return true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4074 if (!event.doit && control.hooks (SWT.Traverse)) return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4075 if (control == shell) return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4076 control = control.parent;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4077 } while (all && control != null);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4078 return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4079 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4080
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4081 int traversalCode (int key, GdkEventKey event) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4082 int code = SWT.TRAVERSE_RETURN | SWT.TRAVERSE_TAB_NEXT | SWT.TRAVERSE_TAB_PREVIOUS | SWT.TRAVERSE_PAGE_NEXT | SWT.TRAVERSE_PAGE_PREVIOUS;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4083 Shell shell = getShell ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4084 if (shell.parent != null) code |= SWT.TRAVERSE_ESCAPE;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4085 return code;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4086 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4087
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4088 boolean traverse (Event event) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4089 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4090 * 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
4091 * code could have disposed the widget in the traverse
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4092 * event. If this happens, return true to stop further
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4093 * event processing.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4094 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4095 sendEvent (SWT.Traverse, event);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4096 if (isDisposed ()) return true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4097 if (!event.doit) return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4098 switch (event.detail) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4099 case SWT.TRAVERSE_NONE: return true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4100 case SWT.TRAVERSE_ESCAPE: return traverseEscape ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4101 case SWT.TRAVERSE_RETURN: return traverseReturn ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4102 case SWT.TRAVERSE_TAB_NEXT: return traverseGroup (true);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4103 case SWT.TRAVERSE_TAB_PREVIOUS: return traverseGroup (false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4104 case SWT.TRAVERSE_ARROW_NEXT: return traverseItem (true);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4105 case SWT.TRAVERSE_ARROW_PREVIOUS: return traverseItem (false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4106 case SWT.TRAVERSE_MNEMONIC: return traverseMnemonic (event.character);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4107 case SWT.TRAVERSE_PAGE_NEXT: return traversePage (true);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4108 case SWT.TRAVERSE_PAGE_PREVIOUS: return traversePage (false);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4109 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4110 return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4111 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4112
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4113 boolean traverseEscape () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4114 return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4115 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4116
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4117 boolean traverseGroup (boolean next) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4118 Control root = computeTabRoot ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4119 Control group = computeTabGroup ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4120 Control [] list = root.computeTabList ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4121 int length = list.length;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4122 int index = 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4123 while (index < length) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4124 if (list [index] == group) break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4125 index++;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4126 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4127 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4128 * 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
4129 * code could have disposed the widget in focus in
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4130 * or out events. Ensure that a disposed widget is
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4131 * not accessed.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4132 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4133 if (index == length) return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4134 int start = index, offset = (next) ? 1 : -1;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4135 while ((index = ((index + offset + length) % length)) != start) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4136 Control control = list [index];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4137 if (!control.isDisposed () && control.setTabGroupFocus (next)) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4138 return true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4139 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4140 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4141 if (group.isDisposed ()) return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4142 return group.setTabGroupFocus (next);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4143 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4144
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4145 boolean traverseItem (boolean next) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4146 Control [] children = parent._getChildren ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4147 int length = children.length;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4148 int index = 0;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4149 while (index < length) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4150 if (children [index] == this) break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4151 index++;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4152 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4153 /*
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4154 * 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
4155 * code could have disposed the widget in focus in
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4156 * or out events. Ensure that a disposed widget is
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4157 * not accessed.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4158 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4159 if (index == length) return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4160 int start = index, offset = (next) ? 1 : -1;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4161 while ((index = (index + offset + length) % length) != start) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4162 Control child = children [index];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4163 if (!child.isDisposed () && child.isTabItem ()) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4164 if (child.setTabItemFocus (next)) return true;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4165 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4166 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4167 return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4168 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4169
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4170 boolean traverseReturn () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4171 return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4172 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4173
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4174 boolean traversePage (boolean next) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4175 return false;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4176 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4177
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4178 boolean traverseMnemonic (char key) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4179 return mnemonicHit (key);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4180 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4181
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4182 /**
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4183 * Forces all outstanding paint requests for the widget
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4184 * to be processed before this method returns. If there
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4185 * are no outstanding paint request, this method does
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4186 * nothing.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4187 * <p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4188 * Note: This method does not cause a redraw.
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4189 * </p>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4190 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4191 * @exception SWTException <ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4192 * <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
4193 * <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
4194 * </ul>
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4195 *
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4196 * @see #redraw()
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4197 * @see #redraw(int, int, int, int, boolean)
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4198 * @see PaintListener
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4199 * @see SWT#Paint
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4200 */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4201 public void update () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4202 checkWidget ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4203 update (false, true);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4204 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4205
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4206 void update (boolean all, boolean flush) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4207 // checkWidget();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4208 if (!OS.GTK_WIDGET_VISIBLE (topHandle ())) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4209 if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_REALIZED) == 0) return;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4210 int /*long*/ window = paintWindow ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4211 if (flush) display.flushExposes (window, all);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4212 OS.gdk_window_process_updates (window, all);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4213 OS.gdk_flush ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4214 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4215
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4216 void updateBackgroundMode () {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4217 int oldState = state & PARENT_BACKGROUND;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4218 checkBackground ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4219 if (oldState != (state & PARENT_BACKGROUND)) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4220 setBackground ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4221 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4222 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4223
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4224 void updateLayout (boolean all) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4225 /* Do nothing */
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4226 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4227
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4228 int /*long*/ windowProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4229 switch ((int)/*64*/user_data) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4230 case EXPOSE_EVENT_INVERSE: {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4231 if ((OS.GTK_VERSION < OS.VERSION (2, 8, 0)) && ((state & OBSCURED) == 0)) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4232 Control control = findBackgroundControl ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4233 if (control != null && control.backgroundImage != null) {
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4234 GdkEventExpose gdkEvent = new GdkEventExpose ();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4235 OS.memmove (gdkEvent, arg0, GdkEventExpose.sizeof);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4236 int /*long*/ paintWindow = paintWindow();
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4237 int /*long*/ window = gdkEvent.window;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4238 if (window != paintWindow) break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4239 int /*long*/ gdkGC = OS.gdk_gc_new (window);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4240 OS.gdk_gc_set_clip_region (gdkGC, gdkEvent.region);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4241 int[] dest_x = new int[1], dest_y = new int[1];
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4242 OS.gtk_widget_translate_coordinates (paintHandle (), control.paintHandle (), 0, 0, dest_x, dest_y);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4243 OS.gdk_gc_set_fill (gdkGC, OS.GDK_TILED);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4244 OS.gdk_gc_set_ts_origin (gdkGC, -dest_x [0], -dest_y [0]);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4245 OS.gdk_gc_set_tile (gdkGC, control.backgroundImage.pixmap);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4246 OS.gdk_draw_rectangle (window, gdkGC, 1, gdkEvent.area_x, gdkEvent.area_y, gdkEvent.area_width, gdkEvent.area_height);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4247 OS.g_object_unref (gdkGC);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4248 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4249 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4250 break;
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4251 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4252 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4253 return super.windowProc (handle, arg0, user_data);
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4254 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4255 }
fc2b263b8a3f Merged back the System.arraycopy and use a System class
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4256 +++/