X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f98bd52a3e896ffa49cf672ec1864f5b2906a0a9..10769d8c47c21fe0ec5034726791a5ad4cf19475:/include/wx/list.h diff --git a/include/wx/list.h b/include/wx/list.h index e166f1423c..79a809ed59 100644 --- a/include/wx/list.h +++ b/include/wx/list.h @@ -92,14 +92,14 @@ class WXDLLEXPORT wxListKey { public: // implicit ctors - wxListKey() - { m_keyType = wxKEY_NONE; } - wxListKey(long i) - { m_keyType = wxKEY_INTEGER; m_key.integer = i; } - wxListKey(const wxChar *s) - { m_keyType = wxKEY_STRING; m_key.string = wxStrdup(s); } - wxListKey(const wxString& s) - { m_keyType = wxKEY_STRING; m_key.string = wxStrdup(s.c_str()); } + wxListKey() : m_keyType(wxKEY_NONE) + { } + wxListKey(long i) : m_keyType(wxKEY_INTEGER) + { m_key.integer = i; } + wxListKey(const wxChar *s) : m_keyType(wxKEY_STRING) + { m_key.string = wxStrdup(s); } + wxListKey(const wxString& s) : m_keyType(wxKEY_STRING) + { m_key.string = wxStrdup(s.c_str()); } // accessors wxKeyType GetKeyType() const { return m_keyType; } @@ -131,6 +131,8 @@ private: WXDLLEXPORT_DATA(extern wxListKey) wxDefaultListKey; +class WXDLLEXPORT wxListBase; + class WXDLLEXPORT wxNodeBase { friend class wxListBase; @@ -181,6 +183,8 @@ private: *m_previous; wxListBase *m_list; // list we belong to + + DECLARE_NO_COPY_CLASS(wxNodeBase) }; // ----------------------------------------------------------------------------- @@ -196,7 +200,8 @@ private: void Init(wxKeyType keyType = wxKEY_NONE); // Must be declared before it's used (for VC++ 1.5) public: // default ctor & dtor - wxListBase(wxKeyType keyType = wxKEY_NONE) { Init(keyType); } + wxListBase(wxKeyType keyType = wxKEY_NONE) + { Init(keyType); } virtual ~wxListBase(); // accessors @@ -271,6 +276,9 @@ protected: // operations // append to end of list + wxNodeBase *Prepend(void *object) + { return (wxNodeBase *)wxListBase::Insert(object); } + // append to beginning of list wxNodeBase *Append(void *object); // insert a new item at the beginning of the list wxNodeBase *Insert(void *object) { return Insert( (wxNodeBase*)NULL, object); } @@ -394,7 +402,7 @@ private: : wxListBase(count, (void **)elements) { } \ \ name& operator=(const name& list) \ - { return (name&)wxListBase::operator=(list); } \ + { (void) wxListBase::operator=(list); return *this; } \ \ nodetype *GetFirst() const \ { return (nodetype *)wxListBase::GetFirst(); } \ @@ -501,7 +509,7 @@ public: ~wxList() { } wxList& operator=(const wxList& list) - { return (wxList&)wxListBase::operator=(list); } + { (void) wxListBase::operator=(list); return *this; } // compatibility methods void Sort(wxSortCompareFunction compfunc) { wxListBase::Sort(compfunc); } @@ -536,6 +544,10 @@ public: // makes a copy of the string wxNode *Add(const wxChar *s) { return (wxNode *)wxStringListBase::Append(copystring(s)); } + + // Append to beginning of list + wxNode *Prepend(const wxChar *s) + { return (wxNode *)wxStringListBase::Insert(copystring(s)); } bool Delete(const wxChar *s);