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

Collapse All | Expand All

(-)Eclipse SWT PI/win32/library/os_structs.h (+12 lines)
Lines 1427-1432 Link Here
1427
#define TOOLINFO_sizeof() 0
1427
#define TOOLINFO_sizeof() 0
1428
#endif
1428
#endif
1429
1429
1430
#ifndef NO_TPMPARAMS
1431
void cacheTPMPARAMSFields(JNIEnv *env, jobject lpObject);
1432
TPMPARAMS *getTPMPARAMSFields(JNIEnv *env, jobject lpObject, TPMPARAMS *lpStruct);
1433
void setTPMPARAMSFields(JNIEnv *env, jobject lpObject, TPMPARAMS *lpStruct);
1434
#define TPMPARAMS_sizeof() sizeof(TPMPARAMS)
1435
#else
1436
#define cacheTPMPARAMSFields(a,b)
1437
#define getTPMPARAMSFields(a,b,c) NULL
1438
#define setTPMPARAMSFields(a,b,c)
1439
#define TPMPARAMS_sizeof() 0
1440
#endif
1441
1430
#ifndef NO_TRACKMOUSEEVENT
1442
#ifndef NO_TRACKMOUSEEVENT
1431
void cacheTRACKMOUSEEVENTFields(JNIEnv *env, jobject lpObject);
1443
void cacheTRACKMOUSEEVENTFields(JNIEnv *env, jobject lpObject);
1432
TRACKMOUSEEVENT *getTRACKMOUSEEVENTFields(JNIEnv *env, jobject lpObject, TRACKMOUSEEVENT *lpStruct);
1444
TRACKMOUSEEVENT *getTRACKMOUSEEVENTFields(JNIEnv *env, jobject lpObject, TRACKMOUSEEVENT *lpStruct);
(-)Eclipse SWT PI/win32/library/os_stats.h (+1 lines)
Lines 866-871 Link Here
866
	ToUnicode_FUNC,
866
	ToUnicode_FUNC,
867
	TrackMouseEvent_FUNC,
867
	TrackMouseEvent_FUNC,
868
	TrackPopupMenu_FUNC,
868
	TrackPopupMenu_FUNC,
869
	TrackPopupMenuEx_FUNC,
869
	TranslateAcceleratorA_FUNC,
870
	TranslateAcceleratorA_FUNC,
870
	TranslateAcceleratorW_FUNC,
871
	TranslateAcceleratorW_FUNC,
871
	TranslateCharsetInfo_FUNC,
872
	TranslateCharsetInfo_FUNC,
(-)Eclipse SWT PI/win32/library/os_structs.c (+43 lines)
Lines 6523-6528 Link Here
6523
}
6523
}
6524
#endif
6524
#endif
6525
6525
6526
#ifndef NO_TPMPARAMS
6527
typedef struct TPMPARAMS_FID_CACHE {
6528
	int cached;
6529
	jclass clazz;
6530
	jfieldID cbSize, left, top, right, bottom;
6531
} TPMPARAMS_FID_CACHE;
6532
6533
TPMPARAMS_FID_CACHE TPMPARAMSFc;
6534
6535
void cacheTPMPARAMSFields(JNIEnv *env, jobject lpObject)
6536
{
6537
	if (TPMPARAMSFc.cached) return;
6538
	TPMPARAMSFc.clazz = (*env)->GetObjectClass(env, lpObject);
6539
	TPMPARAMSFc.cbSize = (*env)->GetFieldID(env, TPMPARAMSFc.clazz, "cbSize", "I");
6540
	TPMPARAMSFc.left = (*env)->GetFieldID(env, TPMPARAMSFc.clazz, "left", "I");
6541
	TPMPARAMSFc.top = (*env)->GetFieldID(env, TPMPARAMSFc.clazz, "top", "I");
6542
	TPMPARAMSFc.right = (*env)->GetFieldID(env, TPMPARAMSFc.clazz, "right", "I");
6543
	TPMPARAMSFc.bottom = (*env)->GetFieldID(env, TPMPARAMSFc.clazz, "bottom", "I");
6544
	TPMPARAMSFc.cached = 1;
6545
}
6546
6547
TPMPARAMS *getTPMPARAMSFields(JNIEnv *env, jobject lpObject, TPMPARAMS *lpStruct)
6548
{
6549
	if (!TPMPARAMSFc.cached) cacheTPMPARAMSFields(env, lpObject);
6550
	lpStruct->cbSize = (*env)->GetIntField(env, lpObject, TPMPARAMSFc.cbSize);
6551
	lpStruct->rcExclude.left = (*env)->GetIntField(env, lpObject, TPMPARAMSFc.left);
6552
	lpStruct->rcExclude.top = (*env)->GetIntField(env, lpObject, TPMPARAMSFc.top);
6553
	lpStruct->rcExclude.right = (*env)->GetIntField(env, lpObject, TPMPARAMSFc.right);
6554
	lpStruct->rcExclude.bottom = (*env)->GetIntField(env, lpObject, TPMPARAMSFc.bottom);
6555
	return lpStruct;
6556
}
6557
6558
void setTPMPARAMSFields(JNIEnv *env, jobject lpObject, TPMPARAMS *lpStruct)
6559
{
6560
	if (!TPMPARAMSFc.cached) cacheTPMPARAMSFields(env, lpObject);
6561
	(*env)->SetIntField(env, lpObject, TPMPARAMSFc.cbSize, (jint)lpStruct->cbSize);
6562
	(*env)->SetIntField(env, lpObject, TPMPARAMSFc.left, (jint)lpStruct->rcExclude.left);
6563
	(*env)->SetIntField(env, lpObject, TPMPARAMSFc.top, (jint)lpStruct->rcExclude.top);
6564
	(*env)->SetIntField(env, lpObject, TPMPARAMSFc.right, (jint)lpStruct->rcExclude.right);
6565
	(*env)->SetIntField(env, lpObject, TPMPARAMSFc.bottom, (jint)lpStruct->rcExclude.bottom);
6566
}
6567
#endif
6568
6526
#ifndef NO_TRACKMOUSEEVENT
6569
#ifndef NO_TRACKMOUSEEVENT
6527
typedef struct TRACKMOUSEEVENT_FID_CACHE {
6570
typedef struct TRACKMOUSEEVENT_FID_CACHE {
6528
	int cached;
6571
	int cached;
(-)Eclipse SWT PI/win32/library/os_stats.c (-2 / +3 lines)
Lines 14-21 Link Here
14
14
15
#ifdef NATIVE_STATS
15
#ifdef NATIVE_STATS
16
16
17
int OS_nativeFunctionCount = 873;
17
int OS_nativeFunctionCount = 874;
18
int OS_nativeFunctionCallCount[873];
18
int OS_nativeFunctionCallCount[874];
19
char * OS_nativeFunctionNames[] = {
19
char * OS_nativeFunctionNames[] = {
20
	"ACCEL_1sizeof",
20
	"ACCEL_1sizeof",
21
	"ACTCTX_1sizeof",
21
	"ACTCTX_1sizeof",
Lines 858-863 Link Here
858
	"ToUnicode",
858
	"ToUnicode",
859
	"TrackMouseEvent",
859
	"TrackMouseEvent",
860
	"TrackPopupMenu",
860
	"TrackPopupMenu",
861
	"TrackPopupMenuEx",
861
	"TranslateAcceleratorA",
862
	"TranslateAcceleratorA",
862
	"TranslateAcceleratorW",
863
	"TranslateAcceleratorW",
863
	"TranslateCharsetInfo",
864
	"TranslateCharsetInfo",
(-)Eclipse SWT PI/win32/library/os.c (+28 lines)
Lines 13396-13401 Link Here
13396
}
13396
}
13397
#endif
13397
#endif
13398
13398
13399
#ifndef NO_TPMPARAMS_1sizeof
13400
JNIEXPORT jint JNICALL OS_NATIVE(TPMPARAMS_1sizeof)
13401
	(JNIEnv *env, jclass that)
13402
{
13403
	jint rc = 0;
13404
	OS_NATIVE_ENTER(env, that, TPMPARAMS_1sizeof_FUNC);
13405
	rc = (jint)TPMPARAMS_sizeof();
13406
	OS_NATIVE_EXIT(env, that, TPMPARAMS_1sizeof_FUNC);
13407
	return rc;
13408
}
13409
#endif
13410
13399
#ifndef NO_TRACKMOUSEEVENT_1sizeof
13411
#ifndef NO_TRACKMOUSEEVENT_1sizeof
13400
JNIEXPORT jint JNICALL OS_NATIVE(TRACKMOUSEEVENT_1sizeof)
13412
JNIEXPORT jint JNICALL OS_NATIVE(TRACKMOUSEEVENT_1sizeof)
13401
	(JNIEnv *env, jclass that)
13413
	(JNIEnv *env, jclass that)
Lines 13550-13555 Link Here
13550
}
13562
}
13551
#endif
13563
#endif
13552
13564
13565
#ifndef NO_TrackPopupMenuEx
13566
JNIEXPORT jboolean JNICALL OS_NATIVE(TrackPopupMenuEx)
13567
	(JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jobject arg5)
13568
{
13569
	TPMPARAMS _arg5, *lparg5=NULL;
13570
	jboolean rc = 0;
13571
	OS_NATIVE_ENTER(env, that, TrackPopupMenuEx_FUNC);
13572
	if (arg5) if ((lparg5 = getTPMPARAMSFields(env, arg5, &_arg5)) == NULL) goto fail;
13573
	rc = (jboolean)TrackPopupMenuEx(arg0, arg1, arg2, arg3, arg4, lparg5);
13574
fail:
13575
	if (arg5 && lparg5) setTPMPARAMSFields(env, arg5, lparg5);
13576
	OS_NATIVE_EXIT(env, that, TrackPopupMenuEx_FUNC);
13577
	return rc;
13578
}
13579
#endif
13580
13553
#ifndef NO_TranslateAcceleratorA
13581
#ifndef NO_TranslateAcceleratorA
13554
JNIEXPORT jint JNICALL OS_NATIVE(TranslateAcceleratorA)
13582
JNIEXPORT jint JNICALL OS_NATIVE(TranslateAcceleratorA)
13555
	(JNIEnv *env, jclass that, jint arg0, jint arg1, jobject arg2)
13583
	(JNIEnv *env, jclass that, jint arg0, jint arg1, jobject arg2)
(-)Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java (-1 / +51 lines)
Lines 38-43 Link Here
38
	ToolBar parent;
38
	ToolBar parent;
39
	Control control;
39
	Control control;
40
	Image hotImage, disabledImage;
40
	Image hotImage, disabledImage;
41
	Menu dropDownMenu;
41
	String toolTipText;
42
	String toolTipText;
42
	boolean drawHotImage;
43
	boolean drawHotImage;
43
44
Lines 360-365 Link Here
360
}
361
}
361
362
362
/**
363
/**
364
 * Returns the receiver's drop-down menu if it has one, or null 
365
 * if it does not.
366
 * <p>
367
 * The drop-down menu is activated when the arrow of an {@link SWT#DROP_DOWN}-styled receiver is pressed.
368
 * </p>
369
 * 
370
 * @return the receiver's drop-down menu
371
 * @exception SWTException <ul>
372
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
373
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
374
 * </ul>
375
 */
376
public Menu getDropDownMenu () {
377
	checkWidget();
378
	return dropDownMenu;
379
}
380
381
/**
363
 * Returns <code>true</code> if the receiver is enabled, and
382
 * Returns <code>true</code> if the receiver is enabled, and
364
 * <code>false</code> otherwise. A disabled control is typically
383
 * <code>false</code> otherwise. A disabled control is typically
365
 * not selectable from the user interface and draws with an
384
 * not selectable from the user interface and draws with an
Lines 534-540 Link Here
534
			selectRadio ();
553
			selectRadio ();
535
		}
554
		}
536
	}
555
	}
537
	postEvent (SWT.Selection, event);
556
	if (event.detail == SWT.ARROW) {
557
		sendEvent (SWT.Selection, event);
558
		if (event.doit) {
559
			ToolItemHelper.showDropDownMenu (this);
560
		}
561
	} else {
562
		postEvent (SWT.Selection, event);
563
	}
538
	return 0;
564
	return 0;
539
}
565
}
540
566
Lines 788-793 Link Here
788
}
814
}
789
815
790
/**
816
/**
817
 * Sets the receiver's drop-down menu to the argument, which may be 
818
 * null indicating that no drop-down menu should be displayed.
819
 * <p>
820
 * If this property is null a drop-down menu can still be displayed manually by adding a
821
 * {@link SelectionListener} to the receiver and handling{@link SWT#ARROW} events.
822
 * <p>
823
 * The drop-down menu is activated when the arrow of an {@link SWT#DROP_DOWN}-styled receiver is pressed.
824
 * Attempts to set a drop-dwn menu for a receiver that does not have the {@link SWT#DROP_DOWN}
825
 * style are ignored.
826
 * </p>
827
 * 
828
 * @param menu the drop-down menu to be displayed when the receiver's arrow is pressed
829
 * @exception SWTException <ul>
830
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
831
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
832
 * </ul>
833
 */
834
public void setDropDownMenu (Menu menu) {
835
	checkWidget();
836
	if ((style & SWT.DROP_DOWN) == 0) return;
837
	dropDownMenu = menu;
838
}
839
840
/**
791
 * Enables the receiver if the argument is <code>true</code>,
841
 * Enables the receiver if the argument is <code>true</code>,
792
 * and disables it otherwise.
842
 * and disables it otherwise.
793
 * <p>
843
 * <p>
(-)Eclipse SWT/photon/org/eclipse/swt/widgets/ToolItem.java (-1 / +48 lines)
Lines 39-44 Link Here
39
	String toolTipText;
39
	String toolTipText;
40
	int toolTipHandle;
40
	int toolTipHandle;
41
	Image hotImage, disabledImage;
41
	Image hotImage, disabledImage;
42
	Menu dropDownMenu;
42
	int button, arrow;
43
	int button, arrow;
43
44
44
/**
45
/**
Lines 349-354 Link Here
349
}
350
}
350
351
351
/**
352
/**
353
 * Returns the receiver's drop-down menu if it has one, or null 
354
 * if it does not.
355
 * <p>
356
 * The drop-down menu is activated when the arrow of an {@link SWT#DROP_DOWN}-styled receiver is pressed.
357
 * </p>
358
 * 
359
 * @return the receiver's drop-down menu
360
 * @exception SWTException <ul>
361
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
362
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
363
 * </ul>
364
 */
365
public Menu getDropDownMenu () {
366
	checkWidget();
367
	return dropDownMenu;
368
}
369
370
/**
352
 * Returns <code>true</code> if the receiver is enabled, and
371
 * Returns <code>true</code> if the receiver is enabled, and
353
 * <code>false</code> otherwise. A disabled control is typically
372
 * <code>false</code> otherwise. A disabled control is typically
354
 * not selectable from the user interface and draws with an
373
 * not selectable from the user interface and draws with an
Lines 534-547 Link Here
534
		OS.PtWidgetArea (topHandle, area);
553
		OS.PtWidgetArea (topHandle, area);
535
		event.x = area.pos_x;
554
		event.x = area.pos_x;
536
		event.y = area.pos_y + area.size_h;
555
		event.y = area.pos_y + area.size_h;
556
		sendEvent (SWT.Selection, event);
557
		if (event.doit) {
558
			ToolItemHelper.showDropDownMenu(this);
559
		}
537
	} else {
560
	} else {
538
		if ((style & SWT.RADIO) != 0) {
561
		if ((style & SWT.RADIO) != 0) {
539
			if ((parent.getStyle () & SWT.NO_RADIO_GROUP) == 0) {
562
			if ((parent.getStyle () & SWT.NO_RADIO_GROUP) == 0) {
540
				selectRadio ();
563
				selectRadio ();
541
			}
564
			}
542
		}
565
		}
566
		postEvent (SWT.Selection, event);
543
	}
567
	}
544
	postEvent (SWT.Selection, event);
545
	return OS.Pt_CONTINUE;
568
	return OS.Pt_CONTINUE;
546
}
569
}
547
570
Lines 683-688 Link Here
683
}
706
}
684
707
685
/**
708
/**
709
 * Sets the receiver's drop-down menu to the argument, which may be 
710
 * null indicating that no drop-down menu should be displayed.
711
 * <p>
712
 * If this property is null a drop-down menu can still be displayed manually by adding a
713
 * {@link SelectionListener} to the receiver and handling{@link SWT#ARROW} events.
714
 * <p>
715
 * The drop-down menu is activated when the arrow of an {@link SWT#DROP_DOWN}-styled receiver is pressed.
716
 * Attempts to set a drop-dwn menu for a receiver that does not have the {@link SWT#DROP_DOWN}
717
 * style are ignored.
718
 * </p>
719
 * 
720
 * @param menu the drop-down menu to be displayed when the receiver's arrow is pressed
721
 * @exception SWTException <ul>
722
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
723
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
724
 * </ul>
725
 */
726
public void setDropDownMenu (Menu menu) {
727
	checkWidget();
728
	if ((style & SWT.DROP_DOWN) == 0) return;
729
	dropDownMenu = menu;
730
}
731
732
/**
686
 * Enables the receiver if the argument is <code>true</code>,
733
 * Enables the receiver if the argument is <code>true</code>,
687
 * and disables it otherwise.
734
 * and disables it otherwise.
688
 * <p>
735
 * <p>
(-)Eclipse SWT/motif/org/eclipse/swt/widgets/ToolItem.java (-1 / +50 lines)
Lines 11-16 Link Here
11
package org.eclipse.swt.widgets;
11
package org.eclipse.swt.widgets;
12
12
13
13
14
import org.eclipse.swt.internal.ToolItemHelper;
14
import org.eclipse.swt.internal.motif.*;
15
import org.eclipse.swt.internal.motif.*;
15
import org.eclipse.swt.*;
16
import org.eclipse.swt.*;
16
import org.eclipse.swt.graphics.*;
17
import org.eclipse.swt.graphics.*;
Lines 35-40 Link Here
35
public class ToolItem extends Item {
36
public class ToolItem extends Item {
36
	ToolBar parent;
37
	ToolBar parent;
37
	Image hotImage, disabledImage;
38
	Image hotImage, disabledImage;
39
	Menu dropDownMenu;
38
	String toolTipText;
40
	String toolTipText;
39
	Control control;
41
	Control control;
40
	int width = DEFAULT_SEPARATOR_WIDTH;
42
	int width = DEFAULT_SEPARATOR_WIDTH;
Lines 216-222 Link Here
216
		}
218
		}
217
	}
219
	}
218
	if (state != 0) setInputState (event, state);
220
	if (state != 0) setInputState (event, state);
219
	postEvent (SWT.Selection, event);
221
	if (event.detail == SWT.ARROW) {
222
		sendEvent (SWT.Selection, event);
223
		if (event.doit) {
224
			ToolItemHelper.showDropDownMenu (this);
225
		}
226
	} else {
227
		postEvent (SWT.Selection, event);
228
	}
220
}
229
}
221
230
222
Point computeSize (GC gc) {
231
Point computeSize (GC gc) {
Lines 360-365 Link Here
360
	return disabledImage;
369
	return disabledImage;
361
}
370
}
362
/**
371
/**
372
 * Returns the receiver's drop-down menu if it has one, or null 
373
 * if it does not.
374
 * <p>
375
 * The drop-down menu is activated when the arrow of an {@link SWT#DROP_DOWN}-styled receiver is pressed.
376
 * </p>
377
 * 
378
 * @return the receiver's drop-down menu
379
 * @exception SWTException <ul>
380
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
381
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
382
 * </ul>
383
 */
384
public Menu getDropDownMenu () {
385
	checkWidget();
386
	return dropDownMenu;
387
}
388
/**
363
 * Returns <code>true</code> if the receiver is enabled, and
389
 * Returns <code>true</code> if the receiver is enabled, and
364
 * <code>false</code> otherwise. A disabled control is typically
390
 * <code>false</code> otherwise. A disabled control is typically
365
 * not selectable from the user interface and draws with an
391
 * not selectable from the user interface and draws with an
Lines 702-707 Link Here
702
	disabledImage = image;
728
	disabledImage = image;
703
	if (!getEnabled ()) redraw ();
729
	if (!getEnabled ()) redraw ();
704
}
730
}
731
/**
732
 * Sets the receiver's drop-down menu to the argument, which may be 
733
 * null indicating that no drop-down menu should be displayed.
734
 * <p>
735
 * If this property is null a drop-down menu can still be displayed manually by adding a
736
 * {@link SelectionListener} to the receiver and handling{@link SWT#ARROW} events.
737
 * <p>
738
 * The drop-down menu is activated when the arrow of an {@link SWT#DROP_DOWN}-styled receiver is pressed.
739
 * Attempts to set a drop-dwn menu for a receiver that does not have the {@link SWT#DROP_DOWN}
740
 * style are ignored.
741
 * </p>
742
 * 
743
 * @param menu the drop-down menu to be displayed when the receiver's arrow is pressed
744
 * @exception SWTException <ul>
745
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
746
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
747
 * </ul>
748
 */
749
public void setDropDownMenu (Menu menu) {
750
	checkWidget();
751
	if ((style & SWT.DROP_DOWN) == 0) return;
752
	dropDownMenu = menu;
753
}
705
boolean setFocus () {
754
boolean setFocus () {
706
	if ((style & SWT.SEPARATOR) != 0) return false;
755
	if ((style & SWT.SEPARATOR) != 0) return false;
707
	return XmProcessTraversal (handle, OS.XmTRAVERSE_CURRENT);
756
	return XmProcessTraversal (handle, OS.XmTRAVERSE_CURRENT);
(-)Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java (+3 lines)
Lines 1618-1623 Link Here
1618
	public static final int TPM_LEFTBUTTON = 0x0;
1618
	public static final int TPM_LEFTBUTTON = 0x0;
1619
	public static final int TPM_RIGHTBUTTON = 0x2;
1619
	public static final int TPM_RIGHTBUTTON = 0x2;
1620
	public static final int TPM_RIGHTALIGN = 0x8;
1620
	public static final int TPM_RIGHTALIGN = 0x8;
1621
	public static final int TPM_VERTICAL = 0x40;
1621
	public static final String TRACKBAR_CLASS = "msctls_trackbar32"; //$NON-NLS-1$
1622
	public static final String TRACKBAR_CLASS = "msctls_trackbar32"; //$NON-NLS-1$
1622
	public static final int TRANSPARENT = 0x1;
1623
	public static final int TRANSPARENT = 0x1;
1623
	public static final int TREIS_DISABLED = 4;
1624
	public static final int TREIS_DISABLED = 4;
Lines 2138-2143 Link Here
2138
public static final native int TEXTMETRICA_sizeof ();
2139
public static final native int TEXTMETRICA_sizeof ();
2139
public static final native int TEXTMETRICW_sizeof ();
2140
public static final native int TEXTMETRICW_sizeof ();
2140
public static final native int TOOLINFO_sizeof ();
2141
public static final native int TOOLINFO_sizeof ();
2142
public static final native int TPMPARAMS_sizeof ();
2141
public static final native int TRACKMOUSEEVENT_sizeof ();
2143
public static final native int TRACKMOUSEEVENT_sizeof ();
2142
public static final native int TRIVERTEX_sizeof ();
2144
public static final native int TRIVERTEX_sizeof ();
2143
public static final native int TVHITTESTINFO_sizeof ();
2145
public static final native int TVHITTESTINFO_sizeof ();
Lines 3848-3853 Link Here
3848
public static final native int ToUnicode (int wVirtKey, int wScanCode, byte [] lpKeyState, char [] pwszBuff, int cchBuff, int wFlags);
3850
public static final native int ToUnicode (int wVirtKey, int wScanCode, byte [] lpKeyState, char [] pwszBuff, int cchBuff, int wFlags);
3849
public static final native boolean TrackMouseEvent (TRACKMOUSEEVENT lpEventTrack);
3851
public static final native boolean TrackMouseEvent (TRACKMOUSEEVENT lpEventTrack);
3850
public static final native boolean TrackPopupMenu (int /*long*/ hMenu, int uFlags, int x, int y, int nReserved, int /*long*/ hWnd, RECT prcRect);
3852
public static final native boolean TrackPopupMenu (int /*long*/ hMenu, int uFlags, int x, int y, int nReserved, int /*long*/ hWnd, RECT prcRect);
3853
public static final native boolean TrackPopupMenuEx (int /*long*/ hMenu, int uFlags, int x, int y, int /*long*/ hWnd, TPMPARAMS lptpm);
3851
public static final native int TranslateAcceleratorW (int /*long*/ hWnd, int /*long*/ hAccTable, MSG lpMsg);
3854
public static final native int TranslateAcceleratorW (int /*long*/ hWnd, int /*long*/ hAccTable, MSG lpMsg);
3852
public static final native int TranslateAcceleratorA (int /*long*/ hWnd, int /*long*/ hAccTable, MSG lpMsg);
3855
public static final native int TranslateAcceleratorA (int /*long*/ hWnd, int /*long*/ hAccTable, MSG lpMsg);
3853
public static final native boolean TranslateCharsetInfo (int /*long*/ lpSrc, int [] lpCs, int dwFlags);
3856
public static final native boolean TranslateCharsetInfo (int /*long*/ lpSrc, int [] lpCs, int dwFlags);
(-)Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java (+43 lines)
Lines 39-44 Link Here
39
	String toolTipText;
39
	String toolTipText;
40
	Image disabledImage, hotImage;
40
	Image disabledImage, hotImage;
41
	Image disabledImage2;
41
	Image disabledImage2;
42
	Menu dropDownMenu;
42
	int id;
43
	int id;
43
44
44
/**
45
/**
Lines 254-259 Link Here
254
}
255
}
255
256
256
/**
257
/**
258
 * Returns the receiver's drop-down menu if it has one, or null 
259
 * if it does not.
260
 * <p>
261
 * The drop-down menu is activated when the arrow of an {@link SWT#DROP_DOWN}-styled receiver is pressed.
262
 * </p>
263
 * 
264
 * @return the receiver's drop-down menu
265
 * @exception SWTException <ul>
266
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
267
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
268
 * </ul>
269
 */
270
public Menu getDropDownMenu () {
271
	checkWidget();
272
	return dropDownMenu;
273
}
274
275
/**
257
 * Returns <code>true</code> if the receiver is enabled, and
276
 * Returns <code>true</code> if the receiver is enabled, and
258
 * <code>false</code> otherwise. A disabled control is typically
277
 * <code>false</code> otherwise. A disabled control is typically
259
 * not selectable from the user interface and draws with an
278
 * not selectable from the user interface and draws with an
Lines 638-643 Link Here
638
}
657
}
639
658
640
/**
659
/**
660
 * Sets the receiver's drop-down menu to the argument, which may be 
661
 * null indicating that no drop-down menu should be displayed.
662
 * <p>
663
 * If this property is null a drop-down menu can still be displayed manually by adding a
664
 * {@link SelectionListener} to the receiver and handling{@link SWT#ARROW} events.
665
 * <p>
666
 * The drop-down menu is activated when the arrow of an {@link SWT#DROP_DOWN}-styled receiver is pressed.
667
 * Attempts to set a drop-dwn menu for a receiver that does not have the {@link SWT#DROP_DOWN}
668
 * style are ignored.
669
 * </p>
670
 * 
671
 * @param menu the drop-down menu to be displayed when the receiver's arrow is pressed
672
 * @exception SWTException <ul>
673
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
674
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
675
 * </ul>
676
 */
677
public void setDropDownMenu (Menu menu) {
678
	checkWidget();
679
	if ((style & SWT.DROP_DOWN) == 0) return;
680
	dropDownMenu = menu;
681
}
682
683
/**
641
 * Sets the receiver's hot image to the argument, which may be
684
 * Sets the receiver's hot image to the argument, which may be
642
 * null indicating that no hot image should be displayed.
685
 * null indicating that no hot image should be displayed.
643
 * <p>
686
 * <p>
(-)Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java (-1 / +9 lines)
Lines 1306-1312 Link Here
1306
				OS.SendMessage (handle, OS.TB_GETITEMRECT, index, rect);
1306
				OS.SendMessage (handle, OS.TB_GETITEMRECT, index, rect);
1307
				event.x = rect.left;
1307
				event.x = rect.left;
1308
				event.y = rect.bottom;
1308
				event.y = rect.bottom;
1309
				child.postEvent (SWT.Selection, event);
1309
				child.sendEvent (SWT.Selection, event);
1310
				if (event.doit) {
1311
					Menu dropDownMenu = child.dropDownMenu;
1312
					if (dropDownMenu != null) {
1313
						OS.MapWindowPoints(handle, 0, rect, 2);
1314
						dropDownMenu.setLocation (rect.left, rect.bottom);
1315
						dropDownMenu._setVisible (true, rect, OS.TPM_VERTICAL);
1316
					}
1317
				}
1310
			}
1318
			}
1311
			break;
1319
			break;
1312
		case OS.NM_CUSTOMDRAW:
1320
		case OS.NM_CUSTOMDRAW:
(-)Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java (-1 / +17 lines)
Lines 196-201 Link Here
196
}
196
}
197
197
198
void _setVisible (boolean visible) {
198
void _setVisible (boolean visible) {
199
	_setVisible(visible, null, 0);
200
}
201
202
void _setVisible (boolean visible, RECT excludeRect, int extraFlags) {
199
	if ((style & (SWT.BAR | SWT.DROP_DOWN)) != 0) return;
203
	if ((style & (SWT.BAR | SWT.DROP_DOWN)) != 0) return;
200
	int hwndParent = parent.handle;
204
	int hwndParent = parent.handle;
201
	if (visible) {
205
	if (visible) {
Lines 206-211 Link Here
206
			flags &= ~OS.TPM_RIGHTALIGN;
210
			flags &= ~OS.TPM_RIGHTALIGN;
207
			if ((style & SWT.LEFT_TO_RIGHT) != 0) flags |= OS.TPM_RIGHTALIGN;
211
			if ((style & SWT.LEFT_TO_RIGHT) != 0) flags |= OS.TPM_RIGHTALIGN;
208
		}
212
		}
213
		flags |= extraFlags;
209
		int nX = x, nY = y;
214
		int nX = x, nY = y;
210
		if (!hasLocation) {
215
		if (!hasLocation) {
211
			int pos = OS.GetMessagePos ();
216
			int pos = OS.GetMessagePos ();
Lines 225-231 Link Here
225
		* case when TrackPopupMenu() fails and the number of items in
230
		* case when TrackPopupMenu() fails and the number of items in
226
		* the menu is zero and issue a fake WM_MENUSELECT.
231
		* the menu is zero and issue a fake WM_MENUSELECT.
227
		*/
232
		*/
228
		boolean success = OS.TrackPopupMenu (handle, flags, nX, nY, 0, hwndParent, null);
233
		boolean success;
234
		if (excludeRect == null) {
235
			success = OS.TrackPopupMenu (handle, flags, nX, nY, 0, hwndParent, null);
236
		} else {
237
			TPMPARAMS lptpm = new TPMPARAMS();
238
			lptpm.cbSize = TPMPARAMS.sizeof;
239
			lptpm.left = excludeRect.left;
240
			lptpm.top = excludeRect.top;
241
			lptpm.right = excludeRect.right;
242
			lptpm.bottom = excludeRect.bottom;
243
			success = OS.TrackPopupMenuEx (handle, flags, nX, nY, hwndParent, lptpm);
244
		}
229
		if (!success && GetMenuItemCount (handle) == 0) {
245
		if (!success && GetMenuItemCount (handle) == 0) {
230
			OS.SendMessage (hwndParent, OS.WM_MENUSELECT, 0xFFFF0000, 0);
246
			OS.SendMessage (hwndParent, OS.WM_MENUSELECT, 0xFFFF0000, 0);
231
		}
247
		}
(-)Eclipse SWT/wpf/org/eclipse/swt/widgets/ToolItem.java (-1 / +52 lines)
Lines 11-16 Link Here
11
package org.eclipse.swt.widgets;
11
package org.eclipse.swt.widgets;
12
12
13
 
13
 
14
import org.eclipse.swt.internal.ToolItemHelper;
14
import org.eclipse.swt.internal.wpf.*;
15
import org.eclipse.swt.internal.wpf.*;
15
import org.eclipse.swt.*;
16
import org.eclipse.swt.*;
16
import org.eclipse.swt.graphics.*;
17
import org.eclipse.swt.graphics.*;
Lines 38-43 Link Here
38
	Control control;
39
	Control control;
39
	String toolTipText;
40
	String toolTipText;
40
	Image disabledImage, hotImage;
41
	Image disabledImage, hotImage;
42
	Menu dropDownMenu;
41
	boolean ignoreSelection;
43
	boolean ignoreSelection;
42
44
43
/**
45
/**
Lines 331-336 Link Here
331
}
333
}
332
334
333
/**
335
/**
336
 * Returns the receiver's drop-down menu if it has one, or null 
337
 * if it does not.
338
 * <p>
339
 * The drop-down menu is activated when the arrow of an {@link SWT#DROP_DOWN}-styled receiver is pressed.
340
 * </p>
341
 * 
342
 * @return the receiver's drop-down menu
343
 * @exception SWTException <ul>
344
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
345
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
346
 * </ul>
347
 */
348
public Menu getDropDownMenu () {
349
	checkWidget();
350
	return dropDownMenu;
351
}
352
353
/**
334
 * Returns <code>true</code> if the receiver is enabled, and
354
 * Returns <code>true</code> if the receiver is enabled, and
335
 * <code>false</code> otherwise. A disabled control is typically
355
 * <code>false</code> otherwise. A disabled control is typically
336
 * not selectable from the user interface and draws with an
356
 * not selectable from the user interface and draws with an
Lines 466-472 Link Here
466
		OS.GCHandle_Free (zero);
486
		OS.GCHandle_Free (zero);
467
		OS.GCHandle_Free (mousePos);
487
		OS.GCHandle_Free (mousePos);
468
	}
488
	}
469
	postEvent (SWT.Selection, event);
489
	if (event.detail == SWT.ARROW) {
490
		sendEvent (SWT.Selection, event);
491
		if (event.doit) {
492
			ToolItemHelper.showDropDownMenu(this);
493
		}
494
	} else {
495
		postEvent (SWT.Selection, event);
496
	}
470
}
497
}
471
498
472
void HandleUnchecked (int sender, int e) {
499
void HandleUnchecked (int sender, int e) {
Lines 676-681 Link Here
676
}
703
}
677
704
678
/**
705
/**
706
 * Sets the receiver's drop-down menu to the argument, which may be 
707
 * null indicating that no drop-down menu should be displayed.
708
 * <p>
709
 * If this property is null a drop-down menu can still be displayed manually by adding a
710
 * {@link SelectionListener} to the receiver and handling{@link SWT#ARROW} events.
711
 * <p>
712
 * The drop-down menu is activated when the arrow of an {@link SWT#DROP_DOWN}-styled receiver is pressed.
713
 * Attempts to set a drop-dwn menu for a receiver that does not have the {@link SWT#DROP_DOWN}
714
 * style are ignored.
715
 * </p>
716
 * 
717
 * @param menu the drop-down menu to be displayed when the receiver's arrow is pressed
718
 * @exception SWTException <ul>
719
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
720
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
721
 * </ul>
722
 */
723
public void setDropDownMenu (Menu menu) {
724
	checkWidget();
725
	if ((style & SWT.DROP_DOWN) == 0) return;
726
	dropDownMenu = menu;
727
}
728
729
/**
679
 * Sets the receiver's hot image to the argument, which may be
730
 * Sets the receiver's hot image to the argument, which may be
680
 * null indicating that no hot image should be displayed.
731
 * null indicating that no hot image should be displayed.
681
 * <p>
732
 * <p>
(-)Eclipse SWT/carbon/org/eclipse/swt/widgets/ToolItem.java (-1 / +48 lines)
Lines 11-16 Link Here
11
package org.eclipse.swt.widgets;
11
package org.eclipse.swt.widgets;
12
12
13
13
14
import org.eclipse.swt.internal.ToolItemHelper;
14
import org.eclipse.swt.internal.carbon.OS;
15
import org.eclipse.swt.internal.carbon.OS;
15
import org.eclipse.swt.internal.carbon.ControlButtonContentInfo;
16
import org.eclipse.swt.internal.carbon.ControlButtonContentInfo;
16
import org.eclipse.swt.internal.carbon.ControlFontStyleRec;
17
import org.eclipse.swt.internal.carbon.ControlFontStyleRec;
Lines 48-53 Link Here
48
	int width = DEFAULT_SEPARATOR_WIDTH;
49
	int width = DEFAULT_SEPARATOR_WIDTH;
49
	ToolBar parent;
50
	ToolBar parent;
50
	Image hotImage, disabledImage;
51
	Image hotImage, disabledImage;
52
	Menu dropDownMenu;
51
	String toolTipText;
53
	String toolTipText;
52
	Control control;
54
	Control control;
53
	boolean selection;
55
	boolean selection;
Lines 499-504 Link Here
499
}
501
}
500
502
501
/**
503
/**
504
 * Returns the receiver's drop-down menu if it has one, or null 
505
 * if it does not.
506
 * <p>
507
 * The drop-down menu is activated when the arrow of an {@link SWT#DROP_DOWN}-styled receiver is pressed.
508
 * </p>
509
 * 
510
 * @return the receiver's drop-down menu
511
 * @exception SWTException <ul>
512
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
513
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
514
 * </ul>
515
 */
516
public Menu getDropDownMenu () {
517
	checkWidget();
518
	return dropDownMenu;
519
}
520
521
/**
502
 * Returns <code>true</code> if the receiver is enabled, and
522
 * Returns <code>true</code> if the receiver is enabled, and
503
 * <code>false</code> otherwise. A disabled control is typically
523
 * <code>false</code> otherwise. A disabled control is typically
504
 * not selectable from the user interface and draws with an
524
 * not selectable from the user interface and draws with an
Lines 797-803 Link Here
797
			event.detail = SWT.ARROW;
817
			event.detail = SWT.ARROW;
798
			event.x = (int) pt.x;
818
			event.x = (int) pt.x;
799
			event.y = (int) pt.y;
819
			event.y = (int) pt.y;
800
			postEvent (SWT.Selection, event);				
820
			sendEvent (SWT.Selection, event);
821
			if (event.doit) {
822
				ToolItemHelper.showDropDownMenu (this);
823
			}
801
		}
824
		}
802
	}	
825
	}	
803
	return result;
826
	return result;
Lines 1032-1037 Link Here
1032
}
1055
}
1033
1056
1034
/**
1057
/**
1058
 * Sets the receiver's drop-down menu to the argument, which may be 
1059
 * null indicating that no drop-down menu should be displayed.
1060
 * <p>
1061
 * If this property is null a drop-down menu can still be displayed manually by adding a
1062
 * {@link SelectionListener} to the receiver and handling{@link SWT#ARROW} events.
1063
 * <p>
1064
 * The drop-down menu is activated when the arrow of an {@link SWT#DROP_DOWN}-styled receiver is pressed.
1065
 * Attempts to set a drop-dwn menu for a receiver that does not have the {@link SWT#DROP_DOWN}
1066
 * style are ignored.
1067
 * </p>
1068
 * 
1069
 * @param menu the drop-down menu to be displayed when the receiver's arrow is pressed
1070
 * @exception SWTException <ul>
1071
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
1072
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
1073
 * </ul>
1074
 */
1075
public void setDropDownMenu (Menu menu) {
1076
	checkWidget();
1077
	if ((style & SWT.DROP_DOWN) == 0) return;
1078
	dropDownMenu = menu;
1079
}
1080
1081
/**
1035
 * Sets the receiver's hot image to the argument, which may be
1082
 * Sets the receiver's hot image to the argument, which may be
1036
 * null indicating that no hot image should be displayed.
1083
 * null indicating that no hot image should be displayed.
1037
 * <p>
1084
 * <p>
(-)Eclipse (+8 lines)
Added Link Here
1
package org.eclipse.swt.internal.win32;
2
3
public class TPMPARAMS {
4
	public int cbSize;
5
//	public RECT rcExclude;
6
	public int left, top, right, bottom;
7
	public static int sizeof =  OS.TPMPARAMS_sizeof ();
8
}
(-)Eclipse (+21 lines)
Added Link Here
1
package org.eclipse.swt.internal;
2
3
import org.eclipse.swt.graphics.Point;
4
import org.eclipse.swt.graphics.Rectangle;
5
import org.eclipse.swt.widgets.Menu;
6
import org.eclipse.swt.widgets.ToolItem;
7
8
public final class ToolItemHelper {
9
10
	public static void showDropDownMenu (ToolItem item) {
11
		Menu dropDownMenu = item.getDropDownMenu ();	
12
		if (dropDownMenu != null) {
13
			Rectangle rect = item.getBounds ();
14
			Point pt = new Point (rect.x, rect.y + rect.height);
15
			pt = item.getParent ().toDisplay (pt);
16
			dropDownMenu.setLocation (pt);
17
			dropDownMenu.setVisible (true);
18
		}
19
	}
20
21
}

Return to bug 193318