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 180532 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]
Latest update
222859-patch-3 (text/plain), 61.36 KB, created by
Scott Kovatch
on 2010-10-08 20:27:59 EDT
(
hide
)
Description:
Latest update
Filename:
MIME Type:
Creator:
Scott Kovatch
Created:
2010-10-08 20:27:59 EDT
Size:
61.36 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.swt >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 8 Oct 2010 23:52:57 -0000 >@@ -1290,6 +1290,20 @@ > } > #endif > >+#ifndef NO_CGContextBeginTransparencyLayerWithRect >+JNIEXPORT void JNICALL OS_NATIVE(CGContextBeginTransparencyLayerWithRect) >+ (JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jintLong arg2) >+{ >+ CGRect _arg1, *lparg1=NULL; >+ OS_NATIVE_ENTER(env, that, CGContextBeginTransparencyLayerWithRect_FUNC); >+ if (arg1) if ((lparg1 = getCGRectFields(env, arg1, &_arg1)) == NULL) goto fail; >+ CGContextBeginTransparencyLayerWithRect((CGContextRef)arg0, *lparg1, (CFDictionaryRef)arg2); >+fail: >+ if (arg1 && lparg1) setCGRectFields(env, arg1, lparg1); >+ OS_NATIVE_EXIT(env, that, CGContextBeginTransparencyLayerWithRect_FUNC); >+} >+#endif >+ > #ifndef NO_CGContextCopyPath > JNIEXPORT jintLong JNICALL OS_NATIVE(CGContextCopyPath) > (JNIEnv *env, jclass that, jintLong arg0) >@@ -1349,6 +1363,16 @@ > } > #endif > >+#ifndef NO_CGContextEndTransparencyLayer >+JNIEXPORT void JNICALL OS_NATIVE(CGContextEndTransparencyLayer) >+ (JNIEnv *env, jclass that, jintLong arg0) >+{ >+ OS_NATIVE_ENTER(env, that, CGContextEndTransparencyLayer_FUNC); >+ CGContextEndTransparencyLayer((CGContextRef)arg0); >+ OS_NATIVE_EXIT(env, that, CGContextEndTransparencyLayer_FUNC); >+} >+#endif >+ > #ifndef NO_CGContextFillRect > JNIEXPORT void JNICALL OS_NATIVE(CGContextFillRect) > (JNIEnv *env, jclass that, jintLong arg0, jobject arg1) >@@ -4911,6 +4935,20 @@ > } > #endif > >+#ifndef NO_NSRectFillUsingOperation >+JNIEXPORT void JNICALL OS_NATIVE(NSRectFillUsingOperation) >+ (JNIEnv *env, jclass that, jobject arg0, jintLong arg1) >+{ >+ NSRect _arg0, *lparg0=NULL; >+ OS_NATIVE_ENTER(env, that, NSRectFillUsingOperation_FUNC); >+ if (arg0) if ((lparg0 = getNSRectFields(env, arg0, &_arg0)) == NULL) goto fail; >+ NSRectFillUsingOperation(*lparg0, (NSCompositingOperation)arg1); >+fail: >+ if (arg0 && lparg0) setNSRectFields(env, arg0, lparg0); >+ OS_NATIVE_EXIT(env, that, NSRectFillUsingOperation_FUNC); >+} >+#endif >+ > #ifndef NO_NSRect_1sizeof > JNIEXPORT jint JNICALL OS_NATIVE(NSRect_1sizeof) > (JNIEnv *env, jclass that) >@@ -9440,6 +9478,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 8 Oct 2010 23:52:57 -0000 >@@ -14,8 +14,8 @@ > > #ifdef NATIVE_STATS > >-int OS_nativeFunctionCount = 610; >-int OS_nativeFunctionCallCount[610]; >+int OS_nativeFunctionCount = 614; >+int OS_nativeFunctionCallCount[614]; > char * OS_nativeFunctionNames[] = { > "ATSFontActivateFromFileReference", > "AcquireRootMenu", >@@ -85,9 +85,11 @@ > "CGColorSpaceCreateDeviceRGB", > "CGColorSpaceRelease", > "CGContextAddPath", >+ "CGContextBeginTransparencyLayerWithRect", > "CGContextCopyPath", > "CGContextCopyWindowContentsToRect", > "CGContextDrawImage", >+ "CGContextEndTransparencyLayer", > "CGContextFillRect", > "CGContextRelease", > "CGContextReplacePathWithStrokedPath", >@@ -375,6 +377,7 @@ > "NSPrintSpoolJob", > "NSRTFPboardType", > "NSRange_1sizeof", >+ "NSRectFillUsingOperation", > "NSRect_1sizeof", > "NSSearchPathForDirectoriesInDomains", > "NSSize_1sizeof", >@@ -1081,6 +1084,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 8 Oct 2010 23:52:57 -0000 >@@ -93,9 +93,11 @@ > CGColorSpaceCreateDeviceRGB_FUNC, > CGColorSpaceRelease_FUNC, > CGContextAddPath_FUNC, >+ CGContextBeginTransparencyLayerWithRect_FUNC, > CGContextCopyPath_FUNC, > CGContextCopyWindowContentsToRect_FUNC, > CGContextDrawImage_FUNC, >+ CGContextEndTransparencyLayer_FUNC, > CGContextFillRect_FUNC, > CGContextRelease_FUNC, > CGContextReplacePathWithStrokedPath_FUNC, >@@ -383,6 +385,7 @@ > NSPrintSpoolJob_FUNC, > NSRTFPboardType_FUNC, > NSRange_1sizeof_FUNC, >+ NSRectFillUsingOperation_FUNC, > NSRect_1sizeof_FUNC, > NSSearchPathForDirectoriesInDomains_FUNC, > NSSize_1sizeof_FUNC, >@@ -1089,6 +1092,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 8 Oct 2010 23:52:58 -0000 >@@ -650,6 +650,10 @@ > <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> >@@ -742,6 +746,10 @@ > <arg swt_gen="true"></arg> > <retval swt_gen="true"></retval> > </method> >+ <method selector="setBackgroundStyle:" swt_gen="true"> >+ <arg swt_gen="true"></arg> >+ <retval swt_gen="true"></retval> >+ </method> > <method selector="setBaseWritingDirection:" swt_gen="true"> > <arg swt_gen="true"></arg> > <retval swt_gen="true"></retval> >@@ -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> >@@ -3808,6 +3827,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> >@@ -4460,6 +4487,7 @@ > <enum name="NSApplicationDefined" swt_gen="true"></enum> > <enum name="NSApplicationDelegateReplySuccess" swt_gen="true"></enum> > <enum name="NSAtTop" swt_gen="true"></enum> >+ <enum name="NSBackgroundStyleRaised" swt_gen="true"></enum> > <enum name="NSBackingStoreBuffered" swt_gen="true"></enum> > <enum name="NSBackspaceCharacter" swt_gen="true"></enum> > <enum name="NSBevelLineJoinStyle" swt_gen="true"></enum> >@@ -4479,8 +4507,10 @@ > <enum name="NSCommandKeyMask" swt_gen="true"></enum> > <enum name="NSCompositeClear" swt_gen="true"></enum> > <enum name="NSCompositeCopy" swt_gen="true"></enum> >+ <enum name="NSCompositeSourceAtop" 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> >@@ -4606,6 +4636,7 @@ > <enum name="NSTerminateNow" swt_gen="true"></enum> > <enum name="NSTextFieldAndStepperDatePickerStyle" swt_gen="true"></enum> > <enum name="NSTitledWindowMask" swt_gen="true"></enum> >+ <enum name="NSToolbarDisplayModeIconOnly" 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> >@@ -4683,6 +4714,10 @@ > <arg swt_gen="true"></arg> > <retval swt_gen="true"></retval> > </function> >+ <function name="NSRectFillUsingOperation" swt_gen="true"> >+ <arg swt_gen="true"></arg> >+ <arg swt_gen="true"></arg> >+ </function> > <function name="NSWindowList" swt_gen="true"> > <arg swt_gen="true"></arg> > <arg swt_gen="true" swt_java_type="int[]" swt_java_type64="long[]"></arg> >Index: Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/CoreGraphicsFull.bridgesupport.extras >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/CoreGraphicsFull.bridgesupport.extras,v >retrieving revision 1.36 >diff -u -r1.36 CoreGraphicsFull.bridgesupport.extras >--- Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/CoreGraphicsFull.bridgesupport.extras 12 Apr 2010 17:19:54 -0000 1.36 >+++ Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/CoreGraphicsFull.bridgesupport.extras 8 Oct 2010 23:52:58 -0000 >@@ -63,11 +63,19 @@ > <arg swt_gen="true"></arg> > <arg swt_gen="true"></arg> > </function> >+ <function name="CGContextBeginTransparencyLayerWithRect" swt_gen="true"> >+ <arg swt_gen="true"></arg> >+ <arg swt_gen="true"></arg> >+ <arg swt_gen="true"></arg> >+ </function> > <function name="CGContextDrawImage" swt_gen="true"> > <arg swt_gen="true"></arg> > <arg swt_gen="true"></arg> > <arg swt_gen="true"></arg> > </function> >+ <function name="CGContextEndTransparencyLayer" swt_gen="true"> >+ <arg swt_gen="true"></arg> >+ </function> > <function name="CGContextFillRect" swt_gen="true"> > <arg swt_gen="true"></arg> > <arg swt_gen="true"></arg> >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 8 Oct 2010 23:52:58 -0000 >@@ -47,6 +47,10 @@ > 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); > } >Index: Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSCell.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSCell.java,v >retrieving revision 1.29 >diff -u -r1.29 NSCell.java >--- Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSCell.java 27 Jul 2010 16:36:38 -0000 1.29 >+++ Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSCell.java 8 Oct 2010 23:52:58 -0000 >@@ -114,6 +114,10 @@ > OS.objc_msgSend(this.id, OS.sel_setAttributedStringValue_, obj != null ? obj.id : 0); > } > >+public void setBackgroundStyle(int /*long*/ style) { >+ OS.objc_msgSend(this.id, OS.sel_setBackgroundStyle_, style); >+} >+ > public void setBaseWritingDirection(int /*long*/ writingDirection) { > OS.objc_msgSend(this.id, OS.sel_setBaseWritingDirection_, writingDirection); > } >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 8 Oct 2010 23:52:58 -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 8 Oct 2010 23:52:58 -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); > } >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 8 Oct 2010 23:52:58 -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/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 8 Oct 2010 23:53:00 -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 */ >@@ -1375,7 +1377,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:"); >@@ -1640,6 +1644,7 @@ > public static final int /*long*/ sel_setAutosaveExpandedItems_ = sel_registerName("setAutosaveExpandedItems:"); > public static final int /*long*/ sel_setBackgroundColor_ = sel_registerName("setBackgroundColor:"); > public static final int /*long*/ sel_setBackgroundLayoutEnabled_ = sel_registerName("setBackgroundLayoutEnabled:"); >+public static final int /*long*/ sel_setBackgroundStyle_ = sel_registerName("setBackgroundStyle:"); > public static final int /*long*/ sel_setBadgeLabel_ = sel_registerName("setBadgeLabel:"); > public static final int /*long*/ sel_setBaseWritingDirection_ = sel_registerName("setBaseWritingDirection:"); > public static final int /*long*/ sel_setBaseWritingDirection_range_ = sel_registerName("setBaseWritingDirection:range:"); >@@ -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:"); >@@ -2087,6 +2095,7 @@ > public static final int NSApplicationDefined = 15; > public static final int NSApplicationDelegateReplySuccess = 0; > public static final int NSAtTop = 2; >+public static final int NSBackgroundStyleRaised = 2; > public static final int NSBackingStoreBuffered = 2; > public static final int NSBackspaceCharacter = 8; > public static final int NSBevelLineJoinStyle = 2; >@@ -2106,8 +2115,10 @@ > public static final int NSCommandKeyMask = 1048576; > public static final int NSCompositeClear = 0; > public static final int NSCompositeCopy = 1; >+public static final int NSCompositeSourceAtop = 5; > 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; >@@ -2233,6 +2244,7 @@ > public static final int NSTerminateNow = 1; > public static final int NSTextFieldAndStepperDatePickerStyle = 0; > public static final int NSTitledWindowMask = 1; >+public static final int NSToolbarDisplayModeIconOnly = 2; > public static final int NSUnderlineStyleDouble = 9; > public static final int NSUnderlineStyleNone = 0; > public static final int NSUnderlineStyleSingle = 1; >@@ -2948,6 +2960,11 @@ > */ > public static final native int /*long*/ NSNumberOfColorComponents(int /*long*/ colorSpaceName); > /** >+ * @param aRect flags=struct >+ * @param op cast=(NSCompositingOperation) >+ */ >+public static final native void NSRectFillUsingOperation(NSRect aRect, int /*long*/ op); >+/** > * @param size cast=(NSInteger) > * @param list cast=(NSInteger*) > */ >@@ -3070,12 +3087,22 @@ > */ > public static final native void CGContextAddPath(int /*long*/ context, int /*long*/ path); > /** >+ * @param context cast=(CGContextRef) >+ * @param rect flags=struct >+ * @param auxiliaryInfo cast=(CFDictionaryRef) >+ */ >+public static final native void CGContextBeginTransparencyLayerWithRect(int /*long*/ context, CGRect rect, int /*long*/ auxiliaryInfo); >+/** > * @param c cast=(CGContextRef) > * @param rect flags=struct > * @param image cast=(CGImageRef) > */ > public static final native void CGContextDrawImage(int /*long*/ c, CGRect rect, int /*long*/ image); > /** >+ * @param context cast=(CGContextRef) >+ */ >+public static final native void CGContextEndTransparencyLayer(int /*long*/ context); >+/** > * @param c cast=(CGContextRef) > * @param rect flags=struct > */ >@@ -3526,6 +3553,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/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 8 Oct 2010 23:53:00 -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.341 >diff -u -r1.341 Display.java >--- Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java 5 Oct 2010 19:52:26 -0000 1.341 >+++ Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java 8 Oct 2010 23:53:01 -0000 >@@ -2132,6 +2132,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}"); >@@ -2289,7 +2290,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}"); >@@ -2688,6 +2688,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); >@@ -4615,7 +4634,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); >@@ -5122,6 +5141,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) { >@@ -5396,6 +5417,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; > } >@@ -5506,6 +5533,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 8 Oct 2010 23:53:02 -0000 >@@ -124,6 +124,7 @@ > boolean keyInputHappened; > NSRect currentFrame; > NSRect fullScreenFrame; >+ ToolBar toolBar; > > static int DEFAULT_CLIENT_WIDTH = -1; > static int DEFAULT_CLIENT_HEIGHT = -1; >@@ -410,6 +411,17 @@ > return new Shell (display, null, SWT.NO_TRIM, handle, true); > } > >+Control [] _getChildren () { >+ Control [] children = super._getChildren(); >+ if (toolBar != null) { >+ Control [] newChildren = new Control [children.length + 1]; >+ System.arraycopy (children, 0, newChildren, 1, children.length); >+ newChildren[0] = toolBar; >+ children = newChildren; >+ } >+ return children; >+} >+ > static int checkStyle (Shell parent, int style) { > style = Decorations.checkStyle (style); > style &= ~SWT.TRANSPARENT; >@@ -1104,6 +1116,29 @@ > return 1; > } > >+/** >+ * Returns the instance of the ToolBar object representing the tool bar that can appear on the >+ * trim of the shell. This will return <code>null</code> if the platform does not support tool bars that >+ * not part of the content area of the shell, or if the style of the shell does not support a >+ * tool bar. >+ * <p> >+ * NOTE: This API should be considered experimental and subject to change before the final release. >+ * >+ * @return a ToolBar object representing the window's tool bar or null. >+ * >+ * @exception SWTException <ul> >+ * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> >+ * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> >+ * </ul> >+ * >+ * @since 3.7 >+ */ >+public ToolBar getToolbar() { >+ checkWidget(); >+ if (toolBar == null) toolBar = new ToolBar(this, SWT.HORIZONTAL | SWT.SMOOTH, true); >+ return toolBar; >+} >+ > boolean hasBorder () { > return false; > } >@@ -1174,6 +1209,26 @@ > window.makeKeyAndOrderFront (null); > } > >+Point minimumSize (int wHint, int Hint, boolean changed) { >+ // minimumSize is used by computeSize() to figure out how big the view >+ // (or, in this case, the content view of the Shell) should be. >+ // An NSToolbar does not contribute to the content area, but must be >+ // accounted for. If the shell has a toolbar but no other children >+ // this will return the width of the toolbar and a height of 1 >+ Control [] children = _getChildren (); >+ int width = 0, height = 0; >+ for (int i=0; i<children.length; i++) { >+ Rectangle rect = children [i].getBounds (); >+ width = Math.max (width, rect.x + rect.width); >+ if (children[i] != toolBar) { >+ height = Math.max (height, rect.y + rect.height); >+ } else { >+ height = Math.max (height, 1); >+ } >+ } >+ return new Point (width, height); >+} >+ > void mouseMoved(int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) { > super.mouseMoved(id, sel, theEvent); > >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 8 Oct 2010 23:53:02 -0000 >@@ -47,8 +47,10 @@ > public class ToolBar extends Composite { > int itemCount; > ToolItem [] items; >+ NSToolbar nsToolbar; > NSArray accessibilityAttributes = null; > ToolItem lastFocus; >+ static int NEXT_ID; > > /** > * Constructs a new instance of this class given its parent >@@ -84,7 +86,11 @@ > * @see Widget#getStyle() > */ > public ToolBar (Composite parent, int style) { >- super (parent, checkStyle (style)); >+ this(parent, style, false); >+} >+ >+ToolBar(Composite parent, int style, boolean internal) { >+ super (parent, checkStyle (parent, style, internal)); > > /* > * Ensure that either of HORIZONTAL or VERTICAL is set. >@@ -141,7 +147,7 @@ > return super.accessibilityIsIgnored(id, sel); > } > >-static int checkStyle (int style) { >+static int checkStyle (Composite parent, int style, boolean internal) { > /* > * Even though it is legal to create this widget > * with scroll bars, they serve no useful purpose >@@ -149,7 +155,38 @@ > * 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); >+ >+ /* >+ * Only internal clients can create an NSToolbar-based ToolBar. >+ */ >+ if (!internal && (newStyle & SWT.SMOOTH) != 0) { >+ newStyle &= ~SWT.SMOOTH; >+ } >+ >+ /* >+ * 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 ((style & 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 +223,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) { >+ nsToolbar = ((NSToolbar)new SWTToolbar().alloc()).initWithIdentifier(NSString.stringWith(String.valueOf(NEXT_ID++))); >+ nsToolbar.setDelegate(nsToolbar); >+ nsToolbar.setDisplayMode(OS.NSToolbarDisplayModeIconOnly); >+ NSWindow window = parent.view.window(); >+ window.setToolbar(nsToolbar); >+ nsToolbar.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 +264,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) { >+ nsToolbar.insertItemWithItemIdentifier(item.getItemID(), index); >+ } else { >+ view.addSubview(item.view); >+ } > relayout (); > } > >@@ -222,6 +284,15 @@ > itemCount = 0; > } > >+NSFont defaultNSFont() { >+ return NSFont.systemFontOfSize(11.0f); >+} >+ >+void deregister () { >+ super.deregister (); >+ if (nsToolbar != null) display.removeWidget (nsToolbar); >+} >+ > void destroyItem (ToolItem item) { > int index = 0; > while (index < itemCount) { >@@ -232,7 +303,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) { >+ nsToolbar.removeItemAtIndex(index); >+ } else { >+ item.view.removeFromSuperview(); >+ } > relayout (); > } > >@@ -262,6 +337,25 @@ > return super.findTooltip (pt); > } > >+void setZOrder() { >+ if ((style & SWT.SMOOTH) != 0) return; >+ super.setZOrder(); >+} >+ >+public Rectangle getBounds () { >+ checkWidget(); >+ >+ if ((style & SWT.SMOOTH) != 0) { >+ // The NSToolbar's view will always be a child of the Shell, so we can just >+ // convert the frame to window-relative coordinates. >+ NSRect rect = view.frame(); >+ rect = view.convertRect_toView_(rect, null); >+ return new Rectangle((int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height); >+ } >+ >+ return super.getBounds(); >+} >+ > boolean forceFocus (NSView focusView) { > if (lastFocus != null && lastFocus.setFocus ()) return true; > ToolItem [] items = getItems (); >@@ -448,6 +542,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 [] containerRects = 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 (); >+ containerRects [i] = new NSView(itemViewers.objectAtIndex(i)).frame(); >+ if (i == 0) x = (int) containerRects[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 += containerRects[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,6 +610,10 @@ > } > > int [] layout (int nWidth, int nHeight, boolean resize) { >+ if ((style & SWT.SMOOTH) != 0) { >+ return layoutUnified(nWidth, nHeight, resize); >+ } >+ > if ((style & SWT.VERTICAL) != 0) { > return layoutVertical (nWidth, nHeight, resize); > } else { >@@ -492,6 +621,11 @@ > } > } > >+void register() { >+ super.register(); >+ if (nsToolbar != null) display.addWidget (nsToolbar, this); >+} >+ > void relayout () { > if (!getDrawing()) return; > Rectangle rect = getClientArea (); >@@ -513,7 +647,13 @@ > } > > void releaseHandle () { >- super.releaseHandle (); >+ super.releaseHandle (); >+ >+ if (nsToolbar != null) { >+ nsToolbar.release(); >+ nsToolbar = null; >+ } >+ > if (accessibilityAttributes != null) accessibilityAttributes.release(); > accessibilityAttributes = null; > } >@@ -547,14 +687,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 +715,13 @@ > return super.sendMouseEvent(nsEvent, type, send); > } > >+void setBounds (int x, int y, int width, int height, boolean move, boolean resize) { >+ // In the 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 +735,53 @@ > if (redraw && drawCount == 0) relayout(); > } > >+public void setVisible(boolean visible) { >+ if (nsToolbar != null) nsToolbar.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 8 Oct 2010 23:53:02 -0000 >@@ -39,7 +39,10 @@ > public class ToolItem extends Item { > NSView view; > NSButton button; >- int width = DEFAULT_SEPARATOR_WIDTH; >+ NSToolbarItem nsItem; >+ NSMenuItem nsMenuRep; >+ NSString id; >+ int width; > ToolBar parent; > Image hotImage, disabledImage; > String toolTipText; >@@ -302,20 +305,22 @@ > checkWidget(); > int width = 0, height = 0; > if ((style & SWT.SEPARATOR) != 0) { >+ // In the unified toolbar case the width is ignored if 0, DEFAULT, or SEPARATOR_FILL. > if ((parent.style & SWT.HORIZONTAL) != 0) { > width = getWidth (); >+ if (width == SWT.DEFAULT) width = DEFAULT_SEPARATOR_WIDTH; > height = DEFAULT_HEIGHT; > } else { > width = DEFAULT_WIDTH; > height = getWidth (); >+ if (height == SWT.DEFAULT) width = DEFAULT_SEPARATOR_WIDTH; > } > if (control != null) { > height = Math.max (height, control.getMininumHeight ()); > } > } 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,19 +330,38 @@ > if ((style & SWT.DROP_DOWN) != 0) { > width += ARROW_WIDTH + INSET; > } >- width += INSET * 2; >- height += INSET * 2; >+ >+ if ((style & SWT.SMOOTH) == 0 || image != null) { >+ width += INSET * 2; >+ height += INSET * 2; >+ } else { >+ height -= 2; >+ } > } > return new Point (width, height); > } > > void createHandle () { >+ 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 & 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) { >+ 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(); >@@ -351,6 +375,10 @@ > NSButtonCell cell = (NSButtonCell)new SWTButtonCell ().alloc ().init (); > button.setCell (cell); > cell.release(); >+ if ((style & SWT.SMOOTH) != 0) { >+ cell.setHighlightsBy(OS.NSContentsCellMask); >+ cell.setBackgroundStyle(OS.NSBackgroundStyleRaised); >+ } > button.setBordered(false); > button.setAction(OS.sel_sendSelection); > button.setTarget(button); >@@ -393,12 +421,52 @@ > rect.y += 3; > } > } >- callSuper (id, sel, image, rect, view); >+ int /*long*/ cgContext = NSGraphicsContext.currentContext().graphicsPort(); >+ NSCell cell = new NSCell(id); >+ boolean drawSelected = ((style & SWT.SMOOTH) != 0) && getSelection() && ((style & SWT.CHECK) != 0) && !cell.isHighlighted(); >+ >+ if (drawSelected) { >+ NSGraphicsContext.currentContext().saveGraphicsState(); >+ CGRect cgRect = new CGRect(); >+ cgRect.origin.x = rect.x; >+ cgRect.origin.y = rect.y; >+ cgRect.size.width = rect.width; >+ cgRect.size.height = rect.height; >+ OS.CGContextBeginTransparencyLayerWithRect(cgContext, cgRect, 0); >+ } >+ >+ super.drawImageWithFrameInView(id, sel, image, rect, view); >+ >+ if (drawSelected) { >+ NSColor.colorWithCalibratedRed(0,0,0,.3f).setFill(); >+ OS.NSRectFillUsingOperation(rect, OS.NSCompositeSourceAtop); >+ OS.CGContextEndTransparencyLayer(cgContext); >+ NSGraphicsContext.currentContext().restoreGraphicsState(); >+ } >+} >+ >+NSRect drawTitleWithFrameInView (int /*long*/ id, int /*long*/ sel, int /*long*/ title, NSRect titleRect, int /*long*/ view) { >+ boolean hiliteShadow = new NSButtonCell(id).isHighlighted() && (style & SWT.SMOOTH) != 0 && text.length() > 0 && image == null; >+ >+ // An unbordered cell doesn't draw any highlighting when pushed or selected, so we have to do it here. >+ if (hiliteShadow) { >+ NSColor transWhiteColor = NSColor.colorWithCalibratedRed(1.0f, 1.0f, 1.0f, .8f); >+ NSAttributedString attribStr = new NSAttributedString(title); >+ NSMutableAttributedString tmpString = new NSMutableAttributedString(attribStr.mutableCopy()); >+ NSRange range = new NSRange(); >+ range.location = 0; >+ range.length = attribStr.length(); >+ tmpString.addAttribute(OS.NSForegroundColorAttributeName, transWhiteColor, range); >+ tmpString.autorelease(); >+ title = tmpString.id; >+ } >+ return super.drawTitleWithFrameInView(id, sel, title, titleRect, view); > } > > void drawWidget (int /*long*/ id, NSGraphicsContext context, NSRect rect) { > if (id == view.id) { >- if (getSelection ()) { >+ boolean drawSelected = getSelection() && ((style & SWT.SMOOTH) == 0); >+ if (drawSelected) { > NSRect bounds = view.bounds(); > context.saveGraphicsState(); > NSColor.colorWithCalibratedRed(0.1f, 0.1f, 0.1f, 0.1f).setFill(); >@@ -435,6 +503,10 @@ > } > > void enableWidget(boolean enabled) { >+ if ((style & SWT.SMOOTH) != 0) { >+ nsItem.setEnabled(enabled); >+ } >+ > if ((style & SWT.SEPARATOR) == 0) { > ((NSButton)button).setEnabled(enabled); > updateImage(true); >@@ -454,6 +526,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 +621,26 @@ > return hotImage; > } > >+NSString getItemID() { >+ NSString itemID = id; >+ >+ // For separators, return a Cocoa constant for the tool item ID. >+ if ((style & SWT.SEPARATOR) != 0) { >+ // If we are using a non-default width or control use that instead. >+ if (width <= 0 && control == null) { >+ if (width == 0) { >+ itemID = OS.NSToolbarSeparatorItemIdentifier; >+ } else if (width == SWT.DEFAULT) { >+ itemID = OS.NSToolbarSpaceItemIdentifier; >+ } else if (width == SWT.SEPARATOR_FILL) { >+ itemID = OS.NSToolbarFlexibleSpaceItemIdentifier; >+ } >+ } >+ } >+ >+ return itemID; >+} >+ > /** > * Returns the receiver's parent, which must be a <code>ToolBar</code>. > * >@@ -652,6 +753,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 +843,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 +888,35 @@ > > 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; >+ // Temporarily clear the view. This will force the item and toolbar to re-layout >+ // when the view is set again. >+ nsItem.setView(null); >+ view.setFrameSize(newSize); >+ if ((style & SWT.DROP_DOWN) != 0) newSize.width -= ARROW_WIDTH + INSET; >+ if (button != null) button.setFrameSize(newSize); >+ if ((style & SWT.DROP_DOWN) != 0) newSize.width += ARROW_WIDTH + INSET; >+ nsItem.setMinSize(newSize); >+ nsItem.setMaxSize(newSize); >+ nsItem.setView(view); > } > } > >@@ -808,11 +943,14 @@ > } > 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 & 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); >@@ -941,6 +1079,11 @@ > checkWidget(); > if ((style & (SWT.CHECK | SWT.RADIO)) == 0) return; > this.selection = selected; >+ >+ if ((style & (SWT.RADIO | SWT.SMOOTH)) == (SWT.RADIO | SWT.SMOOTH) && selection) { >+ parent.nsToolbar.setSelectedItemIdentifier(nsItem.itemIdentifier()); >+ } >+ > view.setNeedsDisplay(true); > } > >@@ -975,6 +1118,13 @@ > if ((style & SWT.SEPARATOR) != 0) return; > super.setText (string); > NSButton widget = (NSButton)button; >+ if ((style & SWT.SMOOTH) != 0) { >+ char [] chars = new char [text.length ()]; >+ text.getChars (0, chars.length, chars, 0); >+ int length = fixMnemonic (chars); >+ nsMenuRep.setTitle(NSString.stringWithCharacters(chars, length)); >+ } >+ > widget.setAttributedTitle(createString()); > if (text.length() != 0 && image != null) { > if ((parent.style & SWT.RIGHT) != 0) { >@@ -1010,8 +1160,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) { >@@ -1028,7 +1185,14 @@ > /** > * Sets the width of the receiver, for <code>SEPARATOR</code> ToolItems. > * >- * @param width the new width >+ * @param width the new width. If the new value is <code>SWT.DEFAULT</code>, >+ * the width is a fixed-width area whose amount is determined by the platform. >+ * If the new value is 0 a vertical or horizontal line will be drawn, depending >+ * on the setting of the corresponding style bit (<code>SWT.VERTICAL</code> or >+ * <code>SWT.HORIZONTAL</code>). If the new value is <code>SWT.SEPARATOR_FILL</code> >+ * a variable-width space is inserted that acts as a spring between the two adjoining >+ * items which will push them out to the extent of the containing ToolBar. >+ * > * > * @exception SWTException <ul> > * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> >@@ -1040,6 +1204,12 @@ > if ((style & SWT.SEPARATOR) == 0) return; > if (width < 0 || this.width == width) return; > this.width = width; >+ if ((style & SWT.SMOOTH) != 0) { >+ NSToolbar toolbar = parent.nsToolbar; >+ int index = parent.indexOf(this); >+ toolbar.removeItemAtIndex(index); >+ toolbar.insertItemWithItemIdentifier(getItemID(), index); >+ } > 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 8 Oct 2010 23:53:02 -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 8 Oct 2010 23:53:03 -0000 >@@ -1010,6 +1010,14 @@ > */ > public static final int SEPARATOR = 1 << 1; > >+ /** >+ * Constant representing a flexible space separator in a ToolBar. >+ * <p><b>Used By:</b><ul> >+ * <li><code>ToolItem</code></li> >+ * </ul></p> >+ */ >+ public static final int SEPARATOR_FILL = -2; >+ > /** > * 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