View | Details | Raw Unified | Return to bug 81334 | Differences between
and this patch

Collapse All | Expand All

(-)Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java (-1 / +151 lines)
Lines 26-32 Link Here
26
 * <dd>LEFT_TO_RIGHT, RIGHT_TO_LEFT</dd>
26
 * <dd>LEFT_TO_RIGHT, RIGHT_TO_LEFT</dd>
27
 * <dt><b>Events:</b>
27
 * <dt><b>Events:</b>
28
 * <dd>FocusIn, FocusOut, Help, KeyDown, KeyUp, MouseDoubleClick, MouseDown, MouseEnter,
28
 * <dd>FocusIn, FocusOut, Help, KeyDown, KeyUp, MouseDoubleClick, MouseDown, MouseEnter,
29
 *     MouseExit, MouseHover, MouseUp, MouseMove, Move, Paint, Resize, Traverse,
29
 *     MouseExit, MouseHover, MouseMove, MouseUp, MouseWheel, Move, Paint, Resize, Traverse,
30
 *     DragDetect, MenuDetect</dd>
30
 *     DragDetect, MenuDetect</dd>
31
 * </dl>
31
 * </dl>
32
 * </p><p>
32
 * </p><p>
Lines 300-305 Link Here
300
300
301
/**
301
/**
302
 * Adds the listener to the collection of listeners who will
302
 * Adds the listener to the collection of listeners who will
303
 * be notified when the mouse wheel is spun, by sending it one of the
304
 * messages defined in the <code>MouseWheelListener</code>
305
 * interface.
306
 *
307
 * @param listener the listener which should be notified
308
 *
309
 * @exception IllegalArgumentException <ul>
310
 *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
311
 * </ul>
312
 * @exception SWTException <ul>
313
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
314
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
315
 * </ul>
316
 *
317
 * @see MouseWheelListener
318
 * @see #removeMouseWheelListener
319
 */
320
public void addMouseWheelListener (MouseWheelListener listener) {
321
	checkWidget ();
322
	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
323
	TypedListener typedListener = new TypedListener (listener);
324
	addListener (SWT.MouseWheel,typedListener);
325
}
326
327
/**
328
 * Adds the listener to the collection of listeners who will
303
 * be notified when the receiver needs to be painted, by sending it
329
 * be notified when the receiver needs to be painted, by sending it
304
 * one of the messages defined in the <code>PaintListener</code>
330
 * one of the messages defined in the <code>PaintListener</code>
305
 * interface.
331
 * interface.
Lines 350-355 Link Here
350
	addListener (SWT.Traverse,typedListener);
376
	addListener (SWT.Traverse,typedListener);
351
}
377
}
352
378
379
/**
380
 * Adds the listener to the collection of listeners who will
381
 * be notified when drag events occur, by sending it
382
 * one of the messages defined in the <code>DragDetectListener</code>
383
 * interface.
384
 *
385
 * @param listener the listener which should be notified
386
 *
387
 * @exception IllegalArgumentException <ul>
388
 *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
389
 * </ul>
390
 * @exception SWTException <ul>
391
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
392
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
393
 * </ul>
394
 *
395
 * @see DragDetectListener
396
 * @see #removeDragDetectListener
397
 */
398
public void addDragDetectListener (DragDetectListener listener) {
399
	checkWidget ();
400
	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
401
	TypedListener typedListener = new TypedListener (listener);
402
	addListener (SWT.DragDetect,typedListener);
403
}
404
405
/**
406
 * Adds the listener to the collection of listeners who will
407
 * be notified when menu events occur, by sending it
408
 * one of the messages defined in the <code>MenuDetectListener</code>
409
 * interface.
410
 *
411
 * @param listener the listener which should be notified
412
 *
413
 * @exception IllegalArgumentException <ul>
414
 *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
415
 * </ul>
416
 * @exception SWTException <ul>
417
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
418
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
419
 * </ul>
420
 *
421
 * @see MenuDetectListener
422
 * @see #removeMenuDetectListener
423
 */
424
public void addMenuDetectListener (MenuDetectListener listener) {
425
	checkWidget ();
426
	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
427
	TypedListener typedListener = new TypedListener (listener);
428
	addListener (SWT.MenuDetect,typedListener);
429
}
430
353
int borderHandle () {
431
int borderHandle () {
354
	return handle;
432
	return handle;
355
}
433
}
Lines 1970-1975 Link Here
1970
2048
1971
/**
2049
/**
1972
 * Removes the listener from the collection of listeners who will
2050
 * Removes the listener from the collection of listeners who will
2051
 * be notified when the mouse wheel is spun.
2052
 *
2053
 * @param listener the listener which should no longer be notified
2054
 *
2055
 * @exception IllegalArgumentException <ul>
2056
 *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
2057
 * </ul>
2058
 * @exception SWTException <ul>
2059
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
2060
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
2061
 * </ul>
2062
 *
2063
 * @see MouseWheelListener
2064
 * @see #addMouseWheelListener
2065
 */
2066
public void removeMouseWheelListener(MouseWheelListener listener) {
2067
	checkWidget ();
2068
	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
2069
	if (eventTable == null) return;
2070
	eventTable.unhook (SWT.MouseWheel, listener);
2071
}
2072
2073
/**
2074
 * Removes the listener from the collection of listeners who will
1973
 * be notified when the mouse moves.
2075
 * be notified when the mouse moves.
1974
 *
2076
 *
1975
 * @param listener the listener which should no longer be notified
2077
 * @param listener the listener which should no longer be notified
Lines 2040-2045 Link Here
2040
	eventTable.unhook (SWT.Traverse, listener);
2142
	eventTable.unhook (SWT.Traverse, listener);
2041
}
2143
}
2042
2144
2145
/**
2146
 * Removes the listener from the collection of listeners who will
2147
 * be notified when drag events occur.
2148
 *
2149
 * @param listener the listener which should no longer be notified
2150
 *
2151
 * @exception IllegalArgumentException <ul>
2152
 *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
2153
 * </ul>
2154
 * @exception SWTException <ul>
2155
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
2156
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
2157
 * </ul>
2158
 *
2159
 * @see DragDetectListener
2160
 * @see #addDragDetectListener
2161
 */
2162
public void removeDragDetectListener(DragDetectListener listener) {
2163
	checkWidget ();
2164
	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
2165
	if (eventTable == null) return;
2166
	eventTable.unhook (SWT.DragDetect, listener);
2167
}
2168
2169
/**
2170
 * Removes the listener from the collection of listeners who will
2171
 * be notified when menu events occur.
2172
 *
2173
 * @param listener the listener which should no longer be notified
2174
 *
2175
 * @exception IllegalArgumentException <ul>
2176
 *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
2177
 * </ul>
2178
 * @exception SWTException <ul>
2179
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
2180
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
2181
 * </ul>
2182
 *
2183
 * @see MenuDetectListener
2184
 * @see #addMenuDetectListener
2185
 */
2186
public void removeMenuDetectListener(MenuDetectListener listener) {
2187
	checkWidget ();
2188
	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
2189
	if (eventTable == null) return;
2190
	eventTable.unhook (SWT.MenuDetect, listener);
2191
}
2192
2043
void showWidget (boolean visible) {
2193
void showWidget (boolean visible) {
2044
	int topHandle = topHandle ();
2194
	int topHandle = topHandle ();
2045
	OS.ShowWindow (topHandle, visible ? OS.SW_SHOW : OS.SW_HIDE);
2195
	OS.ShowWindow (topHandle, visible ? OS.SW_SHOW : OS.SW_HIDE);
(-)Eclipse SWT/win32/org/eclipse/swt/widgets/TrayItem.java (+50 lines)
Lines 109-114 Link Here
109
	addListener (SWT.DefaultSelection,typedListener);
109
	addListener (SWT.DefaultSelection,typedListener);
110
}
110
}
111
111
112
/**
113
 * Adds the listener to the collection of listeners who will
114
 * be notified when menu events occur, by sending it one of the
115
 * messages defined in the <code>MenuDetectListener</code>
116
 * interface.
117
 *
118
 * @param listener the listener which should be notified
119
 *
120
 * @exception IllegalArgumentException <ul>
121
 *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
122
 * </ul>
123
 * @exception SWTException <ul>
124
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
125
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
126
 * </ul>
127
 *
128
 * @see MenuDetectListener
129
 * @see #removeMenuDetectListener
130
 */
131
public void addMenuDetectListener (MenuDetectListener listener) {
132
	checkWidget ();
133
	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
134
	TypedListener typedListener = new TypedListener (listener);
135
	addListener (SWT.MenuDetect,typedListener);
136
}
137
112
protected void checkSubclass () {
138
protected void checkSubclass () {
113
	if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
139
	if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
114
}
140
}
Lines 322-327 Link Here
322
}
348
}
323
349
324
/**
350
/**
351
 * Removes the listener from the collection of listeners who will
352
 * be notified when menu events occur.
353
 *
354
 * @param listener the listener which should no longer be notified
355
 *
356
 * @exception IllegalArgumentException <ul>
357
 *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
358
 * </ul>
359
 * @exception SWTException <ul>
360
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
361
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
362
 * </ul>
363
 *
364
 * @see MenuDetectListener
365
 * @see #addMenuDetectListener
366
 */
367
public void removeMenuDetectListener(MenuDetectListener listener) {
368
	checkWidget ();
369
	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
370
	if (eventTable == null) return;
371
	eventTable.unhook (SWT.MenuDetect, listener);
372
}
373
374
/**
325
 * Sets the receiver's image.
375
 * Sets the receiver's image.
326
 *
376
 *
327
 * @param image the new image
377
 * @param image the new image
(-)Eclipse SWT/win32/org/eclipse/swt/widgets/Spinner.java (-1 / +1 lines)
Lines 28-34 Link Here
28
 * <dt><b>Styles:</b></dt>
28
 * <dt><b>Styles:</b></dt>
29
 * <dd>READ_ONLY, WRAP</dd>
29
 * <dd>READ_ONLY, WRAP</dd>
30
 * <dt><b>Events:</b></dt>
30
 * <dt><b>Events:</b></dt>
31
 * <dd>Selection, Modify</dd>
31
 * <dd>Selection, Modify, Verify</dd>
32
 * </dl>
32
 * </dl>
33
 * </p><p>
33
 * </p><p>
34
 * IMPORTANT: This class is <em>not</em> intended to be subclassed.
34
 * IMPORTANT: This class is <em>not</em> intended to be subclassed.
(-)Eclipse SWT/win32/org/eclipse/swt/widgets/Tracker.java (-12 / +90 lines)
Lines 28-34 Link Here
28
 * <dt><b>Styles:</b></dt>
28
 * <dt><b>Styles:</b></dt>
29
 * <dd>LEFT, RIGHT, UP, DOWN, RESIZE</dd>
29
 * <dd>LEFT, RIGHT, UP, DOWN, RESIZE</dd>
30
 * <dt><b>Events:</b></dt>
30
 * <dt><b>Events:</b></dt>
31
 * <dd>Move, Resize</dd>
31
 * <dd>Move, Resize, KeyUp, KeyDown</dd>
32
 * </dl>
32
 * </dl>
33
 * <p>
33
 * <p>
34
 * Note: Rectangle move behavior is assumed unless RESIZE is specified.
34
 * Note: Rectangle move behavior is assumed unless RESIZE is specified.
Lines 37-48 Link Here
37
 * </p>
37
 * </p>
38
 */
38
 */
39
public class Tracker extends Widget {
39
public class Tracker extends Widget {
40
	Control parent;
40
	Composite parent;
41
	boolean tracking, cancelled, stippled;
41
	boolean tracking, cancelled, stippled, inEvent, constrain;
42
	Rectangle [] rectangles = new Rectangle [0], proportions = rectangles;
42
	Rectangle [] rectangles = new Rectangle [0], proportions = rectangles;
43
	Rectangle bounds;
43
	Rectangle bounds;
44
	int resizeCursor, clientCursor, cursorOrientation = SWT.NONE;
44
	int resizeCursor, clientCursor, cursorOrientation = SWT.NONE;
45
	boolean inEvent = false;
46
	int oldProc, oldX, oldY;
45
	int oldProc, oldX, oldY;
47
46
48
	/*
47
	/*
Lines 88-93 Link Here
88
	this.parent = parent;
87
	this.parent = parent;
89
}
88
}
90
89
90
public Tracker (Composite parent, int style, boolean constrain) {
91
	super (parent, checkStyle (style));
92
	this.parent = parent;
93
	this.constrain = constrain;
94
}
95
91
/**
96
/**
92
 * Constructs a new instance of this class given the display
97
 * Constructs a new instance of this class given the display
93
 * to create it on and a style value describing its behavior
98
 * to create it on and a style value describing its behavior
Lines 319-337 Link Here
319
324
320
Rectangle [] computeProportions (Rectangle [] rects) {
325
Rectangle [] computeProportions (Rectangle [] rects) {
321
	Rectangle [] result = new Rectangle [rects.length];
326
	Rectangle [] result = new Rectangle [rects.length];
322
	bounds = computeBounds ();
323
	if (bounds != null) {
327
	if (bounds != null) {
324
		for (int i = 0; i < rects.length; i++) {
328
		for (int i = 0; i < rects.length; i++) {
325
			int x = 0, y = 0, width = 0, height = 0;
329
			int x = 0, y = 0, width = 0, height = 0;
326
			if (bounds.width != 0) {
330
			if (bounds.width != 0) {
327
				x = (rects [i].x - bounds.x) * 100 / bounds.width;
331
				x = Math.round ((float)((rects [i].x - bounds.x /*+ 1*/) * 100) / bounds.width);
328
				width = rects [i].width * 100 / bounds.width;
332
				width = Math.round ((float)(rects [i].width * 100) / bounds.width);
329
			} else {
333
			} else {
330
				width = 100;
334
				width = 100;
331
			}
335
			}
332
			if (bounds.height != 0) {
336
			if (bounds.height != 0) {
333
				y = (rects [i].y - bounds.y) * 100 / bounds.height;
337
				y = Math.round ((float)((rects [i].y - bounds.y /*+ 1*/) * 100) / bounds.height);
334
				height = rects [i].height * 100 / bounds.height;
338
				height = Math.round ((float)(rects [i].height * 100) / bounds.height);
335
			} else {
339
			} else {
336
				height = 100;
340
				height = 100;
337
			}
341
			}
Lines 364-369 Link Here
364
		OS.PatBlt (hDC, rect.x + rect.width - bandWidth, rect.y + bandWidth, bandWidth, rect.height - (bandWidth * 2), OS.PATINVERT);
368
		OS.PatBlt (hDC, rect.x + rect.width - bandWidth, rect.y + bandWidth, bandWidth, rect.height - (bandWidth * 2), OS.PATINVERT);
365
		OS.PatBlt (hDC, rect.x, rect.y + rect.height - bandWidth, rect.width, bandWidth, OS.PATINVERT);
369
		OS.PatBlt (hDC, rect.x, rect.y + rect.height - bandWidth, rect.width, bandWidth, OS.PATINVERT);
366
	}
370
	}
371
367
	if (stippled) {
372
	if (stippled) {
368
		OS.SelectObject (hDC, oldBrush);
373
		OS.SelectObject (hDC, oldBrush);
369
		OS.DeleteObject (hBrush);
374
		OS.DeleteObject (hBrush);
Lines 415-420 Link Here
415
	if (xChange > 0 && ((style & SWT.RIGHT) == 0)) xChange = 0;
420
	if (xChange > 0 && ((style & SWT.RIGHT) == 0)) xChange = 0;
416
	if (yChange < 0 && ((style & SWT.UP) == 0)) yChange = 0;
421
	if (yChange < 0 && ((style & SWT.UP) == 0)) yChange = 0;
417
	if (yChange > 0 && ((style & SWT.DOWN) == 0)) yChange = 0;
422
	if (yChange > 0 && ((style & SWT.DOWN) == 0)) yChange = 0;
423
	if (constrain) {
424
		if (xChange < 0) {
425
			if ((bounds.x + xChange) < parent.getClientArea ().x) xChange = Math.min (parent.getClientArea ().x, -(bounds.x - parent.getClientArea ().x));
426
		}
427
		if (xChange > 0) {
428
			int right = bounds.x + bounds.width - 1;
429
			int width = parent.getClientArea ().x + parent.getClientArea ().width;
430
			if (right + xChange >= width) {
431
				xChange = Math.max (0, width - right - 1);
432
			}
433
		}
434
		if (yChange < 0) {
435
			if ((bounds.y + yChange) < parent.getClientArea ().y) yChange = Math.min (parent.getClientArea ().y, -(bounds.y - parent.getClientArea ().y));
436
		}
437
		if (yChange > 0) {
438
			int bottom = bounds.y + bounds.height - 1;
439
			int height = parent.getClientArea ().y + parent.getClientArea ().height;
440
			if (bottom + yChange >= height) {
441
				yChange = Math.max (0, height - bottom - 1);
442
			}
443
		}
444
	}
418
	if (xChange == 0 && yChange == 0) return;
445
	if (xChange == 0 && yChange == 0) return;
419
	bounds.x += xChange; bounds.y += yChange;
446
	bounds.x += xChange; bounds.y += yChange;
420
	for (int i = 0; i < rectangles.length; i++) {
447
	for (int i = 0; i < rectangles.length; i++) {
Lines 635-641 Link Here
635
	if (yChange > 0 && ((style & SWT.DOWN) != 0) && ((cursorOrientation & SWT.UP) == 0)) {
662
	if (yChange > 0 && ((style & SWT.DOWN) != 0) && ((cursorOrientation & SWT.UP) == 0)) {
636
		cursorOrientation |= SWT.DOWN;
663
		cursorOrientation |= SWT.DOWN;
637
	}
664
	}
638
	
665
666
	if (constrain) {
667
		if (xChange < 0) {
668
			if (((cursorOrientation & SWT.LEFT) != 0) && (bounds.x + xChange) < parent.getClientArea ().x) {
669
				if ((bounds.x + xChange) < parent.getClientArea ().x) xChange = Math.min (parent.getClientArea ().x, -(bounds.x - parent.getClientArea ().x));
670
				xChange = Math.min (parent.getClientArea ().x, -(bounds.x - parent.getClientArea ().x));
671
			}
672
			if (((cursorOrientation & SWT.RIGHT) != 0) && (bounds.x + bounds.width - 1 + xChange) < 0) {
673
				/* will flip about y axis before hitting edge */
674
				xChange = Math.min (parent.getClientArea ().x, -(bounds.x - parent.getClientArea ().x + bounds.width - 1));
675
			}
676
		}
677
		if (xChange > 0) {
678
			int right = bounds.x + bounds.width - 1;
679
			int width = parent.getClientArea ().x + parent.getClientArea ().width;
680
			if ((cursorOrientation & SWT.RIGHT) != 0 && (right + xChange) >= width) {
681
				xChange = Math.max (0, width - right - 1);
682
			}
683
			if ((cursorOrientation & SWT.LEFT) != 0 && (bounds.x + xChange) >= width) {
684
				/* will flip about y axis before hitting edge */
685
				xChange = Math.max (0, width - bounds.x - 1);
686
			}
687
		}
688
		if (yChange < 0) {
689
			if (((cursorOrientation & SWT.TOP) != 0) && (bounds.y + yChange) < parent.getClientArea ().y) {
690
				yChange = Math.min (parent.getClientArea ().y, -(bounds.y - parent.getClientArea ().y));
691
			}
692
			if (((cursorOrientation & SWT.BOTTOM) != 0) && (bounds.y + bounds.height - 1 + yChange) < 0) {
693
				/* will flip about x axis before hitting edge */
694
				yChange = Math.min (parent.getClientArea ().y, -(bounds.y - parent.getClientArea ().y + bounds.height - 1));
695
			}
696
		}
697
		if (yChange > 0) {
698
			int bottom = bounds.y + bounds.height - 1;
699
			int height = parent.getClientArea ().y + parent.getClientArea ().height;
700
			if ((cursorOrientation & SWT.BOTTOM) != 0 && (bottom + yChange) >= height) {
701
				yChange = Math.max (0, height - bottom - 1);
702
			}
703
			if ((cursorOrientation & SWT.BOTTOM) != 0 && (bounds.y + yChange) >= height) {
704
				/* will flip about x axis before hitting edge */
705
				yChange = Math.max (0, height - bounds.y - 1);
706
			}
707
		}
708
		if (xChange == 0 && yChange == 0) return;
709
	}
710
639
	/*
711
	/*
640
	 * If the bounds will flip about the x or y axis then apply the adjustment
712
	 * If the bounds will flip about the x or y axis then apply the adjustment
641
	 * up to the axis (ie.- where bounds width/height becomes 0), change the
713
	 * up to the axis (ie.- where bounds width/height becomes 0), change the
Lines 726-732 Link Here
726
			proportion.width * bounds.width / 100,
798
			proportion.width * bounds.width / 100,
727
			proportion.height * bounds.height / 100);
799
			proportion.height * bounds.height / 100);
728
	}
800
	}
729
	rectangles = newRects;	
801
	rectangles = newRects;
802
	System.out.println("bounds: " + bounds);
803
	System.out.println("rect2: " + rectangles[1].toString());
804
	System.out.println("----");
730
}
805
}
731
806
732
/**
807
/**
Lines 772-778 Link Here
772
		if (current == null) error (SWT.ERROR_NULL_ARGUMENT);
847
		if (current == null) error (SWT.ERROR_NULL_ARGUMENT);
773
		this.rectangles [i] = new Rectangle (current.x, current.y, current.width, current.height);
848
		this.rectangles [i] = new Rectangle (current.x, current.y, current.width, current.height);
774
	}
849
	}
775
	proportions = computeProportions (rectangles);
850
	bounds = computeBounds ();
851
	if ((style & SWT.RESIZE) != 0) { 
852
		proportions = computeProportions (rectangles);
853
	}
776
}
854
}
777
855
778
/**
856
/**
(-)Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java (+108 lines)
Lines 307-312 Link Here
307
	addListener (SWT.Collapse, typedListener);
307
	addListener (SWT.Collapse, typedListener);
308
} 
308
} 
309
309
310
/**
311
 * Adds the listener to the collection of listeners who will
312
 * be notified when data is set, by sending it one of the
313
 * messages defined in the <code>SetDataListener</code>
314
 * interface.
315
 * <p>
316
 *
317
 * @param listener the listener which should be notified
318
 *
319
 * @exception IllegalArgumentException <ul>
320
 *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
321
 * </ul>
322
 * @exception SWTException <ul>
323
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
324
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
325
 * </ul>
326
 *
327
 * @see SetDataListener
328
 * @see #removeSetDataListener
329
 * @see SetDataEvent
330
 */
331
public void addSetDataListener (SetDataListener listener) {
332
	checkWidget ();
333
	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
334
	TypedListener typedListener = new TypedListener (listener);
335
	addListener (SWT.SetData,typedListener);
336
}
337
338
/**
339
 * Adds the listener to the collection of listeners who will
340
 * be notified when items change, by sending it one of the
341
 * messages defined in the <code>ItemListener</code>
342
 * interface.
343
 * <p>
344
 *
345
 * @param listener the listener which should be notified
346
 *
347
 * @exception IllegalArgumentException <ul>
348
 *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
349
 * </ul>
350
 * @exception SWTException <ul>
351
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
352
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
353
 * </ul>
354
 *
355
 * @see ItemListener
356
 * @see #removeItemListener
357
 * @see ItemEvent
358
 */
359
public void addItemListener (ItemListener listener) {
360
	checkWidget ();
361
	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
362
	TypedListener typedListener = new TypedListener (listener);
363
	addListener (SWT.MeasureItem,typedListener);
364
	addListener (SWT.EraseItem,typedListener);
365
	addListener (SWT.PaintItem,typedListener);
366
}
367
310
int borderHandle () {
368
int borderHandle () {
311
	return hwndParent != 0 ? hwndParent : handle;
369
	return hwndParent != 0 ? hwndParent : handle;
312
}
370
}
Lines 3498-3503 Link Here
3498
}
3556
}
3499
3557
3500
/**
3558
/**
3559
 * Removes the listener from the collection of listeners who will
3560
 * be notified when data is set.
3561
 *
3562
 * @param listener the listener which should no longer be notified
3563
 *
3564
 * @exception IllegalArgumentException <ul>
3565
 *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
3566
 * </ul>
3567
 * @exception SWTException <ul>
3568
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
3569
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
3570
 * </ul>
3571
 *
3572
 * @see SetDataListener
3573
 * @see #addSetDataListener(SetDataListener)
3574
 */
3575
public void removeSetDataListener(SetDataListener listener) {
3576
	checkWidget ();
3577
	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
3578
	if (eventTable == null) return;
3579
	eventTable.unhook (SWT.SetData, listener);
3580
}
3581
3582
/**
3583
 * Removes the listener from the collection of listeners who will
3584
 * be notified when items change.
3585
 *
3586
 * @param listener the listener which should no longer be notified
3587
 *
3588
 * @exception IllegalArgumentException <ul>
3589
 *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
3590
 * </ul>
3591
 * @exception SWTException <ul>
3592
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
3593
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
3594
 * </ul>
3595
 *
3596
 * @see ItemListener
3597
 * @see #addItemListener(ItemListener)
3598
 */
3599
public void removeItemListener(ItemListener listener) {
3600
	checkWidget ();
3601
	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
3602
	if (eventTable == null) return;
3603
	eventTable.unhook (SWT.MeasureItem, listener);
3604
	eventTable.unhook (SWT.EraseItem, listener);
3605
	eventTable.unhook (SWT.PaintItem, listener);
3606
}
3607
3608
/**
3501
 * Display a mark indicating the point at which an item will be inserted.
3609
 * Display a mark indicating the point at which an item will be inserted.
3502
 * The drop insert item has a visual hint to show where a dragged item 
3610
 * The drop insert item has a visual hint to show where a dragged item 
3503
 * will be inserted when dropped on the tree.
3611
 * will be inserted when dropped on the tree.
(-)Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java (+108 lines)
Lines 186-191 Link Here
186
	addListener (SWT.DefaultSelection,typedListener);
186
	addListener (SWT.DefaultSelection,typedListener);
187
}
187
}
188
188
189
/**
190
 * Adds the listener to the collection of listeners who will
191
 * be notified when data is set, by sending it one of the
192
 * messages defined in the <code>SetDataListener</code>
193
 * interface.
194
 * <p>
195
 *
196
 * @param listener the listener which should be notified
197
 *
198
 * @exception IllegalArgumentException <ul>
199
 *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
200
 * </ul>
201
 * @exception SWTException <ul>
202
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
203
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
204
 * </ul>
205
 *
206
 * @see SetDataListener
207
 * @see #removeSetDataListener
208
 * @see SetDataEvent
209
 */
210
public void addSetDataListener (SetDataListener listener) {
211
	checkWidget ();
212
	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
213
	TypedListener typedListener = new TypedListener (listener);
214
	addListener (SWT.SetData,typedListener);
215
}
216
217
/**
218
 * Adds the listener to the collection of listeners who will
219
 * be notified when items change, by sending it one of the
220
 * messages defined in the <code>ItemListener</code>
221
 * interface.
222
 * <p>
223
 *
224
 * @param listener the listener which should be notified
225
 *
226
 * @exception IllegalArgumentException <ul>
227
 *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
228
 * </ul>
229
 * @exception SWTException <ul>
230
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
231
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
232
 * </ul>
233
 *
234
 * @see ItemListener
235
 * @see #removeItemListener
236
 * @see ItemEvent
237
 */
238
public void addItemListener (ItemListener listener) {
239
	checkWidget ();
240
	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
241
	TypedListener typedListener = new TypedListener (listener);
242
	addListener (SWT.MeasureItem,typedListener);
243
	addListener (SWT.EraseItem,typedListener);
244
	addListener (SWT.PaintItem,typedListener);
245
}
246
189
int callWindowProc (int hwnd, int msg, int wParam, int lParam) {
247
int callWindowProc (int hwnd, int msg, int wParam, int lParam) {
190
	return callWindowProc (hwnd, msg, wParam, lParam, false);
248
	return callWindowProc (hwnd, msg, wParam, lParam, false);
191
}
249
}
Lines 2691-2696 Link Here
2691
}
2749
}
2692
2750
2693
/**
2751
/**
2752
 * Removes the listener from the collection of listeners who will
2753
 * be notified when data is set.
2754
 *
2755
 * @param listener the listener which should no longer be notified
2756
 *
2757
 * @exception IllegalArgumentException <ul>
2758
 *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
2759
 * </ul>
2760
 * @exception SWTException <ul>
2761
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
2762
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
2763
 * </ul>
2764
 *
2765
 * @see SetDataListener
2766
 * @see #addSetDataListener(SetDataListener)
2767
 */
2768
public void removeSetDataListener(SetDataListener listener) {
2769
	checkWidget ();
2770
	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
2771
	if (eventTable == null) return;
2772
	eventTable.unhook (SWT.SetData, listener);
2773
}
2774
2775
/**
2776
 * Removes the listener from the collection of listeners who will
2777
 * be notified when items change.
2778
 *
2779
 * @param listener the listener which should no longer be notified
2780
 *
2781
 * @exception IllegalArgumentException <ul>
2782
 *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
2783
 * </ul>
2784
 * @exception SWTException <ul>
2785
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
2786
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
2787
 * </ul>
2788
 *
2789
 * @see ItemListener
2790
 * @see #addItemListener(ItemListener)
2791
 */
2792
public void removeItemListener(ItemListener listener) {
2793
	checkWidget ();
2794
	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
2795
	if (eventTable == null) return;
2796
	eventTable.unhook (SWT.MeasureItem, listener);
2797
	eventTable.unhook (SWT.EraseItem, listener);
2798
	eventTable.unhook (SWT.PaintItem, listener);
2799
}
2800
2801
/**
2694
 * Selects the items at the given zero-relative indices in the receiver.
2802
 * Selects the items at the given zero-relative indices in the receiver.
2695
 * The current selection is not cleared before the new items are selected.
2803
 * The current selection is not cleared before the new items are selected.
2696
 * <p>
2804
 * <p>
(-)Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java (-1 / +155 lines)
Lines 14-19 Link Here
14
import org.eclipse.swt.internal.*;
14
import org.eclipse.swt.internal.*;
15
import org.eclipse.swt.internal.win32.*;
15
import org.eclipse.swt.internal.win32.*;
16
import org.eclipse.swt.*;
16
import org.eclipse.swt.*;
17
import org.eclipse.swt.events.CloseListener;
18
import org.eclipse.swt.events.DisposeListener;
19
import org.eclipse.swt.events.SettingsListener;
17
import org.eclipse.swt.graphics.*;
20
import org.eclipse.swt.graphics.*;
18
21
19
/**
22
/**
Lines 79-85 Link Here
79
 * <dt><b>Styles:</b></dt>
82
 * <dt><b>Styles:</b></dt>
80
 * <dd>(none)</dd>
83
 * <dd>(none)</dd>
81
 * <dt><b>Events:</b></dt>
84
 * <dt><b>Events:</b></dt>
82
 * <dd>Close, Dispose</dd>
85
 * <dd>Close, Dispose, Settings</dd>
83
 * </dl>
86
 * </dl>
84
 * <p>
87
 * <p>
85
 * IMPORTANT: This class is <em>not</em> intended to be subclassed.
88
 * IMPORTANT: This class is <em>not</em> intended to be subclassed.
Lines 546-551 Link Here
546
	eventTable.hook (eventType, listener);
549
	eventTable.hook (eventType, listener);
547
}
550
}
548
551
552
/**
553
 * Adds the listener to the collection of listeners who will
554
 * be notified when the widget is disposed. When the widget is
555
 * disposed, the listener is notified by sending it the
556
 * <code>widgetDisposed()</code> message.
557
 *
558
 * @param listener the listener which should be notified when the receiver is disposed
559
 *
560
 * @exception IllegalArgumentException <ul>
561
 *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
562
 * </ul>
563
 * @exception SWTException <ul>
564
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
565
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
566
 * </ul>
567
 *
568
 * @see DisposeListener
569
 * @see #removeDisposeListener
570
 */
571
public void addDisposeListener (DisposeListener listener) {
572
	checkDevice();
573
	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
574
	TypedListener typedListener = new TypedListener (listener);
575
	addListener (SWT.Dispose, typedListener);
576
}
577
578
/**
579
 * Adds the listener to the collection of listeners who will
580
 * be notified when appearance settings, such as theme, font, or
581
 * default colors are changed for the desktop. When the settings
582
 * are changed, the listener is notified by sending it the
583
 * <code>settingsChanged()</code> message.
584
 *
585
 * @param listener the listener which should be notified when the receiver is disposed
586
 *
587
 * @exception IllegalArgumentException <ul>
588
 *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
589
 * </ul>
590
 * @exception SWTException <ul>
591
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
592
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
593
 * </ul>
594
 *
595
 * @see SettingsListener
596
 * @see #removeSettingsListener
597
 */
598
public void addSettingsListener (SettingsListener listener) {
599
	checkDevice();
600
	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
601
	TypedListener typedListener = new TypedListener (listener);
602
	addListener (SWT.Settings, typedListener);
603
}
604
605
/**
606
 * Adds the listener to the collection of listeners who will
607
 * be notified when the display is closed, by sending the
608
 * listener one of the messages defined in the
609
 * <code>CloseListener</code> interface.
610
 *
611
 * @param listener the listener which should be notified
612
 *
613
 * @exception IllegalArgumentException <ul>
614
 *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
615
 * </ul>
616
 * @exception SWTException <ul>
617
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
618
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
619
 * </ul>
620
 *
621
 * @see CloseListener
622
 * @see #removeCloseListener
623
 */
624
public void addCloseListener (CloseListener listener) {
625
	checkDevice();
626
	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
627
	TypedListener typedListener = new TypedListener (listener);
628
	addListener (SWT.Close, typedListener);
629
}
630
549
void addMenuItem (MenuItem item) {
631
void addMenuItem (MenuItem item) {
550
	if (items == null) items = new MenuItem [64];
632
	if (items == null) items = new MenuItem [64];
551
	for (int i=0; i<items.length; i++) {
633
	for (int i=0; i<items.length; i++) {
Lines 3389-3394 Link Here
3389
	eventTable.unhook (eventType, listener);
3471
	eventTable.unhook (eventType, listener);
3390
}
3472
}
3391
3473
3474
/**
3475
 * Removes the listener from the collection of listeners who will
3476
 * be notified when the widget is disposed.
3477
 *
3478
 * @param listener the listener which should no longer be notified when the receiver is disposed
3479
 *
3480
 * @exception IllegalArgumentException <ul>
3481
 *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
3482
 * </ul>
3483
 * @exception SWTException <ul>
3484
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
3485
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
3486
 * </ul>
3487
 *
3488
 * @see DisposeListener
3489
 * @see #addDisposeListener
3490
 */
3491
public void removeDisposeListener (DisposeListener listener) {
3492
	checkDevice();
3493
	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
3494
	if (eventTable == null) return;
3495
	eventTable.unhook (SWT.Dispose, listener);
3496
}
3497
3498
/**
3499
 * Removes the listener from the collection of listeners who will
3500
 * be notified when appearance settings are changed.
3501
 *
3502
 * @param listener the listener which should no longer be notified when settings are changed
3503
 *
3504
 * @exception IllegalArgumentException <ul>
3505
 *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
3506
 * </ul>
3507
 * @exception SWTException <ul>
3508
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
3509
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
3510
 * </ul>
3511
 *
3512
 * @see SettingsListener
3513
 * @see #addSettingsListener
3514
 */
3515
public void removeSettingsListener (SettingsListener listener) {
3516
	checkDevice();
3517
	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
3518
	if (eventTable == null) return;
3519
	eventTable.unhook (SWT.Settings, listener);
3520
}
3521
3522
/**
3523
 * Removes the listener from the collection of listeners who will
3524
 * be notified when the display is closed.
3525
 *
3526
 * @param listener the listener which should no longer be notified when settings are changed
3527
 *
3528
 * @exception IllegalArgumentException <ul>
3529
 *    <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
3530
 * </ul>
3531
 * @exception SWTException <ul>
3532
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
3533
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
3534
 * </ul>
3535
 *
3536
 * @see CloseListener
3537
 * @see #addCloseListener
3538
 */
3539
public void removeCloseListener (CloseListener listener) {
3540
	checkDevice();
3541
	if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
3542
	if (eventTable == null) return;
3543
	eventTable.unhook (SWT.Close, listener);
3544
}
3545
3392
void removeBar (Menu menu) {
3546
void removeBar (Menu menu) {
3393
	if (bars == null) return;
3547
	if (bars == null) return;
3394
	for (int i=0; i<bars.length; i++) {
3548
	for (int i=0; i<bars.length; i++) {
(-)Eclipse (+38 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.swt.events;
12
13
14
import org.eclipse.swt.internal.SWTEventListener;
15
16
/**
17
 * Classes which implement this interface provide a method
18
 * that deals with the event that is generated when a widget
19
 * is closed.
20
 * <p>
21
 * After creating an instance of a class that implements
22
 * this interface it can be added to a widget using the
23
 * <code>addCloseListener</code> method and removed using
24
 * the <code>removeCloseListener</code> method. When the
25
 * widget is closed, the widgetClosed method will be invoked.
26
 * </p>
27
 *
28
 * @see CloseEvent
29
 */
30
public interface CloseListener extends SWTEventListener {
31
32
/**
33
 * Sent when a widget is closed.
34
 *
35
 * @param e an event containing information about the close
36
 */
37
public void widgetClosed(CloseEvent e);
38
}
(-)Eclipse (+37 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.swt.events;
12
13
14
import org.eclipse.swt.widgets.Event;
15
16
/**
17
 * Instances of this class are sent as a result of
18
 * display being closed.
19
 *
20
 * @see CloseListener
21
 */
22
 
23
public final class CloseEvent extends TypedEvent {
24
25
	static final long serialVersionUID = 128479775059453532L;
26
27
/**
28
 * Constructs a new instance of this class based on the
29
 * information in the given untyped event.
30
 *
31
 * @param e the untyped event containing the information
32
 */
33
public CloseEvent(Event e) {
34
	super(e);
35
}
36
37
}
(-)Eclipse (+53 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.swt.events;
12
13
14
import org.eclipse.swt.internal.SWTEventListener;
15
16
/**
17
 * Classes which implement this interface provide methods
18
 * that deal with the events that are generated when cells
19
 * are custom drawn.
20
 * <p>
21
 * After creating an instance of a class that implements
22
 * this interface it can be added to a control using the
23
 * <code>addItemListener</code> method and removed using
24
 * the <code>removeItemListener</code> method. When the cells
25
 * are custom drawn, the appropriate method will be invoked.
26
 * </p>
27
 *
28
 * @see ItemAdapter
29
 * @see ItemEvent
30
 */
31
public interface ItemListener extends SWTEventListener {
32
33
/**
34
 * Sent just before the background of a cell is about to be drawn.
35
 *
36
 * @param e an event containing information about the
37
 */
38
public void itemMeasured(ItemEvent e);
39
40
/**
41
 * Sent when the size of a cell's content is needed.
42
 *
43
 * @param e an event containing information about the 
44
 */
45
public void itemErased(ItemEvent e);
46
47
/**
48
 * Sent just after the cell's default foreground contents have been drawn.
49
 *
50
 * @param e an event containing information about the 
51
 */
52
public void itemPainted(ItemEvent e);
53
}
(-)Eclipse (+37 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.swt.events;
12
13
14
import org.eclipse.swt.widgets.Event;
15
16
/**
17
 * Instances of this class are sent as a result of
18
 * appearance settings of a display being changed.
19
 *
20
 * @see SettingsListener
21
 */
22
23
public final class SettingsEvent extends TypedEvent {
24
25
	static final long serialVersionUID = 2378826870814461521L;
26
27
/**
28
 * Constructs a new instance of this class based on the
29
 * information in the given untyped event.
30
 *
31
 * @param e the untyped event containing the information
32
 */
33
public SettingsEvent(Event e) {
34
	super(e);
35
}
36
37
}
(-)Eclipse (+35 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.swt.events;
12
13
14
import org.eclipse.swt.internal.SWTEventListener;
15
16
/**
17
 * Classes which implement this interface provide a method
18
 * that deals with the event that is generated as the mouse
19
 * wheel is scrolled.
20
 * <p>
21
 * After creating an instance of a class that implements
22
 * this interface it can be added to a control using the
23
 * <code>addMouseListener</code> method and removed using
24
 * the <code>removeMouseListener</code> method. When a
25
 * mouse button is pressed or released, the appropriate method
26
 * will be invoked.
27
 * </p>
28
 *
29
 * @see MouseAdapter
30
 * @see MouseEvent
31
 */
32
public interface MouseWheelListener extends SWTEventListener {
33
34
public void mouseWheeled(MouseWheelEvent e);	
35
}
(-)Eclipse (+34 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.swt.events;
12
13
14
import org.eclipse.swt.widgets.Event;
15
16
/**
17
 * Instances of this class are sent as a result of
18
 * a context (pop-up) menu being detected.
19
 *
20
 * @see MenuDetectListener
21
 */
22
23
public final class MenuDetectEvent extends TypedEvent {
24
25
	/**
26
	 * 
27
	 */
28
	private static final long serialVersionUID = -3061660596590828941L;
29
30
	public MenuDetectEvent(Event e) {
31
		super(e);
32
	}
33
34
}
(-)Eclipse (+39 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.swt.events;
12
13
14
import org.eclipse.swt.internal.SWTEventListener;
15
16
/**
17
 * Classes which implement this interface provide methods
18
 * that deal with the events that are generated when dragging
19
 * is detected.
20
 * <p>
21
 * After creating an instance of a class that implements
22
 * this interface it can be added to a control using the
23
 * <code>addDragDetectListener</code> method and removed using
24
 * the <code>removeDragDetectListener</code> method. When the
25
 * drag is detected, the drageDetected method will be invoked.
26
 * </p>
27
 *
28
 * @see DragDetectEvent
29
 *
30
 */
31
public interface DragDetectListener extends SWTEventListener {
32
33
/**
34
 * Sent when drag is detected.
35
 *
36
 * @param e an event containing information about the drag
37
 */
38
public void dragDetected(DragDetectEvent e);
39
}
(-)Eclipse (+54 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.swt.events;
12
13
14
/**
15
 * This adapter class provides default implementations for the
16
 * methods described by the <code>ItemListener</code> interface.
17
 * <p>
18
 * Classes that wish to deal with <code>ItemEvent</code>s can
19
 * extend this class and override only the methods which they are
20
 * interested in.
21
 * </p>
22
 *
23
 * @see ItemListener
24
 * @see ItemEvent
25
 */
26
public abstract class ItemAdapter implements ItemListener {
27
28
/**
29
 * Sent just before the background of a cell is about to be drawn.
30
 * The default behavior is to do nothing.
31
 *
32
 * @param e an event containing information about the selection
33
 */
34
public void itemErased(ItemEvent e) {
35
}
36
37
/**
38
 * Sent when the size of a cell's content is needed.
39
 * The default behavior is to do nothing.
40
 *
41
 * @param e an event containing information about the selection
42
 */
43
public void itemMeasured(ItemEvent e) {
44
}
45
46
/**
47
 * Sent just after the cell's default foreground contents have been drawn.
48
 * The default behavior is to do nothing.
49
 *
50
 * @param e an event containing information about the selection
51
 */
52
public void itemPainted(ItemEvent e) {
53
}
54
}
(-)Eclipse (+37 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.swt.events;
12
13
14
import org.eclipse.swt.widgets.Event;
15
16
/**
17
 * Instances of this class are sent as a result of
18
 * data being set.
19
 *
20
 * @see SetDataListener
21
 */
22
23
public final class SetDataEvent extends TypedEvent {
24
25
	private static final long serialVersionUID = -7777426631952432666L;
26
27
/**
28
 * Constructs a new instance of this class based on the
29
 * information in the given untyped event.
30
 *
31
 * @param e the untyped event containing the information
32
 */
33
public SetDataEvent(Event e) {
34
	super(e);
35
}
36
37
}
(-)Eclipse (+38 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.swt.events;
12
13
14
import org.eclipse.swt.internal.SWTEventListener;
15
16
/**
17
 * Classes which implement this interface provide methods
18
 * that deal with the events that are generated when data is set.
19
 * <p>
20
 * After creating an instance of a class that implements
21
 * this interface it can be added to a control using the
22
 * <code>addSetDataListener</code> method and removed using
23
 * the <code>removeSetDataListener</code> method. When the
24
 * data is set, the dataSet method will be invoked.
25
 * </p>
26
 *
27
 * @see SetDataEvent
28
 *
29
 */
30
public interface SetDataListener extends SWTEventListener {
31
32
/**
33
 * Sent when the data is set.
34
 *
35
 * @param e an event containing information about the set
36
 */
37
public void dataSet(SetDataEvent e);
38
}
(-)Eclipse (+78 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.swt.events;
12
13
import org.eclipse.swt.widgets.Event;
14
15
public final class DragDetectEvent extends TypedEvent {
16
17
	/**
18
	 * 
19
	 */
20
	public int button;
21
	
22
	/**
23
	 * 
24
	 */
25
	public int x;
26
	
27
	/**
28
	 * 
29
	 */
30
	public int y;
31
	
32
	/**
33
	 * The state of the keyboard modifier keys at the time
34
	 * the event was generated.
35
	 */
36
	public int stateMask;
37
	
38
	/**
39
	 * A flag indicating whether the operation should be allowed.
40
	 * Setting this field to <code>false</code> will cancel the
41
	 * operation, depending on the widget.
42
	 */
43
	public boolean doit;
44
	
45
	private static final long serialVersionUID = -7229172519733647232L;
46
47
/**
48
 * Constructs a new instance of this class based on the
49
 * information in the given untyped event.
50
 *
51
 * @param e the untyped event containing the information
52
 */
53
public DragDetectEvent(Event e) {
54
	super(e);
55
	this.button = e.button;
56
	this.x = e.x;
57
	this.y = e.y;
58
	this.stateMask = e.stateMask;
59
	this.doit = e.doit;
60
}
61
62
/**
63
 * Returns a string containing a concise, human-readable
64
 * description of the receiver.
65
 *
66
 * @return a string representation of the event
67
 */
68
public String toString() {
69
	String string = super.toString ();
70
	return string.substring (0, string.length() - 1) // remove trailing '}'
71
		+ " button=" + button
72
		+ " x=" + x
73
		+ " y=" + y
74
		+ " stateMask=" + stateMask
75
		+ " doit=" + doit
76
		+ "}";
77
}
78
}
(-)Eclipse (+34 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.swt.events;
12
13
14
import org.eclipse.swt.internal.SWTEventListener;
15
16
/**
17
 * Classes which implement this interface provide methods
18
 * that deal with the events that are generated when a context
19
 * (pop-up) menu is detected.
20
 * <p>
21
 * After creating an instance of a class that implements
22
 * this interface it can be added to a control using the
23
 * <code>addMenuDetectListener</code> method and removed using
24
 * the <code>removeMenuDetectListener</code> method. When the
25
 * data is set, the dataSet method will be invoked.
26
 * </p>
27
 *
28
 * @see MenuDetectEvent
29
 *
30
 */
31
public interface MenuDetectListener extends SWTEventListener {
32
33
public void menuDetected(MenuDetectEvent e);
34
}
(-)Eclipse (+26 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.swt.events;
12
13
import org.eclipse.swt.widgets.Event;
14
15
public final class MouseWheelEvent extends TypedEvent {
16
17
	/**
18
	 * 
19
	 */
20
	private static final long serialVersionUID = 5586414311162923003L;
21
22
	public MouseWheelEvent(Event e) {
23
		super(e);
24
	}
25
26
}
(-)Eclipse (+38 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.swt.events;
12
13
14
import org.eclipse.swt.internal.SWTEventListener;
15
16
/**
17
 * Classes which implement this interface provide a method
18
 * that deals with the event that is generated when appearance
19
 * settings are changed on a display.
20
 * <p>
21
 * After creating an instance of a class that implements
22
 * this interface it can be added to a control using the
23
 * <code>addSettingsListener</code> method and removed using
24
 * the <code>removeSettingsListener</code> method. When settings
25
 * are changed, the settingsChanged method will be invoked.
26
 * </p>
27
 *
28
 * @see SettingsEvent
29
 */
30
public interface SettingsListener extends SWTEventListener {
31
32
/**
33
 * Sent when appearance settings are changed on a display.
34
 *
35
 * @param e an event containing information about the change
36
 */
37
public void settingsChanged(SettingsEvent e);
38
}
(-)Eclipse (+117 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.swt.events;
12
13
14
import org.eclipse.swt.widgets.*;
15
import org.eclipse.swt.graphics.GC;
16
17
/**
18
 * Instances of this class are sent as a result of
19
 * cells being custom drawn.
20
 *
21
 * @see ItemListener
22
 */
23
24
public final class ItemEvent extends TypedEvent {
25
	
26
	/**
27
	 * The item being custom drawn.
28
	 */
29
	public Widget item;
30
	
31
	/**
32
	 * the graphics context to use when painting
33
	 * that is configured to use the colors, font and
34
	 * damaged region of the control.  It is valid
35
	 * only during the paint and must not be disposed
36
	 */
37
	public GC gc;
38
	
39
	/**
40
	 * 
41
	 */
42
	public int x;
43
	
44
	/**
45
	 * 
46
	 */
47
	public int y;
48
	
49
	/**
50
	 * 
51
	 */
52
	public int width;
53
	
54
	/**
55
	 * 
56
	 */
57
	public int height;
58
	
59
	/**
60
	 * 
61
	 */
62
	public int index;
63
	
64
	/**
65
	 * Extra detail information
66
	 */
67
	public int detail;
68
	
69
	/**
70
	 * 
71
	 */
72
	public boolean doit;
73
74
	
75
	
76
	static final long serialVersionUID = 8699558427065873648L;
77
	
78
/**
79
 * Constructs a new instance of this class based on the
80
 * information in the given untyped event.
81
 *
82
 * @param e the untyped event containing the information
83
 */
84
public ItemEvent(Event e) {
85
	super(e);
86
	this.item = e.item;
87
	this.gc = e.gc;
88
	this.x = e.x;
89
	this.y = e.y;
90
	this.width = e.width;
91
	this.height = e.height;
92
	this.index = e.index;
93
	this.detail = e.detail;
94
	this.doit = e.doit;
95
}
96
97
/**
98
 * Returns a string containing a concise, human-readable
99
 * description of the receiver.
100
 *
101
 * @return a string representation of the event
102
 */
103
public String toString() {
104
	String string = super.toString ();
105
	return string.substring (0, string.length() - 1) // remove trailing '}'
106
		+ " item=" + item
107
		+ " gc=" + gc
108
		+ " x=" + x
109
		+ " y=" + y
110
		+ " width=" + width
111
		+ " height=" + height
112
		+ " index=" + index
113
		+ " detail=" + detail
114
		+ " doit=" + doit
115
		+ "}";
116
}
117
}

Return to bug 81334