Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 222859 | Differences between
and this patch

Collapse All | Expand All

(-)Eclipse SWT PI/cocoa/library/make_macosx.mak (-2 / +2 lines)
Lines 44-52 Link Here
44
	-Wno-non-virtual-dtor -include ${XULRUNNER_SDK}/include/mozilla-config.h -I${XULRUNNER_SDK}/include 
44
	-Wno-non-virtual-dtor -include ${XULRUNNER_SDK}/include/mozilla-config.h -I${XULRUNNER_SDK}/include 
45
XULRUNNERLFLAGS = $(LFLAGS)
45
XULRUNNERLFLAGS = $(LFLAGS)
46
46
47
all: $(SWT_LIB) $(SWTPI_LIB) $(AWT_LIB) $(XULRUNNER_LIB)
47
all: $(SWT_LIB) $(SWTPI_LIB) $(AWT_LIB)
48
48
49
all_x86_64: $(SWT_LIB) $(SWTPI_LIB) $(AWT_LIB) $(XULRUNNER_LIB)
49
all_x86_64: $(SWT_LIB) $(SWTPI_LIB) $(AWT_LIB)
50
50
51
.c.o:
51
.c.o:
52
	cc $(CFLAGS) $*.c
52
	cc $(CFLAGS) $*.c
(-)Eclipse SWT PI/cocoa/library/os.c (+30 lines)
Lines 9440-9445 Link Here
9440
}
9440
}
9441
#endif
9441
#endif
9442
9442
9443
#if (!defined(NO_objc_1msgSend_1bool__IILorg_eclipse_swt_internal_cocoa_NSPoint_2Lorg_eclipse_swt_internal_cocoa_NSRect_2) && !defined(JNI64)) || (!defined(NO_objc_1msgSend_1bool__JJLorg_eclipse_swt_internal_cocoa_NSPoint_2Lorg_eclipse_swt_internal_cocoa_NSRect_2) && defined(JNI64))
9444
#ifndef JNI64
9445
JNIEXPORT jboolean JNICALL OS_NATIVE(objc_1msgSend_1bool__IILorg_eclipse_swt_internal_cocoa_NSPoint_2Lorg_eclipse_swt_internal_cocoa_NSRect_2)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jobject arg2, jobject arg3)
9446
#else
9447
JNIEXPORT jboolean JNICALL OS_NATIVE(objc_1msgSend_1bool__JJLorg_eclipse_swt_internal_cocoa_NSPoint_2Lorg_eclipse_swt_internal_cocoa_NSRect_2)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jobject arg2, jobject arg3)
9448
#endif
9449
{
9450
	NSPoint _arg2, *lparg2=NULL;
9451
	NSRect _arg3, *lparg3=NULL;
9452
	jboolean rc = 0;
9453
#ifndef JNI64
9454
	OS_NATIVE_ENTER(env, that, objc_1msgSend_1bool__IILorg_eclipse_swt_internal_cocoa_NSPoint_2Lorg_eclipse_swt_internal_cocoa_NSRect_2_FUNC);
9455
#else
9456
	OS_NATIVE_ENTER(env, that, objc_1msgSend_1bool__JJLorg_eclipse_swt_internal_cocoa_NSPoint_2Lorg_eclipse_swt_internal_cocoa_NSRect_2_FUNC);
9457
#endif
9458
	if (arg2) if ((lparg2 = getNSPointFields(env, arg2, &_arg2)) == NULL) goto fail;
9459
	if (arg3) if ((lparg3 = getNSRectFields(env, arg3, &_arg3)) == NULL) goto fail;
9460
	rc = (jboolean)((BOOL (*)(jintLong, jintLong, NSPoint, NSRect))objc_msgSend_bool)(arg0, arg1, *lparg2, *lparg3);
9461
fail:
9462
	if (arg3 && lparg3) setNSRectFields(env, arg3, lparg3);
9463
	if (arg2 && lparg2) setNSPointFields(env, arg2, lparg2);
9464
#ifndef JNI64
9465
	OS_NATIVE_EXIT(env, that, objc_1msgSend_1bool__IILorg_eclipse_swt_internal_cocoa_NSPoint_2Lorg_eclipse_swt_internal_cocoa_NSRect_2_FUNC);
9466
#else
9467
	OS_NATIVE_EXIT(env, that, objc_1msgSend_1bool__JJLorg_eclipse_swt_internal_cocoa_NSPoint_2Lorg_eclipse_swt_internal_cocoa_NSRect_2_FUNC);
9468
#endif
9469
	return rc;
9470
}
9471
#endif
9472
9443
#if (!defined(NO_objc_1msgSend_1bool__IILorg_eclipse_swt_internal_cocoa_NSRange_2I) && !defined(JNI64)) || (!defined(NO_objc_1msgSend_1bool__JJLorg_eclipse_swt_internal_cocoa_NSRange_2J) && defined(JNI64))
9473
#if (!defined(NO_objc_1msgSend_1bool__IILorg_eclipse_swt_internal_cocoa_NSRange_2I) && !defined(JNI64)) || (!defined(NO_objc_1msgSend_1bool__JJLorg_eclipse_swt_internal_cocoa_NSRange_2J) && defined(JNI64))
9444
#ifndef JNI64
9474
#ifndef JNI64
9445
JNIEXPORT jboolean JNICALL OS_NATIVE(objc_1msgSend_1bool__IILorg_eclipse_swt_internal_cocoa_NSRange_2I)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jobject arg2, jintLong arg3)
9475
JNIEXPORT jboolean JNICALL OS_NATIVE(objc_1msgSend_1bool__IILorg_eclipse_swt_internal_cocoa_NSRange_2I)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jobject arg2, jintLong arg3)
(-)Eclipse SWT PI/cocoa/library/os_stats.c (-2 / +7 lines)
Lines 14-21 Link Here
14
14
15
#ifdef NATIVE_STATS
15
#ifdef NATIVE_STATS
16
16
17
int OS_nativeFunctionCount = 610;
17
int OS_nativeFunctionCount = 611;
18
int OS_nativeFunctionCallCount[610];
18
int OS_nativeFunctionCallCount[611];
19
char * OS_nativeFunctionNames[] = {
19
char * OS_nativeFunctionNames[] = {
20
	"ATSFontActivateFromFileReference",
20
	"ATSFontActivateFromFileReference",
21
	"AcquireRootMenu",
21
	"AcquireRootMenu",
Lines 1081-1086 Link Here
1081
	"objc_1msgSend_1bool__JJLorg_eclipse_swt_internal_cocoa_NSPoint_2",
1081
	"objc_1msgSend_1bool__JJLorg_eclipse_swt_internal_cocoa_NSPoint_2",
1082
#endif
1082
#endif
1083
#ifndef JNI64
1083
#ifndef JNI64
1084
	"objc_1msgSend_1bool__IILorg_eclipse_swt_internal_cocoa_NSPoint_2Lorg_eclipse_swt_internal_cocoa_NSRect_2",
1085
#else
1086
	"objc_1msgSend_1bool__JJLorg_eclipse_swt_internal_cocoa_NSPoint_2Lorg_eclipse_swt_internal_cocoa_NSRect_2",
1087
#endif
1088
#ifndef JNI64
1084
	"objc_1msgSend_1bool__IILorg_eclipse_swt_internal_cocoa_NSRange_2I",
1089
	"objc_1msgSend_1bool__IILorg_eclipse_swt_internal_cocoa_NSRange_2I",
1085
#else
1090
#else
1086
	"objc_1msgSend_1bool__JJLorg_eclipse_swt_internal_cocoa_NSRange_2J",
1091
	"objc_1msgSend_1bool__JJLorg_eclipse_swt_internal_cocoa_NSRange_2J",
(-)Eclipse SWT PI/cocoa/library/os_stats.h (+5 lines)
Lines 1089-1094 Link Here
1089
	objc_1msgSend_1bool__JJLorg_eclipse_swt_internal_cocoa_NSPoint_2_FUNC,
1089
	objc_1msgSend_1bool__JJLorg_eclipse_swt_internal_cocoa_NSPoint_2_FUNC,
1090
#endif
1090
#endif
1091
#ifndef JNI64
1091
#ifndef JNI64
1092
	objc_1msgSend_1bool__IILorg_eclipse_swt_internal_cocoa_NSPoint_2Lorg_eclipse_swt_internal_cocoa_NSRect_2_FUNC,
1093
#else
1094
	objc_1msgSend_1bool__JJLorg_eclipse_swt_internal_cocoa_NSPoint_2Lorg_eclipse_swt_internal_cocoa_NSRect_2_FUNC,
1095
#endif
1096
#ifndef JNI64
1092
	objc_1msgSend_1bool__IILorg_eclipse_swt_internal_cocoa_NSRange_2I_FUNC,
1097
	objc_1msgSend_1bool__IILorg_eclipse_swt_internal_cocoa_NSRange_2I_FUNC,
1093
#else
1098
#else
1094
	objc_1msgSend_1bool__JJLorg_eclipse_swt_internal_cocoa_NSRange_2J_FUNC,
1099
	objc_1msgSend_1bool__JJLorg_eclipse_swt_internal_cocoa_NSRange_2J_FUNC,
(-)Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras (+40 lines)
Lines 650-659 Link Here
650
			<arg swt_gen="true"></arg>
650
			<arg swt_gen="true"></arg>
651
			<retval swt_gen="true"></retval>
651
			<retval swt_gen="true"></retval>
652
		</method>
652
		</method>
653
		<method selector="setHighlightsBy:" swt_gen="true">
654
			<arg swt_gen="true"></arg>
655
			<retval swt_gen="true"></retval>
656
		</method>
653
		<method selector="setImagePosition:" swt_gen="true">
657
		<method selector="setImagePosition:" swt_gen="true">
654
			<arg swt_gen="true"></arg>
658
			<arg swt_gen="true"></arg>
655
			<retval swt_gen="true"></retval>
659
			<retval swt_gen="true"></retval>
656
		</method>
660
		</method>
661
		<method selector="setShowsStateBy:" swt_gen="true">
662
			<arg swt_gen="true"></arg>
663
			<retval swt_gen="true"></retval>
664
		</method>
657
		<method selector="title" swt_gen="true">
665
		<method selector="title" swt_gen="true">
658
			<retval swt_gen="true"></retval>
666
			<retval swt_gen="true"></retval>
659
		</method>
667
		</method>
Lines 3547-3552 Link Here
3547
			<arg swt_gen="true"></arg>
3555
			<arg swt_gen="true"></arg>
3548
			<retval swt_gen="true"></retval>
3556
			<retval swt_gen="true"></retval>
3549
		</method>
3557
		</method>
3558
		<method selector="isVisible" swt_gen="true">
3559
			<retval swt_gen="true"></retval>
3560
		</method>
3550
		<method selector="removeItemAtIndex:" swt_gen="true">
3561
		<method selector="removeItemAtIndex:" swt_gen="true">
3551
			<arg swt_gen="true"></arg>
3562
			<arg swt_gen="true"></arg>
3552
			<retval swt_gen="true"></retval>
3563
			<retval swt_gen="true"></retval>
Lines 3563-3568 Link Here
3563
			<arg swt_gen="true"></arg>
3574
			<arg swt_gen="true"></arg>
3564
			<retval swt_gen="true"></retval>
3575
			<retval swt_gen="true"></retval>
3565
		</method>
3576
		</method>
3577
		<method selector="setSelectedItemIdentifier:" swt_gen="true">
3578
			<arg swt_gen="true"></arg>
3579
			<retval swt_gen="true"></retval>
3580
		</method>
3566
		<method selector="setVisible:" swt_gen="true">
3581
		<method selector="setVisible:" swt_gen="true">
3567
			<arg swt_gen="true"></arg>
3582
			<arg swt_gen="true"></arg>
3568
			<retval swt_gen="true"></retval>
3583
			<retval swt_gen="true"></retval>
Lines 3596-3601 Link Here
3596
			<arg swt_gen="true"></arg>
3611
			<arg swt_gen="true"></arg>
3597
			<retval swt_gen="true"></retval>
3612
			<retval swt_gen="true"></retval>
3598
		</method>
3613
		</method>
3614
		<method selector="setMenuFormRepresentation:" swt_gen="true">
3615
			<arg swt_gen="true"></arg>
3616
			<retval swt_gen="true"></retval>
3617
		</method>
3599
		<method selector="setMinSize:" swt_gen="true">
3618
		<method selector="setMinSize:" swt_gen="true">
3600
			<arg swt_gen="true"></arg>
3619
			<arg swt_gen="true"></arg>
3601
			<retval swt_gen="true"></retval>
3620
			<retval swt_gen="true"></retval>
Lines 3616-3621 Link Here
3616
			<arg swt_gen="true"></arg>
3635
			<arg swt_gen="true"></arg>
3617
			<retval swt_gen="true"></retval>
3636
			<retval swt_gen="true"></retval>
3618
		</method>
3637
		</method>
3638
		<method selector="view" swt_gen="true">
3639
			<retval swt_gen="true"></retval>
3640
		</method>
3619
	</class>
3641
	</class>
3620
	<class name="NSToolbarItemGroup" swt_superclass="NSToolbarItem">
3642
	<class name="NSToolbarItemGroup" swt_superclass="NSToolbarItem">
3621
	</class>
3643
	</class>
Lines 3808-3813 Link Here
3808
			<arg swt_gen="true"></arg>
3830
			<arg swt_gen="true"></arg>
3809
			<retval swt_gen="true"></retval>
3831
			<retval swt_gen="true"></retval>
3810
		</method>
3832
		</method>
3833
		<method selector="mouse:inRect:" swt_gen="true">
3834
			<arg swt_gen="true"></arg>
3835
			<arg swt_gen="true"></arg>
3836
			<retval swt_gen="true"></retval>
3837
		</method>
3838
		<method selector="mouseDownCanMoveWindow" swt_gen="true">
3839
			<retval swt_gen="true"></retval>
3840
		</method>
3811
		<method selector="registerForDraggedTypes:" swt_gen="true">
3841
		<method selector="registerForDraggedTypes:" swt_gen="true">
3812
			<arg swt_gen="true"></arg>
3842
			<arg swt_gen="true"></arg>
3813
			<retval swt_gen="true"></retval>
3843
			<retval swt_gen="true"></retval>
Lines 3940-3945 Link Here
3940
		<method selector="close" swt_gen="true">
3970
		<method selector="close" swt_gen="true">
3941
			<retval swt_gen="true"></retval>
3971
			<retval swt_gen="true"></retval>
3942
		</method>
3972
		</method>
3973
		<method class_method="true" selector="contentRectForFrameRect:styleMask:" swt_gen="true">
3974
			<arg swt_gen="true"></arg>
3975
			<arg swt_gen="true"></arg>
3976
			<retval swt_gen="true"></retval>
3977
		</method>
3943
		<method selector="contentView" swt_gen="true">
3978
		<method selector="contentView" swt_gen="true">
3944
			<retval swt_gen="true" swt_java_type="NSView"></retval>
3979
			<retval swt_gen="true" swt_java_type="NSView"></retval>
3945
		</method>
3980
		</method>
Lines 4481-4486 Link Here
4481
	<enum name="NSCompositeCopy" swt_gen="true"></enum>
4516
	<enum name="NSCompositeCopy" swt_gen="true"></enum>
4482
	<enum name="NSCompositeSourceOver" swt_gen="true"></enum>
4517
	<enum name="NSCompositeSourceOver" swt_gen="true"></enum>
4483
	<enum name="NSCompositeXOR" swt_gen="true"></enum>
4518
	<enum name="NSCompositeXOR" swt_gen="true"></enum>
4519
	<enum name="NSContentsCellMask" swt_gen="true"></enum>
4484
	<enum name="NSControlKeyMask" swt_gen="true"></enum>
4520
	<enum name="NSControlKeyMask" swt_gen="true"></enum>
4485
	<enum name="NSCriticalAlertStyle" swt_gen="true"></enum>
4521
	<enum name="NSCriticalAlertStyle" swt_gen="true"></enum>
4486
	<enum name="NSCurveToBezierPathElement" swt_gen="true"></enum>
4522
	<enum name="NSCurveToBezierPathElement" swt_gen="true"></enum>
Lines 4547-4552 Link Here
4547
	<enum name="NSNonZeroWindingRule" swt_gen="true"></enum>
4583
	<enum name="NSNonZeroWindingRule" swt_gen="true"></enum>
4548
	<enum name="NSNonactivatingPanelMask" swt_gen="true"></enum>
4584
	<enum name="NSNonactivatingPanelMask" swt_gen="true"></enum>
4549
	<enum name="NSOffState" swt_gen="true"></enum>
4585
	<enum name="NSOffState" swt_gen="true"></enum>
4586
	<enum name="NSOnOffButton" swt_gen="true"></enum>
4550
	<enum name="NSOnState" swt_gen="true"></enum>
4587
	<enum name="NSOnState" swt_gen="true"></enum>
4551
	<enum name="NSOpenGLPFAAccumSize" swt_gen="true"></enum>
4588
	<enum name="NSOpenGLPFAAccumSize" swt_gen="true"></enum>
4552
	<enum name="NSOpenGLPFAAlphaSize" swt_gen="true"></enum>
4589
	<enum name="NSOpenGLPFAAlphaSize" swt_gen="true"></enum>
Lines 4606-4611 Link Here
4606
	<enum name="NSTerminateNow" swt_gen="true"></enum>
4643
	<enum name="NSTerminateNow" swt_gen="true"></enum>
4607
	<enum name="NSTextFieldAndStepperDatePickerStyle" swt_gen="true"></enum>
4644
	<enum name="NSTextFieldAndStepperDatePickerStyle" swt_gen="true"></enum>
4608
	<enum name="NSTitledWindowMask" swt_gen="true"></enum>
4645
	<enum name="NSTitledWindowMask" swt_gen="true"></enum>
4646
	<enum name="NSToolbarDisplayModeIconAndLabel" swt_gen="true"></enum>
4647
	<enum name="NSToolbarDisplayModeIconOnly" swt_gen="true"></enum>
4648
	<enum name="NSToolbarDisplayModeLabelOnly" swt_gen="true"></enum>
4609
	<enum name="NSUnderlineStyleDouble" swt_gen="true"></enum>
4649
	<enum name="NSUnderlineStyleDouble" swt_gen="true"></enum>
4610
	<enum name="NSUnderlineStyleNone" swt_gen="true"></enum>
4650
	<enum name="NSUnderlineStyleNone" swt_gen="true"></enum>
4611
	<enum name="NSUnderlineStyleSingle" swt_gen="true"></enum>
4651
	<enum name="NSUnderlineStyleSingle" swt_gen="true"></enum>
(-)Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSButtonCell.java (+8 lines)
Lines 47-56 Link Here
47
	OS.objc_msgSend(this.id, OS.sel_setButtonType_, aType);
47
	OS.objc_msgSend(this.id, OS.sel_setButtonType_, aType);
48
}
48
}
49
49
50
public void setHighlightsBy(int /*long*/ aType) {
51
	OS.objc_msgSend(this.id, OS.sel_setHighlightsBy_, aType);
52
}
53
50
public void setImagePosition(int /*long*/ aPosition) {
54
public void setImagePosition(int /*long*/ aPosition) {
51
	OS.objc_msgSend(this.id, OS.sel_setImagePosition_, aPosition);
55
	OS.objc_msgSend(this.id, OS.sel_setImagePosition_, aPosition);
52
}
56
}
53
57
58
public void setShowsStateBy(int /*long*/ aType) {
59
	OS.objc_msgSend(this.id, OS.sel_setShowsStateBy_, aType);
60
}
61
54
public NSString title() {
62
public NSString title() {
55
	int /*long*/ result = OS.objc_msgSend(this.id, OS.sel_title);
63
	int /*long*/ result = OS.objc_msgSend(this.id, OS.sel_title);
56
	return result != 0 ? new NSString(result) : null;
64
	return result != 0 ? new NSString(result) : null;
(-)Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSColorPanel.java (-1 / +7 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 38-43 Link Here
38
	return result != 0 ? new NSColorPanel(result) : null;
38
	return result != 0 ? new NSColorPanel(result) : null;
39
}
39
}
40
40
41
public static NSRect contentRectForFrameRect(NSRect fRect, int /*long*/ aStyle) {
42
	NSRect result = new NSRect();
43
	OS.objc_msgSend_stret(result, OS.class_NSColorPanel, OS.sel_contentRectForFrameRect_styleMask_, fRect, aStyle);
44
	return result;
45
}
46
41
public static float /*double*/ minFrameWidthWithTitle(NSString aTitle, int /*long*/ aStyle) {
47
public static float /*double*/ minFrameWidthWithTitle(NSString aTitle, int /*long*/ aStyle) {
42
	return (float)OS.objc_msgSend_fpret(OS.class_NSColorPanel, OS.sel_minFrameWidthWithTitle_styleMask_, aTitle != null ? aTitle.id : 0, aStyle);
48
	return (float)OS.objc_msgSend_fpret(OS.class_NSColorPanel, OS.sel_minFrameWidthWithTitle_styleMask_, aTitle != null ? aTitle.id : 0, aStyle);
43
}
49
}
(-)Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSFontPanel.java (-1 / +7 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 38-43 Link Here
38
	return result != 0 ? new NSFontPanel(result) : null;
38
	return result != 0 ? new NSFontPanel(result) : null;
39
}
39
}
40
40
41
public static NSRect contentRectForFrameRect(NSRect fRect, int /*long*/ aStyle) {
42
	NSRect result = new NSRect();
43
	OS.objc_msgSend_stret(result, OS.class_NSFontPanel, OS.sel_contentRectForFrameRect_styleMask_, fRect, aStyle);
44
	return result;
45
}
46
41
public static float /*double*/ minFrameWidthWithTitle(NSString aTitle, int /*long*/ aStyle) {
47
public static float /*double*/ minFrameWidthWithTitle(NSString aTitle, int /*long*/ aStyle) {
42
	return (float)OS.objc_msgSend_fpret(OS.class_NSFontPanel, OS.sel_minFrameWidthWithTitle_styleMask_, aTitle != null ? aTitle.id : 0, aStyle);
48
	return (float)OS.objc_msgSend_fpret(OS.class_NSFontPanel, OS.sel_minFrameWidthWithTitle_styleMask_, aTitle != null ? aTitle.id : 0, aStyle);
43
}
49
}
(-)Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSOpenPanel.java (-1 / +7 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 51-56 Link Here
51
	return result != 0 ? new NSSavePanel(result) : null;
51
	return result != 0 ? new NSSavePanel(result) : null;
52
}
52
}
53
53
54
public static NSRect contentRectForFrameRect(NSRect fRect, int /*long*/ aStyle) {
55
	NSRect result = new NSRect();
56
	OS.objc_msgSend_stret(result, OS.class_NSOpenPanel, OS.sel_contentRectForFrameRect_styleMask_, fRect, aStyle);
57
	return result;
58
}
59
54
public static float /*double*/ minFrameWidthWithTitle(NSString aTitle, int /*long*/ aStyle) {
60
public static float /*double*/ minFrameWidthWithTitle(NSString aTitle, int /*long*/ aStyle) {
55
	return (float)OS.objc_msgSend_fpret(OS.class_NSOpenPanel, OS.sel_minFrameWidthWithTitle_styleMask_, aTitle != null ? aTitle.id : 0, aStyle);
61
	return (float)OS.objc_msgSend_fpret(OS.class_NSOpenPanel, OS.sel_minFrameWidthWithTitle_styleMask_, aTitle != null ? aTitle.id : 0, aStyle);
56
}
62
}
(-)Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSPanel.java (+6 lines)
Lines 40-45 Link Here
40
	return OS.objc_msgSend_bool(this.id, OS.sel_worksWhenModal);
40
	return OS.objc_msgSend_bool(this.id, OS.sel_worksWhenModal);
41
}
41
}
42
42
43
public static NSRect contentRectForFrameRect(NSRect fRect, int /*long*/ aStyle) {
44
	NSRect result = new NSRect();
45
	OS.objc_msgSend_stret(result, OS.class_NSPanel, OS.sel_contentRectForFrameRect_styleMask_, fRect, aStyle);
46
	return result;
47
}
48
43
public static float /*double*/ minFrameWidthWithTitle(NSString aTitle, int /*long*/ aStyle) {
49
public static float /*double*/ minFrameWidthWithTitle(NSString aTitle, int /*long*/ aStyle) {
44
	return (float)OS.objc_msgSend_fpret(OS.class_NSPanel, OS.sel_minFrameWidthWithTitle_styleMask_, aTitle != null ? aTitle.id : 0, aStyle);
50
	return (float)OS.objc_msgSend_fpret(OS.class_NSPanel, OS.sel_minFrameWidthWithTitle_styleMask_, aTitle != null ? aTitle.id : 0, aStyle);
45
}
51
}
(-)Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSSavePanel.java (-1 / +7 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 66-71 Link Here
66
	OS.objc_msgSend(this.id, OS.sel_validateVisibleColumns);
66
	OS.objc_msgSend(this.id, OS.sel_validateVisibleColumns);
67
}
67
}
68
68
69
public static NSRect contentRectForFrameRect(NSRect fRect, int /*long*/ aStyle) {
70
	NSRect result = new NSRect();
71
	OS.objc_msgSend_stret(result, OS.class_NSSavePanel, OS.sel_contentRectForFrameRect_styleMask_, fRect, aStyle);
72
	return result;
73
}
74
69
public static float /*double*/ minFrameWidthWithTitle(NSString aTitle, int /*long*/ aStyle) {
75
public static float /*double*/ minFrameWidthWithTitle(NSString aTitle, int /*long*/ aStyle) {
70
	return (float)OS.objc_msgSend_fpret(OS.class_NSSavePanel, OS.sel_minFrameWidthWithTitle_styleMask_, aTitle != null ? aTitle.id : 0, aStyle);
76
	return (float)OS.objc_msgSend_fpret(OS.class_NSSavePanel, OS.sel_minFrameWidthWithTitle_styleMask_, aTitle != null ? aTitle.id : 0, aStyle);
71
}
77
}
(-)Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSToolbar.java (-1 / +9 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 33-38 Link Here
33
	OS.objc_msgSend(this.id, OS.sel_insertItemWithItemIdentifier_atIndex_, itemIdentifier != null ? itemIdentifier.id : 0, index);
33
	OS.objc_msgSend(this.id, OS.sel_insertItemWithItemIdentifier_atIndex_, itemIdentifier != null ? itemIdentifier.id : 0, index);
34
}
34
}
35
35
36
public boolean isVisible() {
37
	return OS.objc_msgSend_bool(this.id, OS.sel_isVisible);
38
}
39
36
public void removeItemAtIndex(int /*long*/ index) {
40
public void removeItemAtIndex(int /*long*/ index) {
37
	OS.objc_msgSend(this.id, OS.sel_removeItemAtIndex_, index);
41
	OS.objc_msgSend(this.id, OS.sel_removeItemAtIndex_, index);
38
}
42
}
Lines 49-54 Link Here
49
	OS.objc_msgSend(this.id, OS.sel_setDisplayMode_, displayMode);
53
	OS.objc_msgSend(this.id, OS.sel_setDisplayMode_, displayMode);
50
}
54
}
51
55
56
public void setSelectedItemIdentifier(NSString itemIdentifier) {
57
	OS.objc_msgSend(this.id, OS.sel_setSelectedItemIdentifier_, itemIdentifier != null ? itemIdentifier.id : 0);
58
}
59
52
public void setVisible(boolean shown) {
60
public void setVisible(boolean shown) {
53
	OS.objc_msgSend(this.id, OS.sel_setVisible_, shown);
61
	OS.objc_msgSend(this.id, OS.sel_setVisible_, shown);
54
}
62
}
(-)Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSToolbarItem.java (-1 / +10 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 54-59 Link Here
54
	OS.objc_msgSend(this.id, OS.sel_setMaxSize_, size);
54
	OS.objc_msgSend(this.id, OS.sel_setMaxSize_, size);
55
}
55
}
56
56
57
public void setMenuFormRepresentation(NSMenuItem menuItem) {
58
	OS.objc_msgSend(this.id, OS.sel_setMenuFormRepresentation_, menuItem != null ? menuItem.id : 0);
59
}
60
57
public void setMinSize(NSSize size) {
61
public void setMinSize(NSSize size) {
58
	OS.objc_msgSend(this.id, OS.sel_setMinSize_, size);
62
	OS.objc_msgSend(this.id, OS.sel_setMinSize_, size);
59
}
63
}
Lines 74-77 Link Here
74
	OS.objc_msgSend(this.id, OS.sel_setView_, view != null ? view.id : 0);
78
	OS.objc_msgSend(this.id, OS.sel_setView_, view != null ? view.id : 0);
75
}
79
}
76
80
81
public NSView view() {
82
	int /*long*/ result = OS.objc_msgSend(this.id, OS.sel_view);
83
	return result != 0 ? new NSView(result) : null;
84
}
85
77
}
86
}
(-)Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSView.java (+8 lines)
Lines 203-208 Link Here
203
	return result != 0 ? new NSMenu(result) : null;
203
	return result != 0 ? new NSMenu(result) : null;
204
}
204
}
205
205
206
public boolean mouse(NSPoint aPoint, NSRect aRect) {
207
	return OS.objc_msgSend_bool(this.id, OS.sel_mouse_inRect_, aPoint, aRect);
208
}
209
210
public boolean mouseDownCanMoveWindow() {
211
	return OS.objc_msgSend_bool(this.id, OS.sel_mouseDownCanMoveWindow);
212
}
213
206
public void registerForDraggedTypes(NSArray newTypes) {
214
public void registerForDraggedTypes(NSArray newTypes) {
207
	OS.objc_msgSend(this.id, OS.sel_registerForDraggedTypes_, newTypes != null ? newTypes.id : 0);
215
	OS.objc_msgSend(this.id, OS.sel_registerForDraggedTypes_, newTypes != null ? newTypes.id : 0);
208
}
216
}
(-)Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSWindow.java (+6 lines)
Lines 54-59 Link Here
54
	OS.objc_msgSend(this.id, OS.sel_close);
54
	OS.objc_msgSend(this.id, OS.sel_close);
55
}
55
}
56
56
57
public static NSRect contentRectForFrameRect(NSRect fRect, int /*long*/ aStyle) {
58
	NSRect result = new NSRect();
59
	OS.objc_msgSend_stret(result, OS.class_NSWindow, OS.sel_contentRectForFrameRect_styleMask_, fRect, aStyle);
60
	return result;
61
}
62
57
public NSView contentView() {
63
public NSView contentView() {
58
	int /*long*/ result = OS.objc_msgSend(this.id, OS.sel_contentView);
64
	int /*long*/ result = OS.objc_msgSend(this.id, OS.sel_contentView);
59
	return result != 0 ? new NSView(result) : null;
65
	return result != 0 ? new NSView(result) : null;
(-)Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java (+20 lines)
Lines 137-142 Link Here
137
	public static final int /*long*/ class_JRSAppKitAWT = objc_getClass("JRSAppKitAWT");
137
	public static final int /*long*/ class_JRSAppKitAWT = objc_getClass("JRSAppKitAWT");
138
	public static final int /*long*/ sel_awtAppDelegate = sel_registerName("awtAppDelegate");
138
	public static final int /*long*/ sel_awtAppDelegate = sel_registerName("awtAppDelegate");
139
	
139
	
140
	public static final int /*long*/ class_NSToolbarView = objc_getClass("NSToolbarView");
141
140
/** JNI natives */
142
/** JNI natives */
141
143
142
/** @method flags=jni */
144
/** @method flags=jni */
Lines 980-985 Link Here
980
public static final int /*long*/ sel_containsObject_ = sel_registerName("containsObject:");
982
public static final int /*long*/ sel_containsObject_ = sel_registerName("containsObject:");
981
public static final int /*long*/ sel_containsPoint_ = sel_registerName("containsPoint:");
983
public static final int /*long*/ sel_containsPoint_ = sel_registerName("containsPoint:");
982
public static final int /*long*/ sel_contentRect = sel_registerName("contentRect");
984
public static final int /*long*/ sel_contentRect = sel_registerName("contentRect");
985
public static final int /*long*/ sel_contentRectForFrameRect_styleMask_ = sel_registerName("contentRectForFrameRect:styleMask:");
983
public static final int /*long*/ sel_contentSize = sel_registerName("contentSize");
986
public static final int /*long*/ sel_contentSize = sel_registerName("contentSize");
984
public static final int /*long*/ sel_contentSizeForFrameSize_hasHorizontalScroller_hasVerticalScroller_borderType_ = sel_registerName("contentSizeForFrameSize:hasHorizontalScroller:hasVerticalScroller:borderType:");
987
public static final int /*long*/ sel_contentSizeForFrameSize_hasHorizontalScroller_hasVerticalScroller_borderType_ = sel_registerName("contentSizeForFrameSize:hasHorizontalScroller:hasVerticalScroller:borderType:");
985
public static final int /*long*/ sel_contentView = sel_registerName("contentView");
988
public static final int /*long*/ sel_contentView = sel_registerName("contentView");
Lines 1375-1381 Link Here
1375
public static final int /*long*/ sel_minuteOfHour = sel_registerName("minuteOfHour");
1378
public static final int /*long*/ sel_minuteOfHour = sel_registerName("minuteOfHour");
1376
public static final int /*long*/ sel_modifierFlags = sel_registerName("modifierFlags");
1379
public static final int /*long*/ sel_modifierFlags = sel_registerName("modifierFlags");
1377
public static final int /*long*/ sel_monthOfYear = sel_registerName("monthOfYear");
1380
public static final int /*long*/ sel_monthOfYear = sel_registerName("monthOfYear");
1381
public static final int /*long*/ sel_mouse_inRect_ = sel_registerName("mouse:inRect:");
1378
public static final int /*long*/ sel_mouseDown_ = sel_registerName("mouseDown:");
1382
public static final int /*long*/ sel_mouseDown_ = sel_registerName("mouseDown:");
1383
public static final int /*long*/ sel_mouseDownCanMoveWindow = sel_registerName("mouseDownCanMoveWindow");
1379
public static final int /*long*/ sel_mouseDragged_ = sel_registerName("mouseDragged:");
1384
public static final int /*long*/ sel_mouseDragged_ = sel_registerName("mouseDragged:");
1380
public static final int /*long*/ sel_mouseEntered_ = sel_registerName("mouseEntered:");
1385
public static final int /*long*/ sel_mouseEntered_ = sel_registerName("mouseEntered:");
1381
public static final int /*long*/ sel_mouseExited_ = sel_registerName("mouseExited:");
1386
public static final int /*long*/ sel_mouseExited_ = sel_registerName("mouseExited:");
Lines 1732-1737 Link Here
1732
public static final int /*long*/ sel_setHighlightMode_ = sel_registerName("setHighlightMode:");
1737
public static final int /*long*/ sel_setHighlightMode_ = sel_registerName("setHighlightMode:");
1733
public static final int /*long*/ sel_setHighlighted_ = sel_registerName("setHighlighted:");
1738
public static final int /*long*/ sel_setHighlighted_ = sel_registerName("setHighlighted:");
1734
public static final int /*long*/ sel_setHighlightedTableColumn_ = sel_registerName("setHighlightedTableColumn:");
1739
public static final int /*long*/ sel_setHighlightedTableColumn_ = sel_registerName("setHighlightedTableColumn:");
1740
public static final int /*long*/ sel_setHighlightsBy_ = sel_registerName("setHighlightsBy:");
1735
public static final int /*long*/ sel_setHorizontalScroller_ = sel_registerName("setHorizontalScroller:");
1741
public static final int /*long*/ sel_setHorizontalScroller_ = sel_registerName("setHorizontalScroller:");
1736
public static final int /*long*/ sel_setHorizontallyResizable_ = sel_registerName("setHorizontallyResizable:");
1742
public static final int /*long*/ sel_setHorizontallyResizable_ = sel_registerName("setHorizontallyResizable:");
1737
public static final int /*long*/ sel_setIcon_ = sel_registerName("setIcon:");
1743
public static final int /*long*/ sel_setIcon_ = sel_registerName("setIcon:");
Lines 1775-1780 Link Here
1775
public static final int /*long*/ sel_setMaximumIntegerDigits_ = sel_registerName("setMaximumIntegerDigits:");
1781
public static final int /*long*/ sel_setMaximumIntegerDigits_ = sel_registerName("setMaximumIntegerDigits:");
1776
public static final int /*long*/ sel_setMenu_ = sel_registerName("setMenu:");
1782
public static final int /*long*/ sel_setMenu_ = sel_registerName("setMenu:");
1777
public static final int /*long*/ sel_setMenu_forSegment_ = sel_registerName("setMenu:forSegment:");
1783
public static final int /*long*/ sel_setMenu_forSegment_ = sel_registerName("setMenu:forSegment:");
1784
public static final int /*long*/ sel_setMenuFormRepresentation_ = sel_registerName("setMenuFormRepresentation:");
1778
public static final int /*long*/ sel_setMessage_ = sel_registerName("setMessage:");
1785
public static final int /*long*/ sel_setMessage_ = sel_registerName("setMessage:");
1779
public static final int /*long*/ sel_setMessageText_ = sel_registerName("setMessageText:");
1786
public static final int /*long*/ sel_setMessageText_ = sel_registerName("setMessageText:");
1780
public static final int /*long*/ sel_setMinSize_ = sel_registerName("setMinSize:");
1787
public static final int /*long*/ sel_setMinSize_ = sel_registerName("setMinSize:");
Lines 1817-1822 Link Here
1817
public static final int /*long*/ sel_setSegmentStyle_ = sel_registerName("setSegmentStyle:");
1824
public static final int /*long*/ sel_setSegmentStyle_ = sel_registerName("setSegmentStyle:");
1818
public static final int /*long*/ sel_setSelectable_ = sel_registerName("setSelectable:");
1825
public static final int /*long*/ sel_setSelectable_ = sel_registerName("setSelectable:");
1819
public static final int /*long*/ sel_setSelected_forSegment_ = sel_registerName("setSelected:forSegment:");
1826
public static final int /*long*/ sel_setSelected_forSegment_ = sel_registerName("setSelected:forSegment:");
1827
public static final int /*long*/ sel_setSelectedItemIdentifier_ = sel_registerName("setSelectedItemIdentifier:");
1820
public static final int /*long*/ sel_setSelectedRange_ = sel_registerName("setSelectedRange:");
1828
public static final int /*long*/ sel_setSelectedRange_ = sel_registerName("setSelectedRange:");
1821
public static final int /*long*/ sel_setSelectedSegment_ = sel_registerName("setSelectedSegment:");
1829
public static final int /*long*/ sel_setSelectedSegment_ = sel_registerName("setSelectedSegment:");
1822
public static final int /*long*/ sel_setSelectedTextAttributes_ = sel_registerName("setSelectedTextAttributes:");
1830
public static final int /*long*/ sel_setSelectedTextAttributes_ = sel_registerName("setSelectedTextAttributes:");
Lines 1826-1831 Link Here
1826
public static final int /*long*/ sel_setShowsPrintPanel_ = sel_registerName("setShowsPrintPanel:");
1834
public static final int /*long*/ sel_setShowsPrintPanel_ = sel_registerName("setShowsPrintPanel:");
1827
public static final int /*long*/ sel_setShowsProgressPanel_ = sel_registerName("setShowsProgressPanel:");
1835
public static final int /*long*/ sel_setShowsProgressPanel_ = sel_registerName("setShowsProgressPanel:");
1828
public static final int /*long*/ sel_setShowsResizeIndicator_ = sel_registerName("setShowsResizeIndicator:");
1836
public static final int /*long*/ sel_setShowsResizeIndicator_ = sel_registerName("setShowsResizeIndicator:");
1837
public static final int /*long*/ sel_setShowsStateBy_ = sel_registerName("setShowsStateBy:");
1829
public static final int /*long*/ sel_setShowsToolbarButton_ = sel_registerName("setShowsToolbarButton:");
1838
public static final int /*long*/ sel_setShowsToolbarButton_ = sel_registerName("setShowsToolbarButton:");
1830
public static final int /*long*/ sel_setSize_ = sel_registerName("setSize:");
1839
public static final int /*long*/ sel_setSize_ = sel_registerName("setSize:");
1831
public static final int /*long*/ sel_setState_ = sel_registerName("setState:");
1840
public static final int /*long*/ sel_setState_ = sel_registerName("setState:");
Lines 2108-2113 Link Here
2108
public static final int NSCompositeCopy = 1;
2117
public static final int NSCompositeCopy = 1;
2109
public static final int NSCompositeSourceOver = 2;
2118
public static final int NSCompositeSourceOver = 2;
2110
public static final int NSCompositeXOR = 10;
2119
public static final int NSCompositeXOR = 10;
2120
public static final int NSContentsCellMask = 1;
2111
public static final int NSControlKeyMask = 262144;
2121
public static final int NSControlKeyMask = 262144;
2112
public static final int NSCriticalAlertStyle = 2;
2122
public static final int NSCriticalAlertStyle = 2;
2113
public static final int NSCurveToBezierPathElement = 2;
2123
public static final int NSCurveToBezierPathElement = 2;
Lines 2174-2179 Link Here
2174
public static final int NSNonZeroWindingRule = 0;
2184
public static final int NSNonZeroWindingRule = 0;
2175
public static final int NSNonactivatingPanelMask = 128;
2185
public static final int NSNonactivatingPanelMask = 128;
2176
public static final int NSOffState = 0;
2186
public static final int NSOffState = 0;
2187
public static final int NSOnOffButton = 6;
2177
public static final int NSOnState = 1;
2188
public static final int NSOnState = 1;
2178
public static final int NSOpenGLPFAAccumSize = 14;
2189
public static final int NSOpenGLPFAAccumSize = 14;
2179
public static final int NSOpenGLPFAAlphaSize = 11;
2190
public static final int NSOpenGLPFAAlphaSize = 11;
Lines 2233-2238 Link Here
2233
public static final int NSTerminateNow = 1;
2244
public static final int NSTerminateNow = 1;
2234
public static final int NSTextFieldAndStepperDatePickerStyle = 0;
2245
public static final int NSTextFieldAndStepperDatePickerStyle = 0;
2235
public static final int NSTitledWindowMask = 1;
2246
public static final int NSTitledWindowMask = 1;
2247
public static final int NSToolbarDisplayModeIconAndLabel = 1;
2248
public static final int NSToolbarDisplayModeIconOnly = 2;
2249
public static final int NSToolbarDisplayModeLabelOnly = 3;
2236
public static final int NSUnderlineStyleDouble = 9;
2250
public static final int NSUnderlineStyleDouble = 9;
2237
public static final int NSUnderlineStyleNone = 0;
2251
public static final int NSUnderlineStyleNone = 0;
2238
public static final int NSUnderlineStyleSingle = 1;
2252
public static final int NSUnderlineStyleSingle = 1;
Lines 3526-3531 Link Here
3526
/**
3540
/**
3527
 * @method flags=cast
3541
 * @method flags=cast
3528
 * @param arg0 flags=struct
3542
 * @param arg0 flags=struct
3543
 * @param arg1 flags=struct
3544
 */
3545
public static final native boolean objc_msgSend_bool(int /*long*/ id, int /*long*/ sel, NSPoint arg0, NSRect arg1);
3546
/**
3547
 * @method flags=cast
3548
 * @param arg0 flags=struct
3529
 */
3549
 */
3530
public static final native boolean objc_msgSend_bool(int /*long*/ id, int /*long*/ sel, NSRange arg0, int /*long*/ arg1);
3550
public static final native boolean objc_msgSend_bool(int /*long*/ id, int /*long*/ sel, NSRange arg0, int /*long*/ arg1);
3531
/**
3551
/**
(-)Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/SFCertificatePanel.java (+6 lines)
Lines 32-37 Link Here
32
	OS.objc_msgSend(this.id, OS.sel_setShowsHelp_, showsHelp);
32
	OS.objc_msgSend(this.id, OS.sel_setShowsHelp_, showsHelp);
33
}
33
}
34
34
35
public static NSRect contentRectForFrameRect(NSRect fRect, int /*long*/ aStyle) {
36
	NSRect result = new NSRect();
37
	OS.objc_msgSend_stret(result, OS.class_SFCertificatePanel, OS.sel_contentRectForFrameRect_styleMask_, fRect, aStyle);
38
	return result;
39
}
40
35
public static float /*double*/ minFrameWidthWithTitle(NSString aTitle, int /*long*/ aStyle) {
41
public static float /*double*/ minFrameWidthWithTitle(NSString aTitle, int /*long*/ aStyle) {
36
	return (float)OS.objc_msgSend_fpret(OS.class_SFCertificatePanel, OS.sel_minFrameWidthWithTitle_styleMask_, aTitle != null ? aTitle.id : 0, aStyle);
42
	return (float)OS.objc_msgSend_fpret(OS.class_SFCertificatePanel, OS.sel_minFrameWidthWithTitle_styleMask_, aTitle != null ? aTitle.id : 0, aStyle);
37
}
43
}
(-)Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/SFCertificateTrustPanel.java (+6 lines)
Lines 33-38 Link Here
33
	return result != 0 ? new SFCertificateTrustPanel(result) : null;
33
	return result != 0 ? new SFCertificateTrustPanel(result) : null;
34
}
34
}
35
35
36
public static NSRect contentRectForFrameRect(NSRect fRect, int /*long*/ aStyle) {
37
	NSRect result = new NSRect();
38
	OS.objc_msgSend_stret(result, OS.class_SFCertificateTrustPanel, OS.sel_contentRectForFrameRect_styleMask_, fRect, aStyle);
39
	return result;
40
}
41
36
public static float /*double*/ minFrameWidthWithTitle(NSString aTitle, int /*long*/ aStyle) {
42
public static float /*double*/ minFrameWidthWithTitle(NSString aTitle, int /*long*/ aStyle) {
37
	return (float)OS.objc_msgSend_fpret(OS.class_SFCertificateTrustPanel, OS.sel_minFrameWidthWithTitle_styleMask_, aTitle != null ? aTitle.id : 0, aStyle);
43
	return (float)OS.objc_msgSend_fpret(OS.class_SFCertificateTrustPanel, OS.sel_minFrameWidthWithTitle_styleMask_, aTitle != null ? aTitle.id : 0, aStyle);
38
}
44
}
(-)Eclipse SWT/cocoa/org/eclipse/swt/widgets/Button.java (-1 / +1 lines)
Lines 308-314 Link Here
308
			rect.height += EXTRA_HEIGHT;
308
			rect.height += EXTRA_HEIGHT;
309
		}
309
		}
310
	}
310
	}
311
	callSuper (id, sel, image, rect, view);
311
	super.drawImageWithFrameInView(id, sel, image, rect, view);
312
}
312
}
313
313
314
void drawInteriorWithFrame_inView (int /*long*/ id, int /*long*/ sel, NSRect cellRect, int /*long*/ viewid) {
314
void drawInteriorWithFrame_inView (int /*long*/ id, int /*long*/ sel, NSRect cellRect, int /*long*/ viewid) {
(-)Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java (-2 / +31 lines)
Lines 2128-2133 Link Here
2128
		OS.class_addMethod(cls, OS.sel_resetCursorRects, proc2, "@:");
2128
		OS.class_addMethod(cls, OS.sel_resetCursorRects, proc2, "@:");
2129
		OS.class_addMethod(cls, OS.sel_updateTrackingAreas, proc2, "@:");
2129
		OS.class_addMethod(cls, OS.sel_updateTrackingAreas, proc2, "@:");
2130
		OS.class_addMethod(cls, OS.sel_getImageView, proc2, "@:");
2130
		OS.class_addMethod(cls, OS.sel_getImageView, proc2, "@:");
2131
		OS.class_addMethod(cls, OS.sel_mouseDownCanMoveWindow, proc2, "@:");
2131
	}
2132
	}
2132
	if (needsDisplayInRectProc != 0) {
2133
	if (needsDisplayInRectProc != 0) {
2133
		OS.class_addMethod(cls, OS.sel_setNeedsDisplayInRect_, needsDisplayInRectProc, "@:{NSRect}");
2134
		OS.class_addMethod(cls, OS.sel_setNeedsDisplayInRect_, needsDisplayInRectProc, "@:{NSRect}");
Lines 2285-2291 Link Here
2285
	addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc);	
2286
	addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc);	
2286
	OS.class_addMethod (cls, OS.sel_drawImage_withFrame_inView_, drawImageWithFrameInViewProc, "@:@{NSRect}@");
2287
	OS.class_addMethod (cls, OS.sel_drawImage_withFrame_inView_, drawImageWithFrameInViewProc, "@:@{NSRect}@");
2287
	OS.class_addMethod (cls, OS.sel_drawTitle_withFrame_inView_, drawTitleWithFrameInViewProc, "@:@{NSRect}@");
2288
	OS.class_addMethod (cls, OS.sel_drawTitle_withFrame_inView_, drawTitleWithFrameInViewProc, "@:@{NSRect}@");
2288
	OS.class_addMethod(cls, OS.sel_cellSize, cellSizeProc, "@:");
2289
	OS.class_addMethod(cls, OS.sel_drawInteriorWithFrame_inView_, drawInteriorWithFrameInViewProc, "@:{NSRect}@");
2289
	OS.class_addMethod(cls, OS.sel_drawInteriorWithFrame_inView_, drawInteriorWithFrameInViewProc, "@:{NSRect}@");
2290
	OS.class_addMethod(cls, OS.sel_titleRectForBounds_, titleRectForBoundsProc, "@:{NSRect}");
2290
	OS.class_addMethod(cls, OS.sel_titleRectForBounds_, titleRectForBoundsProc, "@:{NSRect}");
2291
	OS.class_addMethod(cls, OS.sel_cellSizeForBounds_, cellSizeForBoundsProc, "@:{NSRect}");
2291
	OS.class_addMethod(cls, OS.sel_cellSizeForBounds_, cellSizeForBoundsProc, "@:{NSRect}");
Lines 2684-2689 Link Here
2684
	addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc);
2684
	addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc);
2685
	OS.objc_registerClassPair(cls);
2685
	OS.objc_registerClassPair(cls);
2686
	
2686
	
2687
	className = "SWTToolbar";
2688
	cls = OS.objc_allocateClassPair(OS.class_NSToolbar, className, 0);
2689
	OS.class_addIvar(cls, SWT_OBJECT, size, (byte)align, types);
2690
	OS.class_addMethod(cls, OS.sel_toolbar_itemForItemIdentifier_willBeInsertedIntoToolbar_, proc5, "@:@@Z");
2691
	OS.class_addMethod(cls, OS.sel_toolbarAllowedItemIdentifiers_, proc3, "@:@");
2692
	OS.class_addMethod(cls, OS.sel_toolbarDefaultItemIdentifiers_, proc3, "@:@");
2693
	OS.class_addMethod(cls, OS.sel_toolbarSelectableItemIdentifiers_, proc3, "@:@");
2694
	addEventMethods(cls, proc2, proc3, drawRectProc, hitTestProc, setNeedsDisplayInRectProc);
2695
	addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc);
2696
	addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc);
2697
	OS.objc_registerClassPair(cls);
2698
	
2699
	className = "SWTToolbarView";
2700
	cls = OS.objc_allocateClassPair(OS.class_NSToolbarView, className, 0);
2701
	OS.class_addIvar(cls, SWT_OBJECT, size, (byte)align, types);
2702
	addEventMethods(cls, proc2, proc3, drawRectProc, hitTestProc, setNeedsDisplayInRectProc);
2703
	addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc);
2704
	OS.objc_registerClassPair(cls);
2705
	
2687
	className = "SWTWindowDelegate";
2706
	className = "SWTWindowDelegate";
2688
	cls = OS.objc_allocateClassPair(OS.class_NSObject, className, 0);
2707
	cls = OS.objc_allocateClassPair(OS.class_NSObject, className, 0);
2689
	OS.class_addIvar(cls, SWT_OBJECT, size, (byte)align, types);
2708
	OS.class_addIvar(cls, SWT_OBJECT, size, (byte)align, types);
Lines 4608-4614 Link Here
4608
		// number passed to windowWithWindowNumber returns nil the window doesn't belong to
4627
		// number passed to windowWithWindowNumber returns nil the window doesn't belong to
4609
		// this process.
4628
		// this process.
4610
		if (window != null) {
4629
		if (window != null) {
4611
			NSView contentView = window.contentView();
4630
			NSView contentView = window.contentView().superview();
4612
			if (contentView != null && OS.NSPointInRect(screenLocation, window.frame())) {
4631
			if (contentView != null && OS.NSPointInRect(screenLocation, window.frame())) {
4613
				NSPoint location = window.convertScreenToBase(screenLocation);
4632
				NSPoint location = window.convertScreenToBase(screenLocation);
4614
				view = contentView.hitTest (location);
4633
				view = contentView.hitTest (location);
Lines 5115-5120 Link Here
5115
		return widget.accessibilityParameterizedAttributeNames(id, sel);
5134
		return widget.accessibilityParameterizedAttributeNames(id, sel);
5116
	} else if (sel == OS.sel_getImageView) {
5135
	} else if (sel == OS.sel_getImageView) {
5117
		return widget.imageView();
5136
		return widget.imageView();
5137
	} else if (sel == OS.sel_mouseDownCanMoveWindow) {
5138
		return (widget.mouseDownCanMoveWindow(id, sel) ? 1 : 0);
5118
	} else if (sel == OS.sel_accessibilityFocusedUIElement) {
5139
	} else if (sel == OS.sel_accessibilityFocusedUIElement) {
5119
		return widget.accessibilityFocusedUIElement(id, sel);
5140
		return widget.accessibilityFocusedUIElement(id, sel);
5120
	} else if (sel == OS.sel_accessibilityIsIgnored) {
5141
	} else if (sel == OS.sel_accessibilityIsIgnored) {
Lines 5389-5394 Link Here
5389
		widget.windowDidMiniturize(id, sel, arg0);
5410
		widget.windowDidMiniturize(id, sel, arg0);
5390
	} else if (sel == OS.sel_windowDidDeminiaturize_) {
5411
	} else if (sel == OS.sel_windowDidDeminiaturize_) {
5391
		widget.windowDidDeminiturize(id, sel, arg0);
5412
		widget.windowDidDeminiturize(id, sel, arg0);
5413
	} else if (sel == OS.sel_toolbarAllowedItemIdentifiers_) {
5414
		return widget.toolbarAllowedItemIdentifiers(id, sel, arg0);
5415
	} else if (sel == OS.sel_toolbarDefaultItemIdentifiers_) {
5416
		return widget.toolbarDefaultItemIdentifiers(id, sel, arg0);
5417
	} else if (sel == OS.sel_toolbarSelectableItemIdentifiers_) {
5418
		return widget.toolbarSelectableItemIdentifiers(id, sel, arg0);
5392
	}
5419
	}
5393
	return 0;
5420
	return 0;
5394
}
5421
}
Lines 5499-5504 Link Here
5499
		return (widget.tableView_writeRowsWithIndexes_toPasteboard(id, sel, arg0, arg1, arg2) ? 1 : 0);
5526
		return (widget.tableView_writeRowsWithIndexes_toPasteboard(id, sel, arg0, arg1, arg2) ? 1 : 0);
5500
	} else if (sel == OS.sel_outlineView_writeItems_toPasteboard_) {
5527
	} else if (sel == OS.sel_outlineView_writeItems_toPasteboard_) {
5501
		return (widget.outlineView_writeItems_toPasteboard(id, sel, arg0, arg1, arg2) ? 1 : 0);
5528
		return (widget.outlineView_writeItems_toPasteboard(id, sel, arg0, arg1, arg2) ? 1 : 0);
5529
	} else if (sel == OS.sel_toolbar_itemForItemIdentifier_willBeInsertedIntoToolbar_) {
5530
		return widget.toolbar_itemForItemIdentifier_willBeInsertedIntoToolbar(id, sel, arg0, arg1, arg2 != 0);
5502
	}
5531
	}
5503
	return 0;
5532
	return 0;
5504
}
5533
}
(-)Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java (-1 / +26 lines)
Lines 410-415 Link Here
410
	return new Shell (display, null, SWT.NO_TRIM, handle, true);
410
	return new Shell (display, null, SWT.NO_TRIM, handle, true);
411
}
411
}
412
412
413
Control [] _getChildren () {
414
	Control [] children = super._getChildren();
415
	if (window.toolbar() != null) {
416
		NSArray views = window.contentView().superview().subviews();
417
		for (int i = 0; i < views.count(); i++) {
418
			id id = views.objectAtIndex(i);
419
			Widget widget = display.getWidget (new NSView(id));
420
			if (widget != null && widget instanceof ToolBar) {
421
				Control [] newChildren = new Control [children.length + 1];
422
				System.arraycopy (children, 0, newChildren, 1, children.length);
423
				newChildren[0] = (Control)widget;
424
				children = newChildren;
425
				break;
426
			}
427
		}
428
	}
429
	return children;
430
}
431
413
static int checkStyle (Shell parent, int style) {
432
static int checkStyle (Shell parent, int style) {
414
	style = Decorations.checkStyle (style);
433
	style = Decorations.checkStyle (style);
415
	style &= ~SWT.TRANSPARENT;
434
	style &= ~SWT.TRANSPARENT;
Lines 1494-1503 Link Here
1494
		frame.y = screenHeight - (int)(y + frame.height);
1513
		frame.y = screenHeight - (int)(y + frame.height);
1495
		window.setFrame(frame, isVisible(), true);
1514
		window.setFrame(frame, isVisible(), true);
1496
	} else {
1515
	} else {
1516
	    NSToolbar toolbar = window.toolbar();
1517
	    int /*long*/ toolbarHeight = 0;
1518
	    if ((toolbar != null) && toolbar.isVisible()) {
1519
	        NSRect windowFrame = NSWindow.contentRectForFrameRect(window.frame(), window.styleMask());
1520
	        toolbarHeight = (int/*64*/) (windowFrame.height - window.contentView().frame().height);
1521
	    }
1497
		frame.x = x;
1522
		frame.x = x;
1498
		frame.y = screenHeight - (int)(y + height);
1523
		frame.y = screenHeight - (int)(y + height);
1499
		frame.width = width;
1524
		frame.width = width;
1500
		frame.height = height;
1525
		frame.height = height - toolbarHeight;
1501
		window.setFrame(frame, isVisible());
1526
		window.setFrame(frame, isVisible());
1502
	}
1527
	}
1503
}
1528
}
(-)Eclipse SWT/cocoa/org/eclipse/swt/widgets/ToolBar.java (-29 / +220 lines)
Lines 47-54 Link Here
47
public class ToolBar extends Composite {
47
public class ToolBar extends Composite {
48
	int itemCount;
48
	int itemCount;
49
	ToolItem [] items;
49
	ToolItem [] items;
50
	NSToolbar toolbar;
50
	NSArray accessibilityAttributes = null;
51
	NSArray accessibilityAttributes = null;
51
	ToolItem lastFocus;
52
	ToolItem lastFocus;
53
	static int NEXT_ID;
52
54
53
/**
55
/**
54
 * Constructs a new instance of this class given its parent
56
 * Constructs a new instance of this class given its parent
Lines 84-90 Link Here
84
 * @see Widget#getStyle()
86
 * @see Widget#getStyle()
85
 */
87
 */
86
public ToolBar (Composite parent, int style) {
88
public ToolBar (Composite parent, int style) {
87
	super (parent, checkStyle (style));
89
	super (parent, checkStyle (parent, style));
88
	
90
	
89
	/*
91
	/*
90
	* Ensure that either of HORIZONTAL or VERTICAL is set.
92
	* Ensure that either of HORIZONTAL or VERTICAL is set.
Lines 141-147 Link Here
141
	return super.accessibilityIsIgnored(id, sel);	
143
	return super.accessibilityIsIgnored(id, sel);	
142
}
144
}
143
145
144
static int checkStyle (int style) {
146
static int checkStyle (Composite parent, int style) {
145
	/*
147
	/*
146
	* Even though it is legal to create this widget
148
	* Even though it is legal to create this widget
147
	* with scroll bars, they serve no useful purpose
149
	* with scroll bars, they serve no useful purpose
Lines 149-155 Link Here
149
	* widget's client area.  The fix is to clear
151
	* widget's client area.  The fix is to clear
150
	* the SWT style.
152
	* the SWT style.
151
	*/
153
	*/
152
	return style & ~(SWT.H_SCROLL | SWT.V_SCROLL);
154
	int newStyle = style & ~(SWT.H_SCROLL | SWT.V_SCROLL);
155
	
156
	/*
157
	 * A unified toolbar can only be parented to a Shell, and
158
	 * there can only be one unified toolbar per shell. If neither of these
159
	 * conditions hold, turn off the SMOOTH flag.
160
	 */
161
	if ((newStyle & SWT.SMOOTH) != 0) {
162
		if (parent instanceof Shell) {
163
			Shell s = (Shell)parent;
164
			if (s.window.toolbar() != null) newStyle &= ~SWT.SMOOTH;
165
		} else {
166
			newStyle &= ~SWT.SMOOTH;
167
		}
168
	}
169
	
170
	/*
171
	 * Unified toolbar only supports a horizontal layout, and doesn't wrap.
172
	 */
173
	if ((newStyle & SWT.SMOOTH) != 0) {
174
		newStyle &= ~(SWT.VERTICAL | SWT.WRAP); 
175
		newStyle |= SWT.HORIZONTAL;
176
	}
177
	
178
	return newStyle;
153
}
179
}
154
180
155
protected void checkSubclass () {
181
protected void checkSubclass () {
Lines 186-205 Link Here
186
}
212
}
187
213
188
void createHandle () {
214
void createHandle () {
189
	state |= THEME_BACKGROUND;
215
	if ((style & SWT.SMOOTH) != 0) {
190
	if (hasBorder()) {
216
		toolbar = ((NSToolbar)new SWTToolbar().alloc()).initWithIdentifier(NSString.stringWith(String.valueOf(NEXT_ID++)));
191
		NSRect rect = new NSRect();
217
		toolbar.setDelegate(toolbar);
192
		NSScrollView scrollWidget = (NSScrollView)new SWTScrollView().alloc();
218
		toolbar.setDisplayMode(OS.NSToolbarDisplayModeIconAndLabel);
193
		scrollWidget.initWithFrame (rect);
219
		NSWindow window = parent.view.window();
194
		scrollWidget.setDrawsBackground(false);
220
		window.setToolbar(toolbar);
195
		scrollWidget.setBorderType(OS.NSBezelBorder);
221
		toolbar.setVisible(true);
196
		scrollView = scrollWidget;
222
		NSArray views = window.contentView().superview().subviews();
197
	}
223
		for (int i = 0; i < views.count(); i++) {
198
	NSView widget = (NSView)new SWTView().alloc();
224
			id id = views.objectAtIndex(i);
199
	widget.init();
225
			if (new NSObject(id).className().getString().equals("NSToolbarView")) {
200
//	widget.setDrawsBackground(false);
226
				view = new NSView(id);
201
	view = widget;
227
				OS.object_setClass(view.id, OS.objc_getClass("SWTToolbarView"));
202
	if (scrollView != null) view.setAutoresizingMask(OS.NSViewHeightSizable | OS.NSViewWidthSizable);
228
				view.retain();
229
				break;
230
			}
231
		}
232
	} else {
233
		state |= THEME_BACKGROUND;
234
		if (hasBorder()) {
235
			NSRect rect = new NSRect();
236
			NSScrollView scrollWidget = (NSScrollView)new SWTScrollView().alloc();
237
			scrollWidget.initWithFrame (rect);
238
			scrollWidget.setDrawsBackground(false);
239
			scrollWidget.setBorderType(OS.NSBezelBorder);
240
			scrollView = scrollWidget;
241
		}
242
		NSView widget = (NSView)new SWTView().alloc();
243
		widget.init();
244
		view = widget;
245
		if (scrollView != null) view.setAutoresizingMask(OS.NSViewHeightSizable | OS.NSViewWidthSizable);
246
	}
203
}
247
}
204
248
205
void createItem (ToolItem item, int index) {
249
void createItem (ToolItem item, int index) {
Lines 209-218 Link Here
209
		System.arraycopy (items, 0, newItems, 0, items.length);
253
		System.arraycopy (items, 0, newItems, 0, items.length);
210
		items = newItems;
254
		items = newItems;
211
	}
255
	}
212
	item.createWidget();
256
	if ((style & SWT.SMOOTH) != 0) {
213
	view.addSubview(item.view);
257
		item.style |= SWT.SMOOTH;
258
	}
259
    item.createWidget();
214
	System.arraycopy (items, index, items, index + 1, itemCount++ - index);
260
	System.arraycopy (items, index, items, index + 1, itemCount++ - index);
215
	items [index] = item;
261
	items [index] = item;
262
	if ((style & SWT.SMOOTH) != 0) {
263
        toolbar.insertItemWithItemIdentifier(item.getItemID(), index);	    
264
	} else {
265
        view.addSubview(item.view);
266
	}
216
	relayout ();
267
	relayout ();
217
}
268
}
218
269
Lines 222-227 Link Here
222
	itemCount = 0;
273
	itemCount = 0;
223
}
274
}
224
275
276
NSFont defaultNSFont() {
277
	return NSFont.systemFontOfSize(11.0f);
278
}
279
280
void deregister () {
281
	super.deregister ();
282
	if (toolbar != null) display.removeWidget (toolbar);
283
}
284
225
void destroyItem (ToolItem item) {
285
void destroyItem (ToolItem item) {
226
	int index = 0;
286
	int index = 0;
227
	while (index < itemCount) {
287
	while (index < itemCount) {
Lines 232-238 Link Here
232
	if (item == lastFocus) lastFocus = null;
292
	if (item == lastFocus) lastFocus = null;
233
	System.arraycopy (items, index + 1, items, index, --itemCount - index);
293
	System.arraycopy (items, index + 1, items, index, --itemCount - index);
234
	items [itemCount] = null;
294
	items [itemCount] = null;
235
	item.view.removeFromSuperview();
295
	if ((style & SWT.SMOOTH) != 0) {
296
		toolbar.removeItemAtIndex(index);
297
	} else {
298
		item.view.removeFromSuperview();
299
	}
236
	relayout ();
300
	relayout ();
237
}
301
}
238
302
Lines 262-267 Link Here
262
	return super.findTooltip (pt);
326
	return super.findTooltip (pt);
263
}
327
}
264
328
329
public Rectangle getBounds () {
330
	checkWidget();
331
	NSRect rect = view.frame();
332
	if (view.isFlipped()) {
333
		rect.y = view.bounds().height - rect.y;
334
	}
335
	return new Rectangle((int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height);
336
}
337
265
boolean forceFocus (NSView focusView) {
338
boolean forceFocus (NSView focusView) {
266
	if (lastFocus != null && lastFocus.setFocus ()) return true;
339
	if (lastFocus != null && lastFocus.setFocus ()) return true;
267
	ToolItem [] items = getItems ();
340
	ToolItem [] items = getItems ();
Lines 448-453 Link Here
448
	return new int [] {rows, maxX, y + itemHeight};
521
	return new int [] {rows, maxX, y + itemHeight};
449
}
522
}
450
523
524
int [] layoutUnified (int width, int height, boolean resize) {
525
	int x = 0, y = 0;
526
	int itemHeight = 0, maxX = 0;
527
	Point [] sizes = new Point [itemCount];
528
	NSRect [] containerSizes = new NSRect[itemCount];
529
	// This next line relies on the observation that all of the toolbar item views are children of the first
530
	// subview of the NSToolbarView.
531
	NSArray itemViewers = new NSView(view.subviews().objectAtIndex(0)).subviews();
532
	for (int i=0; i<itemCount; i++) {
533
		Point size = sizes [i] = items [i].computeSize ();
534
		containerSizes [i] = new NSView(itemViewers.objectAtIndex(i)).frame();
535
		if (i == 0) x = (int) containerSizes[0].x;
536
		itemHeight = Math.max (itemHeight, size.y);
537
	}
538
	for (int i=0; i<itemCount; i++) {
539
		ToolItem item = items [i];
540
		Point size = sizes [i];
541
		if (resize) {
542
			item.setBounds (0, 0, size.x, itemHeight);
543
			Control control = item.control;
544
			if (control != null) {
545
				control.setBounds (x, y, size.x, itemHeight);
546
			}
547
		}
548
		x += containerSizes[i].width;
549
		maxX = Math.max (maxX, x);
550
	}
551
	
552
	return new int [] {1, maxX, itemHeight};
553
}
554
451
int [] layoutVertical (int width, int height, boolean resize) {
555
int [] layoutVertical (int width, int height, boolean resize) {
452
	int xSpacing = 2, ySpacing = 0;
556
	int xSpacing = 2, ySpacing = 0;
453
	int marginWidth = 0, marginHeight = 0;
557
	int marginWidth = 0, marginHeight = 0;
Lines 485-497 Link Here
485
}
589
}
486
590
487
int [] layout (int nWidth, int nHeight, boolean resize) {
591
int [] layout (int nWidth, int nHeight, boolean resize) {
488
	if ((style & SWT.VERTICAL) != 0) {
592
	if ((style & SWT.SMOOTH) != 0) {
489
		return layoutVertical (nWidth, nHeight, resize);
593
		boolean hasText = false;
594
		boolean hasImage = false;
595
		for (int i = 0; i < itemCount; i++) {
596
			hasText |= items[i].getText().length() > 0;
597
			hasImage |= items[i].getControl() != null;
598
			hasImage |= items[i].getImage() != null;
599
			if (hasText && hasImage) break;
600
		}
601
		
602
		if (hasText && hasImage) {
603
			toolbar.setDisplayMode(OS.NSToolbarDisplayModeIconAndLabel);
604
		} else if (hasText) {
605
			toolbar.setDisplayMode(OS.NSToolbarDisplayModeLabelOnly);
606
		} else {
607
			toolbar.setDisplayMode(OS.NSToolbarDisplayModeIconOnly);
608
		}
609
	}
610
	
611
	if ((style & SWT.SMOOTH) != 0) {
612
		return layoutUnified(nWidth, nHeight, resize);
490
	} else {
613
	} else {
491
		return layoutHorizontal (nWidth, nHeight, resize);
614
		if ((style & SWT.VERTICAL) != 0) {
615
			return layoutVertical (nWidth, nHeight, resize);
616
		} else {
617
			return layoutHorizontal (nWidth, nHeight, resize);
618
		}
492
	}
619
	}
493
}
620
}
494
621
622
void register() {
623
	super.register();
624
	if (toolbar != null) display.addWidget (toolbar, this);
625
}
626
495
void relayout () {
627
void relayout () {
496
	if (!getDrawing()) return;
628
	if (!getDrawing()) return;
497
	Rectangle rect = getClientArea ();
629
	Rectangle rect = getClientArea ();
Lines 513-519 Link Here
513
}
645
}
514
646
515
void releaseHandle () {
647
void releaseHandle () {
516
	super.releaseHandle ();
648
    super.releaseHandle ();
649
650
    if (toolbar != null) {
651
        toolbar.release();
652
        toolbar = null;
653
	}
654
517
	if (accessibilityAttributes != null) accessibilityAttributes.release();
655
	if (accessibilityAttributes != null) accessibilityAttributes.release();
518
	accessibilityAttributes = null;
656
	accessibilityAttributes = null;
519
}
657
}
Lines 547-560 Link Here
547
	case SWT.MouseMove:
685
	case SWT.MouseMove:
548
		// Start with the global mouse location, as the MouseEnter may occur due to
686
		// Start with the global mouse location, as the MouseEnter may occur due to
549
		// an application-activated event, which isn't associated with a window.
687
		// an application-activated event, which isn't associated with a window.
550
		NSPoint toolbarPoint = NSEvent.mouseLocation();
688
		NSPoint windowPoint = NSEvent.mouseLocation();
551
		toolbarPoint = view.window().convertScreenToBase(toolbarPoint);
689
		windowPoint = view.window().convertScreenToBase(windowPoint);
552
		toolbarPoint = view.convertPoint_fromView_(toolbarPoint, null);
553
		for (int i = 0; i < itemCount; i++) {
690
		for (int i = 0; i < itemCount; i++) {
554
			ToolItem item = items [i];
691
			ToolItem item = items [i];
555
			int currState = item.state;
692
			int currState = item.state;
556
			
693
			NSPoint viewPoint = item.view.convertPoint_fromView_(windowPoint, null); 
557
			if (OS.NSPointInRect(toolbarPoint, item.view.frame())) {
694
			if (item.view.mouse(viewPoint, item.view.bounds())) {
558
				item.state |= Widget.HOT;
695
				item.state |= Widget.HOT;
559
			} else {
696
			} else {
560
				item.state &= ~Widget.HOT;				
697
				item.state &= ~Widget.HOT;				
Lines 576-581 Link Here
576
	return super.sendMouseEvent(nsEvent, type, send);
713
	return super.sendMouseEvent(nsEvent, type, send);
577
}
714
}
578
715
716
void setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
717
	// In unified toolbar case, the toolbar view size and position is completely controlled
718
	// by the window, so don't change its bounds or location.
719
	if ((style & SWT.SMOOTH) != 0) return;
720
	super.setBounds(x, y, width, height, move, resize);
721
}
722
	
579
void setFont(NSFont font) {
723
void setFont(NSFont font) {
580
	for (int i = 0; i < itemCount; i++) {
724
	for (int i = 0; i < itemCount; i++) {
581
		ToolItem item = items[i];
725
		ToolItem item = items[i];
Lines 589-594 Link Here
589
	if (redraw && drawCount == 0) relayout();
733
	if (redraw && drawCount == 0) relayout();
590
}
734
}
591
735
736
public void setVisible(boolean visible) {
737
    if (toolbar != null) toolbar.setVisible(visible);
738
    super.setVisible(visible);
739
}
740
741
int /*long*/ toolbar_itemForItemIdentifier_willBeInsertedIntoToolbar(int /*long*/ id, int /*long*/ sel, int /*long*/ toolbar, int /*long*/ itemIdentifier, boolean flag) {
742
	NSString itemID = new NSString(itemIdentifier);
743
	for (int j = 0; j < itemCount; j++) {
744
		ToolItem item = items[j];
745
		if (itemID.isEqual(item.nsItem.itemIdentifier())) {
746
			return item.nsItem.id;
747
		}
748
	}
749
	return 0;
750
}
751
752
/*
753
 * Returns an array of all toolbar item IDs allowed to be in the toolbar. Since the ToolBar created all of the ToolItems
754
 * return all of the item IDs.
755
 */
756
int /*long*/ toolbarAllowedItemIdentifiers(int /*long*/ id, int /*long*/ sel, int /*long*/ toolbar) {
757
	NSMutableArray array = NSMutableArray.arrayWithCapacity(itemCount);
758
	for (int i = 0; i < itemCount; i++) {
759
		array.addObject(items[i].nsItem.itemIdentifier());
760
	}
761
	return array.id;
762
}
763
764
/*
765
 * This delegate method isn't really needed because ToolBars aren't customizable, but it's required according to the documentation.
766
 */
767
int /*long*/ toolbarDefaultItemIdentifiers(int /*long*/ id, int /*long*/ sel, int /*long*/ toolbar) {
768
	return toolbarAllowedItemIdentifiers(id, sel, toolbar);
769
}
770
771
/*
772
 * toolbarSelectableItemIdentifiers returns an array of all items that can be the selected item, as determined
773
 * by setSelectedItemIdentifier. 
774
 */
775
int /*long*/ toolbarSelectableItemIdentifiers(int /*long*/ id, int /*long*/ sel, int /*long*/ toolbar) {
776
	NSMutableArray array = NSMutableArray.arrayWithCapacity(itemCount);
777
	for (int i = 0; i < itemCount; i++) {
778
		if ((items[i].style & SWT.RADIO) != 0) array.addObject(items[i].nsItem.itemIdentifier());
779
	}
780
	return array.id;
781
}
782
592
boolean translateTraversal (int key, NSEvent theEvent, boolean[] consume) {
783
boolean translateTraversal (int key, NSEvent theEvent, boolean[] consume) {
593
	boolean result = super.translateTraversal (key, theEvent, consume);
784
	boolean result = super.translateTraversal (key, theEvent, consume);
594
	if (result) return result;
785
	if (result) return result;
(-)Eclipse SWT/cocoa/org/eclipse/swt/widgets/ToolItem.java (-71 / +217 lines)
Lines 39-44 Link Here
39
public class ToolItem extends Item {
39
public class ToolItem extends Item {
40
	NSView view;
40
	NSView view;
41
	NSButton button;
41
	NSButton button;
42
	NSToolbarItem nsItem;
43
	NSMenuItem nsMenuRep;
44
	NSString id;
42
	int width = DEFAULT_SEPARATOR_WIDTH;
45
	int width = DEFAULT_SEPARATOR_WIDTH;
43
	ToolBar parent;
46
	ToolBar parent;
44
	Image hotImage, disabledImage;
47
	Image hotImage, disabledImage;
Lines 46-51 Link Here
46
	Control control;
49
	Control control;
47
	boolean selection;
50
	boolean selection;
48
51
52
	static final int SEPARATOR_MASK = SWT.SEPARATOR | SWT.SPACER | SWT.FLEX_SPACER;
49
	static final int DEFAULT_WIDTH = 24;
53
	static final int DEFAULT_WIDTH = 24;
50
	static final int DEFAULT_HEIGHT = 22;
54
	static final int DEFAULT_HEIGHT = 22;
51
	static final int DEFAULT_SEPARATOR_WIDTH = 6;
55
	static final int DEFAULT_SEPARATOR_WIDTH = 6;
Lines 301-307 Link Here
301
Point computeSize () {
305
Point computeSize () {
302
	checkWidget();
306
	checkWidget();
303
	int width = 0, height = 0;
307
	int width = 0, height = 0;
304
	if ((style & SWT.SEPARATOR) != 0) {
308
	if ((style & SEPARATOR_MASK) != 0) {
305
		if ((parent.style & SWT.HORIZONTAL) != 0) {
309
		if ((parent.style & SWT.HORIZONTAL) != 0) {
306
			width = getWidth ();
310
			width = getWidth ();
307
			height = DEFAULT_HEIGHT;
311
			height = DEFAULT_HEIGHT;
Lines 314-321 Link Here
314
		}
318
		}
315
	} else {
319
	} else {
316
		if (text.length () != 0 || image != null) {
320
		if (text.length () != 0 || image != null) {
317
			NSButton widget = (NSButton)button;
321
			NSSize size = button.cell().cellSize();
318
			NSSize size = widget.cell().cellSize();
319
			width = (int)Math.ceil(size.width);
322
			width = (int)Math.ceil(size.width);
320
			height = (int)Math.ceil(size.height);
323
			height = (int)Math.ceil(size.height);
321
		} else {
324
		} else {
Lines 325-367 Link Here
325
		if ((style & SWT.DROP_DOWN) != 0) {
328
		if ((style & SWT.DROP_DOWN) != 0) {
326
			width += ARROW_WIDTH + INSET;
329
			width += ARROW_WIDTH + INSET;
327
		}
330
		}
328
		width += INSET * 2;
331
329
		height += INSET * 2;
332
		if ((style & SWT.SMOOTH) == 0) {
333
			width += INSET * 2;
334
			height += INSET * 2;
335
		}
330
	}
336
	}
331
	return new Point (width, height);
337
	return new Point (width, height);
332
}
338
}
333
339
334
void createHandle () {
340
void createHandle () {
335
	if ((style & SWT.SEPARATOR) != 0) {
341
	if ((style & SWT.SMOOTH) != 0) {
336
		NSBox widget = (NSBox)new SWTBox().alloc();
342
		id = NSString.stringWith(String.valueOf(++ToolBar.NEXT_ID));
337
		widget.init();
343
		id.retain();
338
		widget.setBoxType(OS.NSBoxSeparator);
344
		nsItem = ((NSToolbarItem)new NSToolbarItem().alloc()).initWithItemIdentifier(id);
339
		widget.setBorderWidth(0);
345
		nsItem.setAction(OS.sel_sendSelection);
340
		view = widget;
346
		nsMenuRep = ((NSMenuItem)new SWTMenuItem().alloc()).initWithTitle(NSString.string(), OS.sel_sendSelection, NSString.string());
347
		nsItem.setMenuFormRepresentation(nsMenuRep);
348
	} 
349
350
	if ((style & SEPARATOR_MASK) != 0) {
351
		if ((style & SWT.SMOOTH) != 0) {
352
			view = (NSView)new SWTView().alloc();
353
			view.init();
354
		} else {
355
			NSBox widget = (NSBox)new SWTBox().alloc();
356
			widget.init();
357
			widget.setBoxType(OS.NSBoxSeparator);
358
			widget.setBorderWidth(0);
359
			view = widget;
360
		}
341
	} else {
361
	} else {
342
		NSView widget = (NSView)new SWTView().alloc();
362
		NSView widget = (NSView)new SWTView().alloc();
343
		widget.init();
363
		widget.init();
344
		button = (NSButton)new SWTButton().alloc();
364
		NSButton tbButton = (NSButton)new SWTButton().alloc();
345
		button.init();
365
		tbButton.init();
346
		/*
366
		/*
347
		* Feature in Cocoa.  NSButtons without borders do not leave any margin
367
		* Feature in Cocoa.  NSButtons without borders do not leave any margin
348
		* between their edge and their image.  The workaround is to provide a
368
		* between their edge and their image.  The workaround is to provide a
349
		* custom cell that displays the image in a better position. 
369
		* custom cell that displays the image in a better position. 
350
		*/
370
		*/
351
		NSButtonCell cell = (NSButtonCell)new SWTButtonCell ().alloc ().init ();
371
		if ((style & SWT.SMOOTH) == 0) {
352
		button.setCell (cell);
372
			NSCell cell = (NSCell)new SWTButtonCell().alloc().init();
353
		cell.release();
373
			tbButton.setCell (cell);
354
		button.setBordered(false);
374
			cell.release();
355
		button.setAction(OS.sel_sendSelection);
375
		} else {
356
		button.setTarget(button);
376
			if ((style & SWT.CHECK) != 0) tbButton.setButtonType(OS.NSPushOnPushOffButton);
377
			NSButtonCell buttonCell = new NSButtonCell(tbButton.cell().id);
378
			buttonCell.setHighlightsBy(OS.NSContentsCellMask);
379
			buttonCell.setShowsStateBy(OS.NSContentsCellMask);
380
		}
381
		tbButton.setBordered(false);
382
		tbButton.setAction(OS.sel_sendSelection);
383
		tbButton.setTarget(tbButton);
357
		Font font = parent.font != null ? parent.font : parent.defaultFont ();
384
		Font font = parent.font != null ? parent.font : parent.defaultFont ();
358
		button.setFont(font.handle);
385
		tbButton.setFont(font.handle);
359
		button.setImagePosition(OS.NSImageOverlaps);
386
		tbButton.setTitle(NSString.stringWith(""));
360
		button.setTitle(NSString.string());
387
		tbButton.setImagePosition(OS.NSImageOnly);
361
		button.setEnabled(parent.getEnabled());
388
		tbButton.setEnabled(parent.getEnabled());
362
		widget.addSubview(button);
389
		widget.addSubview(tbButton);
390
		button = tbButton;
363
		view = widget;
391
		view = widget;
364
	}
392
	}
393
394
	if (nsItem != null) {
395
		nsItem.setTarget(button);
396
		nsItem.setView(view);
397
		nsMenuRep.setTarget(button);
398
	}
365
}
399
}
366
400
367
NSAttributedString createString() {
401
NSAttributedString createString() {
Lines 386-404 Link Here
386
}
420
}
387
421
388
void drawImageWithFrameInView (int /*long*/ id, int /*long*/ sel, int /*long*/ image, NSRect rect, int /*long*/ view) {
422
void drawImageWithFrameInView (int /*long*/ id, int /*long*/ sel, int /*long*/ image, NSRect rect, int /*long*/ view) {
389
	if (text.length () > 0) {
423
	if ((style & SWT.SMOOTH) == 0) {
390
		if ((parent.style & SWT.RIGHT) != 0) {
424
		if (text.length () > 0) {
391
			rect.x += 3;
425
			if ((parent.style & SWT.RIGHT) != 0) {
392
		} else {
426
				rect.x += 3;
393
			rect.y += 3;			
427
			} else {
428
				rect.y += 3;			
429
			}
394
		}
430
		}
395
	}
431
	}
396
	callSuper (id, sel, image, rect, view);
432
	super.drawImageWithFrameInView(id, sel, image, rect, view);
397
}
433
}
398
434
399
void drawWidget (int /*long*/ id, NSGraphicsContext context, NSRect rect) {
435
void drawWidget (int /*long*/ id, NSGraphicsContext context, NSRect rect) {
400
	if (id == view.id) {
436
	if (id == view.id) {
401
		if (getSelection ()) {
437
		boolean drawSelected = getSelection() && ((style & (SWT.SMOOTH | SWT.CHECK)) == (SWT.SMOOTH | SWT.CHECK)) || ((style & SWT.SMOOTH) == 0); 
438
		if (drawSelected) {
402
			NSRect bounds = view.bounds();
439
			NSRect bounds = view.bounds();
403
			context.saveGraphicsState();
440
			context.saveGraphicsState();
404
			NSColor.colorWithCalibratedRed(0.1f, 0.1f, 0.1f, 0.1f).setFill();
441
			NSColor.colorWithCalibratedRed(0.1f, 0.1f, 0.1f, 0.1f).setFill();
Lines 435-443 Link Here
435
}
472
}
436
473
437
void enableWidget(boolean enabled) {
474
void enableWidget(boolean enabled) {
438
	if ((style & SWT.SEPARATOR) == 0) {
475
	if ((style & SWT.SMOOTH) != 0) {
439
		((NSButton)button).setEnabled(enabled);
476
		nsItem.setEnabled(enabled);
440
		updateImage(true);
477
	} else {
478
		if ((style & SEPARATOR_MASK) == 0) {
479
			((NSButton)button).setEnabled(enabled);
480
			updateImage(true);
481
		}
441
	}
482
	}
442
}
483
}
443
484
Lines 454-459 Link Here
454
 */
495
 */
455
public Rectangle getBounds () {
496
public Rectangle getBounds () {
456
	checkWidget();
497
	checkWidget();
498
	if ((style & SWT.SMOOTH) != 0) {
499
		NSRect rect = view.frame();
500
		// ToolItems in the unified toolbar are not contained directly within the Toolbar.
501
		// Convert the toolitem rect from toolitem-relative coordinates to its
502
		// parent, the toolbar, relative coordinates.
503
		rect = parent.view.convertRect_fromView_(rect, view);
504
		return new Rectangle((int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height);
505
	} 
506
457
	NSRect rect = view.frame();
507
	NSRect rect = view.frame();
458
	return new Rectangle((int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height);
508
	return new Rectangle((int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height);
459
}
509
}
Lines 540-545 Link Here
540
	return hotImage;
590
	return hotImage;
541
}
591
}
542
592
593
NSString getItemID() {
594
    NSString itemID = id;
595
    
596
    // For separators, return a Cocoa constant for the tool item ID.
597
    if ((style & SEPARATOR_MASK) != 0) {
598
    	// If we are using a non-default width or control use that instead.  
599
    	if (width == DEFAULT_SEPARATOR_WIDTH && control == null) {
600
    		if ((style & SWT.SEPARATOR) != 0) {
601
    			itemID = OS.NSToolbarSeparatorItemIdentifier;
602
    		} else if ((style & SWT.SPACER) != 0) {
603
    			itemID = OS.NSToolbarSpaceItemIdentifier;
604
    		} else if ((style & SWT.FLEX_SPACER) != 0) {
605
    			itemID = OS.NSToolbarFlexibleSpaceItemIdentifier;
606
    		}
607
    	}
608
    }
609
    
610
    return itemID;
611
}
612
543
/**
613
/**
544
 * Returns the receiver's parent, which must be a <code>ToolBar</code>.
614
 * Returns the receiver's parent, which must be a <code>ToolBar</code>.
545
 *
615
 *
Lines 652-657 Link Here
652
	}
722
	}
653
}
723
}
654
724
725
boolean mouseDownCanMoveWindow(int /*long*/ id, int /*long*/ sel) {
726
	if (id == view.id) return false;
727
	return super.mouseDownCanMoveWindow(id, sel);
728
}
729
655
void mouseUp(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) {
730
void mouseUp(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) {
656
	if (!parent.mouseEvent(parent.view.id, sel, theEvent, SWT.MouseUp)) return;
731
	if (!parent.mouseEvent(parent.view.id, sel, theEvent, SWT.MouseUp)) return;
657
	super.mouseUp(id, sel, theEvent);
732
	super.mouseUp(id, sel, theEvent);
Lines 737-742 Link Here
737
	if (view != null) view.release ();
812
	if (view != null) view.release ();
738
	if (button != null) button.release ();
813
	if (button != null) button.release ();
739
	view = button = null;
814
	view = button = null;
815
	if (nsItem != null) {
816
	    nsItem.release();
817
	    nsItem = null;
818
	}
819
	if (id != null) {
820
	    id.release();
821
	    id = null;
822
	}
823
	if (nsMenuRep != null) {
824
		nsMenuRep.release();
825
		nsMenuRep = null;
826
	}
740
	parent = null;
827
	parent = null;
741
}
828
}
742
829
Lines 770-787 Link Here
770
857
771
void setBounds (int x, int y, int width, int height) {
858
void setBounds (int x, int y, int width, int height) {
772
	NSRect rect = new NSRect();
859
	NSRect rect = new NSRect();
773
	rect.x = x;
860
	if ((style & SWT.SMOOTH) == 0) {
774
	rect.y = y;
861
		rect.x = x;
775
	rect.width = width;
862
		rect.y = y;
776
	rect.height = height;
777
	view.setFrame(rect);
778
	if (button != null) {
779
		rect.x = 0;
780
		rect.y = 0;
781
		rect.width = width;
863
		rect.width = width;
782
		rect.height = height;
864
		rect.height = height;
783
		if ((style & SWT.DROP_DOWN) != 0) rect.width -= ARROW_WIDTH + INSET;
865
		view.setFrame(rect);
784
		button.setFrame(rect);
866
		if (button != null) {
867
			rect.x = 0;
868
			rect.y = 0;
869
			rect.width = width;
870
			rect.height = height;
871
			if ((style & SWT.DROP_DOWN) != 0) rect.width -= ARROW_WIDTH + INSET;
872
			button.setFrame(rect);
873
		}
874
	} else {
875
		// Let the NSToolbar manage the position of the view in the toolbar.
876
		NSSize newSize = new NSSize();
877
		newSize.height = height;
878
		newSize.width = width;
879
		view.setFrameSize(newSize);
880
		nsItem.setMinSize(newSize);
881
		nsItem.setMaxSize(newSize);
882
		if ((style & SWT.DROP_DOWN) != 0) newSize.width -= ARROW_WIDTH + INSET;
883
		if (button != null) button.setFrameSize(newSize);
785
	}
884
	}
786
}
885
}
787
886
Lines 806-818 Link Here
806
		if (control.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
905
		if (control.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
807
		if (control.parent != parent) error (SWT.ERROR_INVALID_PARENT);
906
		if (control.parent != parent) error (SWT.ERROR_INVALID_PARENT);
808
	}
907
	}
809
	if ((style & SWT.SEPARATOR) == 0) return;
908
	if ((style & SEPARATOR_MASK) == 0) return;
810
	if (this.control == control) return;
909
    if (this.control == control) return;
811
	NSBox widget = (NSBox)view;
910
812
	if (control == null) {
911
	if ((style & SWT.SMOOTH) == 0) {
813
		widget.setBoxType(OS.NSBoxSeparator);
912
        NSBox widget = (NSBox)view;
814
	} else {
913
        if (control == null) {
815
		widget.setBoxType(OS.NSBoxCustom);
914
        	widget.setBoxType(OS.NSBoxSeparator);
915
        } else {
916
        	widget.setBoxType(OS.NSBoxCustom);
917
        }
816
	}
918
	}
817
	this.control = control;
919
	this.control = control;
818
	view.setHidden(control != null);
920
	view.setHidden(control != null);
Lines 869-875 Link Here
869
public void setDisabledImage (Image image) {
971
public void setDisabledImage (Image image) {
870
	checkWidget();
972
	checkWidget();
871
	if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
973
	if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
872
	if ((style & SWT.SEPARATOR) != 0) return;
974
	if ((style & SEPARATOR_MASK) != 0) return;
873
	disabledImage = image;
975
	disabledImage = image;
874
	updateImage (true);
976
	updateImage (true);
875
}
977
}
Lines 900-906 Link Here
900
public void setHotImage (Image image) {
1002
public void setHotImage (Image image) {
901
	checkWidget();
1003
	checkWidget();
902
	if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
1004
	if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
903
	if ((style & SWT.SEPARATOR) != 0) return;
1005
	if ((style & SEPARATOR_MASK) != 0) return;
904
	hotImage = image;
1006
	hotImage = image;
905
	updateImage (true);
1007
	updateImage (true);
906
}
1008
}
Lines 908-914 Link Here
908
public void setImage (Image image) {
1010
public void setImage (Image image) {
909
	checkWidget();
1011
	checkWidget();
910
	if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
1012
	if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
911
	if ((style & SWT.SEPARATOR) != 0) return;
1013
	if ((style & SEPARATOR_MASK) != 0) return;
912
	super.setImage (image);
1014
	super.setImage (image);
913
	updateImage (true);
1015
	updateImage (true);
914
}
1016
}
Lines 941-946 Link Here
941
	checkWidget();
1043
	checkWidget();
942
	if ((style & (SWT.CHECK | SWT.RADIO)) == 0) return;
1044
	if ((style & (SWT.CHECK | SWT.RADIO)) == 0) return;
943
	this.selection = selected;
1045
	this.selection = selected;
1046
	
1047
	if ((style & (SWT.CHECK | SWT.SMOOTH)) == (SWT.CHECK | SWT.SMOOTH)) {
1048
		button.setState (selection ? OS.NSOnState : OS.NSOffState);
1049
	}
1050
1051
	if ((style & (SWT.RADIO | SWT.SMOOTH)) == (SWT.RADIO | SWT.SMOOTH) && selection) {
1052
		parent.toolbar.setSelectedItemIdentifier(nsItem.itemIdentifier());
1053
	}
944
	view.setNeedsDisplay(true);
1054
	view.setNeedsDisplay(true);
945
}
1055
}
946
1056
Lines 972-989 Link Here
972
public void setText (String string) {
1082
public void setText (String string) {
973
	checkWidget();
1083
	checkWidget();
974
	if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
1084
	if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
975
	if ((style & SWT.SEPARATOR) != 0) return;
1085
	if ((style & SEPARATOR_MASK) != 0) return;
976
	super.setText (string);
1086
	super.setText (string);
977
	NSButton widget = (NSButton)button;
1087
	NSButton widget = (NSButton)button;
978
	widget.setAttributedTitle(createString());
1088
	if ((style & SWT.SMOOTH) != 0) {
979
	if (text.length() != 0 && image != null) {
1089
		if (text.length() > 0) {
980
		if ((parent.style & SWT.RIGHT) != 0) {
1090
			char [] chars = new char [text.length ()];
981
			widget.setImagePosition(OS.NSImageLeft);
1091
			text.getChars (0, chars.length, chars, 0);
1092
			int length = fixMnemonic (chars);
1093
			nsItem.setLabel(NSString.stringWithCharacters(chars, length));
1094
			nsMenuRep.setTitle(NSString.stringWithCharacters(chars, length));
982
		} else {
1095
		} else {
983
			widget.setImagePosition(OS.NSImageAbove);		
1096
			nsItem.setLabel(NSString.string());
1097
			nsMenuRep.setTitle(NSString.string());
984
		}
1098
		}
985
	} else {
1099
	} else {
986
		widget.setImagePosition(text.length() != 0 ? OS.NSNoImage : OS.NSImageOnly);
1100
		widget.setAttributedTitle(createString());
1101
		if (text.length() != 0 && image != null) {
1102
			if ((parent.style & SWT.RIGHT) != 0) {
1103
				widget.setImagePosition(OS.NSImageLeft);
1104
			} else {
1105
				widget.setImagePosition(OS.NSImageAbove);
1106
			}
1107
		} else {
1108
			widget.setImagePosition(text.length() != 0 ? OS.NSNoImage : OS.NSImageOnly);
1109
		}
987
	}
1110
	}
988
	parent.relayout ();
1111
	parent.relayout ();
989
}
1112
}
Lines 1010-1017 Link Here
1010
 */
1133
 */
1011
public void setToolTipText (String string) {
1134
public void setToolTipText (String string) {
1012
	checkWidget();
1135
	checkWidget();
1013
	toolTipText = string;
1136
    toolTipText = string;
1014
	parent.checkToolTip (this);
1137
	if ((style & SWT.SMOOTH) != 0) {
1138
        char[] chars = new char [toolTipText.length ()];
1139
        string.getChars (0, chars.length, chars, 0);
1140
        int length = fixMnemonic (chars);
1141
        nsItem.setToolTip(NSString.stringWithCharacters (chars, length));
1142
	} else {
1143
        parent.checkToolTip (this);
1144
	}
1015
}
1145
}
1016
1146
1017
void setVisible (boolean visible) {
1147
void setVisible (boolean visible) {
Lines 1037-1045 Link Here
1037
 */
1167
 */
1038
public void setWidth (int width) {
1168
public void setWidth (int width) {
1039
	checkWidget();
1169
	checkWidget();
1040
	if ((style & SWT.SEPARATOR) == 0) return;
1170
	if ((style & SEPARATOR_MASK) == 0) return;
1041
	if (width < 0 || this.width == width) return;
1171
	if (width < 0 || this.width == width) return;
1172
	if (width == SWT.DEFAULT) width = DEFAULT_SEPARATOR_WIDTH;
1042
	this.width = width;
1173
	this.width = width;
1174
	if ((style & SWT.SMOOTH) != 0) {
1175
		NSToolbar toolbar = parent.toolbar;
1176
		int index = parent.indexOf(this);
1177
		toolbar.removeItemAtIndex(index);
1178
		toolbar.insertItemWithItemIdentifier(getItemID(), index);
1179
1180
		NSRect newFrame = new NSRect();
1181
		newFrame.width = width;
1182
		newFrame.height = 1;
1183
		view.setFrame(newFrame);
1184
		nsItem.setView(view);
1185
	}
1043
	parent.relayout();
1186
	parent.relayout();
1044
}
1187
}
1045
1188
Lines 1048-1054 Link Here
1048
}
1191
}
1049
1192
1050
void updateImage (boolean layout) {
1193
void updateImage (boolean layout) {
1051
	if ((style & SWT.SEPARATOR) != 0) return;
1194
	if ((style & SEPARATOR_MASK) != 0) return;
1052
	Image newImage = null;
1195
	Image newImage = null;
1053
1196
1054
	if ((state & DISABLED) == DISABLED && disabledImage != null) {
1197
	if ((state & DISABLED) == DISABLED && disabledImage != null) {
Lines 1071-1084 Link Here
1071
	 */
1214
	 */
1072
	widget.setImage(newImage != null ? newImage.handle : null);
1215
	widget.setImage(newImage != null ? newImage.handle : null);
1073
	widget.setNeedsDisplay(true);
1216
	widget.setNeedsDisplay(true);
1074
	if (text.length() != 0 && newImage != null) {
1217
1075
		if ((parent.style & SWT.RIGHT) != 0) {
1218
	if ((style & SWT.SMOOTH) == 0) {
1076
			widget.setImagePosition(OS.NSImageLeft);
1219
		if (text.length() != 0 && newImage != null) {
1220
			if ((parent.style & SWT.RIGHT) != 0) {
1221
				widget.setImagePosition(OS.NSImageLeft);
1222
			} else {
1223
				widget.setImagePosition(OS.NSImageAbove);		
1224
			}
1077
		} else {
1225
		} else {
1078
			widget.setImagePosition(OS.NSImageAbove);		
1226
			widget.setImagePosition(text.length() != 0 ? OS.NSNoImage : OS.NSImageOnly);
1079
		}
1227
		}
1080
	} else {	
1081
		widget.setImagePosition(text.length() != 0 ? OS.NSNoImage : OS.NSImageOnly);		
1082
	}
1228
	}
1083
	parent.relayout();
1229
	parent.relayout();
1084
}
1230
}
(-)Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java (+20 lines)
Lines 666-671 Link Here
666
}
666
}
667
667
668
void drawImageWithFrameInView (int /*long*/ id, int /*long*/ sel, int /*long*/ image, NSRect rect, int /*long*/ view) {
668
void drawImageWithFrameInView (int /*long*/ id, int /*long*/ sel, int /*long*/ image, NSRect rect, int /*long*/ view) {
669
	callSuper(id, sel, image, rect, view);
669
}
670
}
670
671
671
NSRect drawTitleWithFrameInView (int /*long*/ id, int /*long*/ sel, int /*long*/ title, NSRect rect, int /*long*/ view) {
672
NSRect drawTitleWithFrameInView (int /*long*/ id, int /*long*/ sel, int /*long*/ title, NSRect rect, int /*long*/ view) {
Lines 1062-1067 Link Here
1062
	mouseDownSuper(id, sel, theEvent);
1063
	mouseDownSuper(id, sel, theEvent);
1063
}
1064
}
1064
1065
1066
boolean mouseDownCanMoveWindow(int /*long*/ id, int /*long*/ sel) {
1067
	return callSuperBoolean(id, sel);
1068
}
1069
1065
void mouseDownSuper(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) {
1070
void mouseDownSuper(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) {
1066
	callSuper(id, sel, theEvent);
1071
	callSuper(id, sel, theEvent);
1067
}
1072
}
Lines 1922-1927 Link Here
1922
	return result;
1927
	return result;
1923
}
1928
}
1924
1929
1930
int /*long*/ toolbar_itemForItemIdentifier_willBeInsertedIntoToolbar(int /*long*/ id, int /*long*/ sel, int /*long*/ toolbar, int /*long*/ itemID, boolean flag) {
1931
	return 0;
1932
}
1933
1934
int /*long*/ toolbarAllowedItemIdentifiers(int /*long*/ id, int /*long*/ sel, int /*long*/ toolbar) {
1935
	return 0;
1936
}
1937
1938
int /*long*/ toolbarDefaultItemIdentifiers(int /*long*/ id, int /*long*/ sel, int /*long*/ toolbar) {
1939
	return 0;
1940
}
1941
1942
int /*long*/ toolbarSelectableItemIdentifiers(int /*long*/ id, int /*long*/ sel, int /*long*/ toolbar) {
1943
	return 0;
1944
}
1925
String tooltipText () {
1945
String tooltipText () {
1926
	return null;
1946
	return null;
1927
}
1947
}
(-)Eclipse SWT/common/org/eclipse/swt/SWT.java (+14 lines)
Lines 1010-1015 Link Here
1010
	 */
1010
	 */
1011
	public static final int SEPARATOR = 1 << 1;
1011
	public static final int SEPARATOR = 1 << 1;
1012
1012
1013
    /**
1014
     * A Style constant representing a flexible space separator in a Cocoa
1015
     * Unified toolbar. Although the (1 << 7) bit is already taken (they all are
1016
     * several times over) it's in a different context so it shouldn't represent
1017
     * a conflict. Carries no meaning on WS-s other than Cocoa.
1018
     */
1019
    public static final int FLEX_SPACER = 1 << 7;
1020
1021
    /**
1022
     * A Style constant representing a space separator in a Cocoa Unified
1023
     * toolbar. Carries no meaning on WS-s other than Cocoa.
1024
     */
1025
    public static final int SPACER = 1 << 10;
1026
1013
	/**
1027
	/**
1014
	 * Style constant for toggle button behavior (value is 1&lt;&lt;1).
1028
	 * Style constant for toggle button behavior (value is 1&lt;&lt;1).
1015
	 * <p><b>Used By:</b><ul>
1029
	 * <p><b>Used By:</b><ul>

Return to bug 222859