+ @code
+ // this part might be in a header or source (.cpp) file
+ class MyListElement
+ {
+ ... // whatever
+ };
+
+ // this macro declares and partly implements MyList class
+ WX_DECLARE_LIST(MyListElement, MyList);
+
+ ...
+
+ // the only requirement for the rest is to be AFTER the full declaration of
+ // MyListElement (for WX_DECLARE_LIST forward declaration is enough), but
+ // usually it will be found in the source file and not in the header
+
+ #include <wx/listimpl.cpp>
+ WX_DEFINE_LIST(MyList);
+
+
+ MyList list;
+ MyListElement element;
+ list.Append(&element); // ok
+ list.Append(17); // error: incorrect type
+
+ // let's iterate over the list in STL syntax
+ MyList::iterator iter;
+ for (iter = list.begin(); iter != list.end(); ++iter)
+ {
+ MyListElement *current = *iter;
+
+ ...process the current element...
+ }
+
+ // the same with the legacy API from the old wxList class
+ MyList::compatibility_iterator node = list.GetFirst();
+ while (node)
+ {
+ MyListElement *current = node->GetData();
+
+ ...process the current element...
+
+ node = node->GetNext();
+ }
+ @endcode
+
+