Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti2006-12-01 19:41:43 +0000
committerSilenio Quarti2006-12-01 19:41:43 +0000
commitf098d2465fbdfa81c6532fa2c9d1d4a8feb55b7a (patch)
tree70ed3eee039a49b4d000db6527121bb4f183c6f3
parentabdb7df6c5ef7f31dd770f626e22ad0d039e1629 (diff)
downloadeclipse.platform.swt-f098d2465fbdfa81c6532fa2c9d1d4a8feb55b7a.tar.gz
eclipse.platform.swt-f098d2465fbdfa81c6532fa2c9d1d4a8feb55b7a.tar.xz
eclipse.platform.swt-f098d2465fbdfa81c6532fa2c9d1d4a8feb55b7a.zip
*** empty log message ***
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/Image.java74
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Shell.java79
2 files changed, 34 insertions, 119 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/Image.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/Image.java
index aa0c6b53b7..ce01eb260d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/Image.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/Image.java
@@ -499,78 +499,6 @@ public Image(Device device, InputStream stream) {
public Image(Device device, String filename) {
if (device == null) device = Device.getDevice();
if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (filename == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- this.device = device;
-// String name = filename.toLowerCase();
-// boolean png = false, jpeg = false;
-// if ((jpeg = name.endsWith(".jpg")) || (png = name.endsWith(".png"))) {
-// char [] chars = new char [filename.length ()];
-// filename.getChars (0, chars.length, chars, 0);
-// int str = OS.CFStringCreateWithCharacters (OS.kCFAllocatorDefault, chars, chars.length);
-// if (str != 0) {
-// int url = OS.CFURLCreateWithFileSystemPath(OS.kCFAllocatorDefault, str, OS.kCFURLPOSIXPathStyle, false);
-// if (url != 0) {
-// int provider = OS.CGDataProviderCreateWithURL(url);
-// if (provider != 0) {
-// int image = 0;
-// if (jpeg) {
-// image = OS.CGImageCreateWithJPEGDataProvider(provider, null, true, OS.kCGRenderingIntentDefault);
-// } else if (png) {
-// image = OS.CGImageCreateWithPNGDataProvider(provider, null, true, OS.kCGRenderingIntentDefault);
-// }
-// OS.CGDataProviderRelease(provider);
-// if (image != 0) {
-//// handle = image;
-// int width = OS.CGImageGetWidth(image);
-// int height = OS.CGImageGetHeight(image);
-// int bpr = width * 4;
-// int dataSize = height * bpr;
-// int data = OS.NewPtr(dataSize);
-// if (data != 0) {
-// provider = OS.CGDataProviderCreateWithData(0, data, dataSize, 0);
-// if (provider != 0) {
-// int alphaInfo = OS.kCGImageAlphaNoneSkipFirst;
-//// switch (OS.CGImageGetAlphaInfo(image)) {
-//// case OS.kCGImageAlphaPremultipliedLast:
-//// case OS.kCGImageAlphaPremultipliedFirst:
-//// case OS.kCGImageAlphaLast:
-//// case OS.kCGImageAlphaFirst:
-//// alphaInfo = OS.kCGImageAlphaFirst;
-//// break;
-//// }
-// int colorspace = device.colorspace;
-// int handle = OS.CGImageCreate(width, height, 8, 32, bpr, colorspace, alphaInfo, provider, null, true, OS.kCGRenderingIntentDefault);
-// OS.CGDataProviderRelease(provider);
-// if (handle != 0) {
-// int bpc = OS.CGImageGetBitsPerComponent(handle);
-// int context = OS.CGBitmapContextCreate(data, width, height, bpc, bpr, colorspace, OS.kCGImageAlphaNoneSkipFirst);
-// if (context != 0) {
-// CGRect rect = new CGRect();
-// rect.width = width;
-// rect.height = height;
-// OS.CGContextDrawImage(context, rect, image);
-// OS.CGContextRelease(context);
-// handle = OS.CGImageCreate(width, height, 8, 32, bpr, colorspace, OS.kCGImageAlphaFirst, provider, null, true, OS.kCGRenderingIntentDefault);
-// this.data = data;
-// this.handle = handle;
-// System.out.println("here");
-// } else {
-// System.out.println("context failed");
-// OS.CGImageRelease(handle);
-// }
-// }
-// }
-// if (handle == 0) OS.DisposePtr(data);
-// }
-// OS.CGImageRelease(image);
-// }
-// }
-// OS.CFRelease(url);
-// }
-// OS.CFRelease(str);
-// }
-// if (handle != 0) return;
-// }
init(device, new ImageData(filename));
}
@@ -615,7 +543,7 @@ public void dispose () {
if (device.isDisposed()) return;
if (memGC != null) memGC.dispose();
OS.CGImageRelease(handle);
- if (data != 0) OS.DisposePtr(data);
+ OS.DisposePtr(data);
device = null;
data = handle = 0;
memGC = null;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Shell.java
index aae2a32f3e..cbf5cf554e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Shell.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Shell.java
@@ -263,7 +263,7 @@ Shell (Display display, Shell parent, int style, int handle) {
this.style = checkStyle (style);
this.parent = parent;
this.display = display;
- this.shellHandle = handle;
+ this.handle = handle;
createWidget ();
}
@@ -344,10 +344,6 @@ public Shell (Shell parent, int style) {
this (parent != null ? parent.display : null, parent, style, 0);
}
-public static Shell internal_new (Display display, int handle) {
- return new Shell (display, null, SWT.NO_TRIM, handle);
-}
-
static int checkStyle (int style) {
style = Decorations.checkStyle (style);
int mask = SWT.SYSTEM_MODAL | SWT.APPLICATION_MODAL | SWT.PRIMARY_MODAL;
@@ -466,49 +462,40 @@ void createHandle () {
windowClass = (style & SWT.TITLE) != 0 ? OS.kMovableModalWindowClass : OS.kModalWindowClass;
}
}
- if (shellHandle == 0) {
- Monitor monitor = getMonitor ();
- Rectangle rect = monitor.getClientArea ();
- int width = rect.width * 5 / 8;
- int height = rect.height * 5 / 8;
- Rect bounds = new Rect ();
- OS.SetRect (bounds, (short) 0, (short) 0, (short) width, (short) height);
- int [] outWindow = new int [1];
- attributes &= OS.GetAvailableWindowAttributes (windowClass);
- OS.CreateNewWindow (windowClass, attributes, bounds, outWindow);
- if (outWindow [0] == 0) error (SWT.ERROR_NO_HANDLES);
- shellHandle = outWindow [0];
- OS.RepositionWindow (shellHandle, 0, OS.kWindowCascadeOnMainScreen);
- // OS.SetThemeWindowBackground (shellHandle, (short) OS.kThemeBrushDialogBackgroundActive, false);
- int [] theRoot = new int [1];
- if (OS.HIVIEW) {
- OS.HIViewFindByID (shellHandle, OS.kHIViewWindowContentID (), theRoot);
- /*
- * Bug in the Macintosh. When the window class is kMovableModalWindowClass or
- * kModalWindowClass, HIViewFindByID() fails to find the control identified by
- * kHIViewWindowContentID. The fix is to call GetRootControl() if the call
- * failed.
- */
- if (theRoot [0] == 0) OS.GetRootControl (shellHandle, theRoot);
- } else {
- OS.CreateRootControl (shellHandle, theRoot);
- OS.GetRootControl (shellHandle, theRoot);
- }
- if (theRoot [0] == 0) error (SWT.ERROR_NO_HANDLES);
- if ((style & (SWT.H_SCROLL | SWT.V_SCROLL)) != 0) {
- createScrolledHandle (theRoot [0]);
- } else {
- createHandle (theRoot [0]);
- }
- OS.SetControlVisibility (topHandle (), false, false);
- } else {
- int [] theRoot = new int [1];
+ Monitor monitor = getMonitor ();
+ Rectangle rect = monitor.getClientArea ();
+ int width = rect.width * 5 / 8;
+ int height = rect.height * 5 / 8;
+ Rect bounds = new Rect ();
+ OS.SetRect (bounds, (short) 0, (short) 0, (short) width, (short) height);
+ int [] outWindow = new int [1];
+ attributes &= OS.GetAvailableWindowAttributes (windowClass);
+ OS.CreateNewWindow (windowClass, attributes, bounds, outWindow);
+ if (outWindow [0] == 0) error (SWT.ERROR_NO_HANDLES);
+ shellHandle = outWindow [0];
+ OS.RepositionWindow (shellHandle, 0, OS.kWindowCascadeOnMainScreen);
+// OS.SetThemeWindowBackground (shellHandle, (short) OS.kThemeBrushDialogBackgroundActive, false);
+ int [] theRoot = new int [1];
+ if (OS.HIVIEW) {
OS.HIViewFindByID (shellHandle, OS.kHIViewWindowContentID (), theRoot);
- if (theRoot [0] == 0) OS.GetRootControl (shellHandle, theRoot);
- handle = OS.HIViewGetFirstSubview (theRoot[0]);
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- if (OS.IsWindowVisible (shellHandle)) state &= ~HIDDEN;
+ /*
+ * Bug in the Macintosh. When the window class is kMovableModalWindowClass or
+ * kModalWindowClass, HIViewFindByID() fails to find the control identified by
+ * kHIViewWindowContentID. The fix is to call GetRootControl() if the call
+ * failed.
+ */
+ if (theRoot [0] == 0) OS.GetRootControl (shellHandle, theRoot);
+ } else {
+ OS.CreateRootControl (shellHandle, theRoot);
+ OS.GetRootControl (shellHandle, theRoot);
+ }
+ if (theRoot [0] == 0) error (SWT.ERROR_NO_HANDLES);
+ if ((style & (SWT.H_SCROLL | SWT.V_SCROLL)) != 0) {
+ createScrolledHandle (theRoot [0]);
+ } else {
+ createHandle (theRoot [0]);
}
+ OS.SetControlVisibility (topHandle (), false, false);
int [] outGroup = new int [1];
OS.CreateWindowGroup (OS.kWindowGroupAttrHideOnCollapse, outGroup);
if (outGroup [0] == 0) error (SWT.ERROR_NO_HANDLES);

Back to the top