Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti2008-06-09 20:39:25 +0000
committerSilenio Quarti2008-06-09 20:39:25 +0000
commit6687475724d9098125bacb1518a341736c8eafd3 (patch)
tree9b695be33a23c88162e1c7e8a025a21de60c334a
parent32519857d7ad2eb01dc0315f618d4bd0cd96d2c6 (diff)
downloadeclipse.platform.swt-6687475724d9098125bacb1518a341736c8eafd3.tar.gz
eclipse.platform.swt-6687475724d9098125bacb1518a341736c8eafd3.tar.xz
eclipse.platform.swt-6687475724d9098125bacb1518a341736c8eafd3.zip
do not use setTag() to store widget
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Browser/cocoa/org/eclipse/swt/browser/Safari.java125
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/SWTPanelDelegate.java8
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/SWTSearchField.java15
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/SWTSecureTextField.java15
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/SWTWebViewDelegate.java3
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ColorDialog.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java130
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/FontDialog.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ScrollBar.java1
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Scrollable.java14
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Text.java4
11 files changed, 166 insertions, 155 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/cocoa/org/eclipse/swt/browser/Safari.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/cocoa/org/eclipse/swt/browser/Safari.java
index 3860846889..c60328374f 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT Browser/cocoa/org/eclipse/swt/browser/Safari.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/cocoa/org/eclipse/swt/browser/Safari.java
@@ -19,7 +19,6 @@ import org.eclipse.swt.widgets.*;
class Safari extends WebBrowser {
WebView webView;
SWTWebViewDelegate delegate;
- int jniRef;
boolean changingLocation;
String lastHoveredLinkURL;
String html;
@@ -34,7 +33,7 @@ class Safari extends WebBrowser {
// boolean doit;
static boolean Initialized;
- static Callback Callback2, Callback3, Callback4, Callback5, Callback6, Callback7;
+ static Callback Callback3, Callback4, Callback5, Callback6, Callback7;
static final int MIN_SIZE = 16;
static final int MAX_PROGRESS = 100;
@@ -44,7 +43,9 @@ class Safari extends WebBrowser {
static final String PROTOCOL_FILE = "file:"; //$NON-NLS-1$
static final String PROTOCOL_HTTP = "http:"; //$NON-NLS-1$
static final String ABOUT_BLANK = "about:blank"; //$NON-NLS-1$
+ static final String ADD_WIDGET_KEY = "org.eclipse.swt.internal.addWidget"; //$NON-NLS-1$
static final String SAFARI_EVENTS_FIX_KEY = "org.eclipse.swt.internal.safariEventsFix"; //$NON-NLS-1$
+ static final String SWT_OBJECT = "SWT_OBJECT"; //$NON-NLS-1$
/* event strings */
static final String DOMEVENT_KEYUP = "keyup"; //$NON-NLS-1$
@@ -75,9 +76,6 @@ public void create (Composite parent, int style) {
String className = "SWTWebViewDelegate";
if (OS.objc_lookUpClass(className) == 0) {
Class safaryClass = this.getClass();
- Callback2 = new Callback(safaryClass, "browserProc", 2);
- int proc2 = Callback2.getAddress();
- if (proc2 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
Callback3 = new Callback(safaryClass, "browserProc", 3);
int proc3 = Callback3.getAddress();
if (proc3 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
@@ -95,9 +93,7 @@ public void create (Composite parent, int style) {
if (proc7 == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
int cls = OS.objc_allocateClassPair(OS.class_NSObject, className, 0);
- OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
- OS.class_addMethod(cls, OS.sel_tag, proc2, "@:");
- OS.class_addMethod(cls, OS.sel_setTag_1, proc3, "@:i");
+ OS.class_addIvar(cls, SWT_OBJECT, OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
OS.class_addMethod(cls, OS.sel_webView_1didChangeLocationWithinPageForFrame_1, proc4, "@:@@");
OS.class_addMethod(cls, OS.sel_webView_1didFailProvisionalLoadWithError_1forFrame_1, proc5, "@:@@@");
OS.class_addMethod(cls, OS.sel_webView_1didFinishLoadForFrame_1, proc4, "@:@@");
@@ -144,10 +140,9 @@ public void create (Composite parent, int style) {
if (webView == null) SWT.error(SWT.ERROR_NO_HANDLES);
webView.initWithFrame(browser.view.frame(), null, null);
webView.setAutoresizingMask(OS.NSViewWidthSizable | OS.NSViewHeightSizable);
- jniRef = OS.NewGlobalRef(this);
- if (jniRef == 0) SWT.error(SWT.ERROR_NO_HANDLES);
final SWTWebViewDelegate delegate = (SWTWebViewDelegate)new SWTWebViewDelegate().alloc().init();
- delegate.setTag(jniRef);
+ Display display = browser.getDisplay();
+ display.setData(ADD_WIDGET_KEY, new Object[] {delegate, browser});
this.delegate = delegate;
this.webView = webView;
browser.view.addSubview_(webView);
@@ -166,6 +161,8 @@ public void create (Composite parent, int style) {
ignoreDispose = true;
browser.notifyListeners (e.type, e);
e.type = SWT.NONE;
+
+ e.display.setData(ADD_WIDGET_KEY, new Object[] {delegate, null});
Safari.this.webView.setFrameLoadDelegate(null);
Safari.this.webView.setResourceLoadDelegate(null);
@@ -178,8 +175,6 @@ public void create (Composite parent, int style) {
Safari.this.webView = null;
Safari.this.delegate.release();
Safari.this.delegate = null;
- OS.DeleteGlobalRef(jniRef);
- jniRef = 0;
html = null;
lastHoveredLinkURL = null;
break;
@@ -209,126 +204,108 @@ public boolean back() {
return webView.goBack();
}
-static int browserProc(int delegate, int sel) {
- if (sel == OS.sel_tag) {
- int[] tag = new int[1];
- OS.object_getInstanceVariable(delegate, "tag", tag);
- return tag[0];
- }
- return 0;
-}
-
static int browserProc(int id, int sel, int arg0) {
- if (sel == OS.sel_setTag_1) {
- OS.object_setInstanceVariable(id, "tag", arg0);
- return 0;
- }
- int jniRef = OS.objc_msgSend(id, OS.sel_tag);
- if (jniRef == 0 || jniRef == -1) return 0;
- Safari widget = (Safari)OS.JNIGetObject(jniRef);
+ Widget widget = Display.getCurrent().findWidget(id);
if (widget == null) return 0;
+ Safari safari = (Safari)((Browser)widget).webBrowser;
if (sel == OS.sel_handleNotification_1) {
- widget.handleNotification(arg0);
+ safari.handleNotification(arg0);
} else if (sel == OS.sel_webViewShow_1) {
- widget.webViewShow(arg0);
+ safari.webViewShow(arg0);
} else if (sel == OS.sel_webViewClose_1) {
- widget.webViewClose(arg0);
+ safari.webViewClose(arg0);
} else if (sel == OS.sel_webViewFocus_1) {
- widget.webViewFocus(arg0);
+ safari.webViewFocus(arg0);
} else if (sel == OS.sel_webViewUnfocus_1) {
- widget.webViewUnfocus(arg0);
+ safari.webViewUnfocus(arg0);
} else if (sel == OS.sel_handleEvent_1) {
- widget.handleEvent(arg0);
+ safari.handleEvent(arg0);
}
return 0;
}
static int browserProc(int id, int sel, int arg0, int arg1) {
- int jniRef = OS.objc_msgSend(id, OS.sel_tag);
- if (jniRef == 0 || jniRef == -1) return 0;
- Safari widget = (Safari)OS.JNIGetObject(jniRef);
+ Widget widget = Display.getCurrent().findWidget(id);
if (widget == null) return 0;
+ Safari safari = (Safari)((Browser)widget).webBrowser;
if (sel == OS.sel_webView_1didChangeLocationWithinPageForFrame_1) {
- widget.webView_didChangeLocationWithinPageForFrame(arg0, arg1);
+ safari.webView_didChangeLocationWithinPageForFrame(arg0, arg1);
} else if (sel == OS.sel_webView_1didFinishLoadForFrame_1) {
- widget.webView_didFinishLoadForFrame(arg0, arg1);
+ safari.webView_didFinishLoadForFrame(arg0, arg1);
} else if (sel == OS.sel_webView_1didStartProvisionalLoadForFrame_1) {
- widget.webView_didStartProvisionalLoadForFrame(arg0, arg1);
+ safari.webView_didStartProvisionalLoadForFrame(arg0, arg1);
} else if (sel == OS.sel_webView_1didCommitLoadForFrame_1) {
- widget.webView_didCommitLoadForFrame(arg0, arg1);
+ safari.webView_didCommitLoadForFrame(arg0, arg1);
} else if (sel == OS.sel_webView_1setFrame_1) {
- widget.webView_setFrame(arg0, arg1);
+ safari.webView_setFrame(arg0, arg1);
} else if (sel == OS.sel_webView_1createWebViewWithRequest_1) {
- return widget.webView_createWebViewWithRequest(arg0, arg1);
+ return safari.webView_createWebViewWithRequest(arg0, arg1);
} else if (sel == OS.sel_webView_1setStatusBarVisible_1) {
- widget.webView_setStatusBarVisible(arg0, arg1);
+ safari.webView_setStatusBarVisible(arg0, arg1);
} else if (sel == OS.sel_webView_1setResizable_1) {
- widget.webView_setResizable(arg0, arg1);
+ safari.webView_setResizable(arg0, arg1);
} else if (sel == OS.sel_webView_1setStatusText_1) {
- widget.webView_setStatusText(arg0, arg1);
+ safari.webView_setStatusText(arg0, arg1);
} else if (sel == OS.sel_webView_1setToolbarsVisible_1) {
- widget.webView_setToolbarsVisible(arg0, arg1);
+ safari.webView_setToolbarsVisible(arg0, arg1);
} else if (sel == OS.sel_webView_1runJavaScriptAlertPanelWithMessage_1) {
- widget.webView_runJavaScriptAlertPanelWithMessage(arg0, arg1);
+ safari.webView_runJavaScriptAlertPanelWithMessage(arg0, arg1);
} else if (sel == OS.sel_webView_1runJavaScriptConfirmPanelWithMessage_1) {
- return widget.webView_runJavaScriptConfirmPanelWithMessage(arg0, arg1);
+ return safari.webView_runJavaScriptConfirmPanelWithMessage(arg0, arg1);
} else if (sel == OS.sel_webView_1runOpenPanelForFileButtonWithResultListener_1) {
- widget.webView_runOpenPanelForFileButtonWithResultListener(arg0, arg1);
+ safari.webView_runOpenPanelForFileButtonWithResultListener(arg0, arg1);
} else if (sel == OS.sel_download_1decideDestinationWithSuggestedFilename_1) {
- widget.download_decideDestinationWithSuggestedFilename(arg0, arg1);
+ safari.download_decideDestinationWithSuggestedFilename(arg0, arg1);
} else if (sel == OS.sel_webView_1printFrameView_1) {
- widget.webView_printFrameView(arg0, arg1);
+ safari.webView_printFrameView(arg0, arg1);
}
return 0;
}
static int browserProc(int id, int sel, int arg0, int arg1, int arg2) {
- int jniRef = OS.objc_msgSend(id, OS.sel_tag);
- if (jniRef == 0 || jniRef == -1) return 0;
- Safari widget = (Safari)OS.JNIGetObject(jniRef);
+ Widget widget = Display.getCurrent().findWidget(id);
if (widget == null) return 0;
+ Safari safari = (Safari)((Browser)widget).webBrowser;
if (sel == OS.sel_webView_1didFailProvisionalLoadWithError_1forFrame_1) {
- widget.webView_didFailProvisionalLoadWithError_forFrame(arg0, arg1, arg2);
+ safari.webView_didFailProvisionalLoadWithError_forFrame(arg0, arg1, arg2);
} else if (sel == OS.sel_webView_1didReceiveTitle_1forFrame_1) {
- widget.webView_didReceiveTitle_forFrame(arg0, arg1, arg2);
+ safari.webView_didReceiveTitle_forFrame(arg0, arg1, arg2);
} else if (sel == OS.sel_webView_1resource_1didFinishLoadingFromDataSource_1) {
- widget.webView_resource_didFinishLoadingFromDataSource(arg0, arg1, arg2);
+ safari.webView_resource_didFinishLoadingFromDataSource(arg0, arg1, arg2);
} else if (sel == OS.sel_webView_1identifierForInitialRequest_1fromDataSource_1) {
- return widget.webView_identifierForInitialRequest_fromDataSource(arg0, arg1, arg2);
+ return safari.webView_identifierForInitialRequest_fromDataSource(arg0, arg1, arg2);
} else if (sel == OS.sel_webView_1contextMenuItemsForElement_1defaultMenuItems_1) {
- return widget.webView_contextMenuItemsForElement_defaultMenuItems(arg0, arg1, arg2);
+ return safari.webView_contextMenuItemsForElement_defaultMenuItems(arg0, arg1, arg2);
} else if (sel == OS.sel_webView_1mouseDidMoveOverElement_1modifierFlags_1) {
- widget.webView_mouseDidMoveOverElement_modifierFlags(arg0, arg1, arg2);
+ safari.webView_mouseDidMoveOverElement_modifierFlags(arg0, arg1, arg2);
} else if (sel == OS.sel_webView_1unableToImplementPolicyWithError_1frame_1) {
- widget.webView_unableToImplementPolicyWithError_frame(arg0, arg1, arg2);
+ safari.webView_unableToImplementPolicyWithError_frame(arg0, arg1, arg2);
}
return 0;
}
static int browserProc(int id, int sel, int arg0, int arg1, int arg2, int arg3) {
- int jniRef = OS.objc_msgSend(id, OS.sel_tag);
- if (jniRef == 0 || jniRef == -1) return 0;
- Safari widget = (Safari)OS.JNIGetObject(jniRef);
+ Widget widget = Display.getCurrent().findWidget(id);
if (widget == null) return 0;
+ Safari safari = (Safari)((Browser)widget).webBrowser;
if (sel == OS.sel_webView_1resource_1didFailLoadingWithError_1fromDataSource_1) {
- widget.webView_resource_didFailLoadingWithError_fromDataSource(arg0, arg1, arg2, arg3);
+ safari.webView_resource_didFailLoadingWithError_fromDataSource(arg0, arg1, arg2, arg3);
}
return 0;
}
static int browserProc(int id, int sel, int arg0, int arg1, int arg2, int arg3, int arg4) {
- int jniRef = OS.objc_msgSend(id, OS.sel_tag);
- if (jniRef == 0 || jniRef == -1) return 0;
- Safari widget = (Safari)OS.JNIGetObject(jniRef);
+ Widget widget = Display.getCurrent().findWidget(id);
if (widget == null) return 0;
+ Safari safari = (Safari)((Browser)widget).webBrowser;
if (sel == OS.sel_webView_1resource_1willSendRequest_1redirectResponse_1fromDataSource_1) {
- return widget.webView_resource_willSendRequest_redirectResponse_fromDataSource(arg0, arg1, arg2, arg3, arg4);
+ return safari.webView_resource_willSendRequest_redirectResponse_fromDataSource(arg0, arg1, arg2, arg3, arg4);
} else if (sel == OS.sel_webView_1decidePolicyForMIMEType_1request_1frame_1decisionListener_1) {
- widget.webView_decidePolicyForMIMEType_request_frame_decisionListener(arg0, arg1, arg2, arg3, arg4);
+ safari.webView_decidePolicyForMIMEType_request_frame_decisionListener(arg0, arg1, arg2, arg3, arg4);
} else if (sel == OS.sel_webView_1decidePolicyForNavigationAction_1request_1frame_1decisionListener_1) {
- widget.webView_decidePolicyForNavigationAction_request_frame_decisionListener(arg0, arg1, arg2, arg3, arg4);
+ safari.webView_decidePolicyForNavigationAction_request_frame_decisionListener(arg0, arg1, arg2, arg3, arg4);
} else if (sel == OS.sel_webView_1decidePolicyForNewWindowAction_1request_1newFrameName_1decisionListener_1) {
- widget.webView_decidePolicyForNewWindowAction_request_newFrameName_decisionListener(arg0, arg1, arg2, arg3, arg4);
+ safari.webView_decidePolicyForNewWindowAction_request_newFrameName_decisionListener(arg0, arg1, arg2, arg3, arg4);
}
return 0;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/SWTPanelDelegate.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/SWTPanelDelegate.java
index c7c1e8ce00..1431679048 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/SWTPanelDelegate.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/SWTPanelDelegate.java
@@ -20,12 +20,4 @@ public SWTPanelDelegate(int id) {
super(id);
}
-public int tag() {
- return OS.objc_msgSend(id, OS.sel_tag);
-}
-
-public void setTag(int tag) {
- OS.objc_msgSend(id, OS.sel_setTag_1, tag);
-}
-
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/SWTSearchField.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/SWTSearchField.java
new file mode 100644
index 0000000000..c9782f216d
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/SWTSearchField.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.internal.cocoa;
+
+public class SWTSearchField extends NSSearchField {
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/SWTSecureTextField.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/SWTSecureTextField.java
new file mode 100644
index 0000000000..9288d12973
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/SWTSecureTextField.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.internal.cocoa;
+
+public class SWTSecureTextField extends NSSecureTextField {
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/SWTWebViewDelegate.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/SWTWebViewDelegate.java
index 5832fda15a..4ca3c829b1 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/SWTWebViewDelegate.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/SWTWebViewDelegate.java
@@ -12,7 +12,4 @@ package org.eclipse.swt.internal.cocoa;
public class SWTWebViewDelegate extends NSObject {
-public void setTag(int tag) {
- OS.objc_msgSend(id, OS.sel_setTag_1, tag);
-}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ColorDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ColorDialog.java
index 766e19c646..a9ab051945 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ColorDialog.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ColorDialog.java
@@ -126,7 +126,7 @@ public RGB open() {
SWTPanelDelegate delegate = (SWTPanelDelegate)new SWTPanelDelegate().alloc().init();
int jniRef = OS.NewGlobalRef(this);
if (jniRef == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- delegate.setTag(jniRef);
+ OS.object_setInstanceVariable(delegate.id, Display.SWT_OBJECT, jniRef);
panel.setDelegate(delegate);
rgb = null;
panel.orderFront(null);
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 2ecca65112..046f92e148 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
@@ -221,6 +221,8 @@ public class Display extends Device {
};
static String APP_NAME = "SWT";
+ static final String ADD_WIDGET_KEY = "org.eclipse.swt.internal.addWidget"; //$NON-NLS-1$
+ static final String SWT_OBJECT = "SWT_OBJECT"; //$NON-NLS-1$
/* Multiple Displays. */
static Display Default;
@@ -400,7 +402,7 @@ public void addListener (int eventType, Listener listener) {
void addWidget (NSObject view, Widget widget) {
if (view == null) return;
- OS.objc_msgSend (view.id, OS.sel_setTag_1, widget.jniRef);
+ OS.object_setInstanceVariable (view.id, SWT_OBJECT, widget.jniRef);
}
/**
@@ -1520,11 +1522,10 @@ public Thread getThread () {
Widget getWidget (int id) {
if (id == 0) return null;
- if (OS.objc_msgSend(id, OS.sel_respondsToSelector_1, OS.sel_tag) == 0) return null;
- int jniRef = OS.objc_msgSend(id, OS.sel_tag);
- if (jniRef == 0 || jniRef == -1) return null;
- Widget widget = (Widget)OS.JNIGetObject(jniRef);
- return widget;
+ int [] jniRef = new int [1];
+ OS.object_getInstanceVariable(id, SWT_OBJECT, jniRef);
+ if (jniRef[0] == 0) return null;
+ return (Widget)OS.JNIGetObject(jniRef[0]);
}
Widget getWidget (NSView view) {
@@ -1609,7 +1610,7 @@ void initClasses () {
String className = "SWTWindowDelegate";
int cls = OS.objc_allocateClassPair(OS.class_NSObject, className, 0);
- OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
+ OS.class_addIvar(cls, SWT_OBJECT, OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
OS.class_addMethod(cls, OS.sel_windowDidResize_1, proc3, "@:@");
OS.class_addMethod(cls, OS.sel_windowDidMove_1, proc3, "@:@");
OS.class_addMethod(cls, OS.sel_windowShouldClose_1, proc3, "@:@");
@@ -1617,38 +1618,28 @@ void initClasses () {
OS.class_addMethod(cls, OS.sel_windowWillClose_1, proc3, "@:@");
OS.class_addMethod(cls, OS.sel_windowDidResignKey_1, proc3, "@:@");
OS.class_addMethod(cls, OS.sel_windowDidBecomeKey_1, proc3, "@:@");
- OS.class_addMethod(cls, OS.sel_tag, proc2, "@:");
- OS.class_addMethod(cls, OS.sel_setTag_1, proc3, "@:i");
OS.class_addMethod(cls, OS.sel_timerProc_1, proc3, "@:@");
OS.objc_registerClassPair(cls);
className = "SWTPanelDelegate";
cls = OS.objc_allocateClassPair(OS.class_NSObject, className, 0);
- OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
+ OS.class_addIvar(cls, SWT_OBJECT, OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
OS.class_addMethod(cls, OS.sel_windowWillClose_1, dialogProc3, "@:@");
OS.class_addMethod(cls, OS.sel_changeColor_1, dialogProc3, "@:@");
OS.class_addMethod(cls, OS.sel_changeFont_1, dialogProc3, "@:@");
- OS.class_addMethod(cls, OS.sel_tag, proc2, "@:");
- OS.class_addMethod(cls, OS.sel_setTag_1, proc3, "@:i");
OS.objc_registerClassPair(cls);
className = "SWTMenu";
cls = OS.objc_allocateClassPair(OS.class_NSMenu, className, 0);
- OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
- OS.class_addMethod(cls, OS.sel_tag, proc2, "@:");
- OS.class_addMethod(cls, OS.sel_setTag_1, proc3, "@:i");
-// OS.class_addMethod(cls, OS.sel_menuWillOpen_1, proc3, "@:@");
- OS.class_addMethod(cls, OS.sel_menuWillClose_1, proc3, "@:@");
-// OS.class_addMethod(cls, OS.sel_numberOfItemsInMenu_1, proc3, "@:@");
+ OS.class_addIvar(cls, SWT_OBJECT, OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
+ OS.class_addMethod(cls, OS.sel_menuWillClose_1, proc3, "@:@");
OS.class_addMethod(cls, OS.sel_menu_1willHighlightItem_1, proc4, "@:@@");
OS.class_addMethod(cls, OS.sel_menuNeedsUpdate_1, proc3, "@:@");
OS.objc_registerClassPair(cls);
className = "SWTView";
cls = OS.objc_allocateClassPair(OS.class_NSView, className, 0);
- OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
- OS.class_addMethod(cls, OS.sel_tag, proc2, "@:");
- OS.class_addMethod(cls, OS.sel_setTag_1, proc3, "@:i");
+ OS.class_addIvar(cls, SWT_OBJECT, OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
OS.class_addMethod(cls, OS.sel_isFlipped, proc2, "@:");
OS.class_addMethod(cls, OS.sel_drawRect_1, drawRectProc, "@:i");
OS.class_addMethod(cls, OS.sel_acceptsFirstResponder, proc2, "@:");
@@ -1659,9 +1650,7 @@ void initClasses () {
className = "SWTScrollView";
cls = OS.objc_allocateClassPair(OS.class_NSScrollView, className, 0);
- OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
- OS.class_addMethod(cls, OS.sel_tag, proc2, "@:");
- OS.class_addMethod(cls, OS.sel_setTag_1, proc3, "@:i");
+ OS.class_addIvar(cls, SWT_OBJECT, OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
OS.class_addMethod(cls, OS.sel_sendVerticalSelection, proc2, "@:");
OS.class_addMethod(cls, OS.sel_sendHorizontalSelection, proc2, "@:");
addEventMethods(cls, proc2, proc3);
@@ -1669,6 +1658,7 @@ void initClasses () {
className = "SWTButton";
cls = OS.objc_allocateClassPair(OS.class_NSButton, className, 0);
+ OS.class_addIvar(cls, SWT_OBJECT, OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
OS.class_addMethod(cls, OS.sel_drawRect_1, drawRectProc, "@:i");
OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:");
OS.class_addMethod(cls, OS.sel_sendArrowSelection, proc2, "@:");
@@ -1677,6 +1667,7 @@ void initClasses () {
className = "SWTTableView";
cls = OS.objc_allocateClassPair(OS.class_NSTableView, className, 0);
+ OS.class_addIvar(cls, SWT_OBJECT, OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
OS.class_addMethod(cls, OS.sel_sendDoubleSelection, proc2, "@:");
OS.class_addMethod(cls, OS.sel_numberOfRowsInTableView_1, proc3, "@:@");
OS.class_addMethod(cls, OS.sel_tableView_1objectValueForTableColumn_1row_1, proc5, "@:@:@:@");
@@ -1689,6 +1680,7 @@ void initClasses () {
className = "SWTOutlineView";
cls = OS.objc_allocateClassPair(OS.class_NSOutlineView, className, 0);
+ OS.class_addIvar(cls, SWT_OBJECT, OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
OS.class_addMethod(cls, OS.sel_sendDoubleSelection, proc2, "@:");
OS.class_addMethod(cls, OS.sel_outlineViewSelectionDidChange_1, proc3, "@:@");
OS.class_addMethod(cls, OS.sel_outlineView_1shouldCollapseItem_1, proc4, "@:@@");
@@ -1704,49 +1696,44 @@ void initClasses () {
className = "SWTTreeItem";
cls = OS.objc_allocateClassPair(OS.class_NSObject, className, 0);
- OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
- OS.class_addMethod(cls, OS.sel_tag, proc2, "@:");
- OS.class_addMethod(cls, OS.sel_setTag_1, proc3, "@:i");
+ OS.class_addIvar(cls, SWT_OBJECT, OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
OS.objc_registerClassPair(cls);
className = "SWTTabView";
cls = OS.objc_allocateClassPair(OS.class_NSTabView, className, 0);
- OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
+ OS.class_addIvar(cls, SWT_OBJECT, OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
OS.class_addMethod(cls, OS.sel_tabView_1willSelectTabViewItem_1, proc4, "@:@@");
- OS.class_addMethod(cls, OS.sel_tag, proc2, "@:");
- OS.class_addMethod(cls, OS.sel_setTag_1, proc3, "@:i");
addEventMethods(cls, proc2, proc3);
OS.objc_registerClassPair(cls);
className = "SWTBox";
cls = OS.objc_allocateClassPair(OS.class_NSBox, className, 0);
- OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
- OS.class_addMethod(cls, OS.sel_tag, proc2, "@:");
- OS.class_addMethod(cls, OS.sel_setTag_1, proc3, "@:i");
+ OS.class_addIvar(cls, SWT_OBJECT, OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
addEventMethods(cls, proc2, proc3);
OS.objc_registerClassPair(cls);
className = "SWTProgressIndicator";
cls = OS.objc_allocateClassPair(OS.class_NSProgressIndicator, className, 0);
- OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
- OS.class_addMethod(cls, OS.sel_tag, proc2, "@:");
- OS.class_addMethod(cls, OS.sel_setTag_1, proc3, "@:i");
+ OS.class_addIvar(cls, SWT_OBJECT, OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
addEventMethods(cls, proc2, proc3);
OS.objc_registerClassPair(cls);
className = "SWTSlider";
cls = OS.objc_allocateClassPair(OS.class_NSSlider, className, 0);
+ OS.class_addIvar(cls, SWT_OBJECT, OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
addEventMethods(cls, proc2, proc3);
OS.objc_registerClassPair(cls);
className = "SWTPopUpButton";
cls = OS.objc_allocateClassPair(OS.class_NSPopUpButton, className, 0);
+ OS.class_addIvar(cls, SWT_OBJECT, OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:");
addEventMethods(cls, proc2, proc3);
OS.objc_registerClassPair(cls);
className = "SWTComboBox";
cls = OS.objc_allocateClassPair(OS.class_NSComboBox, className, 0);
+ OS.class_addIvar(cls, SWT_OBJECT, OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
OS.class_addMethod(cls, OS.sel_comboBoxSelectionDidChange_1, proc3, "@:@");
OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:");
addEventMethods(cls, proc2, proc3);
@@ -1754,53 +1741,68 @@ void initClasses () {
className = "SWTDatePicker";
cls = OS.objc_allocateClassPair(OS.class_NSDatePicker, className, 0);
+ OS.class_addIvar(cls, SWT_OBJECT, OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:");
addEventMethods(cls, proc2, proc3);
OS.objc_registerClassPair(cls);
className = "SWTImageView";
cls = OS.objc_allocateClassPair(OS.class_NSImageView, className, 0);
+ OS.class_addIvar(cls, SWT_OBJECT, OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
OS.class_addMethod(cls, OS.sel_drawRect_1, OS.drawRect_CALLBACK(proc3), "@:i");
addEventMethods(cls, proc2, proc3);
OS.objc_registerClassPair(cls);
className = "SWTStepper";
cls = OS.objc_allocateClassPair(OS.class_NSStepper, className, 0);
+ OS.class_addIvar(cls, SWT_OBJECT, OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:");
addEventMethods(cls, proc2, proc3);
OS.objc_registerClassPair(cls);
className = "SWTScroller";
cls = OS.objc_allocateClassPair(OS.class_NSScroller, className, 0);
+ OS.class_addIvar(cls, SWT_OBJECT, OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:");
addEventMethods(cls, proc2, proc3);
OS.objc_registerClassPair(cls);
className = "SWTMenuItem";
cls = OS.objc_allocateClassPair(OS.class_NSMenuItem, className, 0);
+ OS.class_addIvar(cls, SWT_OBJECT, OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:");
OS.objc_registerClassPair(cls);
className = "SWTTextView";
cls = OS.objc_allocateClassPair(OS.class_NSTextView, className, 0);
-// OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:");
- OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
- OS.class_addMethod(cls, OS.sel_tag, proc2, "@:");
- OS.class_addMethod(cls, OS.sel_setTag_1, proc3, "@:i");
+ OS.class_addIvar(cls, SWT_OBJECT, OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
addEventMethods(cls, proc2, proc3);
OS.objc_registerClassPair(cls);
className = "SWTTextField";
cls = OS.objc_allocateClassPair(OS.class_NSTextField, className, 0);
+ OS.class_addIvar(cls, SWT_OBJECT, OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
OS.class_addMethod(cls, OS.sel_drawRect_1, drawRectProc, "@:i");
addEventMethods(cls, proc2, proc3);
OS.objc_registerClassPair(cls);
-
+
+ className = "SWTSearchField";
+ cls = OS.objc_allocateClassPair(OS.class_NSSearchField, className, 0);
+ OS.class_addIvar(cls, SWT_OBJECT, OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
+ OS.class_addMethod(cls, OS.sel_drawRect_1, drawRectProc, "@:i");
+ addEventMethods(cls, proc2, proc3);
+ OS.objc_registerClassPair(cls);
+
+ className = "SWTSecureTextField";
+ cls = OS.objc_allocateClassPair(OS.class_NSSecureTextField, className, 0);
+ OS.class_addIvar(cls, SWT_OBJECT, OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
+ OS.class_addMethod(cls, OS.sel_drawRect_1, drawRectProc, "@:i");
+ addEventMethods(cls, proc2, proc3);
+ OS.objc_registerClassPair(cls);
+
className = "SWTWindow";
cls = OS.objc_allocateClassPair(OS.class_NSWindow, className, 0);
- OS.class_addIvar(cls, "tag", OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
- OS.class_addMethod(cls, OS.sel_tag, proc2, "@:");
- OS.class_addMethod(cls, OS.sel_setTag_1, proc3, "@:i");
+ OS.class_addIvar(cls, SWT_OBJECT, OS.PTR_SIZEOF, (byte)(Math.log(OS.PTR_SIZEOF) / Math.log(2)), "i");
OS.class_addMethod(cls, OS.sel_sendEvent_1, proc3, "@:@");
OS.class_addMethod(cls, OS.sel_flagsChanged_1, proc3, "@:@");
OS.class_addMethod(cls, OS.sel_helpRequested_1, proc3, "@:@");
@@ -2509,10 +2511,11 @@ public void removeListener (int eventType, Listener listener) {
Widget removeWidget (NSObject view) {
if (view == null) return null;
- int jniRef = OS.objc_msgSend(view.id, OS.sel_tag);
- if (jniRef == 0 || jniRef == -1) return null;
- Widget widget = (Widget)OS.JNIGetObject(jniRef);
- OS.objc_msgSend(view.id, OS.sel_setTag_1, -1);
+ int [] jniRef = new int [1];
+ OS.object_getInstanceVariable(view.id, SWT_OBJECT, jniRef);
+ if (jniRef[0] == 0) return null;
+ Widget widget = (Widget)OS.JNIGetObject(jniRef[0]);
+ OS.object_setInstanceVariable(view.id, SWT_OBJECT, 0);
return widget;
}
@@ -2709,6 +2712,17 @@ public void setData (String key, Object value) {
checkDevice ();
if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (key.equals (ADD_WIDGET_KEY)) {
+ Object [] data = (Object [])value;
+ NSObject object = (NSObject)data [0];
+ Widget widget = (Widget)data [1];
+ if (widget == null) {
+ removeWidget (object);
+ } else {
+ addWidget (object, widget);
+ }
+ }
+
/* Remove the key/value pair */
if (value == null) {
if (keys == null) return;
@@ -3101,18 +3115,19 @@ int applicationDelegateProc(int id, int sel, int arg0) {
}
int dialogProc(int id, int sel, int arg0) {
- int jniRef = OS.objc_msgSend(id, OS.sel_tag);
- if (jniRef == 0 || jniRef == -1) return 0;
+ int [] jniRef = new int [1];
+ OS.object_getInstanceVariable(id, SWT_OBJECT, jniRef);
+ if (jniRef[0] == 0) return 0;
if (sel == OS.sel_changeColor_1) {
- ColorDialog dialog = (ColorDialog)OS.JNIGetObject(jniRef);
+ ColorDialog dialog = (ColorDialog)OS.JNIGetObject(jniRef[0]);
if (dialog == null) return 0;
dialog.changeColor(arg0);
} else if (sel == OS.sel_changeFont_1) {
- FontDialog dialog = (FontDialog)OS.JNIGetObject(jniRef);
+ FontDialog dialog = (FontDialog)OS.JNIGetObject(jniRef[0]);
if (dialog == null) return 0;
dialog.changeFont(arg0);
} else if (sel == OS.sel_windowWillClose_1) {
- Object object = OS.JNIGetObject(jniRef);
+ Object object = OS.JNIGetObject(jniRef[0]);
if (object instanceof FontDialog) {
((FontDialog)object).windowWillClose(arg0);
} else if (object instanceof ColorDialog) {
@@ -3123,11 +3138,6 @@ int dialogProc(int id, int sel, int arg0) {
}
int windowDelegateProc(int delegate, int sel) {
- if (sel == OS.sel_tag) {
- int[] tag = new int[1];
- OS.object_getInstanceVariable(delegate, "tag", tag);
- return tag[0];
- }
Widget widget = getWidget(delegate);
if (widget == null) return 0;
if (sel == OS.sel_isFlipped) {
@@ -3173,10 +3183,6 @@ int windowDelegateProc(int id, int sel, int arg0) {
if (sel == OS.sel_timerProc_1) {
return timerProc (arg0);
}
- if (sel == OS.sel_setTag_1) {
- OS.object_setInstanceVariable(id, "tag", arg0);
- return 0;
- }
Widget widget = getWidget(id);
if (widget == null) return 0;
if (sel == OS.sel_windowWillClose_1) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/FontDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/FontDialog.java
index 44b9593fbe..2c6eba7452 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/FontDialog.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/FontDialog.java
@@ -214,7 +214,7 @@ public FontData open () {
SWTPanelDelegate delegate = (SWTPanelDelegate)new SWTPanelDelegate().alloc().init();
int jniRef = OS.NewGlobalRef(this);
if (jniRef == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- delegate.setTag(jniRef);
+ OS.object_setInstanceVariable(delegate.id, Display.SWT_OBJECT, jniRef);
panel.setDelegate(delegate);
fontData = null;
panel.orderFront(null);
@@ -224,7 +224,7 @@ public FontData open () {
OS.DeleteGlobalRef(jniRef);
NSFont font = NSFontManager.sharedFontManager().selectedFont();
if (font != null) {
- //TODO - this does work
+ //TODO - this does not work
fontData = Font.cocoa_new(display, font).getFontData()[0];
}
return fontData;
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 3960c7883a..e244c11452 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
@@ -390,6 +390,7 @@ void register () {
void releaseHandle () {
super.releaseHandle ();
+ if (view != null) view.release();
view = null;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Scrollable.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Scrollable.java
index f5fe1a3af9..0a09b74e03 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Scrollable.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Scrollable.java
@@ -33,7 +33,7 @@ import org.eclipse.swt.graphics.*;
* @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
*/
public abstract class Scrollable extends Control {
- SWTScrollView scrollView;
+ NSScrollView scrollView;
ScrollBar horizontalBar, verticalBar;
Scrollable () {
@@ -125,11 +125,19 @@ ScrollBar createScrollBar (int style) {
bar.display = display;
NSScroller scroller;
int actionSelector;
+ NSRect rect = new NSRect();
if ((style & SWT.H_SCROLL) != 0) {
- scroller = scrollView.horizontalScroller();
+ rect.width = 1;
+ } else {
+ rect.height = 1;
+ }
+ scroller = (SWTScroller)new SWTScroller().alloc();
+ scroller.initWithFrame(rect);
+ if ((style & SWT.H_SCROLL) != 0) {
+ scrollView.setHorizontalScroller(scroller);
actionSelector = OS.sel_sendHorizontalSelection;
} else {
- scroller = scrollView.verticalScroller();
+ scrollView.setVerticalScroller(scroller);
actionSelector = OS.sel_sendVerticalSelection;
}
bar.view = scroller;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Text.java
index 4b62ffb0fe..2072572f7b 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Text.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Text.java
@@ -338,9 +338,9 @@ void createHandle () {
if ((style & SWT.SINGLE) != 0) {
NSTextField widget;
if ((style & SWT.PASSWORD) != 0) {
- widget = (NSTextField)new NSSecureTextField().alloc();
+ widget = (NSTextField)new SWTSecureTextField().alloc();
} else if ((style & SWT.SEARCH) != 0) {
- widget = (NSTextField)new NSSearchField().alloc();
+ widget = (NSTextField)new SWTSearchField().alloc();
} else {
widget = (NSTextField)new SWTTextField().alloc();
}

Back to the top