Mercurial > projects > dwt-mac
diff dwt/internal/cocoa/NSTabView.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/NSTabView.d Sat Aug 09 17:00:02 2008 +0200 @@ -0,0 +1,241 @@ +/******************************************************************************* + * 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.NSTabView; + +import dwt.internal.cocoa.id; +import dwt.internal.cocoa.NSArray; +import dwt.internal.cocoa.NSCell : NSControlSize, NSControlTint; +import dwt.internal.cocoa.NSFont; +import dwt.internal.cocoa.NSInteger; +import dwt.internal.cocoa.NSPoint; +import dwt.internal.cocoa.NSRect; +import dwt.internal.cocoa.NSSize; +import dwt.internal.cocoa.NSTabViewItem; +import dwt.internal.cocoa.NSView; +import dwt.internal.cocoa.OS; +import objc = dwt.internal.objc.runtime; + +enum NSTabViewType +{ + NSTopTabsBezelBorder = 0, + NSLeftTabsBezelBorder = 1, + NSBottomTabsBezelBorder = 2, + NSRightTabsBezelBorder = 3, + NSNoTabsBezelBorder = 4, + NSNoTabsLineBorder = 5, + NSNoTabsNoBorder = 6 +} + +alias NSTabViewType.NSTopTabsBezelBorder NSTopTabsBezelBorder; +alias NSTabViewType.NSLeftTabsBezelBorder NSLeftTabsBezelBorder; +alias NSTabViewType.NSBottomTabsBezelBorder NSBottomTabsBezelBorder; +alias NSTabViewType.NSRightTabsBezelBorder NSRightTabsBezelBorder; +alias NSTabViewType.NSNoTabsBezelBorder NSNoTabsBezelBorder; +alias NSTabViewType.NSNoTabsLineBorder NSNoTabsLineBorder; +alias NSTabViewType.NSNoTabsNoBorder NSNoTabsNoBorder; + +public class NSTabView : NSView +{ + + public this () + { + super(); + } + + public this (objc.id id) + { + super(id); + } + + public void addTabViewItem (NSTabViewItem tabViewItem) + { + OS.objc_msgSend(this.id, OS.sel_addTabViewItem_1, tabViewItem !is null ? tabViewItem.id : null); + } + + public bool allowsTruncatedLabels () + { + return OS.objc_msgSend(this.id, OS.sel_allowsTruncatedLabels) !is null; + } + + public NSRect contentRect () + { + NSRect result; + OS.objc_msgSend_stret(result, this.id, OS.sel_contentRect); + return result; + } + + public NSControlSize controlSize () + { + return cast(NSControlSize) OS.objc_msgSend(this.id, OS.sel_controlSize); + } + + public NSControlTint controlTint () + { + return OS.objc_msgSend(this.id, OS.sel_controlTint); + } + + public id delegatee () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_delegate); + return result !is null ? new id(result) : null; + } + + public bool drawsBackground () + { + return OS.objc_msgSend(this.id, OS.sel_drawsBackground) !is null; + } + + public NSFont font () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_font); + return result !is null ? new NSFont(result) : null; + } + + public NSInteger indexOfTabViewItem (NSTabViewItem tabViewItem) + { + return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_indexOfTabViewItem_1, tabViewItem !is null ? tabViewItem.id : null); + } + + public NSInteger indexOfTabViewItemWithIdentifier (id identifier) + { + return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_indexOfTabViewItemWithIdentifier_1, identifier !is null ? identifier.id : null); + } + + public void insertTabViewItem (NSTabViewItem tabViewItem, NSInteger index) + { + OS.objc_msgSend(this.id, OS.sel_insertTabViewItem_1atIndex_1, tabViewItem !is null ? tabViewItem.id : null, index); + } + + public NSSize minimumSize () + { + NSSize result; + OS.objc_msgSend_struct(result, this.id, OS.sel_minimumSize); + return result; + } + + public NSInteger numberOfTabViewItems () + { + return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_numberOfTabViewItems); + } + + public void removeTabViewItem (NSTabViewItem tabViewItem) + { + OS.objc_msgSend(this.id, OS.sel_removeTabViewItem_1, tabViewItem !is null ? tabViewItem.id : null); + } + + public void selectFirstTabViewItem (id sender) + { + OS.objc_msgSend(this.id, OS.sel_selectFirstTabViewItem_1, sender !is null ? sender.id : null); + } + + public void selectLastTabViewItem (id sender) + { + OS.objc_msgSend(this.id, OS.sel_selectLastTabViewItem_1, sender !is null ? sender.id : null); + } + + public void selectNextTabViewItem (id sender) + { + OS.objc_msgSend(this.id, OS.sel_selectNextTabViewItem_1, sender !is null ? sender.id : null); + } + + public void selectPreviousTabViewItem (id sender) + { + OS.objc_msgSend(this.id, OS.sel_selectPreviousTabViewItem_1, sender !is null ? sender.id : null); + } + + public void selectTabViewItem (NSTabViewItem tabViewItem) + { + OS.objc_msgSend(this.id, OS.sel_selectTabViewItem_1, tabViewItem !is null ? tabViewItem.id : null); + } + + public void selectTabViewItemAtIndex (NSInteger index) + { + OS.objc_msgSend(this.id, OS.sel_selectTabViewItemAtIndex_1, index); + } + + public void selectTabViewItemWithIdentifier (id identifier) + { + OS.objc_msgSend(this.id, OS.sel_selectTabViewItemWithIdentifier_1, identifier !is null ? identifier.id : null); + } + + public NSTabViewItem selectedTabViewItem () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_selectedTabViewItem); + return result !is null ? new NSTabViewItem(result) : null; + } + + public void setAllowsTruncatedLabels (bool allowTruncatedLabels) + { + OS.objc_msgSend(this.id, OS.sel_setAllowsTruncatedLabels_1, allowTruncatedLabels); + } + + public void setControlSize (NSControlSize controlSize) + { + OS.objc_msgSend(this.id, OS.sel_setControlSize_1, controlSize); + } + + public void setControlTint (NSControlTint controlTint) + { + OS.objc_msgSend(this.id, OS.sel_setControlTint_1, controlTint); + } + + public void setDelegate (id anObject) + { + OS.objc_msgSend(this.id, OS.sel_setDelegate_1, anObject !is null ? anObject.id : null); + } + + public void setDrawsBackground (bool flag) + { + OS.objc_msgSend(this.id, OS.sel_setDrawsBackground_1, flag); + } + + public void setFont (NSFont font) + { + OS.objc_msgSend(this.id, OS.sel_setFont_1, font !is null ? font.id : null); + } + + public void setTabViewType (NSTabViewType tabViewType) + { + OS.objc_msgSend(this.id, OS.sel_setTabViewType_1, tabViewType); + } + + public NSTabViewItem tabViewItemAtIndex (NSInteger index) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_tabViewItemAtIndex_1, index); + return result !is null ? new NSTabViewItem(result) : null; + } + + public NSTabViewItem tabViewItemAtPoint (NSPoint point) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_tabViewItemAtPoint_1, point); + return result !is null ? new NSTabViewItem(result) : null; + } + + public NSArray tabViewItems () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_tabViewItems); + return result !is null ? new NSArray(result) : null; + } + + public NSTabViewType tabViewType () + { + return cast(NSTabViewType) OS.objc_msgSend(this.id, OS.sel_tabViewType); + } + + public void takeSelectedTabViewItemFromSender (id sender) + { + OS.objc_msgSend(this.id, OS.sel_takeSelectedTabViewItemFromSender_1, sender !is null ? sender.id : null); + } + +}