diff options
author | Silenio Quarti <silenio> | 2008-04-11 19:03:38 +0000 |
---|---|---|
committer | Silenio Quarti <silenio> | 2008-04-11 19:03:38 +0000 |
commit | 9da76fa592a484a15f121fdf2a35999495858b74 (patch) | |
tree | 75c7c112e66e7e88f1ca44fee3e2585ffd724ca6 /bundles/org.eclipse.swt | |
parent | 36eaa6570a484e2f9bbbd219e6525409ed733fd2 (diff) | |
download | eclipse.platform.swt-9da76fa592a484a15f121fdf2a35999495858b74.tar.gz eclipse.platform.swt-9da76fa592a484a15f121fdf2a35999495858b74.tar.xz eclipse.platform.swt-9da76fa592a484a15f121fdf2a35999495858b74.zip |
226747 - CCombo arrow button not centered
Diffstat (limited to 'bundles/org.eclipse.swt')
5 files changed, 31 insertions, 30 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c index 3dc7dd7115..6eca87861a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c @@ -2111,6 +2111,16 @@ JNIEXPORT void JNICALL OS_NATIVE(CGContextRestoreGState) } #endif +#ifndef NO_CGContextRotateCTM +JNIEXPORT void JNICALL OS_NATIVE(CGContextRotateCTM) + (JNIEnv *env, jclass that, jint arg0, jfloat arg1) +{ + OS_NATIVE_ENTER(env, that, CGContextRotateCTM_FUNC); + CGContextRotateCTM((CGContextRef)arg0, arg1); + OS_NATIVE_EXIT(env, that, CGContextRotateCTM_FUNC); +} +#endif + #ifndef NO_CGContextSaveGState JNIEXPORT void JNICALL OS_NATIVE(CGContextSaveGState) (JNIEnv *env, jclass that, jint arg0) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.c index 6cc925232d..f20ce0da76 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.c @@ -14,8 +14,8 @@ #ifdef NATIVE_STATS -int OS_nativeFunctionCount = 963; -int OS_nativeFunctionCallCount[963]; +int OS_nativeFunctionCount = 964; +int OS_nativeFunctionCallCount[964]; char * OS_nativeFunctionNames[] = { "AECoerceDesc", "AECountItems", @@ -172,6 +172,7 @@ char * OS_nativeFunctionNames[] = { "CGContextMoveToPoint", "CGContextRelease", "CGContextRestoreGState", + "CGContextRotateCTM", "CGContextSaveGState", "CGContextScaleCTM", "CGContextSelectFont", diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.h index 477843d8b9..f857c7b2d9 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os_stats.h @@ -180,6 +180,7 @@ typedef enum { CGContextMoveToPoint_FUNC, CGContextRelease_FUNC, CGContextRestoreGState_FUNC, + CGContextRotateCTM_FUNC, CGContextSaveGState_FUNC, CGContextScaleCTM_FUNC, CGContextSelectFont_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/OS.java index e1bd398697..2099b54f78 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/org/eclipse/swt/internal/carbon/OS.java @@ -1183,6 +1183,7 @@ public static final native void CGContextGetPathBoundingBox(int ctx, CGRect rect public static final native void CGContextGetTextPosition (int ctx, CGPoint point); public static final native void CGContextMoveToPoint (int ctx, float x, float y); public static final native void CGContextRelease(int ctx); +public static final native void CGContextRotateCTM(int ctx, float angle); public static final native void CGContextRestoreGState(int ctx); public static final native void CGContextSaveGState(int ctx); public static final native void CGContextSelectFont (int ctx, byte[] name, float size, int textEncoding); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Button.java index 4538f90582..3f9783841c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Button.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Button.java @@ -15,6 +15,7 @@ import org.eclipse.swt.*; import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.internal.Compatibility; import org.eclipse.swt.internal.carbon.*; /** @@ -138,36 +139,23 @@ void click () { } int callPaintEventHandler (int control, int damageRgn, int visibleRgn, int theEvent, int nextHandler) { - if ((style & SWT.ARROW) != 0 && OS.VERSION >= 0x1050) { - int [] context = new int [1]; - OS.GetEventParameter (theEvent, OS.kEventParamCGContextRef, OS.typeCGContextRef, null, 4, null, context); - int state; - if (OS.IsControlEnabled (control)) { - state = OS.IsControlActive (control) ? OS.kThemeStateActive : OS.kThemeStateInactive; - if (display.grabControl == this) state = OS.kThemeStatePressed; + int [] context = null; + if ((style & SWT.ARROW) != 0) { + boolean invert = false; + if (OS.VERSION < 0x1050) { + invert = (style & SWT.UP) != 0; } else { - state = OS.IsControlActive (control) ? OS.kThemeStateUnavailable : OS.kThemeStateUnavailableInactive; + invert = (style & SWT.UP) != 0 || (style & SWT.RIGHT) != 0; + } + if (invert) { + context = new int [1]; + OS.GetEventParameter (theEvent, OS.kEventParamCGContextRef, OS.typeCGContextRef, null, 4, null, context); + OS.CGContextSaveGState (context[0]); + CGRect rect = new CGRect(); + OS.HIViewGetBounds (handle, rect); + OS.CGContextRotateCTM (context[0], (float)Compatibility.PI); + OS.CGContextTranslateCTM (context[0], -rect.width, -rect.height); } - CGRect rect = new CGRect (); - OS.HIViewGetBounds (handle, rect); - int orientation = OS.kThemeArrowRight; - if ((style & SWT.UP) != 0) orientation = OS.kThemeArrowUp; - if ((style & SWT.DOWN) != 0) orientation = OS.kThemeArrowDown;; - if ((style & SWT.LEFT) != 0) orientation = OS.kThemeArrowLeft; - HIThemePopupArrowDrawInfo info = new HIThemePopupArrowDrawInfo (); - info.state = state; - info.orientation = (short) orientation; - info.size = (short) OS.kThemeArrow9pt; - OS.HIThemeDrawPopupArrow (rect, info, context [0], OS.kHIThemeOrientationNormal); - return OS.noErr; - } - int [] context = null; - if ((style & SWT.ARROW) != 0 && (style & SWT.UP) != 0) { - context = new int [1]; - OS.GetEventParameter (theEvent, OS.kEventParamCGContextRef, OS.typeCGContextRef, null, 4, null, context); - OS.CGContextSaveGState (context[0]); - OS.CGContextScaleCTM (context[0], 1f, -1); - OS.CGContextTranslateCTM (context[0], 0, -getBounds().height); } int result = super.callPaintEventHandler (control, damageRgn, visibleRgn, theEvent, nextHandler); if (context != null) OS.CGContextRestoreGState (context[0]); |