JUCE
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines
Public Member Functions
TableListBox Class Reference

A table of cells, using a TableHeaderComponent as its header. More...

Inherits ListBox, ListBoxModel, and TableHeaderComponent::Listener.

List of all members.

Public Member Functions

 TableListBox (const String &componentName=String::empty, TableListBoxModel *model=0)
 Creates a TableListBox.
 ~TableListBox ()
 Destructor.
void setModel (TableListBoxModel *newModel)
 Changes the TableListBoxModel that is being used for this table.
TableListBoxModelgetModel () const
 Returns the model currently in use.
TableHeaderComponentgetHeader () const
 Returns the header component being used in this table.
void setHeader (TableHeaderComponent *newHeader)
 Sets the header component to use for the table.
void setHeaderHeight (int newHeight)
 Changes the height of the table header component.
int getHeaderHeight () const
 Returns the height of the table header.
void autoSizeColumn (int columnId)
 Resizes a column to fit its contents.
void autoSizeAllColumns ()
 Calls autoSizeColumn() for all columns in the table.
void setAutoSizeMenuOptionShown (bool shouldBeShown)
 Enables or disables the auto size options on the popup menu.
bool isAutoSizeMenuOptionShown () const
 True if the auto-size options should be shown on the menu.
Rectangle< int > getCellPosition (int columnId, int rowNumber, bool relativeToComponentTopLeft) const
 Returns the position of one of the cells in the table.
ComponentgetCellComponent (int columnId, int rowNumber) const
 Returns the component that currently represents a given cell.
void scrollToEnsureColumnIsOnscreen (int columnId)
 Scrolls horizontally if necessary to make sure that a particular column is visible.
int getNumRows ()
void paintListBoxItem (int, Graphics &, int, int, bool)
ComponentrefreshComponentForRow (int rowNumber, bool isRowSelected, Component *existingComponentToUpdate)
void selectedRowsChanged (int lastRowSelected)
void deleteKeyPressed (int currentSelectedRow)
void returnKeyPressed (int currentSelectedRow)
void backgroundClicked ()
void listWasScrolled ()
void tableColumnsChanged (TableHeaderComponent *)
void tableColumnsResized (TableHeaderComponent *)
void tableSortOrderChanged (TableHeaderComponent *)
void tableColumnDraggingChanged (TableHeaderComponent *, int)
void resized ()

Detailed Description

A table of cells, using a TableHeaderComponent as its header.

This component makes it easy to create a table by providing a TableListBoxModel as the data source.

See also:
TableListBoxModel, TableHeaderComponent

Constructor & Destructor Documentation

TableListBox::TableListBox ( const String componentName = String::empty,
TableListBoxModel model = 0 
)

Creates a TableListBox.

The model pointer passed-in can be null, in which case you can set it later with setModel().

Destructor.


Member Function Documentation

Changes the TableListBoxModel that is being used for this table.

Returns the model currently in use.

Reimplemented from ListBox.

Returns the header component being used in this table.

Sets the header component to use for the table.

The table will take ownership of the component that you pass in, and will delete it when it's no longer needed.

void TableListBox::setHeaderHeight ( int  newHeight)

Changes the height of the table header component.

See also:
getHeaderHeight

Returns the height of the table header.

See also:
setHeaderHeight
void TableListBox::autoSizeColumn ( int  columnId)

Resizes a column to fit its contents.

This uses TableListBoxModel::getColumnAutoSizeWidth() to find the best width, and applies that to the column.

See also:
autoSizeAllColumns, TableHeaderComponent::setColumnWidth

Calls autoSizeColumn() for all columns in the table.

void TableListBox::setAutoSizeMenuOptionShown ( bool  shouldBeShown)

Enables or disables the auto size options on the popup menu.

By default, these are enabled.

True if the auto-size options should be shown on the menu.

See also:
setAutoSizeMenuOptionsShown
Rectangle<int> TableListBox::getCellPosition ( int  columnId,
int  rowNumber,
bool  relativeToComponentTopLeft 
) const

Returns the position of one of the cells in the table.

If relativeToComponentTopLeft is true, the co-ordinates are relative to the table component's top-left. The row number isn't checked to see if it's in-range, but the column ID must exist or this will return an empty rectangle.

If relativeToComponentTopLeft is false, the co-ords are relative to the top-left of the table's top-left cell.

Component* TableListBox::getCellComponent ( int  columnId,
int  rowNumber 
) const

Returns the component that currently represents a given cell.

If the component for this cell is off-screen or if the position is out-of-range, this may return 0.

See also:
getCellPosition

Scrolls horizontally if necessary to make sure that a particular column is visible.

See also:
ListBox::scrollToEnsureRowIsOnscreen
int TableListBox::getNumRows ( ) [virtual]

Implements ListBoxModel.

void TableListBox::paintListBoxItem ( int  ,
Graphics ,
int  ,
int  ,
bool   
) [virtual]

Implements ListBoxModel.

Component* TableListBox::refreshComponentForRow ( int  rowNumber,
bool  isRowSelected,
Component existingComponentToUpdate 
) [virtual]

Reimplemented from ListBoxModel.

void TableListBox::selectedRowsChanged ( int  lastRowSelected) [virtual]

Reimplemented from ListBoxModel.

void TableListBox::deleteKeyPressed ( int  currentSelectedRow) [virtual]

Reimplemented from ListBoxModel.

void TableListBox::returnKeyPressed ( int  currentSelectedRow) [virtual]

Reimplemented from ListBoxModel.

void TableListBox::backgroundClicked ( ) [virtual]

Reimplemented from ListBoxModel.

void TableListBox::listWasScrolled ( ) [virtual]

Reimplemented from ListBoxModel.

Reimplemented from TableHeaderComponent::Listener.

void TableListBox::resized ( ) [virtual]

Reimplemented from ListBox.


The documentation for this class was generated from the following file: