Mercurial > projects > dwt-mac
changeset 78:d226cd03f84a
Ported dwt.widgets.TabFolder
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Wed, 24 Dec 2008 13:12:21 +0100 |
parents | 990305995bc6 |
children | 0dc55b17c290 |
files | dwt/widgets/TabFolder.d |
diffstat | 1 files changed, 17 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/dwt/widgets/TabFolder.d Wed Dec 24 13:06:45 2008 +0100 +++ b/dwt/widgets/TabFolder.d Wed Dec 24 13:12:21 2008 +0100 @@ -7,6 +7,9 @@ * * Contributors: * IBM Corporation - initial API and implementation + * + * Port to the D programming language: + * Jacob Carlborg <doob@me.com> *******************************************************************************/ module dwt.widgets.TabFolder; @@ -29,6 +32,12 @@ import dwt.internal.cocoa.OS; import dwt.internal.cocoa.SWTTabView; +import objc = dwt.internal.objc.runtime; +import dwt.widgets.Composite; +import dwt.widgets.Control; +import dwt.widgets.TabItem; +import dwt.widgets.TypedListener; + /** * Instances of this class implement the notebook user interface * metaphor. It allows the user to select a notebook page from @@ -155,7 +164,7 @@ public Rectangle computeTrim (int x, int y, int width, int height) { checkWidget (); - NSTabView widget = (NSTabView)view; + NSTabView widget = cast(NSTabView)view; NSRect rect = widget.contentRect (); x -= rect.x; y -= rect.y; width += Math.ceil (rect.x); height += Math.ceil (rect.y); @@ -163,7 +172,7 @@ } void createHandle () { - NSTabView widget = cast(NSTabView)new SWTTabView().alloc(); + NSTabView widget = cast(NSTabView)(new SWTTabView()).alloc(); widget.initWithFrame (NSRect()); widget.setDelegate(widget); if ((style & DWT.BOTTOM) !is 0) { @@ -183,7 +192,7 @@ System.arraycopy (items, index, items, index + 1, count - index); items [index] = item; itemCount++; - NSTabViewItem nsItem = cast(NSTabViewItem)new NSTabViewItem().alloc().init(); + NSTabViewItem nsItem = cast(NSTabViewItem)(new NSTabViewItem()).alloc().init(); item.nsItem = nsItem; (cast(NSTabView)view).insertTabViewItem(nsItem, index); } @@ -264,7 +273,7 @@ public TabItem getItem (Point point) { checkWidget (); if (point is null) error (DWT.ERROR_NULL_ARGUMENT); - NSPoint nsPoint = new NSPoint (); + NSPoint nsPoint = NSPoint (); nsPoint.x = point.x; nsPoint.y = point.y; NSTabView tabView = cast(NSTabView) view; @@ -337,7 +346,7 @@ checkWidget (); int index = getSelectionIndex (); if (index is -1) return new TabItem [0]; - return new TabItem [] {items [index]}; + return [items [index]]; } /** @@ -487,7 +496,7 @@ public void setSelection (TabItem item) { checkWidget (); if (item is null) error (DWT.ERROR_NULL_ARGUMENT); - setSelection (new TabItem [] {item}); + setSelection ([item]); } /** @@ -584,7 +593,7 @@ return index is getSelectionIndex (); } -void tabView_willSelectTabViewItem(int /*long*/ id, int /*long*/ sel, int /*long*/ tabView, int /*long*/ tabViewItem) { +void tabView_willSelectTabViewItem(objc.id id, objc.SEL sel, objc.id tabView, objc.id tabViewItem) { if (tabViewItem is 0) return; for (int i = 0; i < itemCount; i++) { TabItem item = items [i]; @@ -608,7 +617,7 @@ } } -void tabView_didSelectTabViewItem(int /*long*/ id, int /*long*/ sel, int /*long*/ tabView, int /*long*/ tabViewItem) { +void tabView_didSelectTabViewItem(objc.id id, objc.SEL sel, objc.id tabView, objc.id tabViewItem) { if (tabViewItem is 0) return; for (int i = 0; i < itemCount; i++) { TabItem item = items [i];