class PListBox: public PControl

A scrollable list box control for selection of a one or more of items.

Inheritance:


Public Classes

[more]enum StringSorting
Option used when constructing a list box for whether the list box entries are sorted or unsorted
[more]enum SelectType
Option used when constructing a list box for whether the list box may have single or multiple entries selected

Public Methods

[more] PListBox ( PInteractor * parent, StringSorting sorted = Sorted, SelectType select = SingleSelect, PDIMENSION columnWidth = 0, BOOL deleteObj = TRUE )
Create a list box with the specified options.
[more] PListBox ( PInteractorLayout * parent, PRESOURCE_ID ctlID, const PNotifier & notify, PINDEX * valuePtr )
Create control from interactor layout with the specified control ID.
[more]virtual ~PListBox ()
Destroy the list box and all its contents.
[more]virtual void TransferValue ( int option )
This function transfers the value of the control to or from the variable pointed to by the value pointer member variable.
[more]virtual void AllowDeleteObjects ( BOOL yes = TRUE )
Set flag to delete entry objects using delete operator.
[more]virtual void DisallowDeleteObjects ()
Reset flag to delete entry objects using delete operator.
[more]virtual void DeleteEntry ( PINDEX index, BOOL update = TRUE )
Delete the entry from the list box.
[more]virtual void DeleteAllEntries ( BOOL update = TRUE )
Delete all of the entries in the list box.
[more]virtual PINDEX GetCount () const
Get the count of the number of items in the list of entries in the list box.
[more]virtual void SetTopIndex ( PINDEX index, BOOL update = TRUE )
Set the index of the list box entry that is currently visible at the top of the list.
[more]virtual PINDEX GetTopIndex () const
Get the index of the list box entry that is currently visible at the top of the list.
[more]virtual void SetColumnWidth ( PDIMENSION newWidth, BOOL update = TRUE )
Set the new width of columns in the list box.
[more]virtual void SetSelection ( PINDEX index )
Set the current selection to the entry specified by the index.
[more]virtual PINDEX GetSelection () const
Get the current selection index.
[more]virtual void Select ( PINDEX index, BOOL update = TRUE, BOOL sel = TRUE )
Set the selection state of the list box item.
[more]virtual void Deselect ( PINDEX index, BOOL update = TRUE )
Reset the selection state of the list box item.
[more]virtual BOOL IsSelected ( PINDEX index ) const
Get the selection state of the list box item.
[more]virtual PINDEX GetSelCount () const
Get the number of list box items that are selected.
[more]virtual PINDEX* GetValuePointer () const
Get the current value pointer associated with the control.
[more]virtual void SetValuePointer ( PINDEX * ptr )
Set the current value pointer associated with the control.

Public

[more] PNotifier codes
[more] Notification codes passed to the PNotifier function when the specified notification events occur
[more] Overrides from class PControl
[more] New functions for class

Protected Fields

[more]BOOL sort
Flag indicating list is sorted.
[more]BOOL multi
Flag indicating the list may have multiple selections.
[more]PDIMENSION width
Width of multi-column list box.
[more]BOOL deleteObjects
Flag to indicate objects placed in list should be deleted when removed.


Inherited from PControl:

Public Fields

oPRESOURCE_ID controlID

Public Methods

ovirtual PBalloon* OnBalloonHelp()
ovirtual BOOL IsTabStop() const
oPRESOURCE_ID GetControlID() const
ovoid SetControlID( PRESOURCE_ID theID )
oconst PNotifier& GetNotifier() const
oBOOL WillNotifyOnStateUpdate() const
ovoid SetNotifier( const PNotifier & func, BOOL notifyForStateUpdate = FALSE )
oconst PString& GetBalloonHelp() const
ovoid SetBalloonHelp( const PString & text )
ovirtual void DefaultDimensions()
ovirtual void UpdateMyCommandSources()

Public

o Codes passed to the notification function on changes of state.

Overrides from class PInteractor

Protected Fields

oPNotifier callback
ovoid* valuePointer
oBOOL notifyForStateUpdate
oPString balloonHelpText

Protected

Overrides from class PInteractor

Member variables


Inherited from PInteractor:

Public Classes

oenum PositionOrigin
oenum CoordinateSystem
oenum AutoAdjustType

Public Fields

oPCursor cursor

Public Methods

ovirtual Comparison Compare( const PObject & obj ) const
oPInteractor* GetParent() const
oBOOL IsChild( PInteractor * parent ) const
oPINDEX GetNumChildren()
oPInteractor& operator[]( PINDEX index )
ovirtual void UpdateCommandSources()
ovirtual void SetFont( const PFont & newFont, BOOL toChildren = TRUE )
oconst PRealFont& GetFont()
oPDIMENSION ToPixelsDX( PDIMENSION x ) const
oPDIMENSION ToPixelsDY( PDIMENSION y ) const
oPORDINATE ToPixelsX( PORDINATE x ) const
oPORDINATE ToPixelsY( PORDINATE y ) const
oPDim ToPixels( const PDim & dim ) const
oPPoint ToPixels( const PPoint & pt ) const
oPRect ToPixels( const PRect & r ) const
oPDIMENSION FromPixelsDX( PDIMENSION x ) const
oPDIMENSION FromPixelsDY( PDIMENSION y ) const
oPORDINATE FromPixelsX( PORDINATE x ) const
oPORDINATE FromPixelsY( PORDINATE y ) const
oPDim FromPixels( const PDim & dim ) const
oPPoint FromPixels( const PPoint & pt ) const
oPRect FromPixels( const PRect & r ) const
ovoid SetPosition( PORDINATE x, PORDINATE y, PositionOrigin xOrigin = TopLeftParent, PositionOrigin yOrigin = TopLeftParent )
oPPoint GetPosition( CoordinateSystem coords ) const
oPPoint ToScreen( PORDINATE x, PORDINATE y, CoordinateSystem coords ) const
oPPoint FromScreen( PORDINATE x, PORDINATE y, CoordinateSystem coords ) const
ovoid SetDimensions( PDIMENSION width, PDIMENSION height, CoordinateSystem coords )
oPDim GetDimensions( CoordinateSystem coords ) const
oPRect GetStructureBounds( CoordinateSystem coords ) const
ovirtual PRect GetDrawingBounds( CoordinateSystem coords ) const
ovoid AutoAdjustBounds( PRect & bounds, AutoAdjustType type = AdjustBounds )
oBOOL ContainsPoint( const PPoint & pt, CoordinateSystem coords ) const
oPInteractor* FindInteractor( const PPoint & pt, CoordinateSystem coords ) const
ovirtual void Enable( BOOL enabled = TRUE )
ovoid Disable()
oBOOL IsEnabled() const
ovirtual void ShowAll()
ovirtual void Show( BOOL visible = TRUE )
ovoid Hide()
oBOOL IsVisible() const
ovirtual void BringToTop()
ovirtual BOOL IsOnTop() const
ovoid Invalidate( PORDINATE x, PORDINATE y, PDIMENSION width, PDIMENSION height, CoordinateSystem coords )
ovoid Validate( PORDINATE x, PORDINATE y, PDIMENSION width, PDIMENSION height, CoordinateSystem coords )
ovoid Update()
ovoid GrabMouse()
ovoid ReleaseMouse()
oBOOL HasMouse() const
ovoid GrabFocus()
oBOOL HasFocus() const
ovirtual void SetCursor( const PCursor & newCursor )
oPCursor GetCursor() const
ovoid SetCursorToParent( BOOL useParent = TRUE )
ovoid SetAllCursors( const PCursor & newCursor )
ovoid RestoreAllCursors()
ovoid SetWaitCursor()
ovoid SetCursorPos( PORDINATE x, PORDINATE y, CoordinateSystem coords )
oPPoint GetCursorPos( CoordinateSystem coords ) const
ovirtual void ShowCursor( BOOL show = TRUE )
ovoid HideCursor()
ovoid SetCaret( const PCaret & newCaret )
oPCaret GetCaret() const
ovoid SetCaretPos( PORDINATE x, PORDINATE y, CoordinateSystem coords )
oPPoint GetCaretPos( CoordinateSystem coords ) const
ovirtual void ShowCaret(BOOL show = TRUE)
ovoid HideCaret()
ovirtual void SetForegroundColour( const PColour & newColour )
oconst PColour& GetForegroundColour() const
ovirtual void SetBackgroundColour( const PColour & newColour )
oconst PColour& GetBackgroundColour() const
oPDim GetBorderSize() const
oconst PColour& GetBorderColour() const
oPCanvas* StartMouseTrack( BOOL wantsCanvas = FALSE )
ovirtual void OnMouseMove( PKeyCode button, const PPoint & where )
ovirtual void OnMouseDown( PKeyCode button, const PPoint & where, BOOL doubleClick )
ovirtual void OnMouseUp( PKeyCode button, const PPoint & where )
ovirtual BOOL OnKeyDown( PKeyCode key, unsigned repeat )
ovirtual void OnKeyUp( PKeyCode key )
ovirtual void OnKeyInput( const PString & str )
ovirtual void OnGainFocus()
ovirtual void OnLostFocus()
ovirtual void OnStartInput()
ovirtual BOOL OnEndInput()
ovirtual void OnRedraw( PCanvas & canvas )
ovirtual void OnControlNotify( PControl & control, int option )
ovirtual void OnSelectHelp()
ovirtual void OnMouseTrack( PCanvas * canvas, const PPoint & where, BOOL lastTrack )
ovirtual void _SetPosition( PORDINATE x, PORDINATE y, PositionOrigin xOrigin, PositionOrigin yOrigin )

Public

Overrides from class PObject

System callback functions.

Protected Fields

oPApplication* owner
oPInteractor* parent
oPInteractorList children
oPRealFont font
oPCursor savedCursor
oPCaret caret
oPPoint caretPosition
oint caretVisible
oPColour foregroundColour
oPColour backgroundColour
oPInteractor* mouseTrackInteractor
oPInteractorCanvas* mouseTrackCanvas

Protected Methods

ovirtual void _SetDimensions( PDIMENSION width, PDIMENSION height, CoordinateSystem coords )
ovirtual void _Invalidate( PORDINATE x, PORDINATE y, PDIMENSION width, PDIMENSION height, CoordinateSystem coords )
ovirtual void _Validate( PORDINATE x, PORDINATE y, PDIMENSION width, PDIMENSION height, CoordinateSystem coords )
ovirtual void _SetCursorPos( PORDINATE x, PORDINATE y, CoordinateSystem coords )
ovirtual void _SetCaretPos( PORDINATE x, PORDINATE y, CoordinateSystem coords )
ovirtual void SetFocusInteractor( PInteractor * interactor )
ovirtual PInteractor* GetFocusInteractor() const

Protected

o Flag to indicate that the parent interactor layouts cursor should be used with this interactor.


Documentation

A scrollable list box control for selection of a one or more of items. The application writer should not normally descend from this class directly but descend from either the PStringListBox or PCustomListBox class.
oenum StringSorting
Option used when constructing a list box for whether the list box entries are sorted or unsorted

o NotSorted
Entries are added to list in any order.

o Sorted
Entries are added to list in correct sorted position.

oenum SelectType
Option used when constructing a list box for whether the list box may have single or multiple entries selected

o SingleSelect
Only zero or one entry may be selected at a time.

o MultiSelect
Any number of entries may be selected.

o PListBox( PInteractor * parent, StringSorting sorted = Sorted, SelectType select = SingleSelect, PDIMENSION columnWidth = 0, BOOL deleteObj = TRUE )
Create a list box with the specified options.
Parameters:
parent - Interactor into which the control is placed.
sorted - If set to Sorted then strings will be inserted in sorted order. This requires that the PObject::Compare() function operate correctly for objects placed into the list box.
select - If set to MultiSelect then more than one item may be selected at a time. Otherwise only zero or one item may be selected.
columnWidth - If this parameter is zero then only one column with a vertical scroll bar is displayed. If non-zero, then multiple columns of this width, in font based coordinates, will be used and a horizontal scroll bar displayed.
deleteObj - If this parameter is TRUE then when the list box is destroyed all entries objects are deleted as well using the delete operator. Similarly if DeleteEntry() or DeleteAllEntries() is called the entry or entries are deleted, again using the delete operator).

o PListBox( PInteractorLayout * parent, PRESOURCE_ID ctlID, const PNotifier & notify, PINDEX * valuePtr )
Create control from interactor layout with the specified control ID.
Parameters:
parent - Interactor into which the box is placed.
ctlID - Identifier for the control in the layout.
notify - Function to call when changes state.
valuePtr - Variable to change to the list box state.

ovirtual ~PListBox()
Destroy the list box and all its contents.

o PNotifier codes

o Notification codes passed to the PNotifier function when the specified notification events occur
Notification codes passed to the PNotifier function when the specified notification events occur

o NewSelection
A new entry was selected or deselected.

o DoubleClick
An entry was double clicked.

o Overrides from class PControl

ovirtual void TransferValue( int option )
This function transfers the value of the control to or from the variable pointed to by the value pointer member variable.
Parameters:
option - Transfer value option. When this is -1 when the function transfers the value from the value pointer into the control. This is called in PDialog::OnInit() function. When option is zero then the function transfers the value from the control to the value pointer variable. This is called just before the callback function every time the list box value changes.

o New functions for class

ovirtual void AllowDeleteObjects( BOOL yes = TRUE )
Set flag to delete entry objects using delete operator.
Parameters:
yes - New flag for deleting entries in list box.

ovirtual void DisallowDeleteObjects()
Reset flag to delete entry objects using delete operator. This is equivalent to AllowDeleteObjects(FALSE).

ovirtual void DeleteEntry( PINDEX index, BOOL update = TRUE )
Delete the entry from the list box. If the delete objects option was selected then all the objects added to the list box are deleted as well.

If the update parameter is FALSE then it is the users responsibility to redraw the list box, ie call PInteractor::Invalidate() or PInteractor::Update() some time afterward. This is typically used if a large number of entries are to be deleted to the list box in one go. The user would delete the entries and then call the PInteractor::Invalidate() function on the list box to force a redraw. This is much faster and tidier in appearance.

Parameters:
index - Index position in list box to delete entry.
update - Flag to indicate screen should be updated.

ovirtual void DeleteAllEntries( BOOL update = TRUE )
Delete all of the entries in the list box. If the delete objects option was selected then all the objects added to the list box are deleted as well.

If the update parameter is FALSE then it is the users responsibility to redraw the list box, ie call PInteractor::Invalidate() or PInteractor::Update() some time afterward. This is typically used if entries are to be added to the list box immediately after deleting then. This is much faster and tidier in appearance.

Parameters:
update - Flag to indicate screen should be updated.

ovirtual PINDEX GetCount() const
Get the count of the number of items in the list of entries in the list box.

Returns:
number of entries.

ovirtual void SetTopIndex( PINDEX index, BOOL update = TRUE )
Set the index of the list box entry that is currently visible at the top of the list. The list is scrolled accordingly.

If the update parameter is FALSE then it is the users responsibility to redraw the list box, ie call PInteractor::Invalidate() or PInteractor::Update() some time afterward.

Parameters:
index - Index position in list box to make the top item.
update - Flag to indicate screen should be updated.

ovirtual PINDEX GetTopIndex() const
Get the index of the list box entry that is currently visible at the top of the list.

Returns:
index position of the list boxes top entry.

ovirtual void SetColumnWidth( PDIMENSION newWidth, BOOL update = TRUE )
Set the new width of columns in the list box.

Note that the list box must have been created with a non-zero width in the first place for this to work. It only allows the width to be readjusted.

For the same reason the function will assert if the newWidth parameter is zero.

If the update parameter is FALSE then it is the users responsibility to redraw the list box, ie call PInteractor::Invalidate() or PInteractor::Update() some time afterward.

Parameters:
newWidth - New width for the columns in the list box.
update - Flag to indicate screen should be updated.

ovirtual void SetSelection( PINDEX index )
Set the current selection to the entry specified by the index.

If the multiple selection option is used then this will deselect all other items and only have the specified entry selected.

If the then all entries are deselected.

Parameters:
index - Index of entry to become the single selection.

ovirtual PINDEX GetSelection() const
Get the current selection index. If the list box has the multi-select option this only indicates the item that has the focus.

Returns:
currently selected item or P_MAX_INDEX if nothing selected.

ovirtual void Select( PINDEX index, BOOL update = TRUE, BOOL sel = TRUE )
Set the selection state of the list box item. If the list box is not a multi-select then deselects all others before selecting or deselecting the item specified.

If the update parameter is FALSE then it is the users responsibility to redraw the list box, ie call PInteractor::Invalidate() or PInteractor::Update() some time afterward. This is typically used if a large number of entries are to be changed in the list box in one go. The user would change the entries and then call the PInteractor::Invalidate() function on the list box to force a redraw. This is much faster and tidier in appearance.

Parameters:
index - Index position in list box to select.
update - Flag to indicate screen should be updated.
sel - State in which to set the entries selection.

ovirtual void Deselect( PINDEX index, BOOL update = TRUE )
Reset the selection state of the list box item. This is equivalent to Select(index, FALSE, update).

If the list box was not multi select then all entries a deselected.

Parameters:
index - Index position in list box to select.
update - Flag to indicate screen should be updated.

ovirtual BOOL IsSelected( PINDEX index ) const
Get the selection state of the list box item.
Parameters:
index - Index of entry to check for being selected.

ovirtual PINDEX GetSelCount() const
Get the number of list box items that are selected. This would only be one or zero unless multiple selection option is used.

Returns:
total items selected in list box.

ovirtual PINDEX* GetValuePointer() const
Get the current value pointer associated with the control. The variable pointed to by this is autamatically updated with the current value of the list box.

Returns:
value pointer associated with the control.

ovirtual void SetValuePointer( PINDEX * ptr )
Set the current value pointer associated with the control. The variable pointed to by this is autamatically updated with the current value of the list box.
Parameters:
ptr - New value pointer to associate with the control.

oBOOL sort
Flag indicating list is sorted.

oBOOL multi
Flag indicating the list may have multiple selections.

oPDIMENSION width
Width of multi-column list box.

oBOOL deleteObjects
Flag to indicate objects placed in list should be deleted when removed.


Direct child classes:
PStringListBox

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.