X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b4affacc1059659eb3772240ee3517df44fb6a44..1ea9acd9aa1b0e5fa3f7bef3db4eca77822bfe35:/include/wx/list.h diff --git a/include/wx/list.h b/include/wx/list.h index 7d1f0ebc1a..5f0790af7b 100644 --- a/include/wx/list.h +++ b/include/wx/list.h @@ -190,6 +190,9 @@ private: } \ compatibility_iterator GetPrevious() const \ { \ + if ( m_iter == m_list->begin() ) \ + return compatibility_iterator(); \ + \ iterator i = m_iter; \ return compatibility_iterator( m_list, --i ); \ } \ @@ -677,7 +680,17 @@ private: { \ public: \ typedef nodetype Node; \ - typedef Node* compatibility_iterator; \ + class compatibility_iterator \ + { \ + public: \ + compatibility_iterator(Node *ptr = NULL) : m_ptr(ptr) { } \ + \ + Node *operator->() const { return m_ptr; } \ + operator Node *() const { return m_ptr; } \ + \ + private: \ + Node *m_ptr; \ + }; \ \ name(wxKeyType keyType = wxKEY_NONE) : wxListBase(keyType) \ { } \ @@ -689,12 +702,12 @@ private: name& operator=(const name& list) \ { Assign(list); return *this; } \ \ - nodetype *GetFirst() const \ + compatibility_iterator GetFirst() const \ { return (nodetype *)wxListBase::GetFirst(); } \ - nodetype *GetLast() const \ + compatibility_iterator GetLast() const \ { return (nodetype *)wxListBase::GetLast(); } \ \ - nodetype *Item(size_t index) const \ + compatibility_iterator Item(size_t index) const \ { return (nodetype *)wxListBase::Item(index); } \ \ T *operator[](size_t index) const \ @@ -703,18 +716,18 @@ private: return node ? (T*)(node->GetData()) : (T*)NULL; \ } \ \ - nodetype *Append(Tbase *object) \ + compatibility_iterator Append(Tbase *object) \ { return (nodetype *)wxListBase::Append(object); } \ - nodetype *Insert(Tbase *object) \ + compatibility_iterator Insert(Tbase *object) \ { return (nodetype *)Insert((nodetype*)NULL, object); } \ - nodetype *Insert(size_t pos, Tbase *object) \ + compatibility_iterator Insert(size_t pos, Tbase *object) \ { return (nodetype *)wxListBase::Insert(pos, object); } \ - nodetype *Insert(nodetype *prev, Tbase *object) \ + compatibility_iterator Insert(nodetype *prev, Tbase *object) \ { return (nodetype *)wxListBase::Insert(prev, object); } \ \ - nodetype *Append(long key, void *object) \ + compatibility_iterator Append(long key, void *object) \ { return (nodetype *)wxListBase::Append(key, object); } \ - nodetype *Append(const wxChar *key, void *object) \ + compatibility_iterator Append(const wxChar *key, void *object) \ { return (nodetype *)wxListBase::Append(key, object); } \ \ nodetype *DetachNode(nodetype *node) \ @@ -726,7 +739,7 @@ private: void Erase(compatibility_iterator it) \ { DeleteNode(it); } \ \ - nodetype *Find(const Tbase *object) const \ + compatibility_iterator Find(const Tbase *object) const \ { return (nodetype *)wxListBase::Find(object); } \ \ virtual nodetype *Find(const wxListKey& key) const \