diff options
author | Silenio Quarti <silenio> | 2005-08-11 17:10:08 +0000 |
---|---|---|
committer | Silenio Quarti <silenio> | 2005-08-11 17:10:08 +0000 |
commit | 9cfd3f4d5cb275c4f7b406fd806f918f2231af08 (patch) | |
tree | f79e9d76c420019726d9c8c033f8863bb00a5f00 | |
parent | 044f465ed5f173afdfd3ec89c194a4de5ce238c5 (diff) | |
download | eclipse.platform.swt-9cfd3f4d5cb275c4f7b406fd806f918f2231af08.tar.gz eclipse.platform.swt-9cfd3f4d5cb275c4f7b406fd806f918f2231af08.tar.xz eclipse.platform.swt-9cfd3f4d5cb275c4f7b406fd806f918f2231af08.zip |
using CGImageRef in columns instead of IconRef
4 files changed, 36 insertions, 13 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/carbon/org/eclipse/swt/browser/Browser.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/carbon/org/eclipse/swt/browser/Browser.java index 53996140b4..88fd47ef5e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Browser/carbon/org/eclipse/swt/browser/Browser.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/carbon/org/eclipse/swt/browser/Browser.java @@ -106,9 +106,7 @@ public Browser(Composite parent, int style) { * The workaround is to detect any OS prior to 10.30 and fail * without crashing. */ - int[] response = new int[1]; - int err = OS.Gestalt(OS.gestaltSystemVersion, response); - if (err != OS.noErr || ((response[0] & 0xffff) < 0x1030)) { + if (OS.VERSION < 0x1030) { dispose(); SWT.error(SWT.ERROR_NO_HANDLES); } 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 0239f54963..a44681174a 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 @@ -20,6 +20,13 @@ public class OS extends Platform { Library.loadLibrary ("swt-pi"); } + public static final int VERSION; + static { + int [] response = new int [1]; + OS.Gestalt (OS.gestaltSystemVersion, response); + VERSION = response [0] & 0xffff; + } + /** Constants */ public static final int RGBDirect = 16; public static final int alphaLock = 0x0400; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TableColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TableColumn.java index 605816f412..8ed0268d6a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TableColumn.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TableColumn.java @@ -303,10 +303,10 @@ public void pack () { checkWidget (); GC gc = new GC (parent); int width = gc.stringExtent (text).x; - if (iconRef != 0) { + if (iconRef != 0 || (image != null && OS.VERSION >= 0x1040)) { /* Note that the image is stretched to the header height */ width += parent.headerHeight; - if (text.length () != 0) width += 3; + if (text.length () != 0) width += 4; } if ((parent.style & SWT.VIRTUAL) == 0) { int index = parent.indexOf (this); @@ -437,7 +437,9 @@ public void setImage (Image image) { } super.setImage (image); if (image != null) { - iconRef = createIconRef (image); + if (OS.VERSION < 0x1040) { + iconRef = createIconRef (image); + } } updateHeader (); } @@ -540,8 +542,15 @@ void updateHeader () { desc.minimumWidth = desc.maximumWidth = width [0]; } desc.titleString = str; - desc.btnContentInfo_contentType = (short) (iconRef != 0 ? OS.kControlContentIconRef : OS.kControlContentTextOnly); - desc.btnContentInfo_iconRef = iconRef; + if (OS.VERSION < 0x1040) { + desc.btnContentInfo_contentType = (short) (iconRef != 0 ? OS.kControlContentIconRef : OS.kControlContentTextOnly); + desc.btnContentInfo_iconRef = iconRef; + } else { + if (image != null) { + desc.btnContentInfo_contentType = OS.kControlContentCGImageRef; + desc.btnContentInfo_iconRef = image.handle; + } + } OS.SetDataBrowserListViewHeaderDesc (parent.handle, id, desc); OS.CFRelease (str); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TreeColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TreeColumn.java index 112ad0f328..f7aa745a25 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TreeColumn.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TreeColumn.java @@ -305,10 +305,10 @@ public void pack () { checkWidget (); GC gc = new GC (parent); int width = gc.stringExtent (text).x; - if (iconRef != 0) { + if (iconRef != 0 || (image != null && OS.VERSION >= 0x1040)) { /* Note that the image is stretched to the header height */ width += parent.headerHeight; - if (text.length () != 0) width += 3; + if (text.length () != 0) width += 4; } if ((parent.style & SWT.VIRTUAL) == 0) { int index = parent.indexOf (this); @@ -445,7 +445,9 @@ public void setImage (Image image) { } super.setImage (image); if (image != null) { - iconRef = createIconRef (image); + if (OS.VERSION < 0x1040) { + iconRef = createIconRef (image); + } } updateHeader (); } @@ -546,8 +548,15 @@ void updateHeader () { desc.minimumWidth = desc.maximumWidth = width [0]; } desc.titleString = str; - desc.btnContentInfo_contentType = (short) (iconRef != 0 ? OS.kControlContentIconRef : OS.kControlContentTextOnly); - desc.btnContentInfo_iconRef = iconRef; + if (OS.VERSION < 0x1040) { + desc.btnContentInfo_contentType = (short) (iconRef != 0 ? OS.kControlContentIconRef : OS.kControlContentTextOnly); + desc.btnContentInfo_iconRef = iconRef; + } else { + if (image != null) { + desc.btnContentInfo_contentType = OS.kControlContentCGImageRef; + desc.btnContentInfo_iconRef = image.handle; + } + } OS.SetDataBrowserListViewHeaderDesc (parent.handle, id, desc); OS.CFRelease (str); } |