Mercurial > projects > dwt-mac
diff dwt/widgets/Group.d @ 69:39340f7612f8
Ported dwt.widgets.Group
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Tue, 23 Dec 2008 23:21:45 +0100 |
parents | cfa563df4fdd |
children | 63a09873578e |
line wrap: on
line diff
--- a/dwt/widgets/Group.d Tue Dec 23 23:16:05 2008 +0100 +++ b/dwt/widgets/Group.d Tue Dec 23 23:21:45 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.Group; @@ -26,6 +29,8 @@ import dwt.internal.cocoa.SWTBox; import dwt.internal.cocoa.SWTView; +import dwt.widgets.Composite; + /** * Instances of this class provide an etched border * with an optional title. @@ -50,7 +55,7 @@ * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ public class Group : Composite { - NSView contentView; + NSView contentView_; String text = ""; /** @@ -108,7 +113,7 @@ public Rectangle computeTrim (int x, int y, int width, int height) { checkWidget (); NSBox widget = cast(NSBox)view; - int border = (int)Math.ceil (widget.borderWidth ()); + int border = cast(int)Math.ceil (widget.borderWidth ()); NSSize margins = widget.contentViewMargins(); NSRect frame = contentView.frame(); width += (margins.width + border) * 2; @@ -123,7 +128,7 @@ void deregister () { super.deregister (); display.removeWidget (contentView); - SWTBox box = (SWTBox)view; + SWTBox box = cast(SWTBox)view; display.removeWidget (box.titleCell()); } @@ -131,11 +136,11 @@ NSBox widget = cast(NSBox)(new SWTBox()).alloc(); widget.initWithFrame(NSRect()); widget.setTitlePosition(OS.NSNoTitle); - NSView contentWidget = (NSView)new SWTView().alloc(); + NSView contentWidget = cast(NSView)(new SWTView()).alloc(); contentWidget.initWithFrame(NSRect()); // contentWidget.setDrawsBackground(false); widget.setContentView(contentWidget); - contentView = contentWidget; + contentView_ = contentWidget; view = widget; } @@ -173,18 +178,18 @@ void register () { super.register (); display.addWidget (contentView, this); - SWTBox box = (SWTBox)view; + SWTBox box = cast(SWTBox)view; display.addWidget (box.titleCell(), this); } void releaseHandle () { super.releaseHandle (); if (contentView !is null) contentView.release(); - contentView = null; + contentView_ = null; } void setFont(NSFont font) { - ((NSBox) view).setTitleFont(font); + (cast(NSBox) view).setTitleFont(font); } /** @@ -220,7 +225,7 @@ int length = fixMnemonic (buffer); NSBox box = cast(NSBox)view; box.setTitlePosition(length is 0 ? OS.NSNoTitle : OS.NSAtTop); - box.setTitle(NSString.stringWithCharacters(buffer, length)); + box.setTitle(NSString.stringWithCharacters(buffer.toString16().ptr, length)); } }