diff options
6 files changed, 30 insertions, 10 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras index 64a517a096..bc6d3e03c5 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras @@ -2860,6 +2860,9 @@ <method selector="hitPart" swt_gen="true"> <retval swt_gen="true"></retval> </method> + <method selector="knobProportion" swt_gen="true"> + <retval swt_gen="true"></retval> + </method> <method selector="rectForPart:" swt_gen="true"> <arg swt_gen="true"></arg> <retval swt_gen="true"></retval> @@ -2875,8 +2878,7 @@ <arg swt_gen="true"></arg> <retval swt_gen="true"></retval> </method> - <method selector="setFloatValue:knobProportion:" swt_gen="true"> - <arg swt_gen="true"></arg> + <method selector="setKnobProportion:" swt_gen="true"> <arg swt_gen="true"></arg> <retval swt_gen="true"></retval> </method> diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSScroller.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSScroller.java index 771e375f4c..d2b0f14454 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSScroller.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSScroller.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2011 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 @@ -32,6 +32,10 @@ public int /*long*/ hitPart() { return OS.objc_msgSend(this.id, OS.sel_hitPart); } +public float /*double*/ knobProportion() { + return (float)OS.objc_msgSend_fpret(this.id, OS.sel_knobProportion); +} + public NSRect rectForPart(int /*long*/ partCode) { NSRect result = new NSRect(); OS.objc_msgSend_stret(result, this.id, OS.sel_rectForPart_, partCode); @@ -50,8 +54,8 @@ public void setControlSize(int /*long*/ controlSize) { OS.objc_msgSend(this.id, OS.sel_setControlSize_, controlSize); } -public void setFloatValue(float aFloat, float /*double*/ proportion) { - OS.objc_msgSend(this.id, OS.sel_setFloatValue_knobProportion_, aFloat, proportion); +public void setKnobProportion(float /*double*/ proportion) { + OS.objc_msgSend(this.id, OS.sel_setKnobProportion_, proportion); } public int /*long*/ testPart(NSPoint thePoint) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java index 0c1aeb4bed..583cf70006 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java @@ -143,6 +143,10 @@ public class OS extends C { /** @method flags=const dynamic no_gen*/ public static final native int /*long*/ NSAccessibilityCellRole(); public static final NSString NSAccessibilityCellRole = new NSString(NSAccessibilityCellRole()); + + /** 10.7 selectors */ + public static final int /*long*/ sel_isCompatibleWithOverlayScrollers = sel_registerName("isCompatibleWithOverlayScrollers"); + public static final int /*long*/ sel_flashScrollers = sel_registerName("flashScrollers"); /* AWT application delegate. Remove these when JavaRuntimeSupport.framework has bridgesupport generated for it. */ public static final int /*long*/ class_JRSAppKitAWT = objc_getClass("JRSAppKitAWT"); @@ -1425,6 +1429,7 @@ public static final int /*long*/ sel_keyEquivalent = sel_registerName("keyEquiva public static final int /*long*/ sel_keyEquivalentModifierMask = sel_registerName("keyEquivalentModifierMask"); public static final int /*long*/ sel_keyUp_ = sel_registerName("keyUp:"); public static final int /*long*/ sel_keyWindow = sel_registerName("keyWindow"); +public static final int /*long*/ sel_knobProportion = sel_registerName("knobProportion"); public static final int /*long*/ sel_knobThickness = sel_registerName("knobThickness"); public static final int /*long*/ sel_lastPathComponent = sel_registerName("lastPathComponent"); public static final int /*long*/ sel_layoutManager = sel_registerName("layoutManager"); @@ -1875,6 +1880,7 @@ public static final int /*long*/ sel_setJobDisposition_ = sel_registerName("setJ public static final int /*long*/ sel_setJobTitle_ = sel_registerName("setJobTitle:"); public static final int /*long*/ sel_setKeyEquivalent_ = sel_registerName("setKeyEquivalent:"); public static final int /*long*/ sel_setKeyEquivalentModifierMask_ = sel_registerName("setKeyEquivalentModifierMask:"); +public static final int /*long*/ sel_setKnobProportion_ = sel_registerName("setKnobProportion:"); public static final int /*long*/ sel_setLabel_ = sel_registerName("setLabel:"); public static final int /*long*/ sel_setLabel_forSegment_ = sel_registerName("setLabel:forSegment:"); public static final int /*long*/ sel_setLeaf_ = sel_registerName("setLeaf:"); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java index a374930374..27458990b1 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java @@ -2596,7 +2596,6 @@ void initClasses () { OS.class_addMethod(cls, OS.sel_collapseItem_collapseChildren_, proc4, "@:@Z"); OS.class_addMethod(cls, OS.sel_drawBackgroundInClipRect_, drawBackgroundInClipRectProc, "@:{NSRect}"); addEventMethods(cls, proc2, proc3, drawRectProc, hitTestProc, setNeedsDisplayInRectProc); - addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc); addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc); OS.objc_registerClassPair(cls); @@ -2645,6 +2644,9 @@ void initClasses () { addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc); addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc); OS.objc_registerClassPair(cls); + /* Note that isFlippedProc is used for performance and convenience */ + int /*long*/ metaClass = OS.objc_getMetaClass(className); + OS.class_addMethod(metaClass, OS.sel_isCompatibleWithOverlayScrollers, isFlippedProc, "@:"); className = "SWTScrollView"; cls = OS.objc_allocateClassPair(OS.class_NSScrollView, className, 0); @@ -2770,7 +2772,6 @@ void initClasses () { OS.class_addMethod(cls, OS.sel_tableView_writeRowsWithIndexes_toPasteboard_, proc5, "@:@@@"); OS.class_addMethod(cls, OS.sel_drawBackgroundInClipRect_, drawBackgroundInClipRectProc, "@:{NSRect}"); addEventMethods(cls, proc2, proc3, drawRectProc, hitTestProc, setNeedsDisplayInRectProc); - addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc); addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc); OS.objc_registerClassPair(cls); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ScrollBar.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ScrollBar.java index 1dcd9042c1..f18a8c0b21 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ScrollBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ScrollBar.java @@ -729,8 +729,14 @@ void updateBar (int selection, int minimum, int maximum, int thumb) { int range = maximum - thumb - minimum; float fraction = range <= 0 ? 1 : (float) (selection - minimum) / range; float knob = range <= 0 ? 1 : (float) thumb / (maximum - minimum); - widget.setFloatValue (fraction, knob); - widget.setEnabled (range > 0); + double oldFraction = widget.doubleValue(); + float /*double*/ oldKnob = widget.knobProportion(); + widget.setDoubleValue(fraction); + widget.setKnobProportion(knob); + widget.setEnabled (range > 0); + if (target == null && (knob != oldKnob || fraction != oldFraction)) { + OS.objc_msgSend(parent.scrollView.id, OS.sel_flashScrollers); + } } } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Slider.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Slider.java index 502957e5b1..1d61979f14 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Slider.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Slider.java @@ -469,7 +469,8 @@ void updateBar (int selection, int minimum, int maximum, int thumb) { int range = maximum - thumb - minimum; float fraction = range <= 0 ? 1 : (float)(selection - minimum) / range; float knob = range <= 0 ? 1 : (float)thumb / (maximum - minimum); - widget.setFloatValue (fraction, knob); + widget.setDoubleValue(fraction); + widget.setKnobProportion(knob); widget.setEnabled (range > 0); } |