wxList: wxObject

This class provides linked list functionality for wxWindows, and for an application if it wishes. Depending on the form of constructor used, a list can be keyed on integer or string keys to provide a primitive look-up ability. See wxHashTable for a faster method of storage when random access is required.

It is very common to iterate on a list as follows:

  ...
  wxPoint *point1 = new wxPoint(100, 100);
  wxPoint *point2 = new wxPoint(200, 200);

  wxList SomeList;
  SomeList.Append(point1);
  SomeList.Append(point2);

  ...

  wxNode *node = SomeList.First();
  while (node)
  {
    wxPoint *point = (wxPoint *)node->Data();
    ...
    node = node->Next();
  }
To delete nodes in a list as the list is being traversed, replace

    ...
    node = node->Next();
    ...
with

    ...
    delete point;
    delete node;
    node = SomeList.First();
    ...
See wxNode for members that retrieve the data associated with a node, and members for getting to the next or previous node.

Note that a cast is required when retrieving the data from a node. Although a node is defined to store objects of type wxObject and derived types, other types (such as char *) may be used with appropriate casting.

wxList::wxList

wxList::~wxList

wxList::Append

wxList::Clear

wxList::DeleteContents

wxList::DeleteNode

wxList::DeleteObject

wxList::Find

wxList::First

wxList::Insert

wxList::Last

wxList::Member

wxList::Nth

wxList::Number