Up

NSTableColumn

Authors

Nicola Pero (n.pero@mi.flashnet.it)

Copyright: (C) 1999 Free Software Foundation, Inc.


Contents -

  1. Overview of NSTableColumn
  2. The Column Identifier
  3. Information Stored in an NSTableColumn Object
  4. Software documentation for the NSTableColumn class

Overview of NSTableColumn

The Column Identifier

Each NSTableColumn object is identified by an object, called the column identifier. The reason is that, after a column has been added to a table view, the user might move the columns around, so there is a need to identify the columns regardless of their position in the table.

The identifier is typically a string describing the column. This identifier object is never displayed to the user ! It is only used internally by the program to identify the column - so yes, you may use a funny string for it and nobody will know, except people reading the code.

Information Stored in an NSTableColumn Object

An NSTableColumn object mainly keeps information about the width of the column, its minimum and maximum width; whether the column can be edited or resized; and the cells used to draw the column header and the data in the column. You can change all these attributes of the column by calling the appropriate methods. Please note that the table column does not hold nor has access to the data to be displayed in the column; this data is maintained in the table view's data source, as described in the NSTableView documentation. A last hint: to set the title of a table column, ask the table column for its header cell, and set the string value of this header cell to the desired title.

Software documentation for the NSTableColumn class

NSTableColumn : NSObject

Declared in:
AppKit/NSTableColumn.h
Conforms to:
NSCoding
Availability: OpenStep

NSTableColumn objects represent columns in NSTableViews.


Instance Variables

Method summary

dataCell 

- (NSCell*) dataCell;
Availability: OpenStep

Return the cell used to display data in the column. The default data cell is an NSTextFieldCell.

dataCellForRow: 

- (NSCell*) dataCellForRow: (NSInteger)row;
Availability: OpenStep

Description forthcoming.

headerCell 

- (NSCell*) headerCell;
Availability: OpenStep

Return the cell used to display the column title. The default header cell is an NSTableHeaderCell.

headerToolTip 

- (NSString*) headerToolTip;
Availability: MacOS-X 10.5.0

Return the toop tip text displayed when the pointer is in the header area.

identifier 

- (id) identifier;
Availability: OpenStep

Return the column identifier, an object used to identify the column. This object is usually a string, but might be any kind of object.

initWithIdentifier: 

- (id) initWithIdentifier: (id)anObject;
Availability: OpenStep

Initialize the column. anObject is an object used to identify the column; it is usually a string, but might be any kind of object. anObject is retained.

isEditable 

- (BOOL) isEditable;
Availability: OpenStep

Return whether data displayed in the column can be edited by the user by double-cliking on them.

isHidden 

- (BOOL) isHidden;
Availability: MacOS-X 10.5.0

Return whether the column is invisible or not. When the column is hidden, it remains present in the column array returned by -[NSTableView tableColumns].

isResizable 

- (BOOL) isResizable;
Availability: OpenStep

Return whether the column might be resized by the user by dragging the column header border.

maxWidth 

- (CGFloat) maxWidth;
Availability: OpenStep

Return the column's max width. The column can in no way be resized to a width bigger than this max width. The default max width is 100000.

minWidth 

- (CGFloat) minWidth;
Availability: OpenStep

Return the column's min width. The column can in no way be resized to a width smaller than this min width. The default min width is 10.

resizingMask 

- (NSUInteger) resizingMask;
Availability: MacOS-X 10.4.0

Set the resizing mask that describes whether the column is resizable and how it resizes.

setDataCell: 

- (void) setDataCell: (NSCell*)aCell;
Availability: OpenStep

Set the cell used to display data in the column. aCell can't be nil, otherwise a warning will be generated and the method ignored. The old cell is released, the new one is retained. If you want to change the attributes in which a single row in a column is displayed, you should better use a delegate for your NSTableView implementing tableView:willDisplayCell:forTableColumn:row:.

setEditable: 

- (void) setEditable: (BOOL)flag;
Availability: OpenStep

Set whether data in the column might be edited by the user by double-cliking on them.

setHeaderCell: 

- (void) setHeaderCell: (NSCell*)aCell;
Availability: OpenStep

Set the cell used to display the column header. aCell can't be nil, otherwise a warning will be generated and the method call ignored. The old cell is released, the new one is retained.

setHeaderToolTip: 

- (void) setHeaderToolTip: (NSString*)aString;
Availability: MacOS-X 10.5.0

Set the tool tip text displayed when the pointer is in the header area.

setHidden: 

- (void) setHidden: (BOOL)hidden;
Availability: MacOS-X 10.5.0

Set whether the column is invisible or not.

setIdentifier: 

- (void) setIdentifier: (id)anObject;
Availability: OpenStep

Set the identifier used to identify the table. The old identifier is released, and the new one is retained.

setMaxWidth: 

- (void) setMaxWidth: (CGFloat)maxWidth;
Availability: OpenStep

Set the max width of the table column, eventually adjusting the width of the column if it is bigger than the new max width. In no way a table column can be made bigger than its max width.

setMinWidth: 

- (void) setMinWidth: (CGFloat)minWidth;
Availability: OpenStep

Set the min width of the table column, eventually adjusting the width of the column if it is smaller than the new min width. In no way a table column can be made smaller than its min width.

setResizable: 

- (void) setResizable: (BOOL)flag;
Availability: OpenStep

Set whether the user can resize the table column by dragging the border of its header with the mouse. The table column can be resized programmatically regardless of this setting.

setResizingMask: 

- (void) setResizingMask: (NSUInteger)resizingMask;
Availability: MacOS-X 10.4.0

Return the resizing mask that describes whether the column is resizable and how it resizes.

setSortDescriptorPrototype: 

- (void) setSortDescriptorPrototype: (NSSortDescriptor*)aSortDescriptor;
Availability: MacOS-X 10.3.0

Return the sort descriptor bound to the column. This sort descriptor will be added to -[NSTableView sortDescriptors] when you bind a column to another object and NSCreateSortDescriptorBindingOption is set to YES.

setTableView: 

- (void) setTableView: (NSTableView*)aTableView;
Availability: OpenStep

Set the table view corresponding to this table column. This method is invoked internally by the table view, and you should not call it directly; it is exposed because you may want to override it in subclasses. To use the table column in a table view, you should use NSTableView's addTableColumn: instead.

setWidth: 

- (void) setWidth: (CGFloat)newWidth;
Availability: OpenStep

Set the width of the table column. Before being resized, the new width is constrained to the table column minimum and maximum width: if newWidth is smaller than the table column's min width, the table column is simply resized to its min width. If newWidth is bigger than the table column's max width, the table column is simply resized to its max width. Otherwise, it is resized to newWidth. If the width of the table was actually changed, the table view (if any) is redisplayed (by calling tile), and the NSTableViewColumnDidResizeNotification is posted on behalf of the table view.

sizeToFit 

- (void) sizeToFit;
Availability: OpenStep

Change the width of the column to be just enough to display its header; change the minimum width and maximum width to allow the column to have this width (if the minimum width is bigger than the column header width, it is reduced to it; if the maximum width is smaller than the column header width, it is increased to it).

sortDescriptorPrototype 

- (NSSortDescriptor*) sortDescriptorPrototype;
Availability: MacOS-X 10.3.0

Return the sort descriptor bound to the column.

tableView 

- (NSTableView*) tableView;
Availability: OpenStep

Return the table view the column belongs to, or nil if the table column was not added to any table view.

width 

- (CGFloat) width;
Availability: OpenStep

Return the width of the table column. The default width is 100.



Instance Variables for NSTableColumn Class

_dataCell

@protected NSCell* _dataCell;
Availability: OpenStep

Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

_headerCell

@protected NSCell* _headerCell;
Availability: OpenStep

Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

_headerToolTip

@protected NSString* _headerToolTip;
Availability: OpenStep

Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

_identifier

@protected id _identifier;
Availability: OpenStep

Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

_is_editable

@protected BOOL _is_editable;
Availability: OpenStep

Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

_is_hidden

@protected BOOL _is_hidden;
Availability: OpenStep

Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

_is_resizable

@protected BOOL _is_resizable;
Availability: OpenStep

Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

_max_width

@protected float _max_width;
Availability: OpenStep

Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

_min_width

@protected float _min_width;
Availability: OpenStep

Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

_resizing_mask

@protected NSUInteger _resizing_mask;
Availability: OpenStep

Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

_sortDescriptorPrototype

@protected NSSortDescriptor* _sortDescriptorPrototype;
Availability: OpenStep

Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

_tableView

@protected NSTableView* _tableView;
Availability: OpenStep

Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

_width

@protected float _width;
Availability: OpenStep

Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.





Up