summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti <silenio>2009-02-02 20:32:07 +0000
committerSilenio Quarti <silenio>2009-02-02 20:32:07 +0000
commita9250e5ee110ad624739bf14112f9f577af663ad (patch)
treecd751ccc5816f7b82f01fed31443426347d594be
parenta6cf3d83f46fabe1a8f671d663cb5b64c1bca724 (diff)
downloadeclipse.platform.swt-a9250e5ee110ad624739bf14112f9f577af663ad.tar.gz
eclipse.platform.swt-a9250e5ee110ad624739bf14112f9f577af663ad.tar.xz
eclipse.platform.swt-a9250e5ee110ad624739bf14112f9f577af663ad.zip
mouse event y coordinate is flipped for NSBox
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java10
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Group.java26
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java6
4 files changed, 31 insertions, 16 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java
index 86c08428b4..c1355e27df 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java
@@ -981,6 +981,10 @@ void enableWidget (boolean enabled) {
}
}
+NSView eventView () {
+ return view;
+}
+
void fillBackground (NSView view, NSGraphicsContext context, NSRect rect, int imgHeight) {
Control control = findBackgroundControl();
if (control == null) control = this;
@@ -2579,6 +2583,7 @@ boolean sendMouseEvent (NSEvent nsEvent, int type, boolean send) {
}
if (event.button != 0) event.count = (int)/*64*/nsEvent.clickCount();
NSPoint windowPoint;
+ NSView view = eventView ();
if (nsEvent == null || nsEvent.type() == OS.NSMouseMoved) {
windowPoint = view.window().convertScreenToBase(NSEvent.mouseLocation());
} else {
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 d1509c5348..63b05cbff0 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
@@ -2054,6 +2054,7 @@ void initClasses () {
className = "SWTDatePicker";
cls = OS.objc_allocateClassPair(OS.class_NSDatePicker, className, 0);
OS.class_addIvar(cls, SWT_OBJECT, size, (byte)align, types);
+ OS.class_addMethod(cls, OS.sel_isFlipped, isFlippedProc, "@:");
OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:");
addEventMethods(cls, proc2, proc3, drawRectProc);
addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc);
@@ -2063,6 +2064,7 @@ void initClasses () {
className = "SWTImageView";
cls = OS.objc_allocateClassPair(OS.class_NSImageView, className, 0);
OS.class_addIvar(cls, SWT_OBJECT, size, (byte)align, types);
+ OS.class_addMethod(cls, OS.sel_isFlipped, isFlippedProc, "@:");
addEventMethods(cls, proc2, proc3, drawRectProc);
addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc);
addAccessibilityMethods(cls, proc2, proc3, proc4, accessibilityHitTestProc);
@@ -2576,13 +2578,13 @@ public Point map (Control from, Control to, int x, int y) {
} else {
NSRect primaryFrame = getPrimaryFrame();
if (from != null) {
- NSView view = from.contentView ();
+ NSView view = from.eventView ();
pt = view.convertPoint_toView_(pt, null);
pt = fromWindow.convertBaseToScreen(pt);
pt.y = primaryFrame.height - pt.y;
}
if (to != null) {
- NSView view = to.contentView ();
+ NSView view = to.eventView ();
pt.y = primaryFrame.height - pt.y;
pt = toWindow.convertScreenToBase(pt);
pt = view.convertPoint_fromView_(pt, null);
@@ -2689,13 +2691,13 @@ public Rectangle map (Control from, Control to, int x, int y, int width, int hei
} else {
NSRect primaryFrame = getPrimaryFrame();
if (from != null) {
- NSView view = from.contentView ();
+ NSView view = from.eventView ();
pt = view.convertPoint_toView_(pt, null);
pt = fromWindow.convertBaseToScreen(pt);
pt.y = primaryFrame.height - pt.y;
}
if (to != null) {
- NSView view = to.contentView ();
+ NSView view = to.eventView ();
pt.y = primaryFrame.height - pt.y;
pt = toWindow.convertScreenToBase(pt);
pt = view.convertPoint_fromView_(pt, null);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Group.java
index 0b46f98c87..9a421ea2a7 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Group.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Group.java
@@ -109,17 +109,6 @@ NSView contentView () {
return contentView;
}
-NSFont defaultNSFont () {
- return display.boxFont;
-}
-
-void deregister () {
- super.deregister ();
- display.removeWidget (contentView);
- SWTBox box = (SWTBox)view;
- display.removeWidget (box.titleCell());
-}
-
void createHandle () {
state |= THEME_BACKGROUND;
NSBox widget = (NSBox)new SWTBox().alloc();
@@ -133,6 +122,21 @@ void createHandle () {
view = widget;
}
+NSFont defaultNSFont () {
+ return display.boxFont;
+}
+
+void deregister () {
+ super.deregister ();
+ display.removeWidget (contentView);
+ SWTBox box = (SWTBox)view;
+ display.removeWidget (box.titleCell());
+}
+
+NSView eventView () {
+ return contentView;
+}
+
public Rectangle getClientArea () {
checkWidget();
NSRect rect = contentView.bounds();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java
index 3d9605db96..ff127de99e 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Label.java
@@ -215,7 +215,7 @@ void createHandle () {
widget.setTitle(NSString.stringWith(""));
if ((style & SWT.SEPARATOR) != 0) {
widget.setBoxType(OS.NSBoxSeparator);
- NSView child = (NSView) new NSView().alloc().init().autorelease();
+ NSView child = (NSView) new SWTView().alloc().init().autorelease();
widget.setContentView(child);
} else {
widget.setBorderType(OS.NSNoBorder);
@@ -297,6 +297,10 @@ void deregister () {
}
}
+NSView eventView () {
+ return ((NSBox)view).contentView();
+}
+
/**
* Returns a value which describes the position of the
* text or image in the receiver. The value will be one of