Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 180221 Details for
Bug 222859
Support native Mac toolbar
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Updated patch -- 10/4/10
222859-patch.txt (text/plain), 69.15 KB, created by
Scott Kovatch
on 2010-10-04 20:46:11 EDT
(
hide
)
Description:
Updated patch -- 10/4/10
Filename:
MIME Type:
Creator:
Scott Kovatch
Created:
2010-10-04 20:46:11 EDT
Size:
69.15 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.swt >Index: Eclipse SWT PI/cocoa/library/make_macosx.mak >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT PI/cocoa/library/make_macosx.mak,v >retrieving revision 1.29 >diff -u -r1.29 make_macosx.mak >--- Eclipse SWT PI/cocoa/library/make_macosx.mak 31 May 2010 16:44:08 -0000 1.29 >+++ Eclipse SWT PI/cocoa/library/make_macosx.mak 5 Oct 2010 00:27:59 -0000 >@@ -44,9 +44,9 @@ > -Wno-non-virtual-dtor -include ${XULRUNNER_SDK}/include/mozilla-config.h -I${XULRUNNER_SDK}/include > XULRUNNERLFLAGS = $(LFLAGS) > >-all: $(SWT_LIB) $(SWTPI_LIB) $(AWT_LIB) $(XULRUNNER_LIB) >+all: $(SWT_LIB) $(SWTPI_LIB) $(AWT_LIB) > >-all_x86_64: $(SWT_LIB) $(SWTPI_LIB) $(AWT_LIB) $(XULRUNNER_LIB) >+all_x86_64: $(SWT_LIB) $(SWTPI_LIB) $(AWT_LIB) > > .c.o: > cc $(CFLAGS) $*.c >Index: Eclipse SWT PI/cocoa/library/os.c >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c,v >retrieving revision 1.149 >diff -u -r1.149 os.c >--- Eclipse SWT PI/cocoa/library/os.c 27 Sep 2010 21:21:58 -0000 1.149 >+++ Eclipse SWT PI/cocoa/library/os.c 5 Oct 2010 00:28:02 -0000 >@@ -9440,6 +9440,36 @@ > } > #endif > >+#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)) >+#ifndef JNI64 >+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) >+#else >+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) >+#endif >+{ >+ NSPoint _arg2, *lparg2=NULL; >+ NSRect _arg3, *lparg3=NULL; >+ jboolean rc = 0; >+#ifndef JNI64 >+ OS_NATIVE_ENTER(env, that, objc_1msgSend_1bool__IILorg_eclipse_swt_internal_cocoa_NSPoint_2Lorg_eclipse_swt_internal_cocoa_NSRect_2_FUNC); >+#else >+ OS_NATIVE_ENTER(env, that, objc_1msgSend_1bool__JJLorg_eclipse_swt_internal_cocoa_NSPoint_2Lorg_eclipse_swt_internal_cocoa_NSRect_2_FUNC); >+#endif >+ if (arg2) if ((lparg2 = getNSPointFields(env, arg2, &_arg2)) == NULL) goto fail; >+ if (arg3) if ((lparg3 = getNSRectFields(env, arg3, &_arg3)) == NULL) goto fail; >+ rc = (jboolean)((BOOL (*)(jintLong, jintLong, NSPoint, NSRect))objc_msgSend_bool)(arg0, arg1, *lparg2, *lparg3); >+fail: >+ if (arg3 && lparg3) setNSRectFields(env, arg3, lparg3); >+ if (arg2 && lparg2) setNSPointFields(env, arg2, lparg2); >+#ifndef JNI64 >+ OS_NATIVE_EXIT(env, that, objc_1msgSend_1bool__IILorg_eclipse_swt_internal_cocoa_NSPoint_2Lorg_eclipse_swt_internal_cocoa_NSRect_2_FUNC); >+#else >+ OS_NATIVE_EXIT(env, that, objc_1msgSend_1bool__JJLorg_eclipse_swt_internal_cocoa_NSPoint_2Lorg_eclipse_swt_internal_cocoa_NSRect_2_FUNC); >+#endif >+ return rc; >+} >+#endif >+ > #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)) > #ifndef JNI64 > 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) >Index: Eclipse SWT PI/cocoa/library/os_stats.c >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c,v >retrieving revision 1.140 >diff -u -r1.140 os_stats.c >--- Eclipse SWT PI/cocoa/library/os_stats.c 27 Sep 2010 21:21:58 -0000 1.140 >+++ Eclipse SWT PI/cocoa/library/os_stats.c 5 Oct 2010 00:28:02 -0000 >@@ -14,8 +14,8 @@ > > #ifdef NATIVE_STATS > >-int OS_nativeFunctionCount = 610; >-int OS_nativeFunctionCallCount[610]; >+int OS_nativeFunctionCount = 611; >+int OS_nativeFunctionCallCount[611]; > char * OS_nativeFunctionNames[] = { > "ATSFontActivateFromFileReference", > "AcquireRootMenu", >@@ -1081,6 +1081,11 @@ > "objc_1msgSend_1bool__JJLorg_eclipse_swt_internal_cocoa_NSPoint_2", > #endif > #ifndef JNI64 >+ "objc_1msgSend_1bool__IILorg_eclipse_swt_internal_cocoa_NSPoint_2Lorg_eclipse_swt_internal_cocoa_NSRect_2", >+#else >+ "objc_1msgSend_1bool__JJLorg_eclipse_swt_internal_cocoa_NSPoint_2Lorg_eclipse_swt_internal_cocoa_NSRect_2", >+#endif >+#ifndef JNI64 > "objc_1msgSend_1bool__IILorg_eclipse_swt_internal_cocoa_NSRange_2I", > #else > "objc_1msgSend_1bool__JJLorg_eclipse_swt_internal_cocoa_NSRange_2J", >Index: Eclipse SWT PI/cocoa/library/os_stats.h >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h,v >retrieving revision 1.140 >diff -u -r1.140 os_stats.h >--- Eclipse SWT PI/cocoa/library/os_stats.h 27 Sep 2010 21:21:58 -0000 1.140 >+++ Eclipse SWT PI/cocoa/library/os_stats.h 5 Oct 2010 00:28:02 -0000 >@@ -1089,6 +1089,11 @@ > objc_1msgSend_1bool__JJLorg_eclipse_swt_internal_cocoa_NSPoint_2_FUNC, > #endif > #ifndef JNI64 >+ objc_1msgSend_1bool__IILorg_eclipse_swt_internal_cocoa_NSPoint_2Lorg_eclipse_swt_internal_cocoa_NSRect_2_FUNC, >+#else >+ objc_1msgSend_1bool__JJLorg_eclipse_swt_internal_cocoa_NSPoint_2Lorg_eclipse_swt_internal_cocoa_NSRect_2_FUNC, >+#endif >+#ifndef JNI64 > objc_1msgSend_1bool__IILorg_eclipse_swt_internal_cocoa_NSRange_2I_FUNC, > #else > objc_1msgSend_1bool__JJLorg_eclipse_swt_internal_cocoa_NSRange_2J_FUNC, >Index: Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras,v >retrieving revision 1.234 >diff -u -r1.234 AppKitFull.bridgesupport.extras >--- Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras 27 Sep 2010 21:21:58 -0000 1.234 >+++ Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras 5 Oct 2010 00:28:03 -0000 >@@ -650,10 +650,18 @@ > <arg swt_gen="true"></arg> > <retval swt_gen="true"></retval> > </method> >+ <method selector="setHighlightsBy:" swt_gen="true"> >+ <arg swt_gen="true"></arg> >+ <retval swt_gen="true"></retval> >+ </method> > <method selector="setImagePosition:" swt_gen="true"> > <arg swt_gen="true"></arg> > <retval swt_gen="true"></retval> > </method> >+ <method selector="setShowsStateBy:" swt_gen="true"> >+ <arg swt_gen="true"></arg> >+ <retval swt_gen="true"></retval> >+ </method> > <method selector="title" swt_gen="true"> > <retval swt_gen="true"></retval> > </method> >@@ -3547,6 +3555,9 @@ > <arg swt_gen="true"></arg> > <retval swt_gen="true"></retval> > </method> >+ <method selector="isVisible" swt_gen="true"> >+ <retval swt_gen="true"></retval> >+ </method> > <method selector="removeItemAtIndex:" swt_gen="true"> > <arg swt_gen="true"></arg> > <retval swt_gen="true"></retval> >@@ -3563,6 +3574,10 @@ > <arg swt_gen="true"></arg> > <retval swt_gen="true"></retval> > </method> >+ <method selector="setSelectedItemIdentifier:" swt_gen="true"> >+ <arg swt_gen="true"></arg> >+ <retval swt_gen="true"></retval> >+ </method> > <method selector="setVisible:" swt_gen="true"> > <arg swt_gen="true"></arg> > <retval swt_gen="true"></retval> >@@ -3596,6 +3611,10 @@ > <arg swt_gen="true"></arg> > <retval swt_gen="true"></retval> > </method> >+ <method selector="setMenuFormRepresentation:" swt_gen="true"> >+ <arg swt_gen="true"></arg> >+ <retval swt_gen="true"></retval> >+ </method> > <method selector="setMinSize:" swt_gen="true"> > <arg swt_gen="true"></arg> > <retval swt_gen="true"></retval> >@@ -3616,6 +3635,9 @@ > <arg swt_gen="true"></arg> > <retval swt_gen="true"></retval> > </method> >+ <method selector="view" swt_gen="true"> >+ <retval swt_gen="true"></retval> >+ </method> > </class> > <class name="NSToolbarItemGroup" swt_superclass="NSToolbarItem"> > </class> >@@ -3808,6 +3830,14 @@ > <arg swt_gen="true"></arg> > <retval swt_gen="true"></retval> > </method> >+ <method selector="mouse:inRect:" swt_gen="true"> >+ <arg swt_gen="true"></arg> >+ <arg swt_gen="true"></arg> >+ <retval swt_gen="true"></retval> >+ </method> >+ <method selector="mouseDownCanMoveWindow" swt_gen="true"> >+ <retval swt_gen="true"></retval> >+ </method> > <method selector="registerForDraggedTypes:" swt_gen="true"> > <arg swt_gen="true"></arg> > <retval swt_gen="true"></retval> >@@ -3940,6 +3970,11 @@ > <method selector="close" swt_gen="true"> > <retval swt_gen="true"></retval> > </method> >+ <method class_method="true" selector="contentRectForFrameRect:styleMask:" swt_gen="true"> >+ <arg swt_gen="true"></arg> >+ <arg swt_gen="true"></arg> >+ <retval swt_gen="true"></retval> >+ </method> > <method selector="contentView" swt_gen="true"> > <retval swt_gen="true" swt_java_type="NSView"></retval> > </method> >@@ -4481,6 +4516,7 @@ > <enum name="NSCompositeCopy" swt_gen="true"></enum> > <enum name="NSCompositeSourceOver" swt_gen="true"></enum> > <enum name="NSCompositeXOR" swt_gen="true"></enum> >+ <enum name="NSContentsCellMask" swt_gen="true"></enum> > <enum name="NSControlKeyMask" swt_gen="true"></enum> > <enum name="NSCriticalAlertStyle" swt_gen="true"></enum> > <enum name="NSCurveToBezierPathElement" swt_gen="true"></enum> >@@ -4547,6 +4583,7 @@ > <enum name="NSNonZeroWindingRule" swt_gen="true"></enum> > <enum name="NSNonactivatingPanelMask" swt_gen="true"></enum> > <enum name="NSOffState" swt_gen="true"></enum> >+ <enum name="NSOnOffButton" swt_gen="true"></enum> > <enum name="NSOnState" swt_gen="true"></enum> > <enum name="NSOpenGLPFAAccumSize" swt_gen="true"></enum> > <enum name="NSOpenGLPFAAlphaSize" swt_gen="true"></enum> >@@ -4606,6 +4643,9 @@ > <enum name="NSTerminateNow" swt_gen="true"></enum> > <enum name="NSTextFieldAndStepperDatePickerStyle" swt_gen="true"></enum> > <enum name="NSTitledWindowMask" swt_gen="true"></enum> >+ <enum name="NSToolbarDisplayModeIconAndLabel" swt_gen="true"></enum> >+ <enum name="NSToolbarDisplayModeIconOnly" swt_gen="true"></enum> >+ <enum name="NSToolbarDisplayModeLabelOnly" swt_gen="true"></enum> > <enum name="NSUnderlineStyleDouble" swt_gen="true"></enum> > <enum name="NSUnderlineStyleNone" swt_gen="true"></enum> > <enum name="NSUnderlineStyleSingle" swt_gen="true"></enum> >Index: Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSButtonCell.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSButtonCell.java,v >retrieving revision 1.12 >diff -u -r1.12 NSButtonCell.java >--- Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSButtonCell.java 3 Sep 2010 16:10:05 -0000 1.12 >+++ Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSButtonCell.java 5 Oct 2010 00:28:03 -0000 >@@ -47,10 +47,18 @@ > OS.objc_msgSend(this.id, OS.sel_setButtonType_, aType); > } > >+public void setHighlightsBy(int /*long*/ aType) { >+ OS.objc_msgSend(this.id, OS.sel_setHighlightsBy_, aType); >+} >+ > public void setImagePosition(int /*long*/ aPosition) { > OS.objc_msgSend(this.id, OS.sel_setImagePosition_, aPosition); > } > >+public void setShowsStateBy(int /*long*/ aType) { >+ OS.objc_msgSend(this.id, OS.sel_setShowsStateBy_, aType); >+} >+ > public NSString title() { > int /*long*/ result = OS.objc_msgSend(this.id, OS.sel_title); > return result != 0 ? new NSString(result) : null; >Index: Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSColorPanel.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSColorPanel.java,v >retrieving revision 1.10 >diff -u -r1.10 NSColorPanel.java >--- Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSColorPanel.java 1 Jul 2009 14:49:14 -0000 1.10 >+++ Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSColorPanel.java 5 Oct 2010 00:28:03 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2010 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -38,6 +38,12 @@ > return result != 0 ? new NSColorPanel(result) : null; > } > >+public static NSRect contentRectForFrameRect(NSRect fRect, int /*long*/ aStyle) { >+ NSRect result = new NSRect(); >+ OS.objc_msgSend_stret(result, OS.class_NSColorPanel, OS.sel_contentRectForFrameRect_styleMask_, fRect, aStyle); >+ return result; >+} >+ > public static float /*double*/ minFrameWidthWithTitle(NSString aTitle, int /*long*/ aStyle) { > return (float)OS.objc_msgSend_fpret(OS.class_NSColorPanel, OS.sel_minFrameWidthWithTitle_styleMask_, aTitle != null ? aTitle.id : 0, aStyle); > } >Index: Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSFontPanel.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSFontPanel.java,v >retrieving revision 1.9 >diff -u -r1.9 NSFontPanel.java >--- Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSFontPanel.java 1 Jul 2009 14:49:08 -0000 1.9 >+++ Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSFontPanel.java 5 Oct 2010 00:28:03 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2010 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -38,6 +38,12 @@ > return result != 0 ? new NSFontPanel(result) : null; > } > >+public static NSRect contentRectForFrameRect(NSRect fRect, int /*long*/ aStyle) { >+ NSRect result = new NSRect(); >+ OS.objc_msgSend_stret(result, OS.class_NSFontPanel, OS.sel_contentRectForFrameRect_styleMask_, fRect, aStyle); >+ return result; >+} >+ > public static float /*double*/ minFrameWidthWithTitle(NSString aTitle, int /*long*/ aStyle) { > return (float)OS.objc_msgSend_fpret(OS.class_NSFontPanel, OS.sel_minFrameWidthWithTitle_styleMask_, aTitle != null ? aTitle.id : 0, aStyle); > } >Index: Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSOpenPanel.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSOpenPanel.java,v >retrieving revision 1.9 >diff -u -r1.9 NSOpenPanel.java >--- Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSOpenPanel.java 1 Jul 2009 14:49:07 -0000 1.9 >+++ Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSOpenPanel.java 5 Oct 2010 00:28:03 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2010 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -51,6 +51,12 @@ > return result != 0 ? new NSSavePanel(result) : null; > } > >+public static NSRect contentRectForFrameRect(NSRect fRect, int /*long*/ aStyle) { >+ NSRect result = new NSRect(); >+ OS.objc_msgSend_stret(result, OS.class_NSOpenPanel, OS.sel_contentRectForFrameRect_styleMask_, fRect, aStyle); >+ return result; >+} >+ > public static float /*double*/ minFrameWidthWithTitle(NSString aTitle, int /*long*/ aStyle) { > return (float)OS.objc_msgSend_fpret(OS.class_NSOpenPanel, OS.sel_minFrameWidthWithTitle_styleMask_, aTitle != null ? aTitle.id : 0, aStyle); > } >Index: Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSPanel.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSPanel.java,v >retrieving revision 1.11 >diff -u -r1.11 NSPanel.java >--- Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSPanel.java 3 Aug 2010 22:56:24 -0000 1.11 >+++ Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSPanel.java 5 Oct 2010 00:28:03 -0000 >@@ -40,6 +40,12 @@ > return OS.objc_msgSend_bool(this.id, OS.sel_worksWhenModal); > } > >+public static NSRect contentRectForFrameRect(NSRect fRect, int /*long*/ aStyle) { >+ NSRect result = new NSRect(); >+ OS.objc_msgSend_stret(result, OS.class_NSPanel, OS.sel_contentRectForFrameRect_styleMask_, fRect, aStyle); >+ return result; >+} >+ > public static float /*double*/ minFrameWidthWithTitle(NSString aTitle, int /*long*/ aStyle) { > return (float)OS.objc_msgSend_fpret(OS.class_NSPanel, OS.sel_minFrameWidthWithTitle_styleMask_, aTitle != null ? aTitle.id : 0, aStyle); > } >Index: Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSSavePanel.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSSavePanel.java,v >retrieving revision 1.17 >diff -u -r1.17 NSSavePanel.java >--- Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSSavePanel.java 7 Jul 2009 20:01:09 -0000 1.17 >+++ Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSSavePanel.java 5 Oct 2010 00:28:03 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2010 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -66,6 +66,12 @@ > OS.objc_msgSend(this.id, OS.sel_validateVisibleColumns); > } > >+public static NSRect contentRectForFrameRect(NSRect fRect, int /*long*/ aStyle) { >+ NSRect result = new NSRect(); >+ OS.objc_msgSend_stret(result, OS.class_NSSavePanel, OS.sel_contentRectForFrameRect_styleMask_, fRect, aStyle); >+ return result; >+} >+ > public static float /*double*/ minFrameWidthWithTitle(NSString aTitle, int /*long*/ aStyle) { > return (float)OS.objc_msgSend_fpret(OS.class_NSSavePanel, OS.sel_minFrameWidthWithTitle_styleMask_, aTitle != null ? aTitle.id : 0, aStyle); > } >Index: Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSToolbar.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSToolbar.java,v >retrieving revision 1.11 >diff -u -r1.11 NSToolbar.java >--- Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSToolbar.java 1 Jul 2009 14:49:10 -0000 1.11 >+++ Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSToolbar.java 5 Oct 2010 00:28:03 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2010 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -33,6 +33,10 @@ > OS.objc_msgSend(this.id, OS.sel_insertItemWithItemIdentifier_atIndex_, itemIdentifier != null ? itemIdentifier.id : 0, index); > } > >+public boolean isVisible() { >+ return OS.objc_msgSend_bool(this.id, OS.sel_isVisible); >+} >+ > public void removeItemAtIndex(int /*long*/ index) { > OS.objc_msgSend(this.id, OS.sel_removeItemAtIndex_, index); > } >@@ -49,6 +53,10 @@ > OS.objc_msgSend(this.id, OS.sel_setDisplayMode_, displayMode); > } > >+public void setSelectedItemIdentifier(NSString itemIdentifier) { >+ OS.objc_msgSend(this.id, OS.sel_setSelectedItemIdentifier_, itemIdentifier != null ? itemIdentifier.id : 0); >+} >+ > public void setVisible(boolean shown) { > OS.objc_msgSend(this.id, OS.sel_setVisible_, shown); > } >Index: Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSToolbarItem.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSToolbarItem.java,v >retrieving revision 1.10 >diff -u -r1.10 NSToolbarItem.java >--- Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSToolbarItem.java 1 Jul 2009 14:49:10 -0000 1.10 >+++ Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSToolbarItem.java 5 Oct 2010 00:28:03 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2010 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -54,6 +54,10 @@ > OS.objc_msgSend(this.id, OS.sel_setMaxSize_, size); > } > >+public void setMenuFormRepresentation(NSMenuItem menuItem) { >+ OS.objc_msgSend(this.id, OS.sel_setMenuFormRepresentation_, menuItem != null ? menuItem.id : 0); >+} >+ > public void setMinSize(NSSize size) { > OS.objc_msgSend(this.id, OS.sel_setMinSize_, size); > } >@@ -74,4 +78,9 @@ > OS.objc_msgSend(this.id, OS.sel_setView_, view != null ? view.id : 0); > } > >+public NSView view() { >+ int /*long*/ result = OS.objc_msgSend(this.id, OS.sel_view); >+ return result != 0 ? new NSView(result) : null; >+} >+ > } >Index: Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSView.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSView.java,v >retrieving revision 1.30 >diff -u -r1.30 NSView.java >--- Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSView.java 18 Feb 2010 15:18:12 -0000 1.30 >+++ Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSView.java 5 Oct 2010 00:28:03 -0000 >@@ -203,6 +203,14 @@ > return result != 0 ? new NSMenu(result) : null; > } > >+public boolean mouse(NSPoint aPoint, NSRect aRect) { >+ return OS.objc_msgSend_bool(this.id, OS.sel_mouse_inRect_, aPoint, aRect); >+} >+ >+public boolean mouseDownCanMoveWindow() { >+ return OS.objc_msgSend_bool(this.id, OS.sel_mouseDownCanMoveWindow); >+} >+ > public void registerForDraggedTypes(NSArray newTypes) { > OS.objc_msgSend(this.id, OS.sel_registerForDraggedTypes_, newTypes != null ? newTypes.id : 0); > } >Index: Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSWindow.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSWindow.java,v >retrieving revision 1.45 >diff -u -r1.45 NSWindow.java >--- Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSWindow.java 3 Aug 2010 22:56:24 -0000 1.45 >+++ Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSWindow.java 5 Oct 2010 00:28:03 -0000 >@@ -54,6 +54,12 @@ > OS.objc_msgSend(this.id, OS.sel_close); > } > >+public static NSRect contentRectForFrameRect(NSRect fRect, int /*long*/ aStyle) { >+ NSRect result = new NSRect(); >+ OS.objc_msgSend_stret(result, OS.class_NSWindow, OS.sel_contentRectForFrameRect_styleMask_, fRect, aStyle); >+ return result; >+} >+ > public NSView contentView() { > int /*long*/ result = OS.objc_msgSend(this.id, OS.sel_contentView); > return result != 0 ? new NSView(result) : null; >Index: Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java,v >retrieving revision 1.354 >diff -u -r1.354 OS.java >--- Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java 27 Sep 2010 21:21:59 -0000 1.354 >+++ Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java 5 Oct 2010 00:28:05 -0000 >@@ -137,6 +137,8 @@ > public static final int /*long*/ class_JRSAppKitAWT = objc_getClass("JRSAppKitAWT"); > public static final int /*long*/ sel_awtAppDelegate = sel_registerName("awtAppDelegate"); > >+ public static final int /*long*/ class_NSToolbarView = objc_getClass("NSToolbarView"); >+ > /** JNI natives */ > > /** @method flags=jni */ >@@ -980,6 +982,7 @@ > public static final int /*long*/ sel_containsObject_ = sel_registerName("containsObject:"); > public static final int /*long*/ sel_containsPoint_ = sel_registerName("containsPoint:"); > public static final int /*long*/ sel_contentRect = sel_registerName("contentRect"); >+public static final int /*long*/ sel_contentRectForFrameRect_styleMask_ = sel_registerName("contentRectForFrameRect:styleMask:"); > public static final int /*long*/ sel_contentSize = sel_registerName("contentSize"); > public static final int /*long*/ sel_contentSizeForFrameSize_hasHorizontalScroller_hasVerticalScroller_borderType_ = sel_registerName("contentSizeForFrameSize:hasHorizontalScroller:hasVerticalScroller:borderType:"); > public static final int /*long*/ sel_contentView = sel_registerName("contentView"); >@@ -1375,7 +1378,9 @@ > public static final int /*long*/ sel_minuteOfHour = sel_registerName("minuteOfHour"); > public static final int /*long*/ sel_modifierFlags = sel_registerName("modifierFlags"); > public static final int /*long*/ sel_monthOfYear = sel_registerName("monthOfYear"); >+public static final int /*long*/ sel_mouse_inRect_ = sel_registerName("mouse:inRect:"); > public static final int /*long*/ sel_mouseDown_ = sel_registerName("mouseDown:"); >+public static final int /*long*/ sel_mouseDownCanMoveWindow = sel_registerName("mouseDownCanMoveWindow"); > public static final int /*long*/ sel_mouseDragged_ = sel_registerName("mouseDragged:"); > public static final int /*long*/ sel_mouseEntered_ = sel_registerName("mouseEntered:"); > public static final int /*long*/ sel_mouseExited_ = sel_registerName("mouseExited:"); >@@ -1732,6 +1737,7 @@ > public static final int /*long*/ sel_setHighlightMode_ = sel_registerName("setHighlightMode:"); > public static final int /*long*/ sel_setHighlighted_ = sel_registerName("setHighlighted:"); > public static final int /*long*/ sel_setHighlightedTableColumn_ = sel_registerName("setHighlightedTableColumn:"); >+public static final int /*long*/ sel_setHighlightsBy_ = sel_registerName("setHighlightsBy:"); > public static final int /*long*/ sel_setHorizontalScroller_ = sel_registerName("setHorizontalScroller:"); > public static final int /*long*/ sel_setHorizontallyResizable_ = sel_registerName("setHorizontallyResizable:"); > public static final int /*long*/ sel_setIcon_ = sel_registerName("setIcon:"); >@@ -1775,6 +1781,7 @@ > public static final int /*long*/ sel_setMaximumIntegerDigits_ = sel_registerName("setMaximumIntegerDigits:"); > public static final int /*long*/ sel_setMenu_ = sel_registerName("setMenu:"); > public static final int /*long*/ sel_setMenu_forSegment_ = sel_registerName("setMenu:forSegment:"); >+public static final int /*long*/ sel_setMenuFormRepresentation_ = sel_registerName("setMenuFormRepresentation:"); > public static final int /*long*/ sel_setMessage_ = sel_registerName("setMessage:"); > public static final int /*long*/ sel_setMessageText_ = sel_registerName("setMessageText:"); > public static final int /*long*/ sel_setMinSize_ = sel_registerName("setMinSize:"); >@@ -1817,6 +1824,7 @@ > public static final int /*long*/ sel_setSegmentStyle_ = sel_registerName("setSegmentStyle:"); > public static final int /*long*/ sel_setSelectable_ = sel_registerName("setSelectable:"); > public static final int /*long*/ sel_setSelected_forSegment_ = sel_registerName("setSelected:forSegment:"); >+public static final int /*long*/ sel_setSelectedItemIdentifier_ = sel_registerName("setSelectedItemIdentifier:"); > public static final int /*long*/ sel_setSelectedRange_ = sel_registerName("setSelectedRange:"); > public static final int /*long*/ sel_setSelectedSegment_ = sel_registerName("setSelectedSegment:"); > public static final int /*long*/ sel_setSelectedTextAttributes_ = sel_registerName("setSelectedTextAttributes:"); >@@ -1826,6 +1834,7 @@ > public static final int /*long*/ sel_setShowsPrintPanel_ = sel_registerName("setShowsPrintPanel:"); > public static final int /*long*/ sel_setShowsProgressPanel_ = sel_registerName("setShowsProgressPanel:"); > public static final int /*long*/ sel_setShowsResizeIndicator_ = sel_registerName("setShowsResizeIndicator:"); >+public static final int /*long*/ sel_setShowsStateBy_ = sel_registerName("setShowsStateBy:"); > public static final int /*long*/ sel_setShowsToolbarButton_ = sel_registerName("setShowsToolbarButton:"); > public static final int /*long*/ sel_setSize_ = sel_registerName("setSize:"); > public static final int /*long*/ sel_setState_ = sel_registerName("setState:"); >@@ -2108,6 +2117,7 @@ > public static final int NSCompositeCopy = 1; > public static final int NSCompositeSourceOver = 2; > public static final int NSCompositeXOR = 10; >+public static final int NSContentsCellMask = 1; > public static final int NSControlKeyMask = 262144; > public static final int NSCriticalAlertStyle = 2; > public static final int NSCurveToBezierPathElement = 2; >@@ -2174,6 +2184,7 @@ > public static final int NSNonZeroWindingRule = 0; > public static final int NSNonactivatingPanelMask = 128; > public static final int NSOffState = 0; >+public static final int NSOnOffButton = 6; > public static final int NSOnState = 1; > public static final int NSOpenGLPFAAccumSize = 14; > public static final int NSOpenGLPFAAlphaSize = 11; >@@ -2233,6 +2244,9 @@ > public static final int NSTerminateNow = 1; > public static final int NSTextFieldAndStepperDatePickerStyle = 0; > public static final int NSTitledWindowMask = 1; >+public static final int NSToolbarDisplayModeIconAndLabel = 1; >+public static final int NSToolbarDisplayModeIconOnly = 2; >+public static final int NSToolbarDisplayModeLabelOnly = 3; > public static final int NSUnderlineStyleDouble = 9; > public static final int NSUnderlineStyleNone = 0; > public static final int NSUnderlineStyleSingle = 1; >@@ -3526,6 +3540,12 @@ > /** > * @method flags=cast > * @param arg0 flags=struct >+ * @param arg1 flags=struct >+ */ >+public static final native boolean objc_msgSend_bool(int /*long*/ id, int /*long*/ sel, NSPoint arg0, NSRect arg1); >+/** >+ * @method flags=cast >+ * @param arg0 flags=struct > */ > public static final native boolean objc_msgSend_bool(int /*long*/ id, int /*long*/ sel, NSRange arg0, int /*long*/ arg1); > /** >Index: Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/SFCertificatePanel.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/SFCertificatePanel.java,v >retrieving revision 1.1 >diff -u -r1.1 SFCertificatePanel.java >--- Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/SFCertificatePanel.java 12 Apr 2010 14:53:51 -0000 1.1 >+++ Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/SFCertificatePanel.java 5 Oct 2010 00:28:05 -0000 >@@ -32,6 +32,12 @@ > OS.objc_msgSend(this.id, OS.sel_setShowsHelp_, showsHelp); > } > >+public static NSRect contentRectForFrameRect(NSRect fRect, int /*long*/ aStyle) { >+ NSRect result = new NSRect(); >+ OS.objc_msgSend_stret(result, OS.class_SFCertificatePanel, OS.sel_contentRectForFrameRect_styleMask_, fRect, aStyle); >+ return result; >+} >+ > public static float /*double*/ minFrameWidthWithTitle(NSString aTitle, int /*long*/ aStyle) { > return (float)OS.objc_msgSend_fpret(OS.class_SFCertificatePanel, OS.sel_minFrameWidthWithTitle_styleMask_, aTitle != null ? aTitle.id : 0, aStyle); > } >Index: Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/SFCertificateTrustPanel.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/SFCertificateTrustPanel.java,v >retrieving revision 1.1 >diff -u -r1.1 SFCertificateTrustPanel.java >--- Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/SFCertificateTrustPanel.java 12 Apr 2010 14:53:51 -0000 1.1 >+++ Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/SFCertificateTrustPanel.java 5 Oct 2010 00:28:05 -0000 >@@ -33,6 +33,12 @@ > return result != 0 ? new SFCertificateTrustPanel(result) : null; > } > >+public static NSRect contentRectForFrameRect(NSRect fRect, int /*long*/ aStyle) { >+ NSRect result = new NSRect(); >+ OS.objc_msgSend_stret(result, OS.class_SFCertificateTrustPanel, OS.sel_contentRectForFrameRect_styleMask_, fRect, aStyle); >+ return result; >+} >+ > public static float /*double*/ minFrameWidthWithTitle(NSString aTitle, int /*long*/ aStyle) { > return (float)OS.objc_msgSend_fpret(OS.class_SFCertificateTrustPanel, OS.sel_minFrameWidthWithTitle_styleMask_, aTitle != null ? aTitle.id : 0, aStyle); > } >Index: Eclipse SWT/cocoa/org/eclipse/swt/widgets/Button.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Button.java,v >retrieving revision 1.77 >diff -u -r1.77 Button.java >--- Eclipse SWT/cocoa/org/eclipse/swt/widgets/Button.java 3 Sep 2010 16:10:05 -0000 1.77 >+++ Eclipse SWT/cocoa/org/eclipse/swt/widgets/Button.java 5 Oct 2010 00:28:05 -0000 >@@ -308,7 +308,7 @@ > rect.height += EXTRA_HEIGHT; > } > } >- callSuper (id, sel, image, rect, view); >+ super.drawImageWithFrameInView(id, sel, image, rect, view); > } > > void drawInteriorWithFrame_inView (int /*long*/ id, int /*long*/ sel, NSRect cellRect, int /*long*/ viewid) { >Index: Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java,v >retrieving revision 1.340 >diff -u -r1.340 Display.java >--- Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java 27 Sep 2010 21:21:59 -0000 1.340 >+++ Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java 5 Oct 2010 00:28:06 -0000 >@@ -2128,6 +2128,7 @@ > OS.class_addMethod(cls, OS.sel_resetCursorRects, proc2, "@:"); > OS.class_addMethod(cls, OS.sel_updateTrackingAreas, proc2, "@:"); > OS.class_addMethod(cls, OS.sel_getImageView, proc2, "@:"); >+ OS.class_addMethod(cls, OS.sel_mouseDownCanMoveWindow, proc2, "@:"); > } > if (needsDisplayInRectProc != 0) { > OS.class_addMethod(cls, OS.sel_setNeedsDisplayInRect_, needsDisplayInRectProc, "@:{NSRect}"); >@@ -2285,7 +2286,6 @@ > addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc); > OS.class_addMethod (cls, OS.sel_drawImage_withFrame_inView_, drawImageWithFrameInViewProc, "@:@{NSRect}@"); > OS.class_addMethod (cls, OS.sel_drawTitle_withFrame_inView_, drawTitleWithFrameInViewProc, "@:@{NSRect}@"); >- OS.class_addMethod(cls, OS.sel_cellSize, cellSizeProc, "@:"); > OS.class_addMethod(cls, OS.sel_drawInteriorWithFrame_inView_, drawInteriorWithFrameInViewProc, "@:{NSRect}@"); > OS.class_addMethod(cls, OS.sel_titleRectForBounds_, titleRectForBoundsProc, "@:{NSRect}"); > OS.class_addMethod(cls, OS.sel_cellSizeForBounds_, cellSizeForBoundsProc, "@:{NSRect}"); >@@ -2684,6 +2684,25 @@ > addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc); > OS.objc_registerClassPair(cls); > >+ className = "SWTToolbar"; >+ cls = OS.objc_allocateClassPair(OS.class_NSToolbar, className, 0); >+ OS.class_addIvar(cls, SWT_OBJECT, size, (byte)align, types); >+ OS.class_addMethod(cls, OS.sel_toolbar_itemForItemIdentifier_willBeInsertedIntoToolbar_, proc5, "@:@@Z"); >+ OS.class_addMethod(cls, OS.sel_toolbarAllowedItemIdentifiers_, proc3, "@:@"); >+ OS.class_addMethod(cls, OS.sel_toolbarDefaultItemIdentifiers_, proc3, "@:@"); >+ OS.class_addMethod(cls, OS.sel_toolbarSelectableItemIdentifiers_, proc3, "@:@"); >+ addEventMethods(cls, proc2, proc3, drawRectProc, hitTestProc, setNeedsDisplayInRectProc); >+ addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc); >+ addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc); >+ OS.objc_registerClassPair(cls); >+ >+ className = "SWTToolbarView"; >+ cls = OS.objc_allocateClassPair(OS.class_NSToolbarView, className, 0); >+ OS.class_addIvar(cls, SWT_OBJECT, size, (byte)align, types); >+ addEventMethods(cls, proc2, proc3, drawRectProc, hitTestProc, setNeedsDisplayInRectProc); >+ addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc); >+ OS.objc_registerClassPair(cls); >+ > className = "SWTWindowDelegate"; > cls = OS.objc_allocateClassPair(OS.class_NSObject, className, 0); > OS.class_addIvar(cls, SWT_OBJECT, size, (byte)align, types); >@@ -4608,7 +4627,7 @@ > // number passed to windowWithWindowNumber returns nil the window doesn't belong to > // this process. > if (window != null) { >- NSView contentView = window.contentView(); >+ NSView contentView = window.contentView().superview(); > if (contentView != null && OS.NSPointInRect(screenLocation, window.frame())) { > NSPoint location = window.convertScreenToBase(screenLocation); > view = contentView.hitTest (location); >@@ -5115,6 +5134,8 @@ > return widget.accessibilityParameterizedAttributeNames(id, sel); > } else if (sel == OS.sel_getImageView) { > return widget.imageView(); >+ } else if (sel == OS.sel_mouseDownCanMoveWindow) { >+ return (widget.mouseDownCanMoveWindow(id, sel) ? 1 : 0); > } else if (sel == OS.sel_accessibilityFocusedUIElement) { > return widget.accessibilityFocusedUIElement(id, sel); > } else if (sel == OS.sel_accessibilityIsIgnored) { >@@ -5389,6 +5410,12 @@ > widget.windowDidMiniturize(id, sel, arg0); > } else if (sel == OS.sel_windowDidDeminiaturize_) { > widget.windowDidDeminiturize(id, sel, arg0); >+ } else if (sel == OS.sel_toolbarAllowedItemIdentifiers_) { >+ return widget.toolbarAllowedItemIdentifiers(id, sel, arg0); >+ } else if (sel == OS.sel_toolbarDefaultItemIdentifiers_) { >+ return widget.toolbarDefaultItemIdentifiers(id, sel, arg0); >+ } else if (sel == OS.sel_toolbarSelectableItemIdentifiers_) { >+ return widget.toolbarSelectableItemIdentifiers(id, sel, arg0); > } > return 0; > } >@@ -5499,6 +5526,8 @@ > return (widget.tableView_writeRowsWithIndexes_toPasteboard(id, sel, arg0, arg1, arg2) ? 1 : 0); > } else if (sel == OS.sel_outlineView_writeItems_toPasteboard_) { > return (widget.outlineView_writeItems_toPasteboard(id, sel, arg0, arg1, arg2) ? 1 : 0); >+ } else if (sel == OS.sel_toolbar_itemForItemIdentifier_willBeInsertedIntoToolbar_) { >+ return widget.toolbar_itemForItemIdentifier_willBeInsertedIntoToolbar(id, sel, arg0, arg1, arg2 != 0); > } > return 0; > } >Index: Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java,v >retrieving revision 1.176 >diff -u -r1.176 Shell.java >--- Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java 27 Sep 2010 21:21:59 -0000 1.176 >+++ Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java 5 Oct 2010 00:28:06 -0000 >@@ -410,6 +410,25 @@ > return new Shell (display, null, SWT.NO_TRIM, handle, true); > } > >+Control [] _getChildren () { >+ Control [] children = super._getChildren(); >+ if (window.toolbar() != null) { >+ NSArray views = window.contentView().superview().subviews(); >+ for (int i = 0; i < views.count(); i++) { >+ id id = views.objectAtIndex(i); >+ Widget widget = display.getWidget (new NSView(id)); >+ if (widget != null && widget instanceof ToolBar) { >+ Control [] newChildren = new Control [children.length + 1]; >+ System.arraycopy (children, 0, newChildren, 1, children.length); >+ newChildren[0] = (Control)widget; >+ children = newChildren; >+ break; >+ } >+ } >+ } >+ return children; >+} >+ > static int checkStyle (Shell parent, int style) { > style = Decorations.checkStyle (style); > style &= ~SWT.TRANSPARENT; >@@ -1494,10 +1513,16 @@ > frame.y = screenHeight - (int)(y + frame.height); > window.setFrame(frame, isVisible(), true); > } else { >+ NSToolbar toolbar = window.toolbar(); >+ int /*long*/ toolbarHeight = 0; >+ if ((toolbar != null) && toolbar.isVisible()) { >+ NSRect windowFrame = NSWindow.contentRectForFrameRect(window.frame(), window.styleMask()); >+ toolbarHeight = (int/*64*/) (windowFrame.height - window.contentView().frame().height); >+ } > frame.x = x; > frame.y = screenHeight - (int)(y + height); > frame.width = width; >- frame.height = height; >+ frame.height = height - toolbarHeight; > window.setFrame(frame, isVisible()); > } > } >Index: Eclipse SWT/cocoa/org/eclipse/swt/widgets/ToolBar.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ToolBar.java,v >retrieving revision 1.40 >diff -u -r1.40 ToolBar.java >--- Eclipse SWT/cocoa/org/eclipse/swt/widgets/ToolBar.java 27 Sep 2010 22:14:07 -0000 1.40 >+++ Eclipse SWT/cocoa/org/eclipse/swt/widgets/ToolBar.java 5 Oct 2010 00:28:07 -0000 >@@ -47,8 +47,10 @@ > public class ToolBar extends Composite { > int itemCount; > ToolItem [] items; >+ NSToolbar toolbar; > NSArray accessibilityAttributes = null; > ToolItem lastFocus; >+ static int NEXT_ID; > > /** > * Constructs a new instance of this class given its parent >@@ -84,7 +86,7 @@ > * @see Widget#getStyle() > */ > public ToolBar (Composite parent, int style) { >- super (parent, checkStyle (style)); >+ super (parent, checkStyle (parent, style)); > > /* > * Ensure that either of HORIZONTAL or VERTICAL is set. >@@ -141,7 +143,7 @@ > return super.accessibilityIsIgnored(id, sel); > } > >-static int checkStyle (int style) { >+static int checkStyle (Composite parent, int style) { > /* > * Even though it is legal to create this widget > * with scroll bars, they serve no useful purpose >@@ -149,7 +151,31 @@ > * widget's client area. The fix is to clear > * the SWT style. > */ >- return style & ~(SWT.H_SCROLL | SWT.V_SCROLL); >+ int newStyle = style & ~(SWT.H_SCROLL | SWT.V_SCROLL); >+ >+ /* >+ * A unified toolbar can only be parented to a Shell, and >+ * there can only be one unified toolbar per shell. If neither of these >+ * conditions hold, turn off the SMOOTH flag. >+ */ >+ if ((newStyle & SWT.SMOOTH) != 0) { >+ if (parent instanceof Shell) { >+ Shell s = (Shell)parent; >+ if (s.window.toolbar() != null) newStyle &= ~SWT.SMOOTH; >+ } else { >+ newStyle &= ~SWT.SMOOTH; >+ } >+ } >+ >+ /* >+ * Unified toolbar only supports a horizontal layout, and doesn't wrap. >+ */ >+ if ((newStyle & SWT.SMOOTH) != 0) { >+ newStyle &= ~(SWT.VERTICAL | SWT.WRAP); >+ newStyle |= SWT.HORIZONTAL; >+ } >+ >+ return newStyle; > } > > protected void checkSubclass () { >@@ -186,20 +212,38 @@ > } > > void createHandle () { >- state |= THEME_BACKGROUND; >- if (hasBorder()) { >- NSRect rect = new NSRect(); >- NSScrollView scrollWidget = (NSScrollView)new SWTScrollView().alloc(); >- scrollWidget.initWithFrame (rect); >- scrollWidget.setDrawsBackground(false); >- scrollWidget.setBorderType(OS.NSBezelBorder); >- scrollView = scrollWidget; >- } >- NSView widget = (NSView)new SWTView().alloc(); >- widget.init(); >-// widget.setDrawsBackground(false); >- view = widget; >- if (scrollView != null) view.setAutoresizingMask(OS.NSViewHeightSizable | OS.NSViewWidthSizable); >+ if ((style & SWT.SMOOTH) != 0) { >+ toolbar = ((NSToolbar)new SWTToolbar().alloc()).initWithIdentifier(NSString.stringWith(String.valueOf(NEXT_ID++))); >+ toolbar.setDelegate(toolbar); >+ toolbar.setDisplayMode(OS.NSToolbarDisplayModeIconAndLabel); >+ NSWindow window = parent.view.window(); >+ window.setToolbar(toolbar); >+ toolbar.setVisible(true); >+ NSArray views = window.contentView().superview().subviews(); >+ for (int i = 0; i < views.count(); i++) { >+ id id = views.objectAtIndex(i); >+ if (new NSObject(id).className().getString().equals("NSToolbarView")) { >+ view = new NSView(id); >+ OS.object_setClass(view.id, OS.objc_getClass("SWTToolbarView")); >+ view.retain(); >+ break; >+ } >+ } >+ } else { >+ state |= THEME_BACKGROUND; >+ if (hasBorder()) { >+ NSRect rect = new NSRect(); >+ NSScrollView scrollWidget = (NSScrollView)new SWTScrollView().alloc(); >+ scrollWidget.initWithFrame (rect); >+ scrollWidget.setDrawsBackground(false); >+ scrollWidget.setBorderType(OS.NSBezelBorder); >+ scrollView = scrollWidget; >+ } >+ NSView widget = (NSView)new SWTView().alloc(); >+ widget.init(); >+ view = widget; >+ if (scrollView != null) view.setAutoresizingMask(OS.NSViewHeightSizable | OS.NSViewWidthSizable); >+ } > } > > void createItem (ToolItem item, int index) { >@@ -209,10 +253,17 @@ > System.arraycopy (items, 0, newItems, 0, items.length); > items = newItems; > } >- item.createWidget(); >- view.addSubview(item.view); >+ if ((style & SWT.SMOOTH) != 0) { >+ item.style |= SWT.SMOOTH; >+ } >+ item.createWidget(); > System.arraycopy (items, index, items, index + 1, itemCount++ - index); > items [index] = item; >+ if ((style & SWT.SMOOTH) != 0) { >+ toolbar.insertItemWithItemIdentifier(item.getItemID(), index); >+ } else { >+ view.addSubview(item.view); >+ } > relayout (); > } > >@@ -222,6 +273,15 @@ > itemCount = 0; > } > >+NSFont defaultNSFont() { >+ return NSFont.systemFontOfSize(11.0f); >+} >+ >+void deregister () { >+ super.deregister (); >+ if (toolbar != null) display.removeWidget (toolbar); >+} >+ > void destroyItem (ToolItem item) { > int index = 0; > while (index < itemCount) { >@@ -232,7 +292,11 @@ > if (item == lastFocus) lastFocus = null; > System.arraycopy (items, index + 1, items, index, --itemCount - index); > items [itemCount] = null; >- item.view.removeFromSuperview(); >+ if ((style & SWT.SMOOTH) != 0) { >+ toolbar.removeItemAtIndex(index); >+ } else { >+ item.view.removeFromSuperview(); >+ } > relayout (); > } > >@@ -262,6 +326,15 @@ > return super.findTooltip (pt); > } > >+public Rectangle getBounds () { >+ checkWidget(); >+ NSRect rect = view.frame(); >+ if (view.isFlipped()) { >+ rect.y = view.bounds().height - rect.y; >+ } >+ return new Rectangle((int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height); >+} >+ > boolean forceFocus (NSView focusView) { > if (lastFocus != null && lastFocus.setFocus ()) return true; > ToolItem [] items = getItems (); >@@ -448,6 +521,37 @@ > return new int [] {rows, maxX, y + itemHeight}; > } > >+int [] layoutUnified (int width, int height, boolean resize) { >+ int x = 0, y = 0; >+ int itemHeight = 0, maxX = 0; >+ Point [] sizes = new Point [itemCount]; >+ NSRect [] containerSizes = new NSRect[itemCount]; >+ // This next line relies on the observation that all of the toolbar item views are children of the first >+ // subview of the NSToolbarView. >+ NSArray itemViewers = new NSView(view.subviews().objectAtIndex(0)).subviews(); >+ for (int i=0; i<itemCount; i++) { >+ Point size = sizes [i] = items [i].computeSize (); >+ containerSizes [i] = new NSView(itemViewers.objectAtIndex(i)).frame(); >+ if (i == 0) x = (int) containerSizes[0].x; >+ itemHeight = Math.max (itemHeight, size.y); >+ } >+ for (int i=0; i<itemCount; i++) { >+ ToolItem item = items [i]; >+ Point size = sizes [i]; >+ if (resize) { >+ item.setBounds (0, 0, size.x, itemHeight); >+ Control control = item.control; >+ if (control != null) { >+ control.setBounds (x, y, size.x, itemHeight); >+ } >+ } >+ x += containerSizes[i].width; >+ maxX = Math.max (maxX, x); >+ } >+ >+ return new int [] {1, maxX, itemHeight}; >+} >+ > int [] layoutVertical (int width, int height, boolean resize) { > int xSpacing = 2, ySpacing = 0; > int marginWidth = 0, marginHeight = 0; >@@ -485,13 +589,41 @@ > } > > int [] layout (int nWidth, int nHeight, boolean resize) { >- if ((style & SWT.VERTICAL) != 0) { >- return layoutVertical (nWidth, nHeight, resize); >+ if ((style & SWT.SMOOTH) != 0) { >+ boolean hasText = false; >+ boolean hasImage = false; >+ for (int i = 0; i < itemCount; i++) { >+ hasText |= items[i].getText().length() > 0; >+ hasImage |= items[i].getControl() != null; >+ hasImage |= items[i].getImage() != null; >+ if (hasText && hasImage) break; >+ } >+ >+ if (hasText && hasImage) { >+ toolbar.setDisplayMode(OS.NSToolbarDisplayModeIconAndLabel); >+ } else if (hasText) { >+ toolbar.setDisplayMode(OS.NSToolbarDisplayModeLabelOnly); >+ } else { >+ toolbar.setDisplayMode(OS.NSToolbarDisplayModeIconOnly); >+ } >+ } >+ >+ if ((style & SWT.SMOOTH) != 0) { >+ return layoutUnified(nWidth, nHeight, resize); > } else { >- return layoutHorizontal (nWidth, nHeight, resize); >+ if ((style & SWT.VERTICAL) != 0) { >+ return layoutVertical (nWidth, nHeight, resize); >+ } else { >+ return layoutHorizontal (nWidth, nHeight, resize); >+ } > } > } > >+void register() { >+ super.register(); >+ if (toolbar != null) display.addWidget (toolbar, this); >+} >+ > void relayout () { > if (!getDrawing()) return; > Rectangle rect = getClientArea (); >@@ -513,7 +645,13 @@ > } > > void releaseHandle () { >- super.releaseHandle (); >+ super.releaseHandle (); >+ >+ if (toolbar != null) { >+ toolbar.release(); >+ toolbar = null; >+ } >+ > if (accessibilityAttributes != null) accessibilityAttributes.release(); > accessibilityAttributes = null; > } >@@ -547,14 +685,13 @@ > case SWT.MouseMove: > // Start with the global mouse location, as the MouseEnter may occur due to > // an application-activated event, which isn't associated with a window. >- NSPoint toolbarPoint = NSEvent.mouseLocation(); >- toolbarPoint = view.window().convertScreenToBase(toolbarPoint); >- toolbarPoint = view.convertPoint_fromView_(toolbarPoint, null); >+ NSPoint windowPoint = NSEvent.mouseLocation(); >+ windowPoint = view.window().convertScreenToBase(windowPoint); > for (int i = 0; i < itemCount; i++) { > ToolItem item = items [i]; > int currState = item.state; >- >- if (OS.NSPointInRect(toolbarPoint, item.view.frame())) { >+ NSPoint viewPoint = item.view.convertPoint_fromView_(windowPoint, null); >+ if (item.view.mouse(viewPoint, item.view.bounds())) { > item.state |= Widget.HOT; > } else { > item.state &= ~Widget.HOT; >@@ -576,6 +713,13 @@ > return super.sendMouseEvent(nsEvent, type, send); > } > >+void setBounds (int x, int y, int width, int height, boolean move, boolean resize) { >+ // In unified toolbar case, the toolbar view size and position is completely controlled >+ // by the window, so don't change its bounds or location. >+ if ((style & SWT.SMOOTH) != 0) return; >+ super.setBounds(x, y, width, height, move, resize); >+} >+ > void setFont(NSFont font) { > for (int i = 0; i < itemCount; i++) { > ToolItem item = items[i]; >@@ -589,6 +733,53 @@ > if (redraw && drawCount == 0) relayout(); > } > >+public void setVisible(boolean visible) { >+ if (toolbar != null) toolbar.setVisible(visible); >+ super.setVisible(visible); >+} >+ >+int /*long*/ toolbar_itemForItemIdentifier_willBeInsertedIntoToolbar(int /*long*/ id, int /*long*/ sel, int /*long*/ toolbar, int /*long*/ itemIdentifier, boolean flag) { >+ NSString itemID = new NSString(itemIdentifier); >+ for (int j = 0; j < itemCount; j++) { >+ ToolItem item = items[j]; >+ if (itemID.isEqual(item.nsItem.itemIdentifier())) { >+ return item.nsItem.id; >+ } >+ } >+ return 0; >+} >+ >+/* >+ * Returns an array of all toolbar item IDs allowed to be in the toolbar. Since the ToolBar created all of the ToolItems >+ * return all of the item IDs. >+ */ >+int /*long*/ toolbarAllowedItemIdentifiers(int /*long*/ id, int /*long*/ sel, int /*long*/ toolbar) { >+ NSMutableArray array = NSMutableArray.arrayWithCapacity(itemCount); >+ for (int i = 0; i < itemCount; i++) { >+ array.addObject(items[i].nsItem.itemIdentifier()); >+ } >+ return array.id; >+} >+ >+/* >+ * This delegate method isn't really needed because ToolBars aren't customizable, but it's required according to the documentation. >+ */ >+int /*long*/ toolbarDefaultItemIdentifiers(int /*long*/ id, int /*long*/ sel, int /*long*/ toolbar) { >+ return toolbarAllowedItemIdentifiers(id, sel, toolbar); >+} >+ >+/* >+ * toolbarSelectableItemIdentifiers returns an array of all items that can be the selected item, as determined >+ * by setSelectedItemIdentifier. >+ */ >+int /*long*/ toolbarSelectableItemIdentifiers(int /*long*/ id, int /*long*/ sel, int /*long*/ toolbar) { >+ NSMutableArray array = NSMutableArray.arrayWithCapacity(itemCount); >+ for (int i = 0; i < itemCount; i++) { >+ if ((items[i].style & SWT.RADIO) != 0) array.addObject(items[i].nsItem.itemIdentifier()); >+ } >+ return array.id; >+} >+ > boolean translateTraversal (int key, NSEvent theEvent, boolean[] consume) { > boolean result = super.translateTraversal (key, theEvent, consume); > if (result) return result; >Index: Eclipse SWT/cocoa/org/eclipse/swt/widgets/ToolItem.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ToolItem.java,v >retrieving revision 1.71 >diff -u -r1.71 ToolItem.java >--- Eclipse SWT/cocoa/org/eclipse/swt/widgets/ToolItem.java 27 Sep 2010 22:14:07 -0000 1.71 >+++ Eclipse SWT/cocoa/org/eclipse/swt/widgets/ToolItem.java 5 Oct 2010 00:28:07 -0000 >@@ -39,6 +39,9 @@ > public class ToolItem extends Item { > NSView view; > NSButton button; >+ NSToolbarItem nsItem; >+ NSMenuItem nsMenuRep; >+ NSString id; > int width = DEFAULT_SEPARATOR_WIDTH; > ToolBar parent; > Image hotImage, disabledImage; >@@ -46,6 +49,7 @@ > Control control; > boolean selection; > >+ static final int SEPARATOR_MASK = SWT.SEPARATOR | SWT.SPACER | SWT.FLEX_SPACER; > static final int DEFAULT_WIDTH = 24; > static final int DEFAULT_HEIGHT = 22; > static final int DEFAULT_SEPARATOR_WIDTH = 6; >@@ -301,7 +305,7 @@ > Point computeSize () { > checkWidget(); > int width = 0, height = 0; >- if ((style & SWT.SEPARATOR) != 0) { >+ if ((style & SEPARATOR_MASK) != 0) { > if ((parent.style & SWT.HORIZONTAL) != 0) { > width = getWidth (); > height = DEFAULT_HEIGHT; >@@ -314,8 +318,7 @@ > } > } else { > if (text.length () != 0 || image != null) { >- NSButton widget = (NSButton)button; >- NSSize size = widget.cell().cellSize(); >+ NSSize size = button.cell().cellSize(); > width = (int)Math.ceil(size.width); > height = (int)Math.ceil(size.height); > } else { >@@ -325,43 +328,74 @@ > if ((style & SWT.DROP_DOWN) != 0) { > width += ARROW_WIDTH + INSET; > } >- width += INSET * 2; >- height += INSET * 2; >+ >+ if ((style & SWT.SMOOTH) == 0) { >+ width += INSET * 2; >+ height += INSET * 2; >+ } > } > return new Point (width, height); > } > > void createHandle () { >- if ((style & SWT.SEPARATOR) != 0) { >- NSBox widget = (NSBox)new SWTBox().alloc(); >- widget.init(); >- widget.setBoxType(OS.NSBoxSeparator); >- widget.setBorderWidth(0); >- view = widget; >+ if ((style & SWT.SMOOTH) != 0) { >+ id = NSString.stringWith(String.valueOf(++ToolBar.NEXT_ID)); >+ id.retain(); >+ nsItem = ((NSToolbarItem)new NSToolbarItem().alloc()).initWithItemIdentifier(id); >+ nsItem.setAction(OS.sel_sendSelection); >+ nsMenuRep = ((NSMenuItem)new SWTMenuItem().alloc()).initWithTitle(NSString.string(), OS.sel_sendSelection, NSString.string()); >+ nsItem.setMenuFormRepresentation(nsMenuRep); >+ } >+ >+ if ((style & SEPARATOR_MASK) != 0) { >+ if ((style & SWT.SMOOTH) != 0) { >+ view = (NSView)new SWTView().alloc(); >+ view.init(); >+ } else { >+ NSBox widget = (NSBox)new SWTBox().alloc(); >+ widget.init(); >+ widget.setBoxType(OS.NSBoxSeparator); >+ widget.setBorderWidth(0); >+ view = widget; >+ } > } else { > NSView widget = (NSView)new SWTView().alloc(); > widget.init(); >- button = (NSButton)new SWTButton().alloc(); >- button.init(); >+ NSButton tbButton = (NSButton)new SWTButton().alloc(); >+ tbButton.init(); > /* > * Feature in Cocoa. NSButtons without borders do not leave any margin > * between their edge and their image. The workaround is to provide a > * custom cell that displays the image in a better position. > */ >- NSButtonCell cell = (NSButtonCell)new SWTButtonCell ().alloc ().init (); >- button.setCell (cell); >- cell.release(); >- button.setBordered(false); >- button.setAction(OS.sel_sendSelection); >- button.setTarget(button); >+ if ((style & SWT.SMOOTH) == 0) { >+ NSCell cell = (NSCell)new SWTButtonCell().alloc().init(); >+ tbButton.setCell (cell); >+ cell.release(); >+ } else { >+ if ((style & SWT.CHECK) != 0) tbButton.setButtonType(OS.NSPushOnPushOffButton); >+ NSButtonCell buttonCell = new NSButtonCell(tbButton.cell().id); >+ buttonCell.setHighlightsBy(OS.NSContentsCellMask); >+ buttonCell.setShowsStateBy(OS.NSContentsCellMask); >+ } >+ tbButton.setBordered(false); >+ tbButton.setAction(OS.sel_sendSelection); >+ tbButton.setTarget(tbButton); > Font font = parent.font != null ? parent.font : parent.defaultFont (); >- button.setFont(font.handle); >- button.setImagePosition(OS.NSImageOverlaps); >- button.setTitle(NSString.string()); >- button.setEnabled(parent.getEnabled()); >- widget.addSubview(button); >+ tbButton.setFont(font.handle); >+ tbButton.setTitle(NSString.stringWith("")); >+ tbButton.setImagePosition(OS.NSImageOnly); >+ tbButton.setEnabled(parent.getEnabled()); >+ widget.addSubview(tbButton); >+ button = tbButton; > view = widget; > } >+ >+ if (nsItem != null) { >+ nsItem.setTarget(button); >+ nsItem.setView(view); >+ nsMenuRep.setTarget(button); >+ } > } > > NSAttributedString createString() { >@@ -386,19 +420,22 @@ > } > > void drawImageWithFrameInView (int /*long*/ id, int /*long*/ sel, int /*long*/ image, NSRect rect, int /*long*/ view) { >- if (text.length () > 0) { >- if ((parent.style & SWT.RIGHT) != 0) { >- rect.x += 3; >- } else { >- rect.y += 3; >+ if ((style & SWT.SMOOTH) == 0) { >+ if (text.length () > 0) { >+ if ((parent.style & SWT.RIGHT) != 0) { >+ rect.x += 3; >+ } else { >+ rect.y += 3; >+ } > } > } >- callSuper (id, sel, image, rect, view); >+ super.drawImageWithFrameInView(id, sel, image, rect, view); > } > > void drawWidget (int /*long*/ id, NSGraphicsContext context, NSRect rect) { > if (id == view.id) { >- if (getSelection ()) { >+ boolean drawSelected = getSelection() && ((style & (SWT.SMOOTH | SWT.CHECK)) == (SWT.SMOOTH | SWT.CHECK)) || ((style & SWT.SMOOTH) == 0); >+ if (drawSelected) { > NSRect bounds = view.bounds(); > context.saveGraphicsState(); > NSColor.colorWithCalibratedRed(0.1f, 0.1f, 0.1f, 0.1f).setFill(); >@@ -435,9 +472,13 @@ > } > > void enableWidget(boolean enabled) { >- if ((style & SWT.SEPARATOR) == 0) { >- ((NSButton)button).setEnabled(enabled); >- updateImage(true); >+ if ((style & SWT.SMOOTH) != 0) { >+ nsItem.setEnabled(enabled); >+ } else { >+ if ((style & SEPARATOR_MASK) == 0) { >+ ((NSButton)button).setEnabled(enabled); >+ updateImage(true); >+ } > } > } > >@@ -454,6 +495,15 @@ > */ > public Rectangle getBounds () { > checkWidget(); >+ if ((style & SWT.SMOOTH) != 0) { >+ NSRect rect = view.frame(); >+ // ToolItems in the unified toolbar are not contained directly within the Toolbar. >+ // Convert the toolitem rect from toolitem-relative coordinates to its >+ // parent, the toolbar, relative coordinates. >+ rect = parent.view.convertRect_fromView_(rect, view); >+ return new Rectangle((int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height); >+ } >+ > NSRect rect = view.frame(); > return new Rectangle((int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height); > } >@@ -540,6 +590,26 @@ > return hotImage; > } > >+NSString getItemID() { >+ NSString itemID = id; >+ >+ // For separators, return a Cocoa constant for the tool item ID. >+ if ((style & SEPARATOR_MASK) != 0) { >+ // If we are using a non-default width or control use that instead. >+ if (width == DEFAULT_SEPARATOR_WIDTH && control == null) { >+ if ((style & SWT.SEPARATOR) != 0) { >+ itemID = OS.NSToolbarSeparatorItemIdentifier; >+ } else if ((style & SWT.SPACER) != 0) { >+ itemID = OS.NSToolbarSpaceItemIdentifier; >+ } else if ((style & SWT.FLEX_SPACER) != 0) { >+ itemID = OS.NSToolbarFlexibleSpaceItemIdentifier; >+ } >+ } >+ } >+ >+ return itemID; >+} >+ > /** > * Returns the receiver's parent, which must be a <code>ToolBar</code>. > * >@@ -652,6 +722,11 @@ > } > } > >+boolean mouseDownCanMoveWindow(int /*long*/ id, int /*long*/ sel) { >+ if (id == view.id) return false; >+ return super.mouseDownCanMoveWindow(id, sel); >+} >+ > void mouseUp(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) { > if (!parent.mouseEvent(parent.view.id, sel, theEvent, SWT.MouseUp)) return; > super.mouseUp(id, sel, theEvent); >@@ -737,6 +812,18 @@ > if (view != null) view.release (); > if (button != null) button.release (); > view = button = null; >+ if (nsItem != null) { >+ nsItem.release(); >+ nsItem = null; >+ } >+ if (id != null) { >+ id.release(); >+ id = null; >+ } >+ if (nsMenuRep != null) { >+ nsMenuRep.release(); >+ nsMenuRep = null; >+ } > parent = null; > } > >@@ -770,18 +857,30 @@ > > void setBounds (int x, int y, int width, int height) { > NSRect rect = new NSRect(); >- rect.x = x; >- rect.y = y; >- rect.width = width; >- rect.height = height; >- view.setFrame(rect); >- if (button != null) { >- rect.x = 0; >- rect.y = 0; >+ if ((style & SWT.SMOOTH) == 0) { >+ rect.x = x; >+ rect.y = y; > rect.width = width; > rect.height = height; >- if ((style & SWT.DROP_DOWN) != 0) rect.width -= ARROW_WIDTH + INSET; >- button.setFrame(rect); >+ view.setFrame(rect); >+ if (button != null) { >+ rect.x = 0; >+ rect.y = 0; >+ rect.width = width; >+ rect.height = height; >+ if ((style & SWT.DROP_DOWN) != 0) rect.width -= ARROW_WIDTH + INSET; >+ button.setFrame(rect); >+ } >+ } else { >+ // Let the NSToolbar manage the position of the view in the toolbar. >+ NSSize newSize = new NSSize(); >+ newSize.height = height; >+ newSize.width = width; >+ view.setFrameSize(newSize); >+ nsItem.setMinSize(newSize); >+ nsItem.setMaxSize(newSize); >+ if ((style & SWT.DROP_DOWN) != 0) newSize.width -= ARROW_WIDTH + INSET; >+ if (button != null) button.setFrameSize(newSize); > } > } > >@@ -806,13 +905,16 @@ > if (control.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); > if (control.parent != parent) error (SWT.ERROR_INVALID_PARENT); > } >- if ((style & SWT.SEPARATOR) == 0) return; >- if (this.control == control) return; >- NSBox widget = (NSBox)view; >- if (control == null) { >- widget.setBoxType(OS.NSBoxSeparator); >- } else { >- widget.setBoxType(OS.NSBoxCustom); >+ if ((style & SEPARATOR_MASK) == 0) return; >+ if (this.control == control) return; >+ >+ if ((style & SWT.SMOOTH) == 0) { >+ NSBox widget = (NSBox)view; >+ if (control == null) { >+ widget.setBoxType(OS.NSBoxSeparator); >+ } else { >+ widget.setBoxType(OS.NSBoxCustom); >+ } > } > this.control = control; > view.setHidden(control != null); >@@ -869,7 +971,7 @@ > public void setDisabledImage (Image image) { > checkWidget(); > if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT); >- if ((style & SWT.SEPARATOR) != 0) return; >+ if ((style & SEPARATOR_MASK) != 0) return; > disabledImage = image; > updateImage (true); > } >@@ -900,7 +1002,7 @@ > public void setHotImage (Image image) { > checkWidget(); > if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT); >- if ((style & SWT.SEPARATOR) != 0) return; >+ if ((style & SEPARATOR_MASK) != 0) return; > hotImage = image; > updateImage (true); > } >@@ -908,7 +1010,7 @@ > public void setImage (Image image) { > checkWidget(); > if (image != null && image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT); >- if ((style & SWT.SEPARATOR) != 0) return; >+ if ((style & SEPARATOR_MASK) != 0) return; > super.setImage (image); > updateImage (true); > } >@@ -941,6 +1043,14 @@ > checkWidget(); > if ((style & (SWT.CHECK | SWT.RADIO)) == 0) return; > this.selection = selected; >+ >+ if ((style & (SWT.CHECK | SWT.SMOOTH)) == (SWT.CHECK | SWT.SMOOTH)) { >+ button.setState (selection ? OS.NSOnState : OS.NSOffState); >+ } >+ >+ if ((style & (SWT.RADIO | SWT.SMOOTH)) == (SWT.RADIO | SWT.SMOOTH) && selection) { >+ parent.toolbar.setSelectedItemIdentifier(nsItem.itemIdentifier()); >+ } > view.setNeedsDisplay(true); > } > >@@ -972,18 +1082,31 @@ > public void setText (String string) { > checkWidget(); > if (string == null) error (SWT.ERROR_NULL_ARGUMENT); >- if ((style & SWT.SEPARATOR) != 0) return; >+ if ((style & SEPARATOR_MASK) != 0) return; > super.setText (string); > NSButton widget = (NSButton)button; >- widget.setAttributedTitle(createString()); >- if (text.length() != 0 && image != null) { >- if ((parent.style & SWT.RIGHT) != 0) { >- widget.setImagePosition(OS.NSImageLeft); >+ if ((style & SWT.SMOOTH) != 0) { >+ if (text.length() > 0) { >+ char [] chars = new char [text.length ()]; >+ text.getChars (0, chars.length, chars, 0); >+ int length = fixMnemonic (chars); >+ nsItem.setLabel(NSString.stringWithCharacters(chars, length)); >+ nsMenuRep.setTitle(NSString.stringWithCharacters(chars, length)); > } else { >- widget.setImagePosition(OS.NSImageAbove); >+ nsItem.setLabel(NSString.string()); >+ nsMenuRep.setTitle(NSString.string()); > } > } else { >- widget.setImagePosition(text.length() != 0 ? OS.NSNoImage : OS.NSImageOnly); >+ widget.setAttributedTitle(createString()); >+ if (text.length() != 0 && image != null) { >+ if ((parent.style & SWT.RIGHT) != 0) { >+ widget.setImagePosition(OS.NSImageLeft); >+ } else { >+ widget.setImagePosition(OS.NSImageAbove); >+ } >+ } else { >+ widget.setImagePosition(text.length() != 0 ? OS.NSNoImage : OS.NSImageOnly); >+ } > } > parent.relayout (); > } >@@ -1010,8 +1133,15 @@ > */ > public void setToolTipText (String string) { > checkWidget(); >- toolTipText = string; >- parent.checkToolTip (this); >+ toolTipText = string; >+ if ((style & SWT.SMOOTH) != 0) { >+ char[] chars = new char [toolTipText.length ()]; >+ string.getChars (0, chars.length, chars, 0); >+ int length = fixMnemonic (chars); >+ nsItem.setToolTip(NSString.stringWithCharacters (chars, length)); >+ } else { >+ parent.checkToolTip (this); >+ } > } > > void setVisible (boolean visible) { >@@ -1037,9 +1167,22 @@ > */ > public void setWidth (int width) { > checkWidget(); >- if ((style & SWT.SEPARATOR) == 0) return; >+ if ((style & SEPARATOR_MASK) == 0) return; > if (width < 0 || this.width == width) return; >+ if (width == SWT.DEFAULT) width = DEFAULT_SEPARATOR_WIDTH; > this.width = width; >+ if ((style & SWT.SMOOTH) != 0) { >+ NSToolbar toolbar = parent.toolbar; >+ int index = parent.indexOf(this); >+ toolbar.removeItemAtIndex(index); >+ toolbar.insertItemWithItemIdentifier(getItemID(), index); >+ >+ NSRect newFrame = new NSRect(); >+ newFrame.width = width; >+ newFrame.height = 1; >+ view.setFrame(newFrame); >+ nsItem.setView(view); >+ } > parent.relayout(); > } > >@@ -1048,7 +1191,7 @@ > } > > void updateImage (boolean layout) { >- if ((style & SWT.SEPARATOR) != 0) return; >+ if ((style & SEPARATOR_MASK) != 0) return; > Image newImage = null; > > if ((state & DISABLED) == DISABLED && disabledImage != null) { >@@ -1071,14 +1214,17 @@ > */ > widget.setImage(newImage != null ? newImage.handle : null); > widget.setNeedsDisplay(true); >- if (text.length() != 0 && newImage != null) { >- if ((parent.style & SWT.RIGHT) != 0) { >- widget.setImagePosition(OS.NSImageLeft); >+ >+ if ((style & SWT.SMOOTH) == 0) { >+ if (text.length() != 0 && newImage != null) { >+ if ((parent.style & SWT.RIGHT) != 0) { >+ widget.setImagePosition(OS.NSImageLeft); >+ } else { >+ widget.setImagePosition(OS.NSImageAbove); >+ } > } else { >- widget.setImagePosition(OS.NSImageAbove); >+ widget.setImagePosition(text.length() != 0 ? OS.NSNoImage : OS.NSImageOnly); > } >- } else { >- widget.setImagePosition(text.length() != 0 ? OS.NSNoImage : OS.NSImageOnly); > } > parent.relayout(); > } >Index: Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java,v >retrieving revision 1.150 >diff -u -r1.150 Widget.java >--- Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java 20 Sep 2010 15:53:22 -0000 1.150 >+++ Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java 5 Oct 2010 00:28:07 -0000 >@@ -666,6 +666,7 @@ > } > > void drawImageWithFrameInView (int /*long*/ id, int /*long*/ sel, int /*long*/ image, NSRect rect, int /*long*/ view) { >+ callSuper(id, sel, image, rect, view); > } > > NSRect drawTitleWithFrameInView (int /*long*/ id, int /*long*/ sel, int /*long*/ title, NSRect rect, int /*long*/ view) { >@@ -1062,6 +1063,10 @@ > mouseDownSuper(id, sel, theEvent); > } > >+boolean mouseDownCanMoveWindow(int /*long*/ id, int /*long*/ sel) { >+ return callSuperBoolean(id, sel); >+} >+ > void mouseDownSuper(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) { > callSuper(id, sel, theEvent); > } >@@ -1922,6 +1927,21 @@ > return result; > } > >+int /*long*/ toolbar_itemForItemIdentifier_willBeInsertedIntoToolbar(int /*long*/ id, int /*long*/ sel, int /*long*/ toolbar, int /*long*/ itemID, boolean flag) { >+ return 0; >+} >+ >+int /*long*/ toolbarAllowedItemIdentifiers(int /*long*/ id, int /*long*/ sel, int /*long*/ toolbar) { >+ return 0; >+} >+ >+int /*long*/ toolbarDefaultItemIdentifiers(int /*long*/ id, int /*long*/ sel, int /*long*/ toolbar) { >+ return 0; >+} >+ >+int /*long*/ toolbarSelectableItemIdentifiers(int /*long*/ id, int /*long*/ sel, int /*long*/ toolbar) { >+ return 0; >+} > String tooltipText () { > return null; > } >Index: Eclipse SWT/common/org/eclipse/swt/SWT.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWT.java,v >retrieving revision 1.199 >diff -u -r1.199 SWT.java >--- Eclipse SWT/common/org/eclipse/swt/SWT.java 21 Sep 2010 15:02:33 -0000 1.199 >+++ Eclipse SWT/common/org/eclipse/swt/SWT.java 5 Oct 2010 00:28:08 -0000 >@@ -1010,6 +1010,20 @@ > */ > public static final int SEPARATOR = 1 << 1; > >+ /** >+ * A Style constant representing a flexible space separator in a Cocoa >+ * Unified toolbar. Although the (1 << 7) bit is already taken (they all are >+ * several times over) it's in a different context so it shouldn't represent >+ * a conflict. Carries no meaning on WS-s other than Cocoa. >+ */ >+ public static final int FLEX_SPACER = 1 << 7; >+ >+ /** >+ * A Style constant representing a space separator in a Cocoa Unified >+ * toolbar. Carries no meaning on WS-s other than Cocoa. >+ */ >+ public static final int SPACER = 1 << 10; >+ > /** > * Style constant for toggle button behavior (value is 1<<1). > * <p><b>Used By:</b><ul>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 222859
:
97896
|
99000
|
99485
|
99492
|
99494
|
100753
|
129651
|
129697
|
129893
|
129894
|
129909
|
129973
|
130031
|
130057
|
147838
|
170610
|
170611
|
180221
|
180379
|
180532
|
180977
|
189297
|
189299