LTableView is a PowerPlant class that forms the basis for the rest of the table classes. The class data members store the data you need to create and manage a table. The class member functions implement standard table-related bahavior.
Methods :
The methods in this class are:
Data Members:
The data members in this class are:
Operation:
LTableView inherits from LPane and LView. It is thus closely related to the operations of LView. An undertanding of how LPane and LView work is essential to getting the most from this class.
Source files:
See also:
Purpose:
The constructor creates an object.
Access :
Prototype:
LTableView();
LTableView( const SPaneInfo &inPaneInfo,
const SViewInfo &inViewInfo );
LTableView( LStream *inStream );Parameters:
This method has the following parameters:
Purpose:
The destructor destroys the object.
Access :
Prototype:
virtual ~LTableView();
Purpose:
Access :
Prototype:
virtual void ActivateSelf();Parameters:
Return:
Purpose:
Adjust the Image size of the Table to reflect the number and size of the rows and columns.
Access :
Prototype:
virtual void AdjustImageSize( Boolean inRefresh );Parameters:
This method has the following parameters:
Return:
Purpose:
Return whether the specified cell is part of the current selection
Access :
Prototype:
virtual Boolean CellIsSelected(
const STableCell &inCell ) const;Parameters:
This method has the following parameters:
Return:
Boolean indicating true if the cell is part of the current selection
Purpose:
Pass back the index number for a specified cell
The cell does not have to be in the Table, but the index is zero if the table has no columns or inCell.row is zero.
Cells are ordered by column (across), and then by row (down)
Access :
Prototype:
virtual void CellToIndex( const STableCell &inCell,
TableIndexT &outIndex ) const;Parameters:
This method has the following parameters:
Purpose:
Handle a mouse click within the specified cell.
Access :
Prototype:
virtual void ClickCell(
const STableCell& inCell,
const SMouseDownEvent& inMouseDown );Parameters:
This method has the following parameters:
Purpose:
Adjust selection in response to a click in the specified cell, and return whether or not to process the click as a normal click.
Access :
Prototype:
virtual Boolean ClickSelect(
const STableCell &inCell,
const SMouseDownEvent &inMouseDown );Parameters:
This method has the following parameters:
Return:
Return true if a normal click, false otherwise.
Purpose:
Handle a mouse click within a TableView. This method is an override of ClickSelf().
Purpose:
Deactivate a Table. This method is an override of DeactivateSelf().
Purpose:
Draw the contents of the specified Cell.
Access :
Prototype:
virtual void DrawCell( const STableCell& inCell,
const Rect& inLocalRect );Parameters:
This method has the following parameters:
Return:
Purpose:
Draw a TableView. This is an override of DrawSelf() in LPane().
Purpose:
Pass back the rectangular range of cells, specified by the top left and bottom right cells, that intersects a given rectangle.
Access :
Prototype:
virtual void FetchIntersectingCells(
const Rect &inLocalRect,
STableCell &outTopLeft,
STableCell &outBotRight) const;Parameters:
This method has the following parameters:
Return:
Purpose:
Pass back the cell that contains the specified data.
Access :
Prototype:
virtual Boolean FindCellData(
STableCell &outCell,
const void *inDataPtr,
UInt32 inDataSize) const;Parameters:
This method has the following parameters:
Return:
Return false if no match is found.
Purpose:
Pass back the data for a particular Cell.
Access :
Prototype:
virtual void GetCellData(
const STableCell &inCell,
void *outDataPtr,
UInt32 &ioDataSize) const;Parameters:
This method has the following parameters:
| The size of the data buffer (
input: maximum bytes of data to retrieve output: actual bytes of data passed back |
Return:
Purpose:
Pass back the cell which contains the specified point.
If no cell contains the point, return false and
outCell.row = 0 if point is above the Table
outCell.row = mRows + 1 if point is below the Table
outCell.col = 0 if point is to the left of the Table
outCell.col = mCols + 1 if point is to the right of the Table
For example, if the horizontal coordinate is within Column 2, but the vertical coordinate is above the Table, then,
Access :
Prototype:
virtual Boolean GetCellHitBy(
const SPoint32 &inImagePt,
STableCell &outCell ) const;Parameters:
This method has the following parameters:
Return:
Return false if no cell contains the point.
Purpose:
Return the width of the specified column.
Access :
Prototype:
virtual UInt16 GetColWidth(
TableIndexT inCol ) const;Parameters:
This method has the following parameters:
Return:
Purpose:
Returns the value of the mCustomHilite member.
Access :
Prototype:
Boolean GetCustomHilite();Parameters:
Purpose:
Return the first selected cell, using the LTableSelector helper object.
Access :
Prototype:
virtual STableCell GetFirstSelectedCell() const;Parameters:
Return:
Purpose:
Pass back a Region containing the frames of all selected cells which are within the visible rectangle of the Table.
Caller must allocate space for the region.
Access :
Prototype:
virtual void GetHiliteRgn(
RgnHandle ioHiliteRgn);Parameters:
This method has the following parameters:
Return:
Purpose:
Pass back the location in Image coords of the specified Cell.
Access :
Prototype:
virtual void GetImageCellBounds(
const STableCell &inCell,
SInt32 &outLeft,
SInt32 &outTop,
SInt32 &outRight,
SInt32 &outBottom) const;Parameters:
This method has the following parameters:
Return:
Purpose:
Pass back the bounding rectangle of the specified Cell and return whether it intersects the Frame of the TableView.
The bounding rectangle is in Local coordinates so it will always be within QuickDraw space when its within the Frame.
Access :
Prototype:
virtual Boolean GetLocalCellRect(
const STableCell &inCell,
Rect &outCellRect) const;Parameters:
This method has the following parameters:
Return:
If the bounding rectangle is outside the Frame, return false and set the rectangle to (0,0,0,0).
Purpose:
Pass back the Cell after the specified Cell.
Cells are ordered by column (across), and then by row (down).
Row zero is before the first row. The next cell after row zero and any column is Cell (1,1).
Column zero is before column one. The next cell after row "r" and column zero is Cell (r,1).
Access :
Prototype:
virtual Boolean GetNextCell(
STableCell &ioCell) const;Parameters:
This method has the following parameters:
Return:
Return false if there is no cell after the specified one, andpass back Cell (0,0). Otherwise, return true and pass back the next Cell's indexes.
Purpose:
Pass back the selected Cell after the specified Cell.
This function uses the same ordering rules as GetNextCell(). Pass in Cell (0,0) to find the first selected Cell.
Access :
Prototype:
virtual Boolean GetNextSelectedCell(
STableCell &ioCell ) const;Parameters:
This method has the following parameters:
Return:
Return false if there is no selected Cell after the specified one.
Purpose:
Pass back the Cell before the specified Cell.
Cells are ordered by column (across), and then by row (down).
Cell (mRows,mCols) is the one before Cell (0,c), where c is any column. Thus, you can pass in Cell (0,0) to get the last cell.
Cell (mRows,mCols) is also the cell before any Cell that is beyond the limits of the table.
Column zero is before column one. The cell before row "r" and column zero is Cell (r-1,mCols).
Access :
Prototype:
virtual Boolean GetPreviousCell(
STableCell &ioCell ) const;Parameters:
This method has the following parameters:
Return:
Return false if there is no cell before the specified one, and pass back Cell (0,0). Otherwise, return true and pass back the previous Cell's indexes.
Purpose:
Pass back the selected Cell before the specified Cell.
This function uses the same ordering rules as GetPreviousCell(). Pass in Cell (0,0) to find the last selected Cell.
Access :
Prototype:
virtual Boolean GetPreviousSelectedCell(
STableCell &ioCell ) const;Parameters:
This method has the following parameters:
Return:
Return false if there is no selected cell before the cell indicated, and pass back Cell (0,0). Otherwise, return true and pass back the previous Cell's indexes.
Purpose:
Return the height of the specified row.
Access :
Prototype:
virtual UInt16 GetRowHeight(
TableIndexT inRow ) const;Parameters:
This method has the following parameters:
Return:
A UInt16 indicating the height of the row i display coordinates.
Purpose:
Return the value of the mTableGeometry data member.
Access :
Prototype:
LTableGeometry* GetTableGeometry();Parameters:
Return:
A pointer to an LTableGeometry object.
Purpose:
Return the value of the mTableSelector data member.
Access :
Prototype:
LTableSelector* GetTableSelector();Parameters:
Return:
A pointer to an LTableSelector object.
Purpose:
Pass back the number of rows and columns in a TableView.
Access :
Prototype:
void GetTableSize(
TableIndexT &outRows,
TableIndexT &outCols ) const;Parameters:
This method has the following parameters:
Return:
Purpose:
Returns the value of the mTableStorage data member.
Access :
Prototype:
LTableStorage* GetTableStorage() ;Parameters:
Return:
A pointer to an LTableStorage object.
Purpose:
Draw or undraw hiliting for the specified Cell
Access :
Prototype:
virtual void HiliteCell(
const STableCell &inCell,
Boolean inHilite );Parameters:
This method has the following parameters:
Return:
Purpose:
Draw or undraw active hiliting for a Cell.
Access :
Prototype:
virtual void HiliteCellActively(
const STableCell &inCell,
Boolean inHilite );Parameters:
This method has the following parameters:
Return:
Purpose:
Draw or undraw inactive hiliting for a Cell
Access :
Prototype:
virtual void HiliteCellInactively(
const STableCell &inCell,
Boolean inHilite);Parameters:
This method has the following parameters:
Return:
Purpose:
Draw or undraw hiliting for the current selection in either the active or inactive state
Access :
Prototype:
virtual void HiliteSelection(
Boolean inActively,
Boolean inHilite );Parameters:
This method has the following parameters:
Return:
Purpose:
Pass back the cell for a specified index number.
Index number does not have to refer to an actual Cell, but Cell is (0,0) if Table has no columns or inIndex is zero.
Access :
Prototype:
virtual void IndexToCell(
TableIndexT inIndex,
STableCell &outCell ) const;Parameters:
This method has the following parameters:
Return:
Purpose:
Access :
Prototype:
void InitTable();Parameters:
Return:
Purpose:
Use inAfterCol of 0 to insert columns at the beginning All cells in the newly inserted rows have the same data.
Access :
Prototype:
virtual void InsertCols(
UInt32inHowMany, TableIndexT inAfterCol, const void* inDataPtr, UInt32 inDataSize, Boolean inRefresh); This method has the following parameters:
Return:
Purpose:
Use inAfterRow of 0 to insert rows at the beginning All cells in the newly inserted rows have the same data.
Access :
Prototype:
virtual void InsertRows(
UInt32 inHowMany, TableIndexT inAfterRow, const void* inDataPtr, UInt32 inDataSize, Boolean inRefresh); This method has the following parameters:
Return:
Purpose:
Return whether a TableView includes a specified Cell.
Access :
Prototype:
Boolean IsValidCell(
const STableCell &inCell ) const;Parameters:
This method has the following parameters:
Return:
Boolean indicating whether the cell is valid or not.
Purpose:
Return whether a TableView includes a specified column.
Access :
Prototype:
Boolean IsValidCol(
TableIndexT inCol ) const;Parameters:
This method has the following parameters:
Return:
Boolean indicating whether the cell includes the column or not.
Purpose:
Return whether a TableView includes a specified row
Access :
Prototype:
Boolean IsValidRow(
TableIndexT inRow ) const;Parameters:
This method has the following parameters:
Return:
Boolean indicating whether the cell includes the row or not.
Purpose:
Indicate whether the two points are close enough to be part of a multi-click. Points are in Local coordinates.
Points must meet the standard test (inherited function) as well as be inside the same cell.
Access :
Prototype:
virtual Boolean PointsAreClose(
Point inFirstPt,
Point inSecondPt ) const;Parameters:
This method has the following parameters:
Return:
Return true if the two points are close enough, else return false.
Purpose:
Invalidate the area occupied by the specified cell so that its contents will be redrawn during the next update event
Access :
Prototype:
virtual void RefreshCell(
const STableCell &inCell );Parameters:
This method has the following parameters:
Return:
Purpose:
Invalidate a rectangular block of cells so that their contents will be redrawn during the next update event.
Access :
Prototype:
virtual void RefreshCellRange(
const STableCell &inTopLeft,
const STableCell &inBotRight );Parameters:
This method has the following parameters:
Return:
Purpose:
Remove all columns in a table.
Access :
Prototype:
virtual void RemoveAllCols(
Boolean inRefresh );Parameters:
This method has the following parameters:
Return:
Purpose:
Access :
Prototype:
virtual void RemoveAllRows(
Boolean inRefresh );Parameters:
This method has the following parameters:
Return:
Purpose:
Delete columns from a TableView
Access :
Prototype:
virtual void RemoveCols(
UInt32 inHowMany,
TableIndexT inFromCol,
Boolean inRefresh );Parameters:
This method has the following parameters:
Return:
Purpose:
Access :
Prototype:
virtual void RemoveRows(
UInt32 inHowMany,
TableIndexT inFromRow,
Boolean inRefresh );Parameters:
This method has the following parameters:
Return:
Purpose:
Scroll the TableView as little as possible to move the specified Cell so that it's entirely within the Frame of the TableView.
If Cell is wider and/or taller than Frame, align Cell to left/top of Frame.
Access :
Prototype:
virtual void ScrollCellIntoFrame(
const STableCell &inCell );Parameters:
This method has the following parameters:
Return:
Purpose:
Access :
Prototype:
virtual void SelectAllCells();Parameters:
Return:
Purpose:
Add the specified cell to the current selection.
Access :
Prototype:
virtual void SelectCell(
const STableCell &inCell );Parameters:
This method has the following parameters:
Return:
Purpose:
Notification that the cells which are selected has changed
Access :
Prototype:
virtual void SelectionChanged();Parameters:
Return:
Purpose:
Specify the data associated with a particular Cell
Access :
Prototype:
virtual void SetCellData(
const STableCell &inCell,
const void *inDataPtr,
UInt32 inDataSize );Parameters:
This method has the following parameters:
Return:
Purpose:
Set the width of the specified columns.
Access :
Prototype:
virtual void SetColWidth(
UInt16 inWidth,
TableIndexT inFromCol,
TableIndexT inToCol);Parameters:
This method has the following parameters:
Return:
Purpose:
Set tha value of the mCustomHilite data member.
Access :
Prototype:
void SetCustomHilite( Boolean inCustom );Parameters:
This method has the following parameters:
Return:
Purpose:
Specify whether to defer adjustment of Table to account for a change in the size of the Table (number or size of rows or columns).
Calling AdjustImageSize() can take a lot of time, especially for large Tables and those with variable row or column sizes. If you are going to make a series of changes to a Table, there's no need to adjust the Image size until after all those changes are made.
Therefore, call SetDeferAdjustment(true) before making your changes, then call SetDeferAdjustment(false) afterwards. Or use the StDeferTableAdjustment stack-based class.
Access :
Prototype:
void SetDeferAdjustment( Boolean inDefer );Parameters:
This method has the following parameters:
Return:
Purpose:
Set the height of the specified rows.
Access :
Prototype:
virtual void SetRowHeight( UInt16 inHeight,
TableIndexT inFromRow,
TableIndexT inToRow );Parameters:
This method has the following parameters:
Return:
Purpose:
Specify the Geometry for a TableView.
The Geometry determines the dimensions of the Cells in the Table
Access :
Prototype:
virtual void SetTableGeometry(
LTableGeometry *inTableGeometry );Parameters:
This method has the following parameters:
Return:
Purpose:
Specify the Selector for a TableView. The Selector stores and controls which Cells in a Table are selected. This sets the value of mTableSelector.
Access :
Prototype:
virtual void SetTableSelector(
LTableSelector *inTableSelector );Parameters:
This method has the following parameters:
Return:
Purpose:
Specify the Storage for a TableView. The Storage holds the data for each Cell in a Table. This sets the value of mTableStorage.
Access :
Prototype:
virtual void SetTableStorage(
LTableStorage *inTableStorage );Parameters:
This method has the following parameters:
Return:
Purpose:
Indicate whether to use drag select or not. This sets the value of the mUseDragSelect data member.
Access :
Prototype:
void SetUseDragSelect( Boolean inUseIt);Parameters:
This method has the following parameters:
Return:
Purpose:
Unselect all currently selected cells so there is no selection
Access :
Prototype:
virtual void UnselectAllCells();Parameters:
Return:
Purpose:
Remove the specified cell from the current selection
Access :
Prototype:
virtual void UnselectCell(const STableCell &inCell);Parameters:
This method has the following parameters:
Return:
Purpose:
Data member that contains number of rows.
Access :
Prototype:
Purpose:
Data member that contains number of columns.
Access :
Prototype:
Purpose:
Storage for the table geometry.
Access :
Prototype:
LTableGeometry *mTableGeometry;
Purpose:
Storage for the table selector
Access :
Prototype:
LTableSelector *mTableSelector;
Purpose:
Access :
Prototype:
Purpose:
Storage for whether or not to use drag select.
Access :
Prototype:
Purpose:
Whether to use custom hilite or not.
Access :
Prototype:
Purpose:
Whether to defer adjustments to the table or not.
Access :
Prototype: