class PStringListBox: public PListBox

A scrollable list box control for selection of a one or more of PString objects

Inheritance:


Public Methods

[more] PCustomListBox ( PInteractor * parent, StringSorting sorted = Sorted, SelectType select = SingleSelect, PDIMENSION columnWidth = 0, BOOL deleteObj = TRUE )
Create a custom list box with the specified options.
[more] PCustomListBox ( PInteractorLayout * parent, PRESOURCE_ID ctlID, const PNotifier & notify, PINDEX * valuePtr )
Create control from interactor layout with the specified control ID.
[more]virtual PINDEX AddEntry ( PObject * obj, BOOL update = TRUE )
Add a new entry to the list box.
[more]void AddEntries ( const PCollection & objects, BOOL update = TRUE )
Add a collection of new entries to the list box.
[more]virtual void InsertEntry ( PObject * obj, PINDEX index, BOOL update = TRUE )
Insert an entry at the specified location.
[more]virtual PINDEX FindEntry ( const PObject & obj, PINDEX startIndex = P_MAX_INDEX ) const
Find the entry in the list box starting at the entry after the specified index.
[more]virtual void SetEntry ( PObject * obj, PINDEX index, BOOL update = TRUE )
Set the entry at the index position.
[more]virtual const PObject* GetEntry ( PINDEX index ) const
Get the entry at the index.
[more]virtual void OnDrawEntry ( PINDEX index, PObject & obj, PCanvas & canvas, const PRect & rect, BOOL hasFocus, BOOL isSelected )
The system calls this whenever an object in the list needs to be redrawn.
[more]virtual PDim OnMeasureEntry ( PINDEX index, PObject & obj, PCanvas & canvas )
The system calls this whenever it needs to get the size of an object in the list.
[more] PStringListBox ( PInteractor * parent, StringSorting sorted = Sorted, SelectType select = SingleSelect, PDIMENSION columnWidth = 0 )
Create a list box with the specified options.
[more] PStringListBox ( PInteractorLayout * parent, PRESOURCE_ID ctlID, const PNotifier & notify, PINDEX * valuePtr )
Create control from interactor layout with the specified control ID.
[more]virtual ~PStringListBox ()
Destroy the list box and all the strings it contains.
[more]virtual PINDEX AddString ( const PString & str, BOOL update = TRUE )
Add a new entry to the list box.
[more]void AddStrings ( const PCollection & objects, BOOL update = TRUE )
Add a collection of new entries to the list box.
[more]virtual void InsertString ( const PString & str, PINDEX index, BOOL update = TRUE )
Insert an entry at the specified location.
[more]virtual void DeleteString ( PINDEX index, BOOL update = TRUE )
Delete the string from the list box.
[more]virtual PINDEX FindString ( const PString & str, PINDEX startIndex = P_MAX_INDEX, BOOL exact = FALSE ) const
Find the string in the list box starting at the string after the specified index.
[more]void SetString ( const PString & str, PINDEX index, BOOL update = TRUE )
Set the string at the index position.
[more]virtual PString GetString ( PINDEX index ) const
Get the string at the index.
[more]PString GetSelectedString () const
Get the selected string in a non-multiselect list box.
[more]void SetTabStops ( PDIMENSION tab )
Set the tab stop positions for strings in each row of the list box.

Public

[more] New functions for class
[more] System callback functions.
[more] New functions for class


Inherited from PListBox:

Public Classes

oenum StringSorting
oenum SelectType

Public Methods

ovirtual void TransferValue( int option )
ovirtual void AllowDeleteObjects( BOOL yes = TRUE )
ovirtual void DisallowDeleteObjects()
ovirtual void DeleteEntry( PINDEX index, BOOL update = TRUE )
ovirtual void DeleteAllEntries( BOOL update = TRUE )
ovirtual PINDEX GetCount() const
ovirtual void SetTopIndex( PINDEX index, BOOL update = TRUE )
ovirtual PINDEX GetTopIndex() const
ovirtual void SetColumnWidth( PDIMENSION newWidth, BOOL update = TRUE )
ovirtual void SetSelection( PINDEX index )
ovirtual PINDEX GetSelection() const
ovirtual void Select( PINDEX index, BOOL update = TRUE, BOOL sel = TRUE )
ovirtual void Deselect( PINDEX index, BOOL update = TRUE )
ovirtual BOOL IsSelected( PINDEX index ) const
ovirtual PINDEX GetSelCount() const
ovirtual PINDEX* GetValuePointer() const
ovirtual void SetValuePointer( PINDEX * ptr )

Public

PNotifier codes

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

Overrides from class PControl

Protected Fields

oBOOL sort
oBOOL multi
oPDIMENSION width
oBOOL deleteObjects


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

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 PString objects
o PCustomListBox( PInteractor * parent, StringSorting sorted = Sorted, SelectType select = SingleSelect, PDIMENSION columnWidth = 0, BOOL deleteObj = TRUE )
Create a custom 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 PCustomListBox( 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.

o New functions for class

ovirtual PINDEX AddEntry( PObject * obj, BOOL update = TRUE )
Add a new entry to the list box. If the sorted option was used this will place the entry in the correct position. Otherwise it adds it to the end of the list.

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 added to the list box in one go. The user would add 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.

Returns:
the index that the entry was placed.
Parameters:
obj - New object to add to list box.
update - Flag to indicate screen should be updated.

ovoid AddEntries( const PCollection & objects, BOOL update = TRUE )
Add a collection of new entries to the list box. Each element of the collection is added in order using the AddEntry() function. Thus, for example, a sorted list string will be added in sorted order.
Parameters:
objects - New objects to add to list box.
update - Flag to indicate screen should be updated.

ovirtual void InsertEntry( PObject * obj, PINDEX index, BOOL update = TRUE )
Insert an entry at the specified location. If the sorted option was used this will place the entry in the correct position, not that specified by the

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 added to the list box in one go. The user would add 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:
obj - New object to add to list box.
index - Index position in list box to insert entry.
update - Flag to indicate screen should be updated.

ovirtual PINDEX FindEntry( const PObject & obj, PINDEX startIndex = P_MAX_INDEX ) const
Find the entry in the list box starting at the entry after the specified index. If the then searches the whole list from the beginning.

This uses the objects PObject::Compare() function to test for equality on the objects in the list.

Parameters:
obj - Object value to search for.
startIndex - Starting index for the search.

ovirtual void SetEntry( PObject * obj, PINDEX index, BOOL update = TRUE )
Set the entry at the index position. If the index is beyond the end of the list then simply adds the entry to the end of the list.

If there was an existing entry at the index position then that entry is removed and if the delet objects option selected it is also deleted using the delete operator.

If the sorted option was used this will place the entry in the correct position, not that specified by the parameter. Note the removal of the previous value still takes place.

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:
obj - New object to add to list box.
index - Index position in list box to set entry.
update - Flag to indicate screen should be updated.

ovirtual const PObject* GetEntry( PINDEX index ) const
Get the entry at the index. If the index is beyond the end of the list then returns NULL.

Returns:
pointer to the object placed in the list box at the index.
Parameters:
index - Index into the list for the entry to retrieve.

o System callback functions.

ovirtual void OnDrawEntry( PINDEX index, PObject & obj, PCanvas & canvas, const PRect & rect, BOOL hasFocus, BOOL isSelected )
The system calls this whenever an object in the list needs to be redrawn.
Parameters:
index - Index of entry to draw in the list box.
obj - Object to draw for this entry in the list box.
canvas - Canvas in which to draw the object entry.
rect - Rectangle of canvas in which the item is drawn.
hasFocus - Flag indicating the item has the focus.
isSelected - Flag indicating the item is selected.

ovirtual PDim OnMeasureEntry( PINDEX index, PObject & obj, PCanvas & canvas )
The system calls this whenever it needs to get the size of an object in the list. The default function returns the full width of the list box and the font size as the height.
Parameters:
index - Index of entry to measure in the list box.
obj - Object to measure for this entry in the list box.
canvas - Canvas in which to measure the object entry.

o PStringListBox( PInteractor * parent, StringSorting sorted = Sorted, SelectType select = SingleSelect, PDIMENSION columnWidth = 0 )
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.

o PStringListBox( 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 ~PStringListBox()
Destroy the list box and all the strings it contains.

o New functions for class

ovirtual PINDEX AddString( const PString & str, BOOL update = TRUE )
Add a new entry to the list box. If the sorted option was used this will place the entry in the correct position. Otherwise it adds it to the end of the list.

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 added to the list box in one go. The user would add 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.

Returns:
the index that the entry was placed.
Parameters:
str - String to add to the list box.
update - Flag to indicate screen should be updated.

ovoid AddStrings( const PCollection & objects, BOOL update = TRUE )
Add a collection of new entries to the list box. Each element of the collection is added in order using the AddEntry() function. Thus, for example, a sorted list string will be added in sorted order.

If the collection is not of string objects then they are translated into a string by the use of the operator<< function.

Parameters:
objects - New objects to add to list box.
update - Flag to indicate screen should be updated.

ovirtual void InsertString( const PString & str, PINDEX index, BOOL update = TRUE )
Insert an entry at the specified location. If the sorted option was used this will place the entry in the correct position, not that specified by the

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 added to the list box in one go. The user would add 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:
str - String to insert into list box.
index - Index position in list box to insert entry.
update - Flag to indicate screen should be updated.

ovirtual void DeleteString( PINDEX index, BOOL update = TRUE )
Delete the string 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 PINDEX FindString( const PString & str, PINDEX startIndex = P_MAX_INDEX, BOOL exact = FALSE ) const
Find the string in the list box starting at the string after the specified index. If the then searches the whole list.

The otherwise a string in the list box that matches up to the length of the argument string will be found.

Parameters:
str - String to search for.
startIndex - Starting index for the search.
exact - Flag for search for exact string or substring.

ovoid SetString( const PString & str, PINDEX index, BOOL update = TRUE )
Set the string at the index position. If the index is beyond the end of the list then simply adds the entry to the end of the list.

If there was an existing entry at the index position then that entry is removed.

If the sorted option was used this will place the entry in the correct position, not that specified by the parameter. Note the removal of the previous value still takes place.

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:
str - New string to set for the entry.
index - Index position in list box to set entry.
update - Flag to indicate screen should be updated.

ovirtual PString GetString( PINDEX index ) const
Get the string at the index. If the index is beyond the end of the list then returns the empty string.

Returns:
string placed in the list box at the index.
Parameters:
index - Index into the list for the string to retrieve.

oPString GetSelectedString() const
Get the selected string in a non-multiselect list box. This is equivalent to going GetString(GetSelection()).

Returns:
string that is selected.

ovoid SetTabStops( PDIMENSION tab )
Set the tab stop positions for strings in each row of the list box.

The first form sets all tab stops to be the same distance. There are an infinite number of tab stops of this size.

The other forms set explicit tab stops for the specified positions. The distance between the last two entries, or between 0 and the first array entry if there is only one entry, is used for all subsequent tab stops.

Parameters:
tab - Repeated tab stop locations


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



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