Mercurial > projects > dwt-mac
diff dwt/internal/cocoa/NSTabViewItem.d @ 0:380af2bdd8e5
Upload of whole dwt tree
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Sat, 09 Aug 2008 17:00:02 +0200 |
parents | |
children | 8b48be5454ce |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/cocoa/NSTabViewItem.d Sat Aug 09 17:00:02 2008 +0200 @@ -0,0 +1,135 @@ +/******************************************************************************* + * Copyright (c) 2007 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 + * + * Port to the D Programming language: + * Jacob Carlborg <jacob.carlborg@gmail.com> + *******************************************************************************/ +module dwt.internal.cocoa.NSTabViewItem; + +import dwt.internal.cocoa.id; +import dwt.internal.cocoa.NSColor; +import dwt.internal.cocoa.NSObject; +import dwt.internal.cocoa.NSRect; +import dwt.internal.cocoa.NSSize; +import dwt.internal.cocoa.NSString; +import dwt.internal.cocoa.NSTabView; +import dwt.internal.cocoa.NSView; +import dwt.internal.cocoa.OS; +import objc = dwt.internal.objc.runtime; + +enum NSTabState +{ + NSSelectedTab = 0, + NSBackgroundTab = 1, + NSPressedTab = 2 +} + +alias NSTabState.NSSelectedTab NSSelectedTab; +alias NSTabState.NSBackgroundTab NSBackgroundTab; +alias NSTabState.NSPressedTab NSPressedTab; + +public class NSTabViewItem : NSObject +{ + + public this () + { + super(); + } + + public this (objc.id id) + { + super(id); + } + + public NSColor color () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_color); + return result !is null ? new NSColor(result) : null; + } + + public void drawLabel (bool shouldTruncateLabel, NSRect labelRect) + { + OS.objc_msgSend(this.id, OS.sel_drawLabel_1inRect_1, shouldTruncateLabel, labelRect); + } + + public id identifier () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_identifier); + return result !is null ? new id(result) : null; + } + + public NSTabViewItem initWithIdentifier (id identifier) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithIdentifier_1, identifier !is null ? identifier.id : null); + return result !is null ? this : null; + } + + public NSTabViewItem initialFirstResponder () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_initialFirstResponder); + return result !is null ? this : null; + } + + public NSString label () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_label); + return result !is null ? new NSString(result) : null; + } + + public void setColor (NSColor color) + { + OS.objc_msgSend(this.id, OS.sel_setColor_1, color !is null ? color.id : null); + } + + public void setIdentifier (id identifier) + { + OS.objc_msgSend(this.id, OS.sel_setIdentifier_1, identifier !is null ? identifier.id : null); + } + + public void setInitialFirstResponder (NSView view) + { + OS.objc_msgSend(this.id, OS.sel_setInitialFirstResponder_1, view !is null ? view.id : null); + } + + public void setLabel (NSString label) + { + OS.objc_msgSend(this.id, OS.sel_setLabel_1, label !is null ? label.id : null); + } + + public void setView (NSView view) + { + OS.objc_msgSend(this.id, OS.sel_setView_1, view !is null ? view.id : null); + } + + public NSSize sizeOfLabel (bool computeMin) + { + NSSize result; + OS.objc_msgSend_stret(result, this.id, OS.sel_sizeOfLabel_1, computeMin); + return result; + } + + public NSTabState tabState () + { + return cast(NSTabState) OS.objc_msgSend(this.id, OS.sel_tabState); + } + + public NSTabView tabView () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_tabView); + return result !is null ? new NSTabView(result) : null; + } + + public id view () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_view); + return result !is null ? new id(result) : null; + } + +}