KwikPeg Manuals
Home
PegList
Index
Index


Members
Styles
Signals
Overview Derived from class PegWindow

The PegList class is a container class used to create lists of KwikPeg objects stacked vertically or horizontally. This class serves as the base class for the PegVertList, PegHorzList and PegComboBox classes.

It is unlikely that you will ever create an instance of a PegList object. However, several of the member functions will be important if you choose to derive a custom list.

The last child object added to the list will be displayed at the topmost or leftmost position in the list if the Add() function is used to add children. The order of display can be reversed by using the function AddToEnd() to add children to the list.

Child objects are positioned when the list is first displayed. When an object is added to the list, the position information provided with the call to Add() (or AddToEnd()) is ignored. The object will be positioned to fit within the client area of the PegList object to which it is added.

For vertical lists, the width of a child object is forced to match the width of the client area of the PegList object to which it has been added. The child object's height is not modified.

For horizontal lists, the height of a child object is forced to match the height of the client area of the PegList object to which it has been added. The child object's width is not modified.



 See Also

PegVertList

PegHorzList

PegComboBox

PegWindow



 Styles

The PegList class supports the following style flags:

FF_NONE No frame.
FF_THIN Thin frame.
FF_THICK Thick 3D frame.
FF_RAISED Raised 3D frame.
FF_RECESSED Recessed 3D frame.
LS_WRAP_SELECT  Wrap selection of items managed by a PegList object or its derivatives. Selection of the previous item on the list will wrap from the head of the list to the last item on the list. Selection of the next item on the list will wrap from the end of the list to the head of the list.

Note that scrolling of the list of objects within a PegList object is enabled using the SetScrollMode() function, as for all windows derived from the PegWindow class.



 Signals

The PegList class generates the following signals:

PSF_LIST_SELECT Sent by PegList derived objects (including PegHorzList, PegVertList and PegComboBox) when list item is selected.
 
A PSF_LIST_SELECT signal is sent to the parent of a PegList object if, and only if, both the list object AND the child object in the list have a non-zero object ID.
 
The signal message contains the following information:
 
Message.lData  Not used.
Message.iData  Object ID of the selected list item.
Message.pSource  Pointer to the PegList object.
 

Top of page


 Members

Constructors:

PegList(const PegRect &Rect,
  WORD wId = 0,
  WORD wStyle = FF_THIN)

This constructor creates a PegList object at a specific location within a rectangle specified by parameter Rect. Objects added to the list are automatically positioned within this rectangle.

 

Public Functions:

virtual void Add(
  PegThing *What, BOOL bDraw = TRUE)

This function adds the PegThing object referenced by What to the head of the list. If parameter bDraw is TRUE, the list will be redrawn after the object has been added.

virtual void AddtoEnd(
  PegThing *What, BOOL bDraw = TRUE)

This function adds the PegThing object referenced by What to the end of the list. If parameter bDraw is TRUE, the list will be redrawn after the object has been added.

virtual SIGNED Clear(void)

This function removes and destroys all of the child objects in the list. Hence, you must use this function with care. The function returns the number of child objects removed from the list. If scrollbars are present, they are removed but are not included in the returned object count.

virtual SIGNED GetIndex(PegThing *Who)

This function returns the index of the list object referenced by parameter Who. Note that list items are numbered from 0. If the object referenced by Who is not a child of the PegList object, this function returns -1.

SIGNED GetNumItems(void)

This function returns a count of the total number of child objects in the list. The count excludes scrollbars or other non-client objects, if present.

virtual PegThing *GetSelected(void)
  {return mpLastSelected;}

This function returns a pointer to the list's child object that was last selected.

virtual SIGNED GetSelectedIndex(void)

This function returns the list index of the list's child object that was last selected. Note that list items are numbered from 0.

virtual void Insert(
  PegThing *What, SIGNED Where,
  BOOL bSelect = TRUE, BOOL bDraw = TRUE)

This function inserts the PegThing object referenced by What into the list. If Where < 0, the object is added to the head of the list. If Where exceeds the number of items on the list, the object is added to the end of the list. Otherwise, the object is inserted after the item on the list with list index Where. Note that list items are numbered from 0.

If parameter bSelect is TRUE, the inserted object will be selected and scrolled into view. If parameter bDraw is TRUE, the list will be redrawn after the object has been inserted.

virtual SIGNED Message(const PegMessage &Mesg)

The PegList class catches the PM_SHOW message to draw the list.

PegThing *PageDown(void)

This function scrolls the list items down by one full page. The first non-visible item on the list below or to the right of the list client area is scrolled into view and selected. The item thus selected will appear at or toward the top of the list client area.

This function returns a pointer to the newly selected item. If the list cannot be paged down, NULL is returned.

This function is called by the list's Message() function in response to the PK_PGDN key message.

PegThing *PageUp(void)

This function scrolls the list items up by one full page. The first non-visible item on the list above or to the left of the list client area is scrolled into view and selected. The item thus selected will appear at or toward the bottom of the list client area.

This function returns a pointer to the newly selected item. If the list cannot be paged up, NULL is returned.

This function is called by the list's Message() function in response to the PK_PGUP key message.

virtual PegThing *Remove(
  PegThing *What, BOOL bDraw = TRUE)

This function removes the PegThing object referenced by What from the list. The function has no effect if the object is not on the list. If parameter bDraw is TRUE, the list will be redrawn after the object has been removed.

PegThing *SelectNext(void)

This function forces the list to advance its list element selection to the next child object. The list will automatically scroll the newly selected child into view. If the list has its LS_WRAP_SELECT style flag set, the selection will wrap to the list item at the head of the list if, at the time this function is called, the list item at the end of the list was selected.

PegThing *SelectPrevious(void)

This function forces the list to move its list element selection to the previous child object. The list will automatically scroll the newly selected child into view. If the list has its LS_WRAP_SELECT style flag set, the selection will wrap to the list item at the end of the list if, at the time this function is called, the list item at the head of the list was selected.

virtual void SetSelected(PegThing *Who)

This function forces the last selected list object to be the child object referenced by pointer Who. If the object referenced by Who is not a child of the PegList object, the selected child object is not altered.

virtual PegThing *SetSelected(SIGNED iIndex)

This function forces the last selected list object to be the child object with list index iIndex. Note that list items are numbered from 0. A pointer to the newly selected child object is returned to the caller. If no object resides on the list at the specified index, a NULL pointer is returned.

void SetSeparation(SIGNED iVal)

This function sets the padding (in pixels) which will separate child objects. Normally, objects derived from the PegList class position their child objects adjacent to each other with no separation. This function can be called after the list is constructed but before the list is displayed to force the child objects to be separated by the specified number of pixels.




Top of page
KwikPeg Manuals
Home
Index
Index

 
Copyright © 2000-2003