Mercurial > projects > dwt-mac
diff dwt/internal/cocoa/NSBox.d @ 45:d8635bb48c7c
Merge with SWT 3.5
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 01 Dec 2008 17:07:00 +0100 |
parents | f565d3a95c0a |
children | 62202ce0039f |
line wrap: on
line diff
--- a/dwt/internal/cocoa/NSBox.d Tue Oct 21 15:20:04 2008 +0200 +++ b/dwt/internal/cocoa/NSBox.d Mon Dec 01 17:07:00 2008 +0100 @@ -1,34 +1,34 @@ -/******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. +/******************************************************************************* + * Copyright (c) 2000, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * IBM Corporation - initial API and implementation + * IBM Corporation - initial API and implementation * * Port to the D programming language: - * Jacob Carlborg <jacob.carlborg@gmail.com> + * Jacob Carlborg <doob@me.com> *******************************************************************************/ module dwt.internal.cocoa.NSBox; -import dwt.internal.cocoa.CGFloat; +import dwt.internal.c.Carbon; +import cocoa = dwt.internal.cocoa.id; import dwt.internal.cocoa.NSCell; import dwt.internal.cocoa.NSColor; import dwt.internal.cocoa.NSFont; -import dwt.internal.cocoa.NSInteger; import dwt.internal.cocoa.NSRect; import dwt.internal.cocoa.NSSize; import dwt.internal.cocoa.NSString; import dwt.internal.cocoa.NSView; import dwt.internal.cocoa.OS; +import dwt.internal.objc.cocoa.Cocoa; import objc = dwt.internal.objc.runtime; alias NSUInteger NSBoxType; -enum -{ +enum { NSBoxPrimary = 0, NSBoxSecondary = 1, NSBoxSeparator = 2, @@ -36,8 +36,7 @@ NSBoxCustom = 4 } -enum NSTitlePosition -{ +enum NSTitlePosition { NSNoTitle = 0, NSAboveTop = 1, NSAtTop = 2, @@ -47,177 +46,68 @@ NSBelowBottom = 6 } -public class NSBox : NSView -{ - public this () - { - super(); - } - - public this (objc.id id) - { - super(id); - } - - public NSColor borderColor () - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_borderColor); - return result !is null ? new NSColor(result) : null; - } +public class NSBox : NSView { + +public this () { + super(); +} - public NSRect borderRect () - { - NSRect result; - OS.objc_msgSend_stret(&result, this.id_, OS.sel_borderRect); - return result; - } +public this (objc.id id) { + super(id); +} - public NSBorderType borderType () - { - return cast(NSBorderType) OS.objc_msgSend(this.id_, OS.sel_borderType); - } - - public CGFloat borderWidth () - { - return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_borderWidth); - } - - public NSBoxType boxType () - { - return cast(NSBoxType) OS.objc_msgSend(this.id_, OS.sel_boxType); - } +public this (cocoa.id id) { + super(id); +} - public NSView contentView () - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_contentView); - return result !is null ? new NSView(result) : null; - } - - public NSSize contentViewMargins () - { - NSSize result; - OS.objc_msgSend_stret(&result, this.id_, OS.sel_contentViewMargins); - return result; - } - - public CGFloat cornerRadius () - { - return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_cornerRadius); - } +public CGFloat borderWidth () { + return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_borderWidth); +} - public NSColor fillColor () - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_fillColor); - return result !is null ? new NSColor(result) : null; - } - - public bool isTransparent () - { - return OS.objc_msgSend(this.id_, OS.sel_isTransparent) !is null; - } +public NSSize contentViewMargins () { + NSSize result; + OS.objc_msgSend_stret(result, this.id, OS.sel_contentViewMargins); + return result; +} - public void setBorderColor (NSColor borderColor) - { - OS.objc_msgSend(this.id_, OS.sel_setBorderColor_1, borderColor !is null ? borderColor.id_ : null); - } +public void setBorderType (NSBorderType aType) { + OS.objc_msgSend(this.id, OS.sel_setBorderType_1, aType); +} - public void setBorderType (NSBorderType aType) - { - OS.objc_msgSend(this.id_, OS.sel_setBorderType_1, aType); - } - - public void setBorderWidth (CGFloat borderWidth) - { - OS.objc_msgSend(this.id_, OS.sel_setBorderWidth_1, borderWidth); - } +public void setBorderWidth (CGFloat borderWidth) { + OS.objc_msgSend(this.id, OS.sel_setBorderWidth_1, borderWidth); +} - public void setBoxType (NSBoxType boxType) - { - OS.objc_msgSend(this.id_, OS.sel_setBoxType_1, boxType); - } - - public void setContentView (NSView aView) - { - OS.objc_msgSend(this.id_, OS.sel_setContentView_1, aView !is null ? aView.id_ : null); - } +public void setBoxType (NSBoxType boxType) { + OS.objc_msgSend(this.id, OS.sel_setBoxType_1, boxType); +} - public void setContentViewMargins (NSSize offsetSize) - { - OS.objc_msgSend(this.id_, OS.sel_setContentViewMargins_1, offsetSize); - } - - public void setCornerRadius (CGFloat cornerRadius) - { - OS.objc_msgSend(this.id_, OS.sel_setCornerRadius_1, cornerRadius); - } +public void setContentView (NSView aView) { + OS.objc_msgSend(this.id, OS.sel_setContentView_, aView !is null ? aView.id : null); +} - public void setFillColor (NSColor fillColor) - { - OS.objc_msgSend(this.id_, OS.sel_setFillColor_1, fillColor !is null ? fillColor.id_ : null); - } - - public void setFrameFromContentFrame (NSRect contentFrame) - { - OS.objc_msgSend(this.id_, OS.sel_setFrameFromContentFrame_1, contentFrame); - } +public void setContentViewMargins (NSSize offsetSize) { + OS.objc_msgSend(this.id, OS.sel_setContentViewMargins_, offsetSize); +} - public void setTitle (NSString aString) - { - OS.objc_msgSend(this.id_, OS.sel_setTitle_1, aString !is null ? aString.id_ : null); - } - - public void setTitleFont (NSFont fontObj) - { - OS.objc_msgSend(this.id_, OS.sel_setTitleFont_1, fontObj !is null ? fontObj.id_ : null); - } - - public void setTitlePosition (NSTitlePosition aPosition) - { - OS.objc_msgSend(this.id_, OS.sel_setTitlePosition_1, aPosition); - } +public void setTitle (NSString aString) { + OS.objc_msgSend(this.id, OS.sel_setTitle_, aString !is null ? aString.id : null); +} - public void setTitleWithMnemonic (NSString StringWithAmpersand) - { - OS.objc_msgSend(this.id_, OS.sel_setTitleWithMnemonic_1, StringWithAmpersand !is null ? StringWithAmpersand.id_ : null); - } - - public void setTransparent (bool flag) - { - OS.objc_msgSend(this.id_, OS.sel_setTransparent_1, flag); - } +public void setTitleFont (NSFont fontObj) { + OS.objc_msgSend(this.id, OS.sel_setTitleFont_, fontObj !is null ? fontObj.id : null); +} - public void sizeToFit () - { - OS.objc_msgSend(this.id_, OS.sel_sizeToFit); - } - - public NSString title () - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_title); - return result !is null ? new NSString(result) : null; - } +public void setTitlePosition (NSTitlePosition aPosition) { + OS.objc_msgSend(this.id, OS.sel_setTitlePosition_, aPosition); +} - public NSCell titleCell () - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_titleCell); - return result !is null ? new NSCell(result) : null; - } - - public NSFont titleFont () - { - objc.id result = OS.objc_msgSend(this.id_, OS.sel_titleFont); - return result !is null ? new NSFont(result) : null; - } +public void sizeToFit () { + OS.objc_msgSend(this.id, OS.sel_sizeToFit); +} - public NSTitlePosition titlePosition () - { - return cast(NSTitlePosition) OS.objc_msgSend(this.id_, OS.sel_titlePosition); - } - - public NSRect titleRect () - { - NSRect result; - OS.objc_msgSend_stret(&result, this.id_, OS.sel_titleRect); - return result; - } +public NSCell titleCell () { + objc.id result = OS.objc_msgSend(this.id, OS.sel_titleCell); + return result !is null ? new NSCell(result) : null; } +}