Inherits from | |
Conforms to | |
Framework | /System/Library/Frameworks/AppKit.framework |
Availability | Available in Mac OS X v10.0 and later. |
Companion guide | |
Declared in | NSTabView.h |
Related sample code |
An NSTabView
object provides a convenient way to present information in multiple pages. The view contains a row of tabs that give the appearance of folder tabs, as shown in the following figure. The user selects the desired page by clicking the appropriate tab or using the arrow keys to move between pages. Each page displays a view hierarchy provided by your application.
– indexOfTabViewItem:
– indexOfTabViewItemWithIdentifier:
– numberOfTabViewItems
– tabViewItemAtIndex:
– tabViewItems
– selectFirstTabViewItem:
– selectLastTabViewItem:
– selectNextTabViewItem:
– selectPreviousTabViewItem:
– selectTabViewItem:
– selectTabViewItemAtIndex:
– selectTabViewItemWithIdentifier:
– selectedTabViewItem
– takeSelectedTabViewItemFromSender:
– tabView:shouldSelectTabViewItem:
delegate method
– tabView:willSelectTabViewItem:
delegate method
– tabView:didSelectTabViewItem:
delegate method
– tabViewDidChangeNumberOfTabViewItems:
delegate method
Adds the tab item specified by tabViewItem.
- (void)addTabViewItem:(NSTabViewItem *)tabViewItem
The item is added at the end of the array of tab items, so the new tab appears on the right side of the view. If the delegate supports it, invokes the delegate’s tabViewDidChangeNumberOfTabViewItems:
method.
– insertTabViewItem:atIndex:
– numberOfTabViewItems
– removeTabViewItem:
– tabViewItemAtIndex:
– tabViewItems
NSTabView.h
Returns YES
if the receiver allows truncating for labels that don’t fit on a tab.
- (BOOL)allowsTruncatedLabels
The default is NO
. When truncating is allowed, the tab view inserts an ellipsis, if necessary, to fit a label in the tab.
NSTabView.h
Returns the rectangle describing the content area of the receiver.
- (NSRect)contentRect
This area does not include the space required for the receiver’s tabs or borders (if any).
NSTabView.h
Returns the size of the receiver.
- (NSControlSize)controlSize
Valid return values are described in NSCell’s “Constants”.
NSTabView.h
Returns the receiver’s control tint.
- (NSControlTint)controlTint
Valid return values are described in “Constants.”
NSTabView.h
Returns the receiver’s delegate.
- (id)delegate
NSTabView.h
Returns YES
if the receiver draws a background color when the tab view type is NSNoTabsNoBorder
. If the receiver uses bezeled edges or a line border, the appropriate background color for that border is used.
- (BOOL)drawsBackground
NSTabView.h
Returns the font for tab label text.
- (NSFont *)font
NSTabView.h
Returns the index of the item that matches tabViewItem, or NSNotFound
if the item is not found.
- (NSInteger)indexOfTabViewItem:(NSTabViewItem *)tabViewItem
A tab view keeps an array containing one tab view item for each tab in the view—this array is the one that is searched. The returned index is base 0.
– indexOfTabViewItemWithIdentifier:
– insertTabViewItem:atIndex:
– numberOfTabViewItems
– tabViewItemAtIndex:
NSTabView.h
Returns the index of the item that matches identifier, or NSNotFound
if the item is not found.
- (NSInteger)indexOfTabViewItemWithIdentifier:(id)identifier
A tab view keeps an array containing one tab view item for each tab in the view—this array is the one that is searched. The returned index is base 0.
NSTabView.h
Inserts tabViewItem into the receiver’s array of tab view items at index.
- (void)insertTabViewItem:(NSTabViewItem *)tabViewItem atIndex:(NSInteger)index
The index parameter is base 0. If there is a delegate and the delegate supports it, sends the delegate the tabViewDidChangeNumberOfTabViewItems:
message.
– indexOfTabViewItem:
– indexOfTabViewItemWithIdentifier:
– numberOfTabViewItems
– tabViewItemAtIndex:
NSTabView.h
Returns the minimum size necessary for the receiver to display tabs in a useful way.
- (NSSize)minimumSize
You can use the value returned by this method to limit how much a user can resize a tab view.
NSTabView.h
Returns the number of items in the receiver’s array of tab view items.
- (NSInteger)numberOfTabViewItems
Because there is one item in the array for each tab in the view, this number is equivalent to the number of tabs in the view.
NSTabView.h
Removes the item specified by tabViewItem from the receiver’s array of tab view items.
- (void)removeTabViewItem:(NSTabViewItem *)tabViewItem
If there is a delegate and the delegate supports it, sends the delegate the tabViewDidChangeNumberOfTabViewItems:
message.
NSTabView.h
Returns the tab view item for the currently selected tab, or nil
if no item is selected.
- (NSTabViewItem *)selectedTabViewItem
NSTabView.h
This action method selects the first tab view item.
- (void)selectFirstTabViewItem:(id)sender
NSTabView.h
This action method selects the last tab view item.
- (void)selectLastTabViewItem:(id)sender
NSTabView.h
This action method selects the next tab view item in the sequence.
- (void)selectNextTabViewItem:(id)sender
If the currently visible item is the last item in the sequence, this method does nothing, and the last page remains displayed.
NSTabView.h
This action method selects the previous tab view item in the sequence.
- (void)selectPreviousTabViewItem:(id)sender
If the currently visible item is the first item in the sequence, this method does nothing, and the first page remains displayed.
NSTabView.h
Selects the tab view item specified by tabViewItem.
- (void)selectTabViewItem:(NSTabViewItem *)tabViewItem
If there is a delegate and the delegate supports it, sends the delegate the tabView:shouldSelectTabViewItem:
message.
NSTabView.h
Selects the tab view item specified by index.
- (void)selectTabViewItemAtIndex:(NSInteger)index
The index parameter is base 0. If there is a delegate and the delegate supports it, sends the delegate the tabView:shouldSelectTabViewItem:
message.
NSTabView.h
Selects the tab view item specified by identifier.
- (void)selectTabViewItemWithIdentifier:(id)identifier
– setIdentifier:
(NSTabViewItem)– identifier
(NSTabViewItem)– selectTabViewItemAtIndex:
– selectedTabViewItem
NSTabView.h
Sets whether the receiver allows truncating for names that don’t fit on a tab to allowTruncatedLabels.
- (void)setAllowsTruncatedLabels:(BOOL)allowTruncatedLabels
NSTabView.h
Sets the size of the receiver to controlSize.
- (void)setControlSize:(NSControlSize)controlSize
Valid values for controlSize are described in “Constants”.
NSTabView.h
Sets the receiver’s control tint to controlTint.
- (void)setControlTint:(NSControlTint)controlTint
Valid values for controlTint are described in “Constants.”
NSTabView.h
Sets the receiver’s delegate to anObject.
- (void)setDelegate:(id)anObject
NSTabView.h
Sets whether a background is drawn when the view type is NSNoTabsNoBorder
to flag.
- (void)setDrawsBackground:(BOOL)flag
If the receiver has a bezeled border or a line border, the appropriate background for that border is used.
NSTabView.h
Sets the font for tab label text to font.
- (void)setFont:(NSFont *)font
Tab height is adjusted automatically to accommodate a new font size. If the view allows truncating, tab labels are truncated as needed.
NSTabView.h
Sets the tab type to tabViewType.
- (void)setTabViewType:(NSTabViewType)tabViewType
The available types are described in “Constants.”
NSTabView.h
Returns the tab view item at index in the tab view’s array of items.
- (NSTabViewItem *)tabViewItemAtIndex:(NSInteger)index
The index parameter is base 0.
NSTabView.h
Returns the tab view item identified by point.
- (NSTabViewItem *)tabViewItemAtPoint:(NSPoint)point
You can use this method to find a tab view item based on a user’s mouse click.
NSTabView.h
Returns the receiver’s array of tab view items.
- (NSArray *)tabViewItems
A tab view keeps an array containing one tab view item for each tab in the view.
NSTabView.h
Returns the tab type for the receiver.
- (NSTabViewType)tabViewType
The available types are described in “Constants.”
NSTabView.h
If sender responds to the indexOfSelectedItem
method, this method invokes that method and selects the tab view item at the specified index. If sender does not respond to indexOfSelectedItem
but is an instance of NSMatrix, this method uses the index of the matrix’s currently selected cell.
- (void)takeSelectedTabViewItemFromSender:(id)sender
The location of the selected cell is a zero-based number, obtained by counting the number of cells up to and including the selected cell. Cells are counted from left to right and from top to bottom. For example in a 5-by-5 matrix, if the selected cell is three rows down in column five (location [2,4] in the matrix), the corresponding index would be 14.
NSTabView.h
Returns the receiver’s window object, or nil
if there is none.
- (NSWindow *)window
If the receiver is not the currently visible tab view this method returns nil
.
Informs the delegate that tabView has selected tabViewItem.
- (void)tabView:(NSTabView *)tabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem
NSTabView.h
Invoked just before tabViewItem in tabView is selected.
- (BOOL)tabView:(NSTabView *)tabView shouldSelectTabViewItem:(NSTabViewItem *)tabViewItem
The delegate can return NO
to prevent selection of specific tabs.
NSTabView.h
Informs the delegate that tabView is about to select tabViewItem.
- (void)tabView:(NSTabView *)tabView willSelectTabViewItem:(NSTabViewItem *)tabViewItem
NSTabView.h
Informs the delegate that the number of tab view items in tabView has changed.
- (void)tabViewDidChangeNumberOfTabViewItems:(NSTabView *)tabView
NSTabView.h
These constants specify the tab view’s type:
typedef enum _NSTabViewType { NSTopTabsBezelBorder = 0, NSLeftTabsBezelBorder = 1, NSBottomTabsBezelBorder = 2, NSRightTabsBezelBorder = 3, NSNoTabsBezelBorder = 4, NSNoTabsLineBorder = 5, NSNoTabsNoBorder = 6 } NSTabViewType;
NSTopTabsBezelBorder
The view includes tabs on the top of the view and has a bezeled border (the default).
Available in Mac OS X v10.0 and later.
Declared in NSTabView.h
.
NSNoTabsBezelBorder
The view does not include tabs and has a bezeled border.
Available in Mac OS X v10.0 and later.
Declared in NSTabView.h
.
NSNoTabsLineBorder
The view does not include tabs and has a lined border.
Available in Mac OS X v10.0 and later.
Declared in NSTabView.h
.
NSNoTabsNoBorder
The view does not include tabs and has no border.
Available in Mac OS X v10.0 and later.
Declared in NSTabView.h
.
NSBottomTabsBezelBorder
Tabs are on the bottom of the view with a bezeled border.
Available in Mac OS X v10.0 and later.
Declared in NSTabView.h
.
NSLeftTabsBezelBorder
Tabs are on the left of the view with a bezeled border.
Available in Mac OS X v10.0 and later.
Declared in NSTabView.h
.
NSRightTabsBezelBorder
Tabs are on the right of the view with a bezeled border.
Available in Mac OS X v10.0 and later.
Declared in NSTabView.h
.
NSTabView.h
© 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-05-23)