Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti2008-06-13 14:31:30 +0000
committerSilenio Quarti2008-06-13 14:31:30 +0000
commit3321329afa864a6d5f9cfdadb85b6a9464a2fcf4 (patch)
tree06eb3099eadd6ff1644a1e82c09e25a30b5d4ea0
parent270311675f6f4cbc05a4249ece03af1024375670 (diff)
downloadeclipse.platform.swt-3321329afa864a6d5f9cfdadb85b6a9464a2fcf4.tar.gz
eclipse.platform.swt-3321329afa864a6d5f9cfdadb85b6a9464a2fcf4.tar.xz
eclipse.platform.swt-3321329afa864a6d5f9cfdadb85b6a9464a2fcf4.zip
setFrameSize()/setFrameOrigin() and events for tab folder children
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Composite.java18
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Control.java82
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java35
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java3
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Spinner.java31
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabFolder.java17
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabItem.java17
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ToolBar.java7
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java14
9 files changed, 136 insertions, 88 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Composite.java
index 63f1b4d983..85a5743278 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Composite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Composite.java
@@ -704,6 +704,15 @@ void removeControl (Control control) {
fixTabList (control);
}
+void resized () {
+ super.resized ();
+ if (layout != null) {
+ markLayout (false, false);
+ updateLayout (false);
+ }
+}
+
+
/**
* Sets the background drawing mode to the argument which should
* be one of the following constants defined in class <code>SWT</code>:
@@ -730,15 +739,6 @@ public void setBackgroundMode (int mode) {
}
}
-int setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
- int result = super.setBounds (x, y, width, height, move, resize);
- if (layout != null && (result & RESIZED) != 0) {
- markLayout (false, false);
- updateLayout (false);
- }
- return result;
-}
-
public boolean setFocus () {
checkWidget ();
Control [] children = _getChildren ();
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 0cedc451ad..eb8ac5f1ed 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
@@ -1579,6 +1579,10 @@ void mouseDown(int id, int sel, int theEvent) {
display.trackingControl = null;
}
+void moved () {
+ sendEvent (SWT.Move);
+}
+
boolean sendKeyEvent (Event event) {
sendEvent (event);
return event.doit;
@@ -2170,6 +2174,10 @@ public void removeTraverseListener(TraverseListener listener) {
eventTable.unhook (SWT.Traverse, listener);
}
+void resized () {
+ sendEvent (SWT.Resize);
+}
+
boolean sendDragEvent (int button, int stateMask, int x, int y) {
Event event = new Event ();
event.button = button;
@@ -2381,44 +2389,26 @@ public void setBounds (int x, int y, int width, int height) {
setBounds (x, y, Math.max (0, width), Math.max (0, height), true, true);
}
-int setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
- int result = 0;
+void setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
NSView topView = topView();
- NSRect rect = topView.frame();
if (move && resize) {
- if (rect.x != x || rect.y != y) result |= MOVED;
- if (rect.width != width || rect.height != height) result |= RESIZED;
- if (result != 0) {
- rect.x = x;
- rect.y = y;
- rect.width = width;
- rect.height = height;
- topView.setFrame (rect);
- }
+ NSRect rect = new NSRect();
+ rect.x = x;
+ rect.y = y;
+ rect.width = width;
+ rect.height = height;
+ topView.setFrame (rect);
} else if (move) {
- if (rect.x != x || rect.y != y) {
- result |= MOVED;
- NSPoint point = new NSPoint();
- point.x = x;
- point.y = y;
- topView.setFrameOrigin(point);
- }
+ NSPoint point = new NSPoint();
+ point.x = x;
+ point.y = y;
+ topView.setFrameOrigin(point);
} else if (resize) {
- if (rect.width != width || rect.height != height) {
- result |= RESIZED;
- NSSize size = new NSSize();
- size.width = width;
- size.height = height;
- topView.setFrameSize(size);
- }
- }
- if ((result & MOVED) != 0) {
- sendEvent(SWT.Move);
+ NSSize size = new NSSize();
+ size.width = width;
+ size.height = height;
+ topView.setFrameSize(size);
}
- if ((result & RESIZED) != 0) {
- sendEvent(SWT.Resize);
- }
- return result;
}
/**
@@ -2644,6 +2634,32 @@ void setForeground (int control, float [] color) {
// OS.SetControlFontStyle (control, fontStyle);
}
+void setFrameOrigin (int id, int sel, NSPoint point) {
+ NSView topView = topView ();
+ if (topView.id != id) {
+ super.setFrameOrigin(id, sel, point);
+ return;
+ }
+ NSRect frame = topView.frame();
+ super.setFrameOrigin(id, sel, point);
+ if (frame.x != point.x || frame.y != point.y) {
+ moved ();
+ }
+}
+
+void setFrameSize (int id, int sel, NSSize size) {
+ NSView topView = topView ();
+ if (topView.id != id) {
+ super.setFrameSize(id, sel, size);
+ return;
+ }
+ NSRect frame = topView.frame();
+ super.setFrameSize(id, sel, size);
+ if (frame.width != size.width || frame.height != size.height) {
+ resized ();
+ }
+}
+
/**
* Sets the layout data associated with the receiver to the argument.
*
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 080e1341ee..2ef18a5d6e 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
@@ -1596,6 +1596,11 @@ void addEventMethods (int cls, int proc2, int proc3) {
OS.class_addMethod(cls, OS.sel_menuForEvent_1, proc3, "@:@");
}
+void addFrameMethods(int cls, int setFrameOriginProc, int setFrameSizeProc) {
+ OS.class_addMethod(cls, OS.sel_setFrameOrigin_1, setFrameOriginProc, "@:{NSPoint}");
+ OS.class_addMethod(cls, OS.sel_setFrameSize_1, setFrameSizeProc, "@:{NSSize}");
+}
+
void initClasses () {
dialogCallback3 = new Callback(this, "dialogProc", 3);
int dialogProc3 = dialogCallback3.getAddress();
@@ -1618,6 +1623,8 @@ void initClasses () {
if (proc6 == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
int drawRectProc = OS.drawRect_CALLBACK(proc3);
+ int setFrameOriginProc = OS.setFrame_CALLBACK(proc3);
+ int setFrameSizeProc = OS.setFrame_CALLBACK(proc3);
String className = "SWTWindowDelegate";
int cls = OS.objc_allocateClassPair(OS.class_NSObject, className, 0);
@@ -1659,6 +1666,7 @@ void initClasses () {
OS.class_addMethod(cls, OS.sel_isOpaque, proc2, "@:");
OS.class_addMethod(cls, OS.sel_flagsChanged_1, proc3, "@:@");
addEventMethods(cls, proc2, proc3);
+ addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc);
OS.objc_registerClassPair(cls);
className = "SWTScrollView";
@@ -1667,6 +1675,7 @@ void initClasses () {
OS.class_addMethod(cls, OS.sel_sendVerticalSelection, proc2, "@:");
OS.class_addMethod(cls, OS.sel_sendHorizontalSelection, proc2, "@:");
addEventMethods(cls, proc2, proc3);
+ addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc);
OS.objc_registerClassPair(cls);
className = "SWTButton";
@@ -1676,6 +1685,7 @@ void initClasses () {
OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:");
OS.class_addMethod(cls, OS.sel_sendArrowSelection, proc2, "@:");
addEventMethods(cls, proc2, proc3);
+ addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc);
OS.objc_registerClassPair(cls);
className = "SWTTableView";
@@ -1689,6 +1699,7 @@ void initClasses () {
OS.class_addMethod(cls, OS.sel_tableView_1willDisplayCell_1forTableColumn_1row_1, proc6, "@:@@@i");
OS.class_addMethod(cls, OS.sel_tableView_1setObjectValue_1forTableColumn_1row_1, proc6, "@:@@@i");
addEventMethods(cls, proc2, proc3);
+ addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc);
OS.objc_registerClassPair(cls);
className = "SWTOutlineView";
@@ -1705,6 +1716,7 @@ void initClasses () {
OS.class_addMethod(cls, OS.sel_outlineView_1willDisplayCell_1forTableColumn_1item_1, proc6, "@:@@@@");
OS.class_addMethod(cls, OS.sel_outlineView_1setObjectValue_1forTableColumn_1byItem_1, proc6, "@:@@@@");
addEventMethods(cls, proc2, proc3);
+ addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc);
OS.objc_registerClassPair(cls);
className = "SWTTreeItem";
@@ -1717,24 +1729,28 @@ void initClasses () {
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, "@:@@");
addEventMethods(cls, proc2, proc3);
+ addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc);
OS.objc_registerClassPair(cls);
className = "SWTBox";
cls = OS.objc_allocateClassPair(OS.class_NSBox, 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);
+ addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc);
OS.objc_registerClassPair(cls);
className = "SWTProgressIndicator";
cls = OS.objc_allocateClassPair(OS.class_NSProgressIndicator, 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);
+ addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc);
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);
+ addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc);
OS.objc_registerClassPair(cls);
className = "SWTPopUpButton";
@@ -1742,6 +1758,7 @@ void initClasses () {
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);
+ addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc);
OS.objc_registerClassPair(cls);
className = "SWTComboBox";
@@ -1750,6 +1767,7 @@ void initClasses () {
OS.class_addMethod(cls, OS.sel_comboBoxSelectionDidChange_1, proc3, "@:@");
OS.class_addMethod(cls, OS.sel_sendSelection, proc2, "@:");
addEventMethods(cls, proc2, proc3);
+ addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc);
OS.objc_registerClassPair(cls);
className = "SWTDatePicker";
@@ -1757,6 +1775,7 @@ void initClasses () {
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);
+ addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc);
OS.objc_registerClassPair(cls);
className = "SWTImageView";
@@ -1764,6 +1783,7 @@ void initClasses () {
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);
+ addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc);
OS.objc_registerClassPair(cls);
className = "SWTStepper";
@@ -1771,6 +1791,7 @@ void initClasses () {
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);
+ addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc);
OS.objc_registerClassPair(cls);
className = "SWTScroller";
@@ -1778,6 +1799,7 @@ void initClasses () {
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);
+ addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc);
OS.objc_registerClassPair(cls);
className = "SWTMenuItem";
@@ -1790,6 +1812,7 @@ void initClasses () {
cls = OS.objc_allocateClassPair(OS.class_NSTextView, 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);
+ addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc);
OS.objc_registerClassPair(cls);
className = "SWTTextField";
@@ -1797,6 +1820,7 @@ void initClasses () {
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);
+ addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc);
OS.objc_registerClassPair(cls);
className = "SWTSearchField";
@@ -1804,6 +1828,7 @@ void initClasses () {
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);
+ addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc);
OS.objc_registerClassPair(cls);
className = "SWTSecureTextField";
@@ -1811,6 +1836,7 @@ void initClasses () {
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);
+ addFrameMethods(cls, setFrameOriginProc, setFrameSizeProc);
OS.objc_registerClassPair(cls);
className = "SWTWindow";
@@ -3150,7 +3176,6 @@ void applicationSendMouseEvent (NSEvent nsEvent, boolean send) {
Cursor cursor = null;
if (control != null) cursor = control.findCursor ();
if (cursor == null) cursor = getSystemCursor (SWT.CURSOR_ARROW);
- System.out.println("set");
cursor.handle.set ();
if (currentControl != null) {
currentControl.sendMouseEvent (nsEvent, SWT.MouseExit, send);
@@ -3322,6 +3347,14 @@ int windowDelegateProc(int id, int sel, int arg0) {
NSRect rect = new NSRect();
OS.memmove(rect, arg0, NSRect.sizeof);
widget.drawRect(id, rect);
+ } else if (sel == OS.sel_setFrameOrigin_1) {
+ NSPoint point = new NSPoint();
+ OS.memmove(point, arg0, NSPoint.sizeof);
+ widget.setFrameOrigin(id, sel, point);
+ } else if (sel == OS.sel_setFrameSize_1) {
+ NSSize size = new NSSize();
+ OS.memmove(size, arg0, NSSize.sizeof);
+ widget.setFrameSize(id, sel, size);
} else if (sel == OS.sel_windowShouldClose_1) {
return widget.windowShouldClose(arg0) ? 1 : 0;
} else if (sel == OS.sel_mouseDown_1) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java
index 255f601e7f..c123ddd8bf 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Shell.java
@@ -986,7 +986,7 @@ public void setAlpha (int alpha) {
window.setAlphaValue (alpha / 255f);
}
-int setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
+void setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
// if (fullScreen) setFullScreen (false);
if (move && resize) {
NSRect rect = new NSRect ();
@@ -1014,7 +1014,6 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize
}
}
}
- return 0;
}
public void setEnabled (boolean enabled) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Spinner.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Spinner.java
index 1ed52675ef..46b248b0b5 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Spinner.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Spinner.java
@@ -500,25 +500,22 @@ void removeVerifyListener (VerifyListener listener) {
eventTable.unhook (SWT.Verify, listener);
}
-void sendSelection () {
- setSelection (getSelection(), false, true, true);
+void resized () {
+ super.resized ();
+ buttonView.sizeToFit();
+ NSRect buttonFrame = buttonView.bounds();
+ NSRect frame = view.frame();
+ buttonFrame.x = frame.width - buttonFrame.width;
+ buttonFrame.y = 0;
+ frame.x = 0;
+ frame.y = 0;
+ frame.width -= buttonFrame.width + GAP;
+ textView.setFrame(frame);
+ buttonView.setFrame(buttonFrame);
}
-int setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
- int result = super.setBounds(x, y, width, height, move, resize);
- if ((result & RESIZED) != 0) {
- buttonView.sizeToFit();
- NSRect buttonFrame = buttonView.bounds();
- NSRect frame = view.frame();
- buttonFrame.x = frame.width - buttonFrame.width;
- buttonFrame.y = 0;
- frame.x = 0;
- frame.y = 0;
- frame.width -= buttonFrame.width + GAP;
- textView.setFrame(frame);
- buttonView.setFrame(buttonFrame);
- }
- return result;
+void sendSelection () {
+ setSelection (getSelection(), false, true, true);
}
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabFolder.java
index 909361471c..c15b17c142 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabFolder.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabFolder.java
@@ -467,21 +467,6 @@ public void removeSelectionListener (SelectionListener listener) {
eventTable.unhook (SWT.DefaultSelection,listener);
}
-int setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
- int result = super.setBounds(x, y, width, height, move, resize);
- if ((result & RESIZED) != 0) {
- int index = getSelectionIndex ();
- if (index != -1) {
- TabItem item = items [index];
- Control control = item.control;
- if (control != null && !control.isDisposed ()) {
- control.setBounds (getClientArea ());
- }
- }
- }
- return result;
-}
-
void setFont (NSFont font) {
((NSTabView)view).setFont(font);
}
@@ -577,7 +562,6 @@ void setSelection (int index, boolean notify, boolean force) {
if (item != null) {
Control control = item.control;
if (control != null && !control.isDisposed ()) {
- control.setBounds (getClientArea ());
control.setVisible (true);
}
if (notify) {
@@ -620,7 +604,6 @@ void willSelectTabViewItem(int tabView, int tabViewItem) {
}
Control control = item.control;
if (control != null && !control.isDisposed ()) {
- control.setBounds (getClientArea ());
control.setVisible (true);
}
Event event = new Event ();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabItem.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabItem.java
index bbad744f2a..cf1cdb8f96 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabItem.java
@@ -252,14 +252,21 @@ public void setControl (Control control) {
int index = parent.indexOf (this);
if (index != parent.getSelectionIndex ()) {
if (newControl != null) newControl.setVisible (false);
- return;
+ } else {
+ if (newControl != null) {
+ newControl.setVisible (true);
+ }
+ if (oldControl != null) oldControl.setVisible (false);
}
+ NSView view;
if (newControl != null) {
-// nsItem.setView(control.topView ());
- newControl.setBounds (parent.getClientArea ());
- newControl.setVisible (true);
+ view = newControl.topView();
+ } else {
+ view = (NSView)new NSView().alloc();
+ view.initWithFrame (new NSRect());
+ view.autorelease();
}
- if (oldControl != null) oldControl.setVisible (false);
+ nsItem.setView (view);
}
public void setImage (Image image) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ToolBar.java
index 9242fe07bc..b5c93834e2 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ToolBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/ToolBar.java
@@ -426,10 +426,9 @@ void removeControl (Control control) {
}
}
-int setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
- int result = super.setBounds (x, y, width, height, move, resize);
- if ((result & RESIZED) != 0) relayout ();
- return result;
+void resized () {
+ super.resized ();
+ relayout ();
}
public void setRedraw (boolean redraw) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java
index 8cacb63306..6f6eea33a5 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java
@@ -1068,6 +1068,20 @@ public void setData (String key, Object value) {
}
}
+void setFrameOrigin (int id, int sel, NSPoint point) {
+ objc_super super_struct = new objc_super();
+ super_struct.receiver = id;
+ super_struct.cls = OS.objc_msgSend(id, OS.sel_superclass);
+ OS.objc_msgSendSuper(super_struct, sel, point);
+}
+
+void setFrameSize (int id, int sel, NSSize size) {
+ objc_super super_struct = new objc_super();
+ super_struct.receiver = id;
+ super_struct.cls = OS.objc_msgSend(id, OS.sel_superclass);
+ OS.objc_msgSendSuper(super_struct, sel, size);
+}
+
boolean setInputState (Event event, int type, int chord, int modifiers) {
// if ((chord & 0x01) != 0) event.stateMask |= SWT.BUTTON1;
// if ((chord & 0x02) != 0) event.stateMask |= SWT.BUTTON3;

Back to the top