]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/list.h
wxCriticalSection implemented using mutexes for !MSW (sample compiles again)
[wxWidgets.git] / include / wx / list.h
index 0274f7fcb335e2f4367dadb1b6950da195b12327..aa901935409924e497561c3c61bd85792bbacf38 100644 (file)
@@ -127,6 +127,8 @@ private:
 // wxNodeBase class is a (base for) node in a double linked list
 // -----------------------------------------------------------------------------
 
+WXDLLEXPORT_DATA(extern wxListKey) wxDefaultListKey;
+
 class WXDLLEXPORT wxNodeBase
 {
 friend class wxListBase;
@@ -136,7 +138,7 @@ public:
                wxNodeBase *previous = (wxNodeBase *)NULL,
                wxNodeBase *next = (wxNodeBase *)NULL,
                void *data = NULL,
-               const wxListKey& key = wxListKey());
+               const wxListKey& key = wxDefaultListKey);
 
     virtual ~wxNodeBase();
 
@@ -195,11 +197,25 @@ public:
     size_t GetCount() const { return m_count; }
 
     // operations
+    
         // delete all nodes
     void Clear();
+    
         // instruct it to destroy user data when deleting nodes
     void DeleteContents(bool destroy) { m_destroy = destroy; }
 
+       // query if to delete
+    bool GetDeleteContents() const
+        { return m_destroy; }
+    
+      // get the keytype
+    wxKeyType GetKeyType() const
+        { return m_keyType; }
+
+      // set the keytype (required by the serial code)
+    void SetKeyType(wxKeyType keyType)
+        { wxASSERT( m_count==0 ); m_keyType = keyType; }
+
 protected:
     // all methods here are "overloaded" in derived classes to provide compile
     // time type checking
@@ -207,7 +223,7 @@ protected:
     // create a node for the list of this type
     virtual wxNodeBase *CreateNode(wxNodeBase *prev, wxNodeBase *next,
                                    void *data,
-                                   const wxListKey& key = wxListKey()) = 0;
+                                   const wxListKey& key = wxDefaultListKey) = 0;
 
     // ctors
         // from an array
@@ -271,11 +287,11 @@ protected:
     void *FirstThat(wxListIterateFunction func);
     void ForEach(wxListIterateFunction func);
     void *LastThat(wxListIterateFunction func);
-
+    
 private:
     // helpers
         // common part of all ctors
-    void Init(wxKeyType keyType);
+    void Init(wxKeyType keyType = wxKEY_NONE);
         // common part of copy ctor and assignment operator
     void DoCopy(const wxListBase& list);
         // common part of all Append()s
@@ -320,7 +336,7 @@ private:
                  nodetype *previous = (nodetype *)NULL,                     \
                  nodetype *next = (nodetype *)NULL,                         \
                  T *data = (T *)NULL,                                       \
-                 const wxListKey& key = wxListKey())                        \
+                 const wxListKey& key = wxDefaultListKey)                        \
             : wxNodeBase(list, previous, next, data, key) { }               \
                                                                             \
         nodetype *GetNext() const                                           \
@@ -339,6 +355,8 @@ private:
     class WXDLLEXPORT name : public wxListBase                                          \
     {                                                                       \
     public:                                                                 \
+        typedef nodetype Node;                                              \
+                                                                            \
         name(wxKeyType keyType = wxKEY_NONE) : wxListBase(keyType)          \
             { }                                                             \
         name(size_t count, T *elements[])                                   \
@@ -392,7 +410,7 @@ private:
     protected:                                                              \
         wxNodeBase *CreateNode(wxNodeBase *prev, wxNodeBase *next,          \
                                void *data,                                  \
-                               const wxListKey& key = wxListKey())          \
+                               const wxListKey& key = wxDefaultListKey)          \
             {                                                               \
                 return new nodetype(this,                                   \
                                     (nodetype *)prev, (nodetype *)next,     \
@@ -461,8 +479,7 @@ public:
     wxNode *Add(const char *s)
         { return (wxNode *)wxStringListBase::Append(copystring(s)); }
 
-    void Delete(const char *s)
-        { wxStringListBase::DeleteObject((char *)s); }
+    bool Delete(const char *s);
 
     char **ListToArray(bool new_copies = FALSE) const;
     bool Member(const char *s) const;