summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Barnes <krbarnes>2008-06-17 21:18:01 +0000
committerKevin Barnes <krbarnes>2008-06-17 21:18:01 +0000
commitbb5ab065078a87fb32da94c3cc824b48af95811c (patch)
treec597657dc9aa440b8b04f0270d74e95fb1c7f2a6
parent96ead799b163f69c971718d08e432a475bbcdbbc (diff)
downloadeclipse.platform.swt-bb5ab065078a87fb32da94c3cc824b48af95811c.tar.gz
eclipse.platform.swt-bb5ab065078a87fb32da94c3cc824b48af95811c.tar.xz
eclipse.platform.swt-bb5ab065078a87fb32da94c3cc824b48af95811c.zip
fix computed size
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_custom.c6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSBox.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Group.java10
3 files changed, 11 insertions, 7 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_custom.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_custom.c
index 354d543671..a585f0e2d7 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_custom.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_custom.c
@@ -250,6 +250,7 @@ static SEL contentSize;
static SEL containerSize;
static SEL cellSize;
static SEL sizeValue;
+static SEL contentViewMargins;
JNIEXPORT jint JNICALL OS_NATIVE(objc_1msgSend_1struct__Lorg_eclipse_swt_internal_cocoa_NSSize_2II)
(JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2)
{
@@ -282,6 +283,11 @@ JNIEXPORT jint JNICALL OS_NATIVE(objc_1msgSend_1struct__Lorg_eclipse_swt_interna
if (sizeValue == 0) sizeValue = sel_registerName("sizeValue");
if ((SEL)arg2 == sizeValue) {
*lparg0 = [(id)arg1 sizeValue];
+ } else {
+ if (contentViewMargins == 0) contentViewMargins = sel_registerName("contentViewMargins");
+ if ((SEL)arg2 == contentViewMargins) {
+ *lparg0 = [(id)arg1 contentViewMargins];
+ }
}
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSBox.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSBox.java
index 80c75009b4..a625fb7164 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSBox.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSBox.java
@@ -50,7 +50,7 @@ public NSView contentView() {
public NSSize contentViewMargins() {
NSSize result = new NSSize();
- OS.objc_msgSend_stret(result, this.id, OS.sel_contentViewMargins);
+ OS.objc_msgSend_struct(result, this.id, OS.sel_contentViewMargins);
return result;
}
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 3789e77543..132949d3bd 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
@@ -39,7 +39,7 @@ import org.eclipse.swt.internal.cocoa.*;
* @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
*/
public class Group extends Composite {
- SWTView contentView;
+ NSView contentView;
String text = "";
/**
@@ -97,11 +97,10 @@ protected void checkSubclass () {
public Rectangle computeTrim (int x, int y, int width, int height) {
checkWidget ();
NSBox widget = (NSBox)view;
- NSRect titleRect = widget.titleRect();
- float borderWidth = widget.borderWidth();
+ NSSize margins = widget.contentViewMargins();
NSRect frame = contentView.frame();
- width += borderWidth * 2 + frame.x;
- height += borderWidth * 2 + titleRect.height + frame.y;
+ width += margins.width * 2;
+ height += margins.height * 2 + frame.y;
return super.computeTrim(x, y, width, height);
}
@@ -118,7 +117,6 @@ void createHandle () {
SWTBox widget = (SWTBox)new SWTBox().alloc();
widget.initWithFrame(new NSRect());
widget.setTitlePosition(OS.NSNoTitle);
- widget.setContentViewMargins(new NSSize());
SWTView contentWidget = (SWTView)new SWTView().alloc();
contentWidget.initWithFrame(new NSRect());
// contentWidget.setDrawsBackground(false);