Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

ListBox Class Reference

Inherits Canvas.

Inherited by TreeBox.

List of all members.


Detailed Description

A list of items that can be selected from, with a set of columns.


Public Member Functions

 this (Control parent)
 Register itself in the parent and then create a window.

bit noSelection ()
 Return whether this doesn't allow selection changes.

void noSelection (bit value)
 Assign whether this doesn't allow selection changes.

bit multipleSelection ()
 Return whether this allows multiple selections.

void multipleSelection (bit value)
 Assign whether this allows multiple selections.

bit stickySelection ()
 Return whether to use sticky selection.

void stickySelection (bit value)
 Assign whether to use sticky selection.

bit columnHeaderShown ()
 Return whether the column header should be displayed.

void columnHeaderShown (bit value)
 Assign whether the column header should be displayed.

void setFocus (Row row)
 Set the keyboard focus, scroll to show it, and paint as needed.

void setFocusWithoutChangingReference (Row row)
 Set the keyboard focus without affecting the reference, which is used for shift-click.

Bindable Functions
These methods are intended to be used for binding or for use in binding.

void funcFocusDelta (int delta)
 Change the focus by a number of cells.

void funcFocusExtendDelta (int delta)
 Change the focus by a number of cells, extending the selection.

void funcFocusUp ()
 Move the focus up a line or to the end if there is no focus.

void funcFocusExtendUp ()
 Extend the focus up a line.

void funcFocusDown ()
 Move the focus down a line or to the beginning if there is no focus.

void funcFocusExtendDown ()
 Extend the focus down a line.

void funcFocusFirst ()
 Move the focus to the beginning of the list.

void funcFocusExtendFirst ()
 Extend the selection to the beginning of the list.

void funcFocusLast ()
 Move the focus to the end of the list.

void funcFocusExtendLast ()
 Extend the selection to the end of the list.

void funcFocusSelect ()
 Select the row under the keyboard focus.

void funcFocusSelectExact ()
 funcFocusSelect can be called under several circumstances.

Row Management
These methods control rows.

bit vscrollToShowRow (Row row)
 Vertical scroll if needed to show this row, and return whether it did need to scroll.

void sort ()
 Sort the list and repaint the control.

void add (Row row)
 Add a row, does not paint.

void addText (char[] a)
 Add a text row with a single column, does not paint.

void addText (char[] a, char[] b)
 Add a text row with two columns, does not paint.

void insertAfter (Row row, int index)
 Insert the row after the indexed row, and repaint the control.

void insertBefore (Row row, int index)
 Insert the row before the indexed row, and repaint the control.

Row row (int index)
 Index the array of rows.

int rowCount ()
 Return the number of rows in the list.

Row rowFocus ()
 Return the current row with keyboard focus or null if there is none.

void paintRow (Row row)
 Paint a single row.

void paintFromRow (Row row)
 Paint from the row to the end of the control.

void paintFromRow (int index)
 Paint from the indexed row to the end of the control.

Row findRow (int y)
 Determine the row this Y coordinate is over or return null if it is out-of-range.

void empty ()
 Delete all the rows in the list, then paint the control.

void remove (Row row)
 Remove a single row from the list, then paint the control.

void removeFilter (bit(*func)(Row row))
 Remove a number of rows from the list by iterating over the rows and calling func on each of them.

Column Management
These methods create, access, and delete columns.

Column addColumn (char[] name, int width)
 Append a column to the list of columns.

Column findColumn (int x)
 Return the column this index is over.

Column orderedColumn (int index)
 Index the columns array.

int orderedColumnCount ()
 Return the number of visible ordered columns.

int columnHeaderHeight ()
 Return the visible height of the column header in pixels.

void paintColumnHeader (Column column)
 Paint a single column's header.

Selection Management
These methods manage the current selection.

void selectAction (Row row)
 Change the current selection.

void selectAdd (Row row)
 Add to the selection.

void selectNone ()
 Clear the selection.

void selectBatch ()
 Start batching a selection change to minimise the number of items actually notified or repainted.

void selectBatchFlush ()
 Flush all batched changes to the selection and stop batching.


Public Attributes

void ListBox onSelectionAdd
 The methods in this list are notified when an item has been added to the selection.

void ListBox onSelectionRemove
 The methods in this list are notified when an item has been removed from the selection.


Member Function Documentation

void ListBox.columnHeaderShown bit  value  ) 
 

Assign whether the column header should be displayed.

If this value is different from its previous setting, the control is painted.

bit ListBox.columnHeaderShown  ) 
 

Return whether the column header should be displayed.

By default this is true. Showing the column header allows changing column sizes, ordering, and every other user interface operation for list boxes, so hiding the header is usually only advisable if there's only one column.

void ListBox.funcFocusDelta int  delta  ) 
 

Change the focus by a number of cells.

If there is no focus currently, it sets the focus to the first or the last depending upon whether the delta's negative or positive, respectively. Out-of-range values are saturated. Scrolls to continue to show the focus.

void ListBox.funcFocusDown  ) 
 

Move the focus down a line or to the beginning if there is no focus.

Scroll to continue to show the focus.

void ListBox.funcFocusExtendDelta int  delta  ) 
 

Change the focus by a number of cells, extending the selection.

If there is no focus currently, it sets the focus to the first or last row depending upon whether the delta's negative or not. Out- of-range values are saturated. Then it selects all the rows between the current and the last position. Scrolls to continue to show the focus.

void ListBox.funcFocusSelect  ) 
 

Select the row under the keyboard focus.

If there is no focus or if no selections are allowed, this is ignored. If this is a single selection list box, the focus is changed. If this is a multiple selection list box, this selection value is toggled.

void ListBox.funcFocusSelectExact  ) 
 

funcFocusSelect can be called under several circumstances.

funcFocusSelectExact is only called under direct user control.

Reimplemented in TreeBox.

void ListBox.funcFocusUp  ) 
 

Move the focus up a line or to the end if there is no focus.

Scroll to continue to show the focus.

void ListBox.multipleSelection bit  value  ) 
 

Assign whether this allows multiple selections.

This doesn't affect the selection, so turning it off with multiple rows currently selected has no effect.

void ListBox.removeFilter bit(*  func)(Row row)  ) 
 

Remove a number of rows from the list by iterating over the rows and calling func on each of them.

If it returns true, the row remains in the list, but if it returns false, the row is removed. This paints the control if any rows were removed.

Parameters:
func The function to call on each row. This will be called with a row from the list and should return true to keep the row in the list or false to remove it.

Row ListBox.row int  index  ) 
 

Index the array of rows.

Out-of-range values will be bounds checked.

void ListBox.selectAction Row  row  ) 
 

Change the current selection.

If no selection is allowed, this is ignored. If this is a single-selection list box, it assigns the selection. If this is a multiple-selection list box, it toggles whether this item is selected. This notifies onSelectionAdd and onSelectionRemove of the change.

void ListBox.selectAdd Row  row  ) 
 

Add to the selection.

If no selection is allowed, this is ignored. If this is a single-selection list box, it assigns the selection. If this is a multiple- selection list box, this item is selected. This notifies onSelectionAdd of any change.

void ListBox.selectBatch  ) 
 

Start batching a selection change to minimise the number of items actually notified or repainted.

Usage is like this:

 control.selectBatch (); // Start batching.
 control.selectAdd (item1); // Notifications and repainting will be avoided.
 control.selectBatchFlush (); // Notify of changes and repaint as needed.

void ListBox.selectNone  ) 
 

Clear the selection.

This notifies onSelectionRemove of the changes.

bit ListBox.stickySelection  ) 
 

Return whether to use sticky selection.

When set with a multiple selection list box, clicking on a row with the mouse will toggle whether this item is selected. When reset, clicking on a row will clear the selection to only be that row. For single selection list boxes or disabled list boxes, this setting is not relevant.


Member Data Documentation

void ListBox ListBox.onSelectionAdd
 

The methods in this list are notified when an item has been added to the selection.

The listbox is a pointer back to the list box, while row is the row added. These methods are called in index order.

void ListBox ListBox.onSelectionRemove
 

The methods in this list are notified when an item has been removed from the selection.

The listbox is a pointer back to the list box, while row is the row added. These methods are called in index order.


The documentation for this class was generated from the following file:
Generated on Thu Sep 4 13:12:52 2003 for dig by doxygen 1.3.2