]> git.saurik.com Git - wxWidgets.git/commitdiff
STL-ification patch for wxMSW and wxGTK.
authorMattia Barbon <mbarbon@cpan.org>
Thu, 10 Jul 2003 19:55:12 +0000 (19:55 +0000)
committerMattia Barbon <mbarbon@cpan.org>
Thu, 10 Jul 2003 19:55:12 +0000 (19:55 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21876 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

73 files changed:
include/wx/cmdproc.h
include/wx/dataobj.h
include/wx/gdicmn.h
include/wx/paper.h
src/common/appcmn.cpp
src/common/artprov.cpp
src/common/cmdproc.cpp
src/common/containr.cpp
src/common/dcbase.cpp
src/common/dobjcmn.cpp
src/common/docview.cpp
src/common/gdicmn.cpp
src/common/image.cpp
src/common/layout.cpp
src/common/menucmn.cpp
src/common/paper.cpp
src/common/sizer.cpp
src/common/statbar.cpp
src/common/tbarbase.cpp
src/common/toplvcmn.cpp
src/common/valtext.cpp
src/common/wincmn.cpp
src/generic/accel.cpp
src/generic/dcpsg.cpp
src/generic/dirctrlg.cpp
src/generic/imaglist.cpp
src/generic/laywin.cpp
src/generic/listctrl.cpp
src/generic/prntdlgg.cpp
src/generic/tbarsmpl.cpp
src/gtk/choice.cpp
src/gtk/colour.cpp
src/gtk/combobox.cpp
src/gtk/listbox.cpp
src/gtk/mdi.cpp
src/gtk/menu.cpp
src/gtk/notebook.cpp
src/gtk/radiobox.cpp
src/gtk/radiobut.cpp
src/gtk/tbargtk.cpp
src/gtk/window.cpp
src/gtk1/choice.cpp
src/gtk1/colour.cpp
src/gtk1/combobox.cpp
src/gtk1/listbox.cpp
src/gtk1/mdi.cpp
src/gtk1/menu.cpp
src/gtk1/notebook.cpp
src/gtk1/radiobox.cpp
src/gtk1/radiobut.cpp
src/gtk1/tbargtk.cpp
src/gtk1/window.cpp
src/html/helpctrl.cpp
src/html/helpfrm.cpp
src/html/htmlpars.cpp
src/html/htmlwin.cpp
src/html/htmprint.cpp
src/html/winpars.cpp
src/msw/dialog.cpp
src/msw/filedlg.cpp
src/msw/frame.cpp
src/msw/gdiimage.cpp
src/msw/mdi.cpp
src/msw/menu.cpp
src/msw/menuitem.cpp
src/msw/nativdlg.cpp
src/msw/radiobut.cpp
src/msw/taskbar.cpp
src/msw/tbar95.cpp
src/msw/timer.cpp
src/msw/treectrl.cpp
src/msw/window.cpp
src/x11/colour.cpp

index d630a152241bfdcade9d61bf5994a7112092cbe4..970922d40ba4208fcacc9e75d7219111db8460d8 100644 (file)
@@ -114,7 +114,7 @@ protected:
 
     int           m_maxNoCommands;
     wxList        m_commands;
-    wxNode*       m_currentCommand;
+    wxList::compatibility_iterator m_currentCommand;
 
 #if wxUSE_MENUS
     wxMenu*       m_commandEditMenu;
index 4aa203de8269d5e63bad83b87ea65b9f2bd7aea2..a80b6a4c6e50d51e3467a4c1f61a794cdb49bf19 100644 (file)
@@ -260,6 +260,7 @@ class WXDLLEXPORT wxDataObjectComposite : public wxDataObject
 public:
     // ctor
     wxDataObjectComposite();
+    virtual ~wxDataObjectComposite();
 
     // add data object (it will be deleted by wxDataObjectComposite, hence it
     // must be allocated on the heap) whose format will become the preferred
index 3b5fb2e41021b426b83cbb1ce9ffe5af49c5f73d..ae96ef17944b4ca9dfb3cd4af22f52e065b9ad65 100644 (file)
@@ -377,11 +377,11 @@ typedef wxInt8 wxDash;
 
 class WXDLLEXPORT wxPenList : public wxList
 {
-    DECLARE_DYNAMIC_CLASS(wxPenList)
+    // DECLARE_DYNAMIC_CLASS(wxPenList)
 
 public:
     wxPenList() { }
-    ~wxPenList();
+    virtual ~wxPenList();
 
     void AddPen(wxPen *pen);
     void RemovePen(wxPen *pen);
@@ -390,11 +390,11 @@ public:
 
 class WXDLLEXPORT wxBrushList : public wxList
 {
-    DECLARE_DYNAMIC_CLASS(wxBrushList)
+    // DECLARE_DYNAMIC_CLASS(wxBrushList)
 
 public:
     wxBrushList() { }
-    ~wxBrushList();
+    virtual ~wxBrushList();
 
     void AddBrush(wxBrush *brush);
     void RemoveBrush(wxBrush *brush);
@@ -403,11 +403,11 @@ public:
 
 class WXDLLEXPORT wxFontList : public wxList
 {
-    DECLARE_DYNAMIC_CLASS(wxFontList)
+    // DECLARE_DYNAMIC_CLASS(wxFontList)
 
 public:
     wxFontList() { }
-    ~wxFontList();
+    virtual ~wxFontList();
 
     void AddFont(wxFont *font);
     void RemoveFont(wxFont *font);
@@ -417,16 +417,19 @@ public:
                              wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
 };
 
-class WXDLLEXPORT wxColourDatabase : public wxList
+class WXDLLEXPORT wxStringToColourHashMap;
+
+class WXDLLEXPORT wxColourDatabase
 {
-    DECLARE_CLASS(wxColourDatabase)
+    // DECLARE_CLASS(wxColourDatabase)
 
 public:
-    wxColourDatabase(int type);
-    ~wxColourDatabase() ;
+    wxColourDatabase();
+    virtual ~wxColourDatabase() ;
 
     // Not const because it may add a name to the database
     wxColour *FindColour(const wxString& colour) ;
+    wxColour *FindColourNoAdd(const wxString& colour) const;
     wxString FindName(const wxColour& colour) const;
     void Initialize();
 #ifdef __WXPM__
@@ -434,15 +437,19 @@ public:
     long*                           m_palTable;
     size_t                          m_nSize;
 #endif
+private:
+    wxColour* FindColour(const wxString& colour, bool add);
+
+    wxStringToColourHashMap* m_map;
 };
 
 class WXDLLEXPORT wxBitmapList : public wxList
 {
-    DECLARE_DYNAMIC_CLASS(wxBitmapList)
+    // DECLARE_DYNAMIC_CLASS(wxBitmapList)
 
 public:
     wxBitmapList();
-    ~wxBitmapList();
+    virtual ~wxBitmapList();
 
     void AddBitmap(wxBitmap *bitmap);
     void RemoveBitmap(wxBitmap *bitmap);
@@ -452,11 +459,13 @@ class WXDLLEXPORT wxResourceCache: public wxList
 {
 public:
     wxResourceCache() { }
+#if !wxUSE_STL
     wxResourceCache(const unsigned int keyType) : wxList(keyType) { }
-    ~wxResourceCache();
+#endif
+    virtual ~wxResourceCache();
 
 private:
-    DECLARE_DYNAMIC_CLASS(wxResourceCache)
+    // DECLARE_DYNAMIC_CLASS(wxResourceCache)
 };
 
 // ---------------------------------------------------------------------------
index 6be58b4ce435355ec14a3e5ee54e4a451a0df57d..d6703eb299cdb6fc99d3e3deb8b4e002f8a36c39 100644 (file)
@@ -69,10 +69,14 @@ private:
     DECLARE_DYNAMIC_CLASS(wxPrintPaperType)
 };
 
-class WXDLLEXPORT wxPrintPaperDatabase: public wxList
+class WXDLLEXPORT wxStringToPrintPaperTypeHashMap;
+class WXDLLEXPORT wxPrintPaperTypeList;
+
+class WXDLLEXPORT wxPrintPaperDatabase
 {
 public:
     wxPrintPaperDatabase();
+    ~wxPrintPaperDatabase();
 
     void CreateDatabase();
     void ClearDatabase();
@@ -104,8 +108,13 @@ public:
     // Get the paper size
     wxPaperSize GetSize(const wxSize& size);
 
+    //
+    wxPrintPaperType* Item(size_t index) const;
+    size_t GetCount() const;
 private:
-    DECLARE_DYNAMIC_CLASS(wxPrintPaperDatabase)
+    wxStringToPrintPaperTypeHashMap* m_map;
+    wxPrintPaperTypeList* m_list;
+    // DECLARE_DYNAMIC_CLASS(wxPrintPaperDatabase)
 };
 
 WXDLLEXPORT_DATA(extern wxPrintPaperDatabase*) wxThePrintPaperDatabase;
index 9424db3196fa936343481ae128b43451e64a3318..97c2f5eb2d2e5c49919557d09d0ff7c0afc6d3e8 100644 (file)
@@ -85,7 +85,7 @@ bool wxAppBase::Initialize(int& argc, wxChar **argv)
     wxPendingEventsLocker = new wxCriticalSection;
 #endif
 
-    wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
+    wxTheColourDatabase = new wxColourDatabase;
     wxTheColourDatabase->Initialize();
 
     wxInitializeStockLists();
@@ -189,7 +189,7 @@ void wxAppBase::SetActive(bool active, wxWindow * WXUNUSED(lastFocus))
 
 void wxAppBase::DeletePendingObjects()
 {
-    wxNode *node = wxPendingDelete.GetFirst();
+    wxList::compatibility_iterator node = wxPendingDelete.GetFirst();
     while (node)
     {
         wxObject *obj = node->GetData();
@@ -197,7 +197,7 @@ void wxAppBase::DeletePendingObjects()
         delete obj;
 
         if (wxPendingDelete.Member(obj))
-            delete node;
+            wxPendingDelete.Erase(node);
 
         // Deleting one object may have deleted other pending
         // objects, so start from beginning of list again.
@@ -208,7 +208,7 @@ void wxAppBase::DeletePendingObjects()
 // Returns TRUE if more time is needed.
 bool wxAppBase::ProcessIdle()
 {
-    wxWindowList::Node* node = wxTopLevelWindows.GetFirst();
+    wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
     node = wxTopLevelWindows.GetFirst();
     while (node)
     {
@@ -231,7 +231,7 @@ bool wxAppBase::SendIdleEvents()
 {
     bool needMore = FALSE;
 
-    wxWindowList::Node* node = wxTopLevelWindows.GetFirst();
+    wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
     while (node)
     {
         wxWindow* win = node->GetData();
@@ -257,7 +257,7 @@ bool wxAppBase::SendIdleEvents(wxWindow* win)
         needMore = event.MoreRequested();
     }
 
-    wxWindowList::Node *node = win->GetChildren().GetFirst();
+    wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst();
     while ( node )
     {
         wxWindow *win = node->GetData();
index 194219d32d980d4372d229f572d7329bf01c7b56..74f8f798e76e5930e49b559ae13966e438e6aae8 100644 (file)
@@ -114,7 +114,6 @@ wxArtProviderCache *wxArtProvider::sm_cache = NULL;
     if ( !sm_providers )
     {
         sm_providers = new wxArtProvidersList;
-        sm_providers->DeleteContents(TRUE);
         sm_cache = new wxArtProviderCache;
     }
 
@@ -127,7 +126,8 @@ wxArtProviderCache *wxArtProvider::sm_cache = NULL;
     wxCHECK_MSG( sm_providers, FALSE, _T("no wxArtProvider exists") );
     wxCHECK_MSG( sm_providers->GetCount() > 0, FALSE, _T("wxArtProviders stack is empty") );
 
-    sm_providers->DeleteNode(sm_providers->GetFirst());
+    delete sm_providers->GetFirst()->GetData();
+    sm_providers->Erase(sm_providers->GetFirst());
     sm_cache->Clear();
     return TRUE;
 }
@@ -138,6 +138,7 @@ wxArtProviderCache *wxArtProvider::sm_cache = NULL;
 
     if ( sm_providers->DeleteObject(provider) )
     {
+        delete provider;
         sm_cache->Clear();
         return TRUE;
     }
@@ -165,7 +166,7 @@ wxArtProviderCache *wxArtProvider::sm_cache = NULL;
     wxBitmap bmp;
     if ( !sm_cache->GetBitmap(hashId, &bmp) )
     {
-        for (wxArtProvidersList::Node *node = sm_providers->GetFirst();
+        for (wxArtProvidersList::compatibility_iterator node = sm_providers->GetFirst();
              node; node = node->GetNext())
         {
             bmp = node->GetData()->CreateBitmap(id, client, size);
index 4945bdbe28c0e38cca283e5a2fb77f0b2f13cde9..6a7475fadb971d0cddd563c5b45ba24210df067e 100644 (file)
@@ -64,7 +64,6 @@ wxCommand::~wxCommand()
 wxCommandProcessor::wxCommandProcessor(int maxCommands)
 {
     m_maxNoCommands = maxCommands;
-    m_currentCommand = (wxNode *) NULL;
 #if wxUSE_MENUS
     m_commandEditMenu = (wxMenu *) NULL;
 #endif // wxUSE_MENUS
@@ -114,10 +113,10 @@ void wxCommandProcessor::Store(wxCommand *command)
 
     if ( (int)m_commands.GetCount() == m_maxNoCommands )
     {
-        wxNode *firstNode = m_commands.GetFirst();
+        wxList::compatibility_iterator firstNode = m_commands.GetFirst();
         wxCommand *firstCommand = (wxCommand *)firstNode->GetData();
         delete firstCommand;
-        delete firstNode;
+        m_commands.Erase(firstNode);
     }
 
     // Correct a bug: we must chop off the current 'branch'
@@ -126,12 +125,12 @@ void wxCommandProcessor::Store(wxCommand *command)
         ClearCommands();
     else
     {
-        wxNode *node = m_currentCommand->GetNext();
+        wxList::compatibility_iterator node = m_currentCommand->GetNext();
         while (node)
         {
-            wxNode *next = node->GetNext();
+            wxList::compatibility_iterator next = node->GetNext();
             delete (wxCommand *)node->GetData();
-            delete node;
+            m_commands.Erase(node);
             node = next;
         }
     }
@@ -160,7 +159,7 @@ bool wxCommandProcessor::Undo()
 bool wxCommandProcessor::Redo()
 {
     wxCommand *redoCommand = (wxCommand *) NULL;
-    wxNode *redoNode = (wxNode *) NULL;
+    wxList::compatibility_iterator redoNode;
 
     if ( m_currentCommand )
     {
@@ -202,13 +201,13 @@ bool wxCommandProcessor::CanUndo() const
 
 bool wxCommandProcessor::CanRedo() const
 {
-    if ((m_currentCommand != (wxNode*) NULL) && (m_currentCommand->GetNext() == (wxNode*) NULL))
+    if (m_currentCommand && !m_currentCommand->GetNext())
         return FALSE;
 
-    if ((m_currentCommand != (wxNode*) NULL) && (m_currentCommand->GetNext() != (wxNode*) NULL))
+    if (m_currentCommand && m_currentCommand->GetNext())
         return TRUE;
 
-    if ((m_currentCommand == (wxNode*) NULL) && (m_commands.GetCount() > 0))
+    if (!m_currentCommand && (m_commands.GetCount() > 0))
         return TRUE;
 
     return FALSE;
@@ -300,15 +299,15 @@ wxString wxCommandProcessor::GetRedoMenuLabel() const
 
 void wxCommandProcessor::ClearCommands()
 {
-    wxNode *node = m_commands.GetFirst();
+    wxList::compatibility_iterator node = m_commands.GetFirst();
     while (node)
     {
         wxCommand *command = (wxCommand *)node->GetData();
         delete command;
-        delete node;
+        m_commands.Erase(node);
         node = m_commands.GetFirst();
     }
-    m_currentCommand = (wxNode *) NULL;
+    m_currentCommand = wxList::compatibility_iterator();
 }
 
 
index fe1ea94cab0dace8a5add805a358dfe3ce23d2a8..f695be633494eb9a769677886b1d77683b100be3 100644 (file)
@@ -61,7 +61,7 @@ bool wxControlContainer::AcceptsFocus() const
         // otherwise we can accept focus either if we have no children at all
         // (in this case we're probably not used as a container) or only when
         // at least one child will accept focus
-        wxWindowList::Node *node = m_winParent->GetChildren().GetFirst();
+        wxWindowList::compatibility_iterator node = m_winParent->GetChildren().GetFirst();
         if ( !node )
             return TRUE;
 
@@ -185,7 +185,7 @@ void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event )
 
     // the node of the children list from which we should start looking for the
     // next acceptable child
-    wxWindowList::Node *node, *start_node;
+    wxWindowList::compatibility_iterator node, start_node;
 
     // we should start from the first/last control and not from the one which
     // had focus the last time if we're propagating the event downwards because
@@ -200,7 +200,7 @@ void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event )
         node = forward ? children.GetFirst() : children.GetLast();
 
         // we want to cycle over all nodes
-        start_node = (wxWindowList::Node *)NULL;
+        start_node = wxWindowList::compatibility_iterator();
     }
     else
     {
@@ -224,7 +224,7 @@ void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event )
         }
         else
         {
-            start_node = (wxWindowList::Node *)NULL;
+            start_node = wxWindowList::compatibility_iterator();
         }
 
         if ( !start_node && m_winLastFocused )
@@ -413,7 +413,7 @@ bool wxSetFocusToChild(wxWindow *win, wxWindow **childLastFocused)
     }
 
     // set the focus to the first child who wants it
-    wxWindowList::Node *node = win->GetChildren().GetFirst();
+    wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst();
     while ( node )
     {
         wxWindow *child = node->GetData();
index f239d3bc013aca887a9703a01f305063f8e0945f..8534732e7ba1577775e4a9e70b8b59365cea589c 100644 (file)
@@ -73,7 +73,7 @@ void wxDCBase::DrawLines(const wxList *list, wxCoord xoffset, wxCoord yoffset)
     wxPoint *points = new wxPoint[n];
 
     int i = 0;
-    for ( wxNode *node = list->GetFirst(); node; node = node->GetNext(), i++ )
+    for ( wxList::compatibility_iterator node = list->GetFirst(); node; node = node->GetNext(), i++ )
     {
         wxPoint *point = (wxPoint *)node->GetData();
         points[i].x = point->x;
@@ -94,7 +94,7 @@ void wxDCBase::DrawPolygon(const wxList *list,
     wxPoint *points = new wxPoint[n];
 
     int i = 0;
-    for ( wxNode *node = list->GetFirst(); node; node = node->GetNext(), i++ )
+    for ( wxList::compatibility_iterator node = list->GetFirst(); node; node = node->GetNext(), i++ )
     {
         wxPoint *point = (wxPoint *)node->GetData();
         points[i].x = point->x;
@@ -131,7 +131,7 @@ void wxDCBase::DrawSpline(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoor
 
     DrawSpline(&point_list);
 
-    for( wxNode *node = point_list.GetFirst(); node; node = node->GetNext() )
+    for( wxList::compatibility_iterator node = point_list.GetFirst(); node; node = node->GetNext() )
     {
         wxPoint *p = (wxPoint *)node->GetData();
         delete p;
@@ -254,12 +254,12 @@ static bool wx_spline_add_point(double x, double y)
 static void wx_spline_draw_point_array(wxDCBase *dc)
 {
   dc->DrawLines(&wx_spline_point_list, 0, 0 );
-  wxNode *node = wx_spline_point_list.GetFirst();
+  wxList::compatibility_iterator node = wx_spline_point_list.GetFirst();
   while (node)
   {
     wxPoint *point = (wxPoint *)node->GetData();
     delete point;
-    delete node;
+    wx_spline_point_list.Erase(node);
     node = wx_spline_point_list.GetFirst();
   }
 }
@@ -272,7 +272,7 @@ void wxDCBase::DoDrawSpline( wxList *points )
     double           cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;
     double           x1, y1, x2, y2;
 
-    wxNode *node = points->GetFirst();
+    wxList::compatibility_iterator node = points->GetFirst();
     p = (wxPoint *)node->GetData();
 
     x1 = p->x;
@@ -290,7 +290,7 @@ void wxDCBase::DoDrawSpline( wxList *points )
 
     wx_spline_add_point(x1, y1);
 
-    while ((node = node->GetNext()) != NULL)
+    while ((node = node->GetNext()))
     {
         p = (wxPoint *)node->GetData();
         x1 = x2;
index 658449d91f627f218c062ca3e676724480fbd4dd..432cb49bfe10a4e43087ca715b6dae0ee9bd63cd 100644 (file)
@@ -97,14 +97,17 @@ bool wxDataObjectBase::IsSupported(const wxDataFormat& format,
 wxDataObjectComposite::wxDataObjectComposite()
 {
     m_preferred = 0;
+}
 
-    m_dataObjects.DeleteContents(TRUE);
+wxDataObjectComposite::~wxDataObjectComposite()
+{
+    WX_CLEAR_LIST(wxSimpleDataObjectList, m_dataObjects);
 }
 
 wxDataObjectSimple *
 wxDataObjectComposite::GetObject(const wxDataFormat& format) const
 {
-    wxSimpleDataObjectList::Node *node = m_dataObjects.GetFirst();
+    wxSimpleDataObjectList::compatibility_iterator node = m_dataObjects.GetFirst();
     while ( node )
     {
         wxDataObjectSimple *dataObj = node->GetData();
@@ -131,7 +134,7 @@ void wxDataObjectComposite::Add(wxDataObjectSimple *dataObject, bool preferred)
 wxDataFormat
 wxDataObjectComposite::GetPreferredFormat(Direction WXUNUSED(dir)) const
 {
-    wxSimpleDataObjectList::Node *node = m_dataObjects.Item( m_preferred );
+    wxSimpleDataObjectList::compatibility_iterator node = m_dataObjects.Item( m_preferred );
 
     wxCHECK_MSG( node, wxFormatInvalid, wxT("no preferred format") );
 
@@ -189,7 +192,7 @@ void wxDataObjectComposite::GetAllFormats(wxDataFormat *formats,
                                           Direction WXUNUSED(dir)) const
 {
     size_t n = 0;
-    wxSimpleDataObjectList::Node *node;
+    wxSimpleDataObjectList::compatibility_iterator node;
     for ( node = m_dataObjects.GetFirst(); node; node = node->GetNext() )
     {
         // TODO if ( !outputOnlyToo ) && this one counts ...
index e0720053f1bc77213a6883ba3a7e2b7ba1fac46e..c158c432432ff8b2dd7ad8373ad65a80d39d9829 100644 (file)
@@ -184,14 +184,14 @@ bool wxDocument::DeleteAllViews()
 {
     wxDocManager* manager = GetDocumentManager();
 
-    wxNode *node = m_documentViews.GetFirst();
+    wxList::compatibility_iterator node = m_documentViews.GetFirst();
     while (node)
     {
         wxView *view = (wxView *)node->GetData();
         if (!view->Close())
             return FALSE;
 
-        wxNode *next = node->GetNext();
+        wxList::compatibility_iterator next = node->GetNext();
 
         delete view; // Deletes node implicitly
         node = next;
@@ -276,7 +276,7 @@ bool wxDocument::SaveAs()
     SetTitle(wxFileNameFromPath(fileName));
 
     // Notify the views that the filename has changed
-    wxNode *node = m_documentViews.GetFirst();
+    wxList::compatibility_iterator node = m_documentViews.GetFirst();
     while (node)
     {
         wxView *view = (wxView *)node->GetData();
@@ -525,7 +525,7 @@ void wxDocument::OnChangedViewList()
 
 void wxDocument::UpdateAllViews(wxView *sender, wxObject *hint)
 {
-    wxNode *node = m_documentViews.GetFirst();
+    wxList::compatibility_iterator node = m_documentViews.GetFirst();
     while (node)
     {
         wxView *view = (wxView *)node->GetData();
@@ -537,7 +537,7 @@ void wxDocument::UpdateAllViews(wxView *sender, wxObject *hint)
 
 void wxDocument::NotifyClosing()
 {
-    wxNode *node = m_documentViews.GetFirst();
+    wxList::compatibility_iterator node = m_documentViews.GetFirst();
     while (node)
     {
         wxView *view = (wxView *)node->GetData();
@@ -552,7 +552,7 @@ void wxDocument::SetFilename(const wxString& filename, bool notifyViews)
     if ( notifyViews )
     {
         // Notify the views that the filename has changed
-        wxNode *node = m_documentViews.GetFirst();
+        wxList::compatibility_iterator node = m_documentViews.GetFirst();
         while (node)
         {
             wxView *view = (wxView *)node->GetData();
@@ -806,12 +806,12 @@ bool wxDocManager::CloseDocument(wxDocument* doc, bool force)
 
 bool wxDocManager::CloseDocuments(bool force)
 {
-    wxNode *node = m_docs.GetFirst();
+    wxList::compatibility_iterator node = m_docs.GetFirst();
     while (node)
     {
         wxDocument *doc = (wxDocument *)node->GetData();
-        wxNode *next = node->GetNext();
-
+        wxList::compatibility_iterator next = node->GetNext();
+        
         if (!CloseDocument(doc, force))
             return FALSE;
 
@@ -828,11 +828,11 @@ bool wxDocManager::Clear(bool force)
     if (!CloseDocuments(force))
         return FALSE;
 
-    wxNode *node = m_templates.GetFirst();
+    wxList::compatibility_iterator node = m_templates.GetFirst();
     while (node)
     {
         wxDocTemplate *templ = (wxDocTemplate*) node->GetData();
-        wxNode* next = node->GetNext();
+        wxList::compatibility_iterator next = node->GetNext();
         delete templ;
         node = next;
     }
@@ -1530,7 +1530,7 @@ wxDocTemplate *wxDocManager::SelectDocumentPath(wxDocTemplate **templates,
 wxDocTemplate *wxDocManager::SelectDocumentType(wxDocTemplate **templates,
                                                 int noTemplates, bool sort)
 {
-    wxArrayString strings(sort);
+    wxArrayString strings;
     wxDocTemplate **data = new wxDocTemplate *[noTemplates];
     int i;
     int n = 0;
@@ -1562,6 +1562,7 @@ wxDocTemplate *wxDocManager::SelectDocumentType(wxDocTemplate **templates,
 
     if (sort)
     {
+        strings.Sort(wxStringSortAscending);
         // Yes, this will be slow, but template lists
         // are typically short.
         int j;
@@ -1610,7 +1611,7 @@ wxDocTemplate *wxDocManager::SelectDocumentType(wxDocTemplate **templates,
 wxDocTemplate *wxDocManager::SelectViewType(wxDocTemplate **templates,
                                             int noTemplates, bool sort)
 {
-    wxArrayString strings(sort);
+    wxArrayString strings;
     wxDocTemplate **data = new wxDocTemplate *[noTemplates];
     int i;
     int n = 0;
@@ -1640,6 +1641,7 @@ wxDocTemplate *wxDocManager::SelectViewType(wxDocTemplate **templates,
 
     if (sort)
     {
+        strings.Sort(wxStringSortAscending);
         // Yes, this will be slow, but template lists
         // are typically short.
         int j;
@@ -2022,7 +2024,7 @@ void wxFileHistory::AddFileToHistory(const wxString& file)
     // Move existing files (if any) down so we can insert file at beginning.
     if (m_fileHistoryN < m_fileMaxFiles)
     {
-        wxNode* node = m_fileMenus.GetFirst();
+        wxList::compatibility_iterator node = m_fileMenus.GetFirst();
         while (node)
         {
             wxMenu* menu = (wxMenu*) node->GetData();
@@ -2067,7 +2069,7 @@ void wxFileHistory::AddFileToHistory(const wxString& file)
 
             wxString buf;
             buf.Printf(s_MRUEntryFormat, i + 1, pathInMenu.c_str());
-            wxNode* node = m_fileMenus.GetFirst();
+            wxList::compatibility_iterator node = m_fileMenus.GetFirst();
             while (node)
             {
                 wxMenu* menu = (wxMenu*) node->GetData();
@@ -2092,7 +2094,7 @@ void wxFileHistory::RemoveFileFromHistory(size_t i)
         m_fileHistory[j] = m_fileHistory[j + 1];
     }
 
-    wxNode* node = m_fileMenus.GetFirst();
+    wxList::compatibility_iterator node = m_fileMenus.GetFirst();
     while ( node )
     {
          wxMenu* menu = (wxMenu*) node->GetData();
@@ -2117,7 +2119,7 @@ void wxFileHistory::RemoveFileFromHistory(size_t i)
         // delete the last separator too if no more files are left
         if ( m_fileHistoryN == 1 )
         {
-            wxMenuItemList::Node *node = menu->GetMenuItems().GetLast();
+            wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetLast();
             if ( node )
             {
                 wxMenuItem *menuItem = node->GetData();
@@ -2196,7 +2198,7 @@ void wxFileHistory::AddFilesToMenu()
 {
     if (m_fileHistoryN > 0)
     {
-        wxNode* node = m_fileMenus.GetFirst();
+        wxList::compatibility_iterator node = m_fileMenus.GetFirst();
         while (node)
         {
             wxMenu* menu = (wxMenu*) node->GetData();
index c797b70ca274772e39fceb04614bb6916464d85b..7bf932f207d0664789196739cccb6e0d563d255e 100644 (file)
@@ -37,6 +37,7 @@
 #include "wx/dc.h"
 #include "wx/utils.h"
 #include "wx/settings.h"
+#include "wx/hashmap.h"
 
 #include "wx/log.h"
 #include <string.h>
 #include "wx/mac/private.h"
 #include "wx/mac/uma.h"
 #endif
-IMPLEMENT_CLASS(wxColourDatabase, wxList)
-IMPLEMENT_DYNAMIC_CLASS(wxFontList, wxList)
-IMPLEMENT_DYNAMIC_CLASS(wxPenList, wxList)
-IMPLEMENT_DYNAMIC_CLASS(wxBrushList, wxList)
-IMPLEMENT_DYNAMIC_CLASS(wxBitmapList, wxList)
-IMPLEMENT_DYNAMIC_CLASS(wxResourceCache, wxList)
+//IMPLEMENT_CLASS(wxColourDatabase, wxList)
+//IMPLEMENT_DYNAMIC_CLASS(wxFontList, wxList)
+//IMPLEMENT_DYNAMIC_CLASS(wxPenList, wxList)
+//IMPLEMENT_DYNAMIC_CLASS(wxBrushList, wxList)
+//IMPLEMENT_DYNAMIC_CLASS(wxBitmapList, wxList)
+//IMPLEMENT_DYNAMIC_CLASS(wxResourceCache, wxList)
 
 IMPLEMENT_ABSTRACT_CLASS(wxDCBase, wxObject)
 
@@ -186,21 +187,22 @@ bool wxRect::Intersects(const wxRect& rect) const
     return r.width != 0;
 }
 
-wxColourDatabase::wxColourDatabase (int type) : wxList (type)
+WX_DECLARE_STRING_HASH_MAP( wxColour*, wxStringToColourHashMap );
+
+wxColourDatabase::wxColourDatabase ()
 {
+    m_map = new wxStringToColourHashMap;
 }
 
 wxColourDatabase::~wxColourDatabase ()
 {
-  // Cleanup Colour allocated in Initialize()
-  wxNode *node = GetFirst ();
-  while (node)
-    {
-      wxColour *col = (wxColour *) node->GetData ();
-      wxNode *next = node->GetNext ();
-      delete col;
-      node = next;
-    }
+    typedef wxStringToColourHashMap::iterator iterator;
+
+    for( iterator it = m_map->begin(), en = m_map->end(); it != en; ++it )
+        delete it->second;
+
+    delete m_map;
+    m_map = NULL;
 #ifdef __WXPM__
     delete [] m_palTable;
 #endif
@@ -298,7 +300,7 @@ void wxColourDatabase::Initialize ()
     for ( n = 0; n < WXSIZEOF(wxColourTable); n++ )
     {
         const wxColourDesc& cc = wxColourTable[n];
-        Append(cc.name, new wxColour(cc.r,cc.g,cc.b));
+        (*m_map)[cc.name] =  new wxColour(cc.r,cc.g,cc.b);
     }
 #ifdef __WXPM__
     m_palTable = new long[n];
@@ -321,6 +323,16 @@ void wxColourDatabase::Initialize ()
  */
 
 wxColour *wxColourDatabase::FindColour(const wxString& colour)
+{
+    return FindColour(colour, true);
+}
+
+wxColour *wxColourDatabase::FindColourNoAdd(const wxString& colour) const
+{
+    return ((wxColourDatabase*)this)->FindColour(colour, false);
+}
+
+wxColour *wxColourDatabase::FindColour(const wxString& colour, bool add)
 {
     // VZ: make the comparaison case insensitive and also match both grey and
     //     gray
@@ -330,17 +342,14 @@ wxColour *wxColourDatabase::FindColour(const wxString& colour)
     if ( !colName2.Replace(_T("GRAY"), _T("GREY")) )
         colName2.clear();
 
-    wxNode *node = GetFirst();
-    while ( node )
-    {
-        const wxChar *key = node->GetKeyString();
-        if ( colName == key || colName2 == key )
-        {
-            return (wxColour *)node->GetData();
-        }
+    wxStringToColourHashMap::iterator it = m_map->find(colName);
+    if ( it == m_map->end() )
+        it = m_map->find(colName2);
+    if ( it != m_map->end() )
+        return it->second;
 
-        node = node->GetNext();
-    }
+    if ( !add )
+        return NULL;
 
 #ifdef __WXMSW__
   return NULL;
@@ -372,7 +381,7 @@ wxColour *wxColourDatabase::FindColour(const wxString& colour)
       delete col;
       return (wxColour *) NULL;
   }
-  Append( colour, col );
+  (*m_map)[colour] = col;
   return col;
 #endif
 
@@ -400,7 +409,7 @@ wxColour *wxColourDatabase::FindColour(const wxString& colour)
 #endif
 
     wxColour *col = new wxColour(r, g, b);
-    Append(colour, col);
+    (*m_map)[colour] = col;
 
     return col;
 #endif // __X__
@@ -408,29 +417,21 @@ wxColour *wxColourDatabase::FindColour(const wxString& colour)
 
 wxString wxColourDatabase::FindName (const wxColour& colour) const
 {
-    wxString name;
-
     unsigned char red = colour.Red ();
     unsigned char green = colour.Green ();
     unsigned char blue = colour.Blue ();
 
-    for (wxNode * node = GetFirst (); node; node = node->GetNext ())
+    typedef wxStringToColourHashMap::iterator iterator;
+
+    for (iterator it = m_map->begin(), en = m_map->end(); it != en; ++it )
     {
-        wxColour *col = (wxColour *) node->GetData ();
+        wxColour *col = it->second;
 
         if (col->Red () == red && col->Green () == green && col->Blue () == blue)
-        {
-            const wxChar *found = node->GetKeyString();
-            if ( found )
-            {
-                name = found;
-
-                break;
-            }
-        }
+            return it->first;
     }
 
-    return name;
+    return wxEmptyString;
 }
 
 void wxInitializeStockLists()
@@ -589,11 +590,11 @@ wxBitmapList::wxBitmapList()
 
 wxBitmapList::~wxBitmapList ()
 {
-  wxNode *node = GetFirst ();
+  wxList::compatibility_iterator node = GetFirst ();
   while (node)
     {
       wxBitmap *bitmap = (wxBitmap *) node->GetData ();
-      wxNode *next = node->GetNext ();
+      wxList::compatibility_iterator next = node->GetNext ();
       if (bitmap->GetVisible())
         delete bitmap;
       node = next;
@@ -603,11 +604,11 @@ wxBitmapList::~wxBitmapList ()
 // Pen and Brush lists
 wxPenList::~wxPenList ()
 {
-  wxNode *node = GetFirst ();
+  wxList::compatibility_iterator node = GetFirst ();
   while (node)
     {
       wxPen *pen = (wxPen *) node->GetData ();
-      wxNode *next = node->GetNext ();
+      wxList::compatibility_iterator next = node->GetNext ();
       if (pen->GetVisible())
         delete pen;
       node = next;
@@ -626,7 +627,7 @@ void wxPenList::RemovePen (wxPen * pen)
 
 wxPen *wxPenList::FindOrCreatePen (const wxColour& colour, int width, int style)
 {
-    for (wxNode * node = GetFirst (); node; node = node->GetNext ())
+    for (wxList::compatibility_iterator node = GetFirst (); node; node = node->GetNext ())
     {
         wxPen *each_pen = (wxPen *) node->GetData ();
         if (each_pen &&
@@ -658,11 +659,11 @@ wxPen *wxPenList::FindOrCreatePen (const wxColour& colour, int width, int style)
 
 wxBrushList::~wxBrushList ()
 {
-  wxNode *node = GetFirst ();
+  wxList::compatibility_iterator node = GetFirst ();
   while (node)
     {
       wxBrush *brush = (wxBrush *) node->GetData ();
-      wxNode *next = node->GetNext ();
+      wxList::compatibility_iterator next = node->GetNext ();
       if (brush && brush->GetVisible())
         delete brush;
       node = next;
@@ -676,7 +677,7 @@ void wxBrushList::AddBrush (wxBrush * brush)
 
 wxBrush *wxBrushList::FindOrCreateBrush (const wxColour& colour, int style)
 {
-    for (wxNode * node = GetFirst (); node; node = node->GetNext ())
+    for (wxList::compatibility_iterator node = GetFirst (); node; node = node->GetNext ())
     {
         wxBrush *each_brush = (wxBrush *) node->GetData ();
         if (each_brush &&
@@ -713,7 +714,7 @@ void wxBrushList::RemoveBrush (wxBrush * brush)
 
 wxFontList::~wxFontList ()
 {
-    wxNode *node = GetFirst ();
+    wxList::compatibility_iterator node = GetFirst ();
     while (node)
     {
         // Only delete objects that are 'visible', i.e.
@@ -721,7 +722,7 @@ wxFontList::~wxFontList ()
         // where the pointers are expected to be shared
         // (and therefore not deleted by any one part of an app).
         wxFont *font = (wxFont *) node->GetData ();
-        wxNode *next = node->GetNext ();
+        wxList::compatibility_iterator next = node->GetNext ();
         if (font->GetVisible())
             delete font;
         node = next;
@@ -747,7 +748,7 @@ wxFont *wxFontList::FindOrCreateFont(int pointSize,
                                      wxFontEncoding encoding)
 {
     wxFont *font = (wxFont *)NULL;
-    wxNode *node;
+    wxList::compatibility_iterator node;
     for ( node = GetFirst(); node; node = node->GetNext() )
     {
         font = (wxFont *)node->GetData();
@@ -845,7 +846,7 @@ wxSize wxGetDisplaySizeMM()
 
 wxResourceCache::~wxResourceCache ()
 {
-    wxNode *node = GetFirst ();
+    wxList::compatibility_iterator node = GetFirst ();
     while (node) {
         wxObject *item = (wxObject *)node->GetData();
         delete item;
index baa5f6b8b425730d9de4125aa00ea970b48f6889..5192bc06d82624615a223c22b73fd72852bd5a86 100644 (file)
@@ -1128,7 +1128,7 @@ bool wxImage::CanRead( wxInputStream &stream )
 {
     const wxList& list = GetHandlers();
 
-    for ( wxList::Node *node = list.GetFirst(); node; node = node->GetNext() )
+    for ( wxList::compatibility_iterator node = list.GetFirst(); node; node = node->GetNext() )
     {
         wxImageHandler *handler=(wxImageHandler*)node->GetData();
         if (handler->CanRead( stream ))
@@ -1146,7 +1146,7 @@ int wxImage::GetImageCount( wxInputStream &stream, long type )
     {
         wxList &list=GetHandlers();
 
-        for (wxList::Node *node = list.GetFirst(); node; node = node->GetNext())
+        for (wxList::compatibility_iterator node = list.GetFirst(); node; node = node->GetNext())
         {
              handler=(wxImageHandler*)node->GetData();
              if ( handler->CanRead(stream) )
@@ -1189,7 +1189,7 @@ bool wxImage::LoadFile( wxInputStream& stream, long type, int index )
     {
         wxList &list=GetHandlers();
 
-        for ( wxList::Node *node = list.GetFirst(); node; node = node->GetNext() )
+        for ( wxList::compatibility_iterator node = list.GetFirst(); node; node = node->GetNext() )
         {
              handler=(wxImageHandler*)node->GetData();
              if ( handler->CanRead(stream) )
@@ -1266,9 +1266,6 @@ bool wxImage::SaveFile( wxOutputStream& stream, const wxString& mimetype ) const
 
 void wxImage::AddHandler( wxImageHandler *handler )
 {
-    // make sure that the memory will be freed at the program end
-    sm_handlers.DeleteContents(true);
-
     // Check for an existing handler of the type being added.
     if (FindHandler( handler->GetType() ) == 0)
     {
@@ -1290,9 +1287,6 @@ void wxImage::AddHandler( wxImageHandler *handler )
 
 void wxImage::InsertHandler( wxImageHandler *handler )
 {
-    // make sure that the memory will be freed at the program end
-    sm_handlers.DeleteContents(true);
-
     // Check for an existing handler of the type being added.
     if (FindHandler( handler->GetType() ) == 0)
     {
@@ -1313,6 +1307,7 @@ bool wxImage::RemoveHandler( const wxString& name )
     if (handler)
     {
         sm_handlers.DeleteObject(handler);
+        delete handler;
         return true;
     }
     else
@@ -1321,7 +1316,7 @@ bool wxImage::RemoveHandler( const wxString& name )
 
 wxImageHandler *wxImage::FindHandler( const wxString& name )
 {
-    wxNode *node = sm_handlers.GetFirst();
+    wxList::compatibility_iterator node = sm_handlers.GetFirst();
     while (node)
     {
         wxImageHandler *handler = (wxImageHandler*)node->GetData();
@@ -1334,7 +1329,7 @@ wxImageHandler *wxImage::FindHandler( const wxString& name )
 
 wxImageHandler *wxImage::FindHandler( const wxString& extension, long bitmapType )
 {
-    wxNode *node = sm_handlers.GetFirst();
+    wxList::compatibility_iterator node = sm_handlers.GetFirst();
     while (node)
     {
         wxImageHandler *handler = (wxImageHandler*)node->GetData();
@@ -1348,7 +1343,7 @@ wxImageHandler *wxImage::FindHandler( const wxString& extension, long bitmapType
 
 wxImageHandler *wxImage::FindHandler( long bitmapType )
 {
-    wxNode *node = sm_handlers.GetFirst();
+    wxList::compatibility_iterator node = sm_handlers.GetFirst();
     while (node)
     {
         wxImageHandler *handler = (wxImageHandler *)node->GetData();
@@ -1360,7 +1355,7 @@ wxImageHandler *wxImage::FindHandler( long bitmapType )
 
 wxImageHandler *wxImage::FindHandlerMime( const wxString& mimetype )
 {
-    wxNode *node = sm_handlers.GetFirst();
+    wxList::compatibility_iterator node = sm_handlers.GetFirst();
     while (node)
     {
         wxImageHandler *handler = (wxImageHandler *)node->GetData();
@@ -1379,24 +1374,24 @@ void wxImage::InitStandardHandlers()
 
 void wxImage::CleanUpHandlers()
 {
-    wxNode *node = sm_handlers.GetFirst();
+    wxList::compatibility_iterator node = sm_handlers.GetFirst();
     while (node)
     {
         wxImageHandler *handler = (wxImageHandler *)node->GetData();
-        wxNode *next = node->GetNext();
+        wxList::compatibility_iterator next = node->GetNext();
         delete handler;
-        delete node;
         node = next;
     }
-}
 
+    sm_handlers.Clear();
+}
 
 wxString wxImage::GetImageExtWildcard()
 {
     wxString fmts;
 
     wxList& Handlers = wxImage::GetHandlers();
-    wxNode* Node = Handlers.GetFirst();
+    wxList::compatibility_iterator Node = Handlers.GetFirst();
     while ( Node )
     {
         wxImageHandler* Handler = (wxImageHandler*)Node->GetData();
@@ -1408,7 +1403,6 @@ wxString wxImage::GetImageExtWildcard()
     return wxT("(") + fmts + wxT(")|") + fmts;
 }
 
-
 //-----------------------------------------------------------------------------
 // wxImageHandler
 //-----------------------------------------------------------------------------
index 1dd0c63123b1b85cd2523616bf0911ac211b81bb..8966a49b9fb15c3dc89f5ec967a3b3c58d1a9ecf 100644 (file)
@@ -734,7 +734,7 @@ int wxIndividualLayoutConstraint::GetEdge(wxEdge which,
     // If the edge or dimension belongs to the parent, then we know the
     // dimension is obtainable immediately. E.g. a wxExpandSizer may contain a
     // button (but the button's true parent is a panel, not the sizer)
-    if (other->GetChildren().Find(thisWin))
+    if (other->GetChildren().Find((wxWindow*)thisWin))
     {
         switch (which)
         {
index 5422c06677e80909c61e6338fa9a50355e712a9f..221de1a5b2e9f99957bd97e4672071e4a3729a6d 100644 (file)
@@ -276,8 +276,6 @@ void wxMenuItemBase::SetAccel(wxAcceleratorEntry *accel)
 
 void wxMenuBase::Init(long style)
 {
-    m_items.DeleteContents(TRUE);
-
     m_menuBar = (wxMenuBar *)NULL;
     m_menuParent = (wxMenu *)NULL;
 
@@ -289,8 +287,8 @@ void wxMenuBase::Init(long style)
 
 wxMenuBase::~wxMenuBase()
 {
-    // nothing to do, wxMenuItemList dtor will delete the menu items.
-
+    WX_CLEAR_LIST(wxMenuItemList, m_items);
+    
     // Actually, in GTK, the submenus have to get deleted first.
 }
 
@@ -345,7 +343,7 @@ bool wxMenuBase::DoInsert(size_t pos, wxMenuItem *item)
 {
     wxCHECK_MSG( item, FALSE, wxT("invalid item in wxMenu::Insert()") );
 
-    wxMenuItemList::Node *node = m_items.Item(pos);
+    wxMenuItemList::compatibility_iterator node = m_items.Item(pos);
     wxCHECK_MSG( node, FALSE, wxT("invalid index in wxMenu::Insert()") );
 
     m_items.Insert(node, item);
@@ -367,15 +365,14 @@ wxMenuItem *wxMenuBase::Remove(wxMenuItem *item)
 
 wxMenuItem *wxMenuBase::DoRemove(wxMenuItem *item)
 {
-    wxMenuItemList::Node *node = m_items.Find(item);
+    wxMenuItemList::compatibility_iterator node = m_items.Find(item);
 
     // if we get here, the item is valid or one of Remove() functions is broken
     wxCHECK_MSG( node, NULL, wxT("bug in wxMenu::Remove logic") );
 
     // we detach the item, but we do delete the list node (i.e. don't call
     // DetachNode() here!)
-    node->SetData((wxMenuItem *)NULL);  // to prevent it from deleting the item
-    m_items.DeleteNode(node);
+    m_items.Erase(node);
 
     // item isn't attached to anything any more
     item->SetMenu((wxMenu *)NULL);
@@ -433,7 +430,7 @@ bool wxMenuBase::DoDestroy(wxMenuItem *item)
 int wxMenuBase::FindItem(const wxString& text) const
 {
     wxString label = wxMenuItem::GetLabelFromText(text);
-    for ( wxMenuItemList::Node *node = m_items.GetFirst();
+    for ( wxMenuItemList::compatibility_iterator node = m_items.GetFirst();
           node;
           node = node->GetNext() )
     {
@@ -464,7 +461,7 @@ wxMenuItem *wxMenuBase::FindItem(int itemId, wxMenu **itemMenu) const
         *itemMenu = NULL;
 
     wxMenuItem *item = NULL;
-    for ( wxMenuItemList::Node *node = m_items.GetFirst();
+    for ( wxMenuItemList::compatibility_iterator node = m_items.GetFirst();
           node && !item;
           node = node->GetNext() )
     {
@@ -493,7 +490,7 @@ wxMenuItem *wxMenuBase::FindItem(int itemId, wxMenu **itemMenu) const
 wxMenuItem *wxMenuBase::FindChildItem(int id, size_t *ppos) const
 {
     wxMenuItem *item = (wxMenuItem *)NULL;
-    wxMenuItemList::Node *node = GetMenuItems().GetFirst();
+    wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
 
     size_t pos;
     for ( pos = 0; node; pos++ )
@@ -541,7 +538,7 @@ void wxMenuBase::UpdateUI(wxEvtHandler* source)
     if ( !source )
         source = this;
 
-    wxMenuItemList::Node* node = GetMenuItems().GetFirst();
+    wxMenuItemList::compatibility_iterator  node = GetMenuItems().GetFirst();
     while ( node )
     {
         wxMenuItem* item = node->GetData();
@@ -714,17 +711,13 @@ wxString wxMenuBase::GetHelpString( int id ) const
 
 wxMenuBarBase::wxMenuBarBase()
 {
-    // we own the menus when we get them
-    m_menus.DeleteContents(TRUE);
-
     // not attached yet
     m_menuBarFrame = NULL;
 }
 
 wxMenuBarBase::~wxMenuBarBase()
 {
-    // nothing to do, the list will delete the menus because of the call to
-    // DeleteContents() above
+    WX_CLEAR_LIST(wxMenuList, m_menus);
 }
 
 // ----------------------------------------------------------------------------
@@ -734,7 +727,7 @@ wxMenuBarBase::~wxMenuBarBase()
 
 wxMenu *wxMenuBarBase::GetMenu(size_t pos) const
 {
-    wxMenuList::Node *node = m_menus.Item(pos);
+    wxMenuList::compatibility_iterator node = m_menus.Item(pos);
     wxCHECK_MSG( node, NULL, wxT("bad index in wxMenuBar::GetMenu()") );
 
     return node->GetData();
@@ -761,7 +754,7 @@ bool wxMenuBarBase::Insert(size_t pos, wxMenu *menu,
     {
         wxCHECK_MSG( menu, FALSE, wxT("can't insert NULL menu") );
 
-        wxMenuList::Node *node = m_menus.Item(pos);
+        wxMenuList::compatibility_iterator node = m_menus.Item(pos);
         wxCHECK_MSG( node, FALSE, wxT("bad index in wxMenuBar::Insert()") );
 
         m_menus.Insert(node, menu);
@@ -776,7 +769,7 @@ wxMenu *wxMenuBarBase::Replace(size_t pos, wxMenu *menu,
 {
     wxCHECK_MSG( menu, NULL, wxT("can't insert NULL menu") );
 
-    wxMenuList::Node *node = m_menus.Item(pos);
+    wxMenuList::compatibility_iterator node = m_menus.Item(pos);
     wxCHECK_MSG( node, NULL, wxT("bad index in wxMenuBar::Replace()") );
 
     wxMenu *menuOld = node->GetData();
@@ -790,16 +783,14 @@ wxMenu *wxMenuBarBase::Replace(size_t pos, wxMenu *menu,
 
 wxMenu *wxMenuBarBase::Remove(size_t pos)
 {
-    wxMenuList::Node *node = m_menus.Item(pos);
+    wxMenuList::compatibility_iterator node = m_menus.Item(pos);
     wxCHECK_MSG( node, NULL, wxT("bad index in wxMenuBar::Remove()") );
 
-    node = m_menus.DetachNode(node);
-    wxCHECK( node, NULL );  // unexpected
     wxMenu *menu = node->GetData();
+    wxCHECK( node, NULL );  // unexpected
+    m_menus.Erase(node);
     menu->Detach();
 
-    delete node;
-
     return menu;
 }
 
@@ -851,10 +842,11 @@ wxMenuItem *wxMenuBarBase::FindItem(int id, wxMenu **menu) const
         *menu = NULL;
 
     wxMenuItem *item = NULL;
-    size_t count = GetMenuCount();
-    for ( size_t i = 0; !item && (i < count); i++ )
+    size_t count = GetMenuCount(), i;
+    wxMenuList::const_iterator it;
+    for ( i = 0, it = m_menus.begin(); !item && (i < count); i++, it++ )
     {
-        item = m_menus[i]->FindItem(id, menu);
+        item = (*it)->FindItem(id, menu);
     }
 
     return item;
@@ -865,7 +857,7 @@ int wxMenuBarBase::FindMenuItem(const wxString& menu, const wxString& item) cons
     wxString label = wxMenuItem::GetLabelFromText(menu);
 
     int i = 0;
-    wxMenuList::Node *node;
+    wxMenuList::compatibility_iterator node;
     for ( node = m_menus.GetFirst(); node; node = node->GetNext(), i++ )
     {
         if ( label == wxMenuItem::GetLabelFromText(GetLabelTop(i)) )
index e02dcdc39fbf5d3062952ce0ebf63755f513928b..b60ad489b545b81d74194c50abd6bbb778d7b9ff 100644 (file)
@@ -33,6 +33,7 @@
 
 #include "wx/paper.h"
 #include "wx/module.h"
+#include "wx/hashmap.h"
 
 #include <stdlib.h>
 #include <string.h>
@@ -49,7 +50,7 @@
  // End __WXMSW__
 
 IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperType, wxObject)
-IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperDatabase, wxList)
+// IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperDatabase, wxList)
 
 /*
  * Paper size database for all platforms
@@ -83,11 +84,22 @@ wxSize wxPrintPaperType::GetSizeDeviceUnits() const
  * Print paper database for PostScript
  */
 
+WX_DECLARE_STRING_HASH_MAP(wxPrintPaperType*, wxStringToPrintPaperTypeHashMap);
+WX_DECLARE_LIST(wxPrintPaperType, wxPrintPaperTypeList);
+#include <wx/listimpl.cpp>
+WX_DEFINE_LIST(wxPrintPaperTypeList);
+
 wxPrintPaperDatabase* wxThePrintPaperDatabase = (wxPrintPaperDatabase*) NULL;
 
-wxPrintPaperDatabase::wxPrintPaperDatabase():wxList(wxKEY_STRING)
+wxPrintPaperDatabase::wxPrintPaperDatabase()
+{
+    m_map = new wxStringToPrintPaperTypeHashMap;
+    m_list = new wxPrintPaperTypeList;
+}
+
+wxPrintPaperDatabase::~wxPrintPaperDatabase()
 {
-    DeleteContents(TRUE);
+    ClearDatabase();
 }
 
 void wxPrintPaperDatabase::CreateDatabase()
@@ -175,66 +187,75 @@ void wxPrintPaperDatabase::CreateDatabase()
 
 void wxPrintPaperDatabase::ClearDatabase()
 {
-    Clear();
+    delete m_list;
+    WX_CLEAR_HASH_MAP(wxStringToPrintPaperTypeHashMap, *m_map);
+    delete m_map;
 }
 
 void wxPrintPaperDatabase::AddPaperType(wxPaperSize paperId, const wxString& name, int w, int h)
 {
-    Append(name, new wxPrintPaperType(paperId, 0, name, w, h));
+    wxPrintPaperType* tmp = new wxPrintPaperType(paperId, 0, name, w, h);
+    (*m_map)[name] = tmp;
+    m_list->push_back(tmp);
 }
 
 void wxPrintPaperDatabase::AddPaperType(wxPaperSize paperId, int platformId, const wxString& name, int w, int h)
 {
-    Append(name, new wxPrintPaperType(paperId, platformId, name, w, h));
+    wxPrintPaperType* tmp = new wxPrintPaperType(paperId, platformId, name, w, h);
+    (*m_map)[name] = tmp;
+    m_list->push_back(tmp);
 }
 
 wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(const wxString& name)
 {
-    wxNode *node = Find(name);
-    if (node)
-        return (wxPrintPaperType *)node->GetData();
+    wxStringToPrintPaperTypeHashMap::iterator it = m_map->find(name);
+    if (it != m_map->end())
+        return it->second;
     else
-        return (wxPrintPaperType *) NULL;
+        return NULL;
 }
 
 wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(wxPaperSize id)
 {
-    wxNode *node = GetFirst();
-    while (node)
+    typedef wxStringToPrintPaperTypeHashMap::iterator iterator;
+
+    for (iterator it = m_map->begin(), en = m_map->end(); it != en; ++it)
     {
-        wxPrintPaperType* paperType = (wxPrintPaperType*) node->GetData();
+        wxPrintPaperType* paperType = it->second;
         if (paperType->GetId() == id)
             return paperType;
-        node = node->GetNext();
     }
-    return (wxPrintPaperType *) NULL;
+
+    return NULL;
 }
 
 wxPrintPaperType *wxPrintPaperDatabase::FindPaperTypeByPlatformId(int id)
 {
-    wxNode *node = GetFirst();
-    while (node)
+    typedef wxStringToPrintPaperTypeHashMap::iterator iterator;
+
+    for (iterator it = m_map->begin(), en = m_map->end(); it != en; ++it)
     {
-        wxPrintPaperType* paperType = (wxPrintPaperType*) node->GetData();
+        wxPrintPaperType* paperType = it->second;
         if (paperType->GetPlatformId() == id)
             return paperType;
-        node = node->GetNext();
     }
-    return (wxPrintPaperType *) NULL;
+
+    return NULL;
 }
 
 wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(const wxSize& sz)
 {
-    wxNode *node = GetFirst();
-    while (node)
+    typedef wxStringToPrintPaperTypeHashMap::iterator iterator;
+
+    for (iterator it = m_map->begin(), en = m_map->end(); it != en; ++it)
     {
-        wxPrintPaperType* paperType = (wxPrintPaperType*) node->GetData();
+        wxPrintPaperType* paperType = it->second;
         wxSize paperSize = paperType->GetSize() ;
         if ( abs( paperSize.x - sz.x ) < 10 && abs( paperSize.y - sz.y ) < 10 )
             return paperType;
-        node = node->GetNext();
     }
-    return (wxPrintPaperType *) NULL;
+
+    return NULL;
 }
 
 // Convert name to size id
@@ -277,6 +298,17 @@ wxPaperSize wxPrintPaperDatabase::GetSize(const wxSize& size)
         return wxPAPER_NONE;
 }
 
+// QUICK and DIRTY
+size_t wxPrintPaperDatabase::GetCount() const
+{
+    return m_list->GetCount();
+}
+
+wxPrintPaperType* wxPrintPaperDatabase::Item(size_t index) const
+{
+    return m_list->Item(index)->GetData();
+}
+
 // A module to allow initialization/cleanup of print paper
 // things without calling these functions from app.cpp.
 
index 18faa4a469fa9d735360cc81981494a76c666437..3f7e4352a6397e329d691e7a6e51cc3424ab43c1 100644 (file)
@@ -277,12 +277,11 @@ int wxSizerItem::GetOption() const
 wxSizer::wxSizer()
     : m_minSize( wxSize( 0, 0 ) )
 {
-    m_children.DeleteContents( true );
 }
 
 wxSizer::~wxSizer()
 {
-    Clear();
+    WX_CLEAR_LIST(wxSizerItemList, m_children);
 }
 
 void wxSizer::Add( wxWindow *window, int proportion, int flag, int border, wxObject* userData )
@@ -385,13 +384,17 @@ bool wxSizer::Remove( wxSizer *sizer )
 {
     wxASSERT_MSG( sizer, _T("Removing NULL sizer") );
 
-    wxSizerItemList::Node   *node = m_children.GetFirst();
+    wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
     while (node)
     {
         wxSizerItem     *item = node->GetData();
 
         if (item->GetSizer() == sizer)
-            return m_children.DeleteNode( node );
+        {
+            delete item;
+            m_children.Erase( node );
+            return true;
+        }
 
         node = node->GetNext();
     }
@@ -405,7 +408,7 @@ bool wxSizer::Remove( int index )
                  false,
                  _T("Remove index is out of range") );
 
-    wxSizerItemList::Node *node = m_children.Item( index );
+    wxSizerItemList::compatibility_iterator node = m_children.Item( index );
 
     wxCHECK_MSG( node, false, _T("Failed to find child node") );
 
@@ -414,14 +417,16 @@ bool wxSizer::Remove( int index )
     if( item->IsWindow() )
         item->GetWindow()->SetContainingSizer( NULL );
 
-    return m_children.DeleteNode( node );
+    delete item;
+    m_children.Erase( node );
+    return true;
 }
 
 bool wxSizer::Detach( wxSizer *sizer )
 {
     wxASSERT_MSG( sizer, _T("Detaching NULL sizer") );
 
-    wxSizerItemList::Node   *node = m_children.GetFirst();
+    wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
     while (node)
     {
         wxSizerItem     *item = node->GetData();
@@ -429,7 +434,8 @@ bool wxSizer::Detach( wxSizer *sizer )
         if (item->GetSizer() == sizer)
         {
             item->DetachSizer();
-            return m_children.DeleteNode( node );
+            m_children.Erase( node );
+            return true;
         }
         node = node->GetNext();
     }
@@ -441,7 +447,7 @@ bool wxSizer::Detach( wxWindow *window )
 {
     wxASSERT_MSG( window, _T("Detaching NULL window") );
 
-    wxSizerItemList::Node   *node = m_children.GetFirst();
+    wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
     while (node)
     {
         wxSizerItem     *item = node->GetData();
@@ -449,7 +455,8 @@ bool wxSizer::Detach( wxWindow *window )
         if (item->GetWindow() == window)
         {
             item->GetWindow()->SetContainingSizer( NULL );
-            return m_children.DeleteNode( node );
+            m_children.Erase( node );
+            return true;
         }
         node = node->GetNext();
     }
@@ -463,7 +470,7 @@ bool wxSizer::Detach( int index )
                  false,
                  _T("Detach index is out of range") );
 
-    wxSizerItemList::Node *node = m_children.Item( index );
+    wxSizerItemList::compatibility_iterator node = m_children.Item( index );
 
     wxCHECK_MSG( node, false, _T("Failed to find child node") );
 
@@ -474,13 +481,14 @@ bool wxSizer::Detach( int index )
     else if( item->IsWindow() )
         item->GetWindow()->SetContainingSizer( NULL );
 
-    return m_children.DeleteNode( node );
+    m_children.Erase( node );
+    return true;
 }
 
 void wxSizer::Clear( bool delete_windows )
 {
     // First clear the ContainingSizer pointers
-    wxSizerItemList::Node   *node = m_children.GetFirst();
+    wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
     while (node)
     {
         wxSizerItem     *item = node->GetData();
@@ -495,12 +503,12 @@ void wxSizer::Clear( bool delete_windows )
         DeleteWindows();
 
     // Now empty the list
-    m_children.Clear();
+    WX_CLEAR_LIST(wxSizerItemList, m_children);
 }
 
 void wxSizer::DeleteWindows()
 {
-    wxSizerItemList::Node   *node = m_children.GetFirst();
+    wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
     while (node)
     {
         wxSizerItem     *item = node->GetData();
@@ -662,7 +670,7 @@ bool wxSizer::DoSetItemMinSize( wxWindow *window, int width, int height )
 
     // Is it our immediate child?
 
-    wxSizerItemList::Node   *node = m_children.GetFirst();
+    wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
     while (node)
     {
         wxSizerItem     *item = node->GetData();
@@ -700,7 +708,7 @@ bool wxSizer::DoSetItemMinSize( wxSizer *sizer, int width, int height )
 
     // Is it our immediate child?
 
-    wxSizerItemList::Node   *node = m_children.GetFirst();
+    wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
     while (node)
     {
         wxSizerItem     *item = node->GetData();
@@ -734,7 +742,7 @@ bool wxSizer::DoSetItemMinSize( wxSizer *sizer, int width, int height )
 
 bool wxSizer::DoSetItemMinSize( size_t index, int width, int height )
 {
-    wxSizerItemList::Node   *node = m_children.Item( index );
+    wxSizerItemList::compatibility_iterator node = m_children.Item( index );
 
     wxCHECK_MSG( node, false, _T("Failed to find child node") );
 
@@ -758,7 +766,7 @@ void wxSizer::Show( wxWindow *window, bool show )
 {
     wxASSERT_MSG( window, _T("Show for NULL window") );
 
-    wxSizerItemList::Node   *node = m_children.GetFirst();
+    wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
     while (node)
     {
         wxSizerItem     *item = node->GetData();
@@ -776,7 +784,7 @@ void wxSizer::Show( wxSizer *sizer, bool show )
 {
     wxASSERT_MSG( sizer, _T("Show for NULL sizer") );
 
-    wxSizerItemList::Node   *node = m_children.GetFirst();
+    wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
     while (node)
     {
         wxSizerItem     *item = node->GetData();
@@ -800,7 +808,7 @@ void wxSizer::Show( size_t index, bool show )
 
 void wxSizer::ShowItems( bool show )
 {
-    wxSizerItemList::Node   *node = m_children.GetFirst();
+    wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
     while (node)
     {
         node->GetData()->Show( show );
@@ -810,7 +818,7 @@ void wxSizer::ShowItems( bool show )
 
 bool wxSizer::IsShown( wxWindow *window ) const
 {
-    wxSizerItemList::Node   *node = m_children.GetFirst();
+    wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
     while (node)
     {
         wxSizerItem     *item = node->GetData();
@@ -829,7 +837,7 @@ bool wxSizer::IsShown( wxWindow *window ) const
 
 bool wxSizer::IsShown( wxSizer *sizer ) const
 {
-    wxSizerItemList::Node   *node = m_children.GetFirst();
+    wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
     while (node)
     {
         wxSizerItem     *item = node->GetData();
@@ -923,7 +931,7 @@ void wxGridSizer::RecalcSizes()
             int i = r * ncols + c;
             if (i < nitems)
             {
-                wxSizerItemList::Node   *node = m_children.Item( i );
+                wxSizerItemList::compatibility_iterator node = m_children.Item( i );
 
                 wxASSERT_MSG( node, _T("Failed to find SizerItemList node") );
 
@@ -945,7 +953,7 @@ wxSize wxGridSizer::CalcMin()
     int w = 0;
     int h = 0;
 
-    wxSizerItemList::Node   *node = m_children.GetFirst();
+    wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
     while (node)
     {
         wxSizerItem     *item = node->GetData();
@@ -1136,7 +1144,7 @@ void wxFlexGridSizer::RecalcSizes()
             int i = r * ncols + c;
             if (i < nitems)
             {
-                wxSizerItemList::Node   *node = m_children.Item( i );
+                wxSizerItemList::compatibility_iterator node = m_children.Item( i );
 
                 wxASSERT_MSG( node, _T("Failed to find node") );
 
@@ -1173,7 +1181,7 @@ wxSize wxFlexGridSizer::CalcMin()
     for( s = m_colWidths.GetCount(), i = 0; i < s; ++i )
         m_colWidths[ i ] = -1;
 
-    wxSizerItemList::Node   *node = m_children.GetFirst();
+    wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
 
     i = 0;
     while (node)
@@ -1286,7 +1294,7 @@ void wxBoxSizer::RecalcSizes()
 
     wxPoint pt( m_position );
 
-    wxSizerItemList::Node   *node = m_children.GetFirst();
+    wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
     while (node)
     {
         wxSizerItem     *item = node->GetData();
@@ -1368,7 +1376,7 @@ wxSize wxBoxSizer::CalcMin()
 
     // Find how long each stretch unit needs to be
     int                      stretchSize = 1;
-    wxSizerItemList::Node   *node = m_children.GetFirst();
+    wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
 
     while (node)
     {
@@ -1539,7 +1547,7 @@ wxSize wxNotebookSizer::CalcMin()
     int maxX = 0;
     int maxY = 0;
 
-    wxWindowList::Node *node = m_notebook->GetChildren().GetFirst();
+    wxWindowList::compatibility_iterator node = m_notebook->GetChildren().GetFirst();
     while (node)
     {
         wxWindow *item = node->GetData();
index 6780e01309fd1ecb188158eb2d86c84e07e1e1aa..3867476a71537b658ec772a4d4eb7ad34490e1d2 100644 (file)
@@ -234,7 +234,8 @@ void wxStatusBarBase::FreeStacks()
     {
         if(m_statusTextStacks[i])
         {
-            m_statusTextStacks[i]->Clear();
+            wxListString& t = *m_statusTextStacks[i];
+            WX_CLEAR_LIST(wxListString, t);
             delete m_statusTextStacks[i];
         }
     }
@@ -257,10 +258,11 @@ void wxStatusBarBase::PopStatusText(int number)
 {
     wxListString *st = GetStatusStack(number);
     wxCHECK_RET( st, _T("Unbalanced PushStatusText/PopStatusText") );
-    wxListString::Node *top = st->GetFirst();
+    wxListString::compatibility_iterator top = st->GetFirst();
 
     SetStatusText(*top->GetData(), number);
-    st->DeleteNode(top);
+    delete top->GetData();
+    st->Erase(top);
     if(st->GetCount() == 0)
     {
         delete st;
@@ -288,7 +290,6 @@ wxListString *wxStatusBarBase::GetOrCreateStatusStack(int i)
     if(!m_statusTextStacks[i])
     {
         m_statusTextStacks[i] = new wxListString();
-        m_statusTextStacks[i]->DeleteContents(TRUE);
     }
 
     return m_statusTextStacks[i];
index a187599235a0ad8bbb3dc0fc5eb6900c54ceebaf..636d4133cf32e72c8630b13acf15994be6506dcf 100644 (file)
@@ -125,8 +125,6 @@ wxToolBarToolBase::~wxToolBarToolBase()
 wxToolBarBase::wxToolBarBase()
 {
     // the list owns the pointers
-    m_tools.DeleteContents(TRUE);
-
     m_xMargin = m_yMargin = 0;
 
     m_maxRows = m_maxCols = 0;
@@ -224,7 +222,7 @@ wxToolBarToolBase *wxToolBarBase::InsertControl(size_t pos, wxControl *control)
 
 wxControl *wxToolBarBase::FindControl( int id )
 {
-    for ( wxToolBarToolsList::Node* node = m_tools.GetFirst();
+    for ( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
           node;
           node = node->GetNext() )
     {
@@ -279,7 +277,7 @@ wxToolBarToolBase *wxToolBarBase::InsertSeparator(size_t pos)
 wxToolBarToolBase *wxToolBarBase::RemoveTool(int id)
 {
     size_t pos = 0;
-    wxToolBarToolsList::Node *node;
+    wxToolBarToolsList::compatibility_iterator node;
     for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
     {
         if ( node->GetData()->GetId() == id )
@@ -301,10 +299,7 @@ wxToolBarToolBase *wxToolBarBase::RemoveTool(int id)
         return (wxToolBarToolBase *)NULL;
     }
 
-    // the node would delete the data, so set it to NULL to avoid this
-    node->SetData(NULL);
-
-    m_tools.DeleteNode(node);
+    m_tools.Erase(node);
 
     return tool;
 }
@@ -314,14 +309,15 @@ bool wxToolBarBase::DeleteToolByPos(size_t pos)
     wxCHECK_MSG( pos < GetToolsCount(), FALSE,
                  _T("invalid position in wxToolBar::DeleteToolByPos()") );
 
-    wxToolBarToolsList::Node *node = m_tools.Item(pos);
+    wxToolBarToolsList::compatibility_iterator node = m_tools.Item(pos);
 
     if ( !DoDeleteTool(pos, node->GetData()) )
     {
         return FALSE;
     }
 
-    m_tools.DeleteNode(node);
+    delete node->GetData();
+    m_tools.Erase(node);
 
     return TRUE;
 }
@@ -329,7 +325,7 @@ bool wxToolBarBase::DeleteToolByPos(size_t pos)
 bool wxToolBarBase::DeleteTool(int id)
 {
     size_t pos = 0;
-    wxToolBarToolsList::Node *node;
+    wxToolBarToolsList::compatibility_iterator node;
     for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
     {
         if ( node->GetData()->GetId() == id )
@@ -343,7 +339,8 @@ bool wxToolBarBase::DeleteTool(int id)
         return FALSE;
     }
 
-    m_tools.DeleteNode(node);
+    delete node->GetData();
+    m_tools.Erase(node);
 
     return TRUE;
 }
@@ -352,7 +349,7 @@ wxToolBarToolBase *wxToolBarBase::FindById(int id) const
 {
     wxToolBarToolBase *tool = (wxToolBarToolBase *)NULL;
 
-    for ( wxToolBarToolsList::Node *node = m_tools.GetFirst();
+    for ( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
           node;
           node = node->GetNext() )
     {
@@ -371,7 +368,7 @@ wxToolBarToolBase *wxToolBarBase::FindById(int id) const
 
 void wxToolBarBase::ClearTools()
 {
-    m_tools.Clear();
+    WX_CLEAR_LIST(wxToolBarToolsList, m_tools);
 }
 
 bool wxToolBarBase::Realize()
@@ -381,6 +378,7 @@ bool wxToolBarBase::Realize()
 
 wxToolBarBase::~wxToolBarBase()
 {
+    WX_CLEAR_LIST(wxToolBarToolsList, m_tools);
 }
 
 // ----------------------------------------------------------------------------
@@ -460,7 +458,7 @@ void wxToolBarBase::SetToolClientData(int id, wxObject *clientData)
 int wxToolBarBase::GetToolPos(int id) const
 {
     size_t pos = 0;
-    wxToolBarToolsList::Node *node;
+    wxToolBarToolsList::compatibility_iterator node;
 
     for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
     {
@@ -587,7 +585,7 @@ void wxToolBarBase::UpdateWindowUI(long flags)
 
     wxEvtHandler* evtHandler = GetEventHandler() ;
 
-    for ( wxToolBarToolsList::Node* node = m_tools.GetFirst();
+    for ( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
           node;
           node = node->GetNext() )
     {
index 8768de7360de4fe2f0f4de89663baaaf7637f137..d5d6bb27fef822d8c7a39a92f51b11b5c19bdc0c 100644 (file)
@@ -161,7 +161,7 @@ void wxTopLevelWindowBase::OnSize(wxSizeEvent& WXUNUSED(event))
     {
         // do we have _exactly_ one child?
         wxWindow *child = (wxWindow *)NULL;
-        for ( wxWindowList::Node *node = GetChildren().GetFirst();
+        for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
               node;
               node = node->GetNext() )
         {
index 90627aa28dc393b2e088dab9ac66a9098f208aaf..35b661342152f1fbe8368d0d28e78f1c63db8a44 100644 (file)
@@ -73,20 +73,9 @@ bool wxTextValidator::Copy(const wxTextValidator& val)
     m_validatorStyle = val.m_validatorStyle ;
     m_stringValue = val.m_stringValue ;
 
-    wxStringList::Node *node = val.m_includeList.GetFirst() ;
-    while ( node )
-    {
-        wxChar *s = node->GetData();
-        m_includeList.Add(s);
-        node = node->GetNext();
-    }
-    node = val.m_excludeList.GetFirst() ;
-    while ( node )
-    {
-        wxChar *s = node->GetData();
-        m_excludeList.Add(s);
-        node = node->GetNext();
-    }
+    m_includeList = val.m_includeList;
+    m_excludeList = val.m_excludeList;
+    
     return TRUE;
 }
 
@@ -232,38 +221,12 @@ bool wxTextValidator::TransferFromWindow(void)
 
 void wxTextValidator::SetIncludeList(const wxStringList& list)
 {
-/*
-    if ( !M_VTEXTDATA )
-        return;
-*/
-
-    m_includeList.Clear();
-    // TODO: replace with =
-    wxStringList::Node     *node = list.GetFirst();
-    while ( node )
-    {
-        wxChar *s = node->GetData();
-        m_includeList.Add(s);
-        node = node->GetNext();
-    }
+    m_includeList = list;
 }
 
 void wxTextValidator::SetExcludeList(const wxStringList& list)
 {
-/*
-    if ( !M_VTEXTDATA )
-        return;
-*/
-
-    m_excludeList.Clear();
-    // TODO: replace with =
-    wxStringList::Node  *node = list.GetFirst() ;
-    while ( node )
-    {
-        wxChar *s = node->GetData();
-        m_excludeList.Add(s);
-        node = node->GetNext();
-    }
+    m_excludeList = list;
 }
 
 void wxTextValidator::OnChar(wxKeyEvent& event)
index 61402fabf07df6ae8a03f26cfd473fc83ee13881..6cc620cf4faaaf6c6aa3a2f240e7ad6840ffca2a 100644 (file)
@@ -114,7 +114,6 @@ void wxWindowBase::InitBase()
     // no window yet, no parent nor children
     m_parent = (wxWindow *)NULL;
     m_windowId = -1;
-    m_children.DeleteContents( FALSE ); // don't auto delete node data
 
     // no constraints on the minimal window size
     m_minWidth =
@@ -263,7 +262,7 @@ wxWindowBase::~wxWindowBase()
 
     // Just in case we've loaded a top-level window via LoadNativeDialog but
     // we weren't a dialog class
-    wxTopLevelWindows.DeleteObject(this);
+    wxTopLevelWindows.DeleteObject((wxWindow*)this);
 
     wxASSERT_MSG( GetChildren().GetCount() == 0, wxT("children not destroyed") );
 
@@ -344,7 +343,7 @@ bool wxWindowBase::Close(bool force)
 
 bool wxWindowBase::DestroyChildren()
 {
-    wxWindowList::Node *node;
+    wxWindowList::compatibility_iterator node;
     for ( ;; )
     {
         // we iterate until the list becomes empty
@@ -520,7 +519,7 @@ wxSize wxWindowBase::DoGetBestSize() const
         int maxX = 0,
             maxY = 0;
 
-        for ( wxWindowList::Node *node = GetChildren().GetFirst();
+        for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
               node;
               node = node->GetNext() )
         {
@@ -554,7 +553,7 @@ wxSize wxWindowBase::DoGetBestSize() const
         int maxX = 0,
             maxY = 0;
 
-        for ( wxWindowList::Node *node = GetChildren().GetFirst();
+        for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
               node;
               node = node->GetNext() )
         {
@@ -708,9 +707,9 @@ void wxWindowBase::AddChild(wxWindowBase *child)
     // this should never happen and it will lead to a crash later if it does
     // because RemoveChild() will remove only one node from the children list
     // and the other(s) one(s) will be left with dangling pointers in them
-    wxASSERT_MSG( !GetChildren().Find(child), _T("AddChild() called twice") );
+    wxASSERT_MSG( !GetChildren().Find((wxWindow*)child), _T("AddChild() called twice") );
 
-    GetChildren().Append(child);
+    GetChildren().Append((wxWindow*)child);
     child->SetParent(this);
 }
 
@@ -718,8 +717,8 @@ void wxWindowBase::RemoveChild(wxWindowBase *child)
 {
     wxCHECK_RET( child, wxT("can't remove a NULL child") );
 
-    GetChildren().DeleteObject(child);
-    child->SetParent((wxWindow *)NULL);
+    GetChildren().DeleteObject((wxWindow *)child);
+    child->SetParent(NULL);
 }
 
 bool wxWindowBase::Reparent(wxWindowBase *newParent)
@@ -738,7 +737,7 @@ bool wxWindowBase::Reparent(wxWindowBase *newParent)
     }
     else
     {
-        wxTopLevelWindows.DeleteObject(this);
+        wxTopLevelWindows.DeleteObject((wxWindow *)this);
     }
 
     // add it to the new one
@@ -748,7 +747,7 @@ bool wxWindowBase::Reparent(wxWindowBase *newParent)
     }
     else
     {
-        wxTopLevelWindows.Append(this);
+        wxTopLevelWindows.Append((wxWindow *)this);
     }
 
     return TRUE;
@@ -988,7 +987,7 @@ wxWindow *wxWindowBase::FindWindow( long id )
         return (wxWindow *)this;
 
     wxWindowBase *res = (wxWindow *)NULL;
-    wxWindowList::Node *node;
+    wxWindowList::compatibility_iterator node;
     for ( node = m_children.GetFirst(); node && !res; node = node->GetNext() )
     {
         wxWindowBase *child = node->GetData();
@@ -1004,7 +1003,7 @@ wxWindow *wxWindowBase::FindWindow( const wxString& name )
         return (wxWindow *)this;
 
     wxWindowBase *res = (wxWindow *)NULL;
-    wxWindowList::Node *node;
+    wxWindowList::compatibility_iterator node;
     for ( node = m_children.GetFirst(); node && !res; node = node->GetNext() )
     {
         wxWindow *child = node->GetData();
@@ -1060,7 +1059,7 @@ wxWindow *wxFindWindowRecursively(const wxWindow *parent,
             return (wxWindow *)parent;
 
         // It wasn't, so check all its children
-        for ( wxWindowList::Node * node = parent->GetChildren().GetFirst();
+        for ( wxWindowList::compatibility_iterator node = parent->GetChildren().GetFirst();
               node;
               node = node->GetNext() )
         {
@@ -1090,7 +1089,7 @@ wxWindow *wxFindWindowHelper(const wxWindow *parent,
     }
 
     // start at very top of wx's windows
-    for ( wxWindowList::Node * node = wxTopLevelWindows.GetFirst();
+    for ( wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
           node;
           node = node->GetNext() )
     {
@@ -1142,7 +1141,7 @@ void wxWindowBase::MakeModal(bool modal)
     // Disable all other windows
     if ( IsTopLevel() )
     {
-        wxWindowList::Node *node = wxTopLevelWindows.GetFirst();
+        wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
         while (node)
         {
             wxWindow *win = node->GetData();
@@ -1159,7 +1158,7 @@ bool wxWindowBase::Validate()
 #if wxUSE_VALIDATORS
     bool recurse = (GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY) != 0;
 
-    wxWindowList::Node *node;
+    wxWindowList::compatibility_iterator node;
     for ( node = m_children.GetFirst(); node; node = node->GetNext() )
     {
         wxWindowBase *child = node->GetData();
@@ -1184,7 +1183,7 @@ bool wxWindowBase::TransferDataToWindow()
 #if wxUSE_VALIDATORS
     bool recurse = (GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY) != 0;
 
-    wxWindowList::Node *node;
+    wxWindowList::compatibility_iterator node;
     for ( node = m_children.GetFirst(); node; node = node->GetNext() )
     {
         wxWindowBase *child = node->GetData();
@@ -1218,7 +1217,7 @@ bool wxWindowBase::TransferDataFromWindow()
 #if wxUSE_VALIDATORS
     bool recurse = (GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY) != 0;
 
-    wxWindowList::Node *node;
+    wxWindowList::compatibility_iterator node;
     for ( node = m_children.GetFirst(); node; node = node->GetNext() )
     {
         wxWindow *child = node->GetData();
@@ -1409,15 +1408,15 @@ void wxWindowBase::AddConstraintReference(wxWindowBase *otherWin)
 {
     if ( !m_constraintsInvolvedIn )
         m_constraintsInvolvedIn = new wxWindowList;
-    if ( !m_constraintsInvolvedIn->Find(otherWin) )
-        m_constraintsInvolvedIn->Append(otherWin);
+    if ( !m_constraintsInvolvedIn->Find((wxWindow *)otherWin) )
+        m_constraintsInvolvedIn->Append((wxWindow *)otherWin);
 }
 
 // REMOVE back-pointer to other windows we're involved with.
 void wxWindowBase::RemoveConstraintReference(wxWindowBase *otherWin)
 {
     if ( m_constraintsInvolvedIn )
-        m_constraintsInvolvedIn->DeleteObject(otherWin);
+        m_constraintsInvolvedIn->DeleteObject((wxWindow *)otherWin);
 }
 
 // Reset any constraints that mention this window
@@ -1425,7 +1424,7 @@ void wxWindowBase::DeleteRelatedConstraints()
 {
     if ( m_constraintsInvolvedIn )
     {
-        wxWindowList::Node *node = m_constraintsInvolvedIn->GetFirst();
+        wxWindowList::compatibility_iterator node = m_constraintsInvolvedIn->GetFirst();
         while (node)
         {
             wxWindow *win = node->GetData();
@@ -1444,8 +1443,8 @@ void wxWindowBase::DeleteRelatedConstraints()
                 constr->centreY.ResetIfWin(this);
             }
 
-            wxWindowList::Node *next = node->GetNext();
-            delete node;
+            wxWindowList::compatibility_iterator next = node->GetNext();
+            m_constraintsInvolvedIn->Erase(node);
             node = next;
         }
 
@@ -1559,7 +1558,7 @@ bool wxWindowBase::DoPhase(int phase)
         int noChanges = 0;
 
         // loop over all children setting their constraints
-        for ( wxWindowList::Node *node = GetChildren().GetFirst();
+        for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
               node;
               node = node->GetNext() )
         {
@@ -1612,7 +1611,7 @@ void wxWindowBase::ResetConstraints()
         constr->centreY.SetDone(FALSE);
     }
 
-    wxWindowList::Node *node = GetChildren().GetFirst();
+    wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
     while (node)
     {
         wxWindow *win = node->GetData();
@@ -1654,7 +1653,7 @@ void wxWindowBase::SetConstraintSizes(bool recurse)
 
     if ( recurse )
     {
-        wxWindowList::Node *node = GetChildren().GetFirst();
+        wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
         while (node)
         {
             wxWindow *win = node->GetData();
@@ -1782,7 +1781,7 @@ void wxWindowBase::UpdateWindowUI(long flags)
 
     if (flags & wxUPDATE_UI_RECURSE)
     {
-        wxWindowList::Node* node = GetChildren().GetFirst();
+        wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
         while (node)
         {
             wxWindow* child = (wxWindow*) node->GetData();
@@ -1836,7 +1835,7 @@ void wxWindowBase::ProcessInternalIdle()
 {
     OnInternalIdle();
 
-    wxWindowList::Node  *node = GetChildren().GetFirst();
+    wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
     while (node)
     {
         wxWindow *child = node->GetData();
@@ -1882,7 +1881,7 @@ wxPoint wxWindowBase::ConvertDialogToPixels(const wxPoint& pt)
 // propagate the colour change event to the subwindows
 void wxWindowBase::OnSysColourChanged(wxSysColourChangedEvent& event)
 {
-    wxWindowList::Node *node = GetChildren().GetFirst();
+    wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
     while ( node )
     {
         // Only propagate to non-top-level windows
@@ -2004,6 +2003,7 @@ wxAccessible* wxWindowBase::CreateAccessible()
 
 #endif
 
+#if !wxUSE_STL
 // ----------------------------------------------------------------------------
 // list classes implementation
 // ----------------------------------------------------------------------------
@@ -2012,6 +2012,7 @@ void wxWindowListNode::DeleteData()
 {
     delete (wxWindow *)GetData();
 }
+#endif
 
 // ----------------------------------------------------------------------------
 // borders
@@ -2271,7 +2272,7 @@ wxAccStatus wxWindowAccessible::Navigate(wxNavDir navDir, int fromId,
     case wxNAVDIR_DOWN:
     case wxNAVDIR_NEXT:
         {
-            wxWindowList::Node *node = NULL;
+            wxWindowList::compatibility_iterator node = NULL;
             if (fromId == 0)
             {
                 // Can't navigate to sibling of this window
@@ -2284,7 +2285,7 @@ wxAccStatus wxWindowAccessible::Navigate(wxNavDir navDir, int fromId,
             else
             {
                 if (fromId <= (int) GetWindow()->GetChildren().GetCount())
-                    node = (wxWindowList::Node*) GetWindow()->GetChildren().Nth(fromId-1);
+                    node = GetWindow()->GetChildren().Nth(fromId-1);
             }
 
             if (node && node->GetNext())
@@ -2300,7 +2301,7 @@ wxAccStatus wxWindowAccessible::Navigate(wxNavDir navDir, int fromId,
     case wxNAVDIR_UP:
     case wxNAVDIR_PREVIOUS:
         {
-            wxWindowList::Node *node = NULL;
+            wxWindowList::compatibility_iterator node = NULL;
             if (fromId == 0)
             {
                 // Can't navigate to sibling of this window
@@ -2313,7 +2314,7 @@ wxAccStatus wxWindowAccessible::Navigate(wxNavDir navDir, int fromId,
             else
             {
                 if (fromId <= (int) GetWindow()->GetChildren().GetCount())
-                    node = (wxWindowList::Node*) GetWindow()->GetChildren().Nth(fromId-1);
+                    node = GetWindow()->GetChildren().Nth(fromId-1);
             }
 
             if (node && node->GetPrevious())
index bede8f488c4f5e5ef0c189cd26a7a97d334c11fd..edf52970cde2e3d060a8515415d1e26258afa0b0 100644 (file)
@@ -55,16 +55,19 @@ class wxAccelRefData : public wxObjectRefData
 public:
     wxAccelRefData()
     {
-        m_accels.DeleteContents(TRUE);
     }
 
     wxAccelRefData(const wxAccelRefData& data)
         : wxObjectRefData()
     {
-        m_accels.DeleteContents(TRUE);
         m_accels = data.m_accels;
     }
 
+    virtual ~wxAccelRefData()
+    {
+        WX_CLEAR_LIST(wxAccelList, m_accels);
+    }
+
     wxAccelList m_accels;
 };
 
@@ -133,14 +136,15 @@ void wxAcceleratorTable::Remove(const wxAcceleratorEntry& entry)
 {
     AllocExclusive();
 
-    wxAccelList::Node *node = M_ACCELDATA->m_accels.GetFirst();
+    wxAccelList::compatibility_iterator node = M_ACCELDATA->m_accels.GetFirst();
     while ( node )
     {
         const wxAcceleratorEntry *entryCur = node->GetData();
 
         if ( *entryCur == entry )
         {
-            M_ACCELDATA->m_accels.DeleteNode(node);
+            delete node->GetData();
+            M_ACCELDATA->m_accels.Erase(node);
 
             return;
         }
@@ -164,7 +168,7 @@ wxAcceleratorTable::GetEntry(const wxKeyEvent& event) const
         return NULL;
     }
 
-    wxAccelList::Node *node = M_ACCELDATA->m_accels.GetFirst();
+    wxAccelList::compatibility_iterator node = M_ACCELDATA->m_accels.GetFirst();
     while ( node )
     {
         const wxAcceleratorEntry *entry = node->GetData();
index c8d9cebdc09a2b6dc77cbf90150134d1630e3b0d..5b5ad1c2f743b1af51d20a26f2a8fdf7ae2b7236 100644 (file)
@@ -1564,7 +1564,7 @@ void wxPostScriptDC::DoDrawSpline( wxList *points )
     double a, b, c, d, x1, y1, x2, y2, x3, y3;
     wxPoint *p, *q;
 
-    wxNode *node = points->GetFirst();
+    wxList::compatibility_iterator node = points->GetFirst();
     p = (wxPoint *)node->GetData();
     x1 = p->x;
     y1 = p->y;
@@ -1586,7 +1586,7 @@ void wxPostScriptDC::DoDrawSpline( wxList *points )
     CalcBoundingBox( (wxCoord)x1, (wxCoord)y1 );
     CalcBoundingBox( (wxCoord)x3, (wxCoord)y3 );
 
-    while ((node = node->GetNext()) != NULL)
+    while ((node = node->GetNext()))
     {
         q = (wxPoint *)node->GetData();
 
index e6a1c6822eb854cfdc88f8bfc0eaf653e7b53aa9..045fa1b2b9d50a2c4fe2e7b2e012be061f9a2cab 100644 (file)
@@ -354,11 +354,8 @@ bool wxIsDriveAvailable(const wxString& dirName)
 
 // Function which is called by quick sort. We want to override the default wxArrayString behaviour,
 // and sort regardless of case.
-static int LINKAGEMODE wxDirCtrlStringCompareFunction(const void *first, const void *second)
+static int LINKAGEMODE wxDirCtrlStringCompareFunction(wxString* strFirst, wxString* strSecond)
 {
-    wxString *strFirst = (wxString *)first;
-    wxString *strSecond = (wxString *)second;
-
     return strFirst->CmpNoCase(*strSecond);
 }
 
@@ -725,7 +722,7 @@ void wxGenericDirCtrl::ExpandDir(wxTreeItemId parentId)
             while (d.GetNext(& eachFilename));
         }
     }
-    dirs.Sort((wxArrayString::CompareFunction) wxDirCtrlStringCompareFunction);
+    dirs.Sort(wxDirCtrlStringCompareFunction);
 
     // Now do the filenames -- but only if we're allowed to
     if ((GetWindowStyle() & wxDIRCTRL_DIR_ONLY) == 0)
@@ -748,7 +745,7 @@ void wxGenericDirCtrl::ExpandDir(wxTreeItemId parentId)
                 while (d.GetNext(& eachFilename));
             }
         }
-        filenames.Sort((wxArrayString::CompareFunction) wxDirCtrlStringCompareFunction);
+        filenames.Sort(wxDirCtrlStringCompareFunction);
     }
 
     // Add the sorted dirs
@@ -1369,7 +1366,11 @@ wxFileIconsTable::wxFileIconsTable()
 
 wxFileIconsTable::~wxFileIconsTable()
 {
-    if (m_HashTable) delete m_HashTable;
+    if (m_HashTable)
+    {
+        WX_CLEAR_HASH_TABLE(*m_HashTable);
+        delete m_HashTable;
+    }
     if (m_smallImageList) delete m_smallImageList;
 }
 
@@ -1380,7 +1381,6 @@ void wxFileIconsTable::Create()
     m_HashTable = new wxHashTable(wxKEY_STRING);
     m_smallImageList = new wxImageList(16, 16);
 
-    m_HashTable->DeleteContents(TRUE);
     // folder:
     m_smallImageList->Add(wxArtProvider::GetBitmap(wxART_FOLDER, wxART_CMN_DIALOG));
     // folder_open
@@ -1401,6 +1401,7 @@ void wxFileIconsTable::Create()
     if (GetIconID(wxEmptyString, _T("application/x-executable")) == file)
     {
         m_smallImageList->Add(wxArtProvider::GetBitmap(wxART_EXECUTABLE_FILE, wxART_CMN_DIALOG));
+        delete m_HashTable->Get(_T("exe"));
         m_HashTable->Delete(_T("exe"));
         m_HashTable->Put(_T("exe"), new wxFileIconEntry(executable));
     }
index aa0e88d75652ccdfeedbb4676c0431264f99bc79..18a0f826ffdfd0e078a776e77eddf3bede7df91f 100644 (file)
@@ -62,7 +62,6 @@ bool wxGenericImageList::Create( int width, int height, bool WXUNUSED(mask), int
 
 bool wxGenericImageList::Create()
 {
-    m_images.DeleteContents( TRUE );
     return TRUE;
 }
 
@@ -92,7 +91,7 @@ int wxGenericImageList::Add( const wxBitmap& bitmap, const wxColour& maskColour
 
 const wxBitmap *wxGenericImageList::GetBitmap( int index ) const
 {
-    wxNode *node = m_images.Item( index );
+    wxList::compatibility_iterator node = m_images.Item( index );
 
     wxCHECK_MSG( node, (wxBitmap *) NULL, wxT("wrong index in image list") );
 
@@ -101,7 +100,7 @@ const wxBitmap *wxGenericImageList::GetBitmap( int index ) const
 
 bool wxGenericImageList::Replace( int index, const wxBitmap &bitmap )
 {
-    wxNode *node = m_images.Item( index );
+    wxList::compatibility_iterator node = m_images.Item( index );
 
     wxCHECK_MSG( node, FALSE, wxT("wrong index in image list") );
 
@@ -119,13 +118,15 @@ bool wxGenericImageList::Replace( int index, const wxBitmap &bitmap )
 
     if (index == (int) m_images.GetCount() - 1)
     {
-        m_images.DeleteNode( node );
+        delete node->GetData();
+        m_images.Erase( node );
         m_images.Append( newBitmap );
     }
     else
     {
-        wxNode *next = node->GetNext();
-        m_images.DeleteNode( node );
+        wxList::compatibility_iterator next = node->GetNext();
+        delete node->GetData();
+        m_images.Erase( node );
         m_images.Insert( next, newBitmap );
     }
 
@@ -134,17 +135,19 @@ bool wxGenericImageList::Replace( int index, const wxBitmap &bitmap )
 
 bool wxGenericImageList::Remove( int index )
 {
-    wxNode *node = m_images.Item( index );
+    wxList::compatibility_iterator node = m_images.Item( index );
 
     wxCHECK_MSG( node, FALSE, wxT("wrong index in image list") );
 
-    m_images.DeleteNode( node );
+    delete node->GetData();
+    m_images.Erase( node );
 
     return TRUE;
 }
 
 bool wxGenericImageList::RemoveAll()
 {
+    WX_CLEAR_LIST(wxList, m_images);
     m_images.Clear();
 
     return TRUE;
@@ -155,7 +158,7 @@ bool wxGenericImageList::GetSize( int index, int &width, int &height ) const
     width = 0;
     height = 0;
 
-    wxNode *node = m_images.Item( index );
+    wxList::compatibility_iterator node = m_images.Item( index );
 
     wxCHECK_MSG( node, FALSE, wxT("wrong index in image list") );
 
@@ -169,7 +172,7 @@ bool wxGenericImageList::GetSize( int index, int &width, int &height ) const
 bool wxGenericImageList::Draw( int index, wxDC &dc, int x, int y,
                         int flags, bool WXUNUSED(solidBackground) )
 {
-    wxNode *node = m_images.Item( index );
+    wxList::compatibility_iterator node = m_images.Item( index );
 
     wxCHECK_MSG( node, FALSE, wxT("wrong index in image list") );
 
index 943351d8e6cbd49f66d5e83f6f98e76964a0703c..e32bb52e57b1061175021b667dd90d47da047fe1 100644 (file)
@@ -195,7 +195,7 @@ bool wxLayoutAlgorithm::LayoutMDIFrame(wxMDIParentFrame* frame, wxRect* r)
     wxCalculateLayoutEvent event;
     event.SetRect(rect);
 
-    wxWindowList::Node *node = frame->GetChildren().GetFirst();
+    wxWindowList::compatibility_iterator node = frame->GetChildren().GetFirst();
     while (node)
     {
         wxWindow* win = node->GetData();
@@ -264,7 +264,7 @@ bool wxLayoutAlgorithm::LayoutWindow(wxWindow* parent, wxWindow* mainWindow)
     // Find the last layout-aware window, so we can make it fill all remaining
     // space.
     wxWindow           *lastAwareWindow = NULL;
-    wxWindowList::Node *node = parent->GetChildren().GetFirst();
+    wxWindowList::compatibility_iterator node = parent->GetChildren().GetFirst();
 
     while (node)
     {
index cb767bfccc84961864a4d1320a3e3d2983d83d75..704fb6e867d9f13379ca1816dc668e0d1023a347 100644 (file)
@@ -289,7 +289,11 @@ public:
 public:
     wxListLineData(wxListMainWindow *owner);
 
-    ~wxListLineData() { delete m_gi; }
+    ~wxListLineData()
+    {
+        WX_CLEAR_LIST(wxListItemDataList, m_items);
+        delete m_gi;
+    }
 
     // are we in report mode?
     inline bool InReportView() const;
@@ -1090,7 +1094,6 @@ inline bool wxListLineData::IsVirtual() const
 wxListLineData::wxListLineData( wxListMainWindow *owner )
 {
     m_owner = owner;
-    m_items.DeleteContents( TRUE );
 
     if ( InReportView() )
     {
@@ -1108,7 +1111,7 @@ wxListLineData::wxListLineData( wxListMainWindow *owner )
 
 void wxListLineData::CalculateSize( wxDC *dc, int spacing )
 {
-    wxListItemDataList::Node *node = m_items.GetFirst();
+    wxListItemDataList::compatibility_iterator node = m_items.GetFirst();
     wxCHECK_RET( node, _T("no subitems at all??") );
 
     wxListItemData *item = node->GetData();
@@ -1218,7 +1221,7 @@ void wxListLineData::SetPosition( int x, int y,
                                   int window_width,
                                   int spacing )
 {
-    wxListItemDataList::Node *node = m_items.GetFirst();
+    wxListItemDataList::compatibility_iterator node = m_items.GetFirst();
     wxCHECK_RET( node, _T("no subitems at all??") );
 
     wxListItemData *item = node->GetData();
@@ -1291,7 +1294,7 @@ void wxListLineData::InitItems( int num )
 
 void wxListLineData::SetItem( int index, const wxListItem &info )
 {
-    wxListItemDataList::Node *node = m_items.Item( index );
+    wxListItemDataList::compatibility_iterator node = m_items.Item( index );
     wxCHECK_RET( node, _T("invalid column index in SetItem") );
 
     wxListItemData *item = node->GetData();
@@ -1300,7 +1303,7 @@ void wxListLineData::SetItem( int index, const wxListItem &info )
 
 void wxListLineData::GetItem( int index, wxListItem &info )
 {
-    wxListItemDataList::Node *node = m_items.Item( index );
+    wxListItemDataList::compatibility_iterator node = m_items.Item( index );
     if (node)
     {
         wxListItemData *item = node->GetData();
@@ -1312,7 +1315,7 @@ wxString wxListLineData::GetText(int index) const
 {
     wxString s;
 
-    wxListItemDataList::Node *node = m_items.Item( index );
+    wxListItemDataList::compatibility_iterator node = m_items.Item( index );
     if (node)
     {
         wxListItemData *item = node->GetData();
@@ -1324,7 +1327,7 @@ wxString wxListLineData::GetText(int index) const
 
 void wxListLineData::SetText( int index, const wxString s )
 {
-    wxListItemDataList::Node *node = m_items.Item( index );
+    wxListItemDataList::compatibility_iterator node = m_items.Item( index );
     if (node)
     {
         wxListItemData *item = node->GetData();
@@ -1334,7 +1337,7 @@ void wxListLineData::SetText( int index, const wxString s )
 
 void wxListLineData::SetImage( int index, int image )
 {
-    wxListItemDataList::Node *node = m_items.Item( index );
+    wxListItemDataList::compatibility_iterator node = m_items.Item( index );
     wxCHECK_RET( node, _T("invalid column index in SetImage()") );
 
     wxListItemData *item = node->GetData();
@@ -1343,7 +1346,7 @@ void wxListLineData::SetImage( int index, int image )
 
 int wxListLineData::GetImage( int index ) const
 {
-    wxListItemDataList::Node *node = m_items.Item( index );
+    wxListItemDataList::compatibility_iterator node = m_items.Item( index );
     wxCHECK_MSG( node, -1, _T("invalid column index in GetImage()") );
 
     wxListItemData *item = node->GetData();
@@ -1352,7 +1355,7 @@ int wxListLineData::GetImage( int index ) const
 
 wxListItemAttr *wxListLineData::GetAttr() const
 {
-    wxListItemDataList::Node *node = m_items.GetFirst();
+    wxListItemDataList::compatibility_iterator node = m_items.GetFirst();
     wxCHECK_MSG( node, NULL, _T("invalid column index in GetAttr()") );
 
     wxListItemData *item = node->GetData();
@@ -1361,7 +1364,7 @@ wxListItemAttr *wxListLineData::GetAttr() const
 
 void wxListLineData::SetAttr(wxListItemAttr *attr)
 {
-    wxListItemDataList::Node *node = m_items.GetFirst();
+    wxListItemDataList::compatibility_iterator node = m_items.GetFirst();
     wxCHECK_RET( node, _T("invalid column index in SetAttr()") );
 
     wxListItemData *item = node->GetData();
@@ -1434,7 +1437,7 @@ bool wxListLineData::SetAttributes(wxDC *dc,
 
 void wxListLineData::Draw( wxDC *dc )
 {
-    wxListItemDataList::Node *node = m_items.GetFirst();
+    wxListItemDataList::compatibility_iterator node = m_items.GetFirst();
     wxCHECK_RET( node, _T("no subitems at all??") );
 
     bool highlighted = IsHighlighted();
@@ -1481,7 +1484,7 @@ void wxListLineData::DrawInReportMode( wxDC *dc,
             y = rect.y + (LINE_SPACING + EXTRA_HEIGHT) / 2;
 
     size_t col = 0;
-    for ( wxListItemDataList::Node *node = m_items.GetFirst();
+    for ( wxListItemDataList::compatibility_iterator node = m_items.GetFirst();
           node;
           node = node->GetNext(), col++ )
     {
@@ -2169,7 +2172,6 @@ END_EVENT_TABLE()
 
 void wxListMainWindow::Init()
 {
-    m_columns.DeleteContents( TRUE );
     m_dirty = TRUE;
     m_countVirt = 0;
     m_lineFrom =
@@ -2265,6 +2267,7 @@ wxListMainWindow::wxListMainWindow( wxWindow *parent,
 wxListMainWindow::~wxListMainWindow()
 {
     DoDeleteAllItems();
+    WX_CLEAR_LIST(wxListHeaderDataList, m_columns);
 
     delete m_highlightBrush;
     delete m_highlightUnfocusedBrush;
@@ -3506,7 +3509,7 @@ int wxListMainWindow::GetItemSpacing( bool isSmall )
 
 void wxListMainWindow::SetColumn( int col, wxListItem &item )
 {
-    wxListHeaderDataList::Node *node = m_columns.Item( col );
+    wxListHeaderDataList::compatibility_iterator node = m_columns.Item( col );
 
     wxCHECK_RET( node, _T("invalid column index in SetColumn") );
 
@@ -3539,7 +3542,7 @@ void wxListMainWindow::SetColumnWidth( int col, int width )
     if ( headerWin )
         headerWin->m_dirty = TRUE;
 
-    wxListHeaderDataList::Node *node = m_columns.Item( col );
+    wxListHeaderDataList::compatibility_iterator node = m_columns.Item( col );
     wxCHECK_RET( node, _T("no column?") );
 
     wxListHeaderData *column = node->GetData();
@@ -3567,7 +3570,7 @@ void wxListMainWindow::SetColumnWidth( int col, int width )
             for ( size_t i = 0; i < count; i++ )
             {
                 wxListLineData *line = GetLine(i);
-                wxListItemDataList::Node *n = line->m_items.Item( col );
+                wxListItemDataList::compatibility_iterator n = line->m_items.Item( col );
 
                 wxCHECK_RET( n, _T("no subitem?") );
 
@@ -3620,7 +3623,7 @@ int wxListMainWindow::GetHeaderWidth() const
 
 void wxListMainWindow::GetColumn( int col, wxListItem &item ) const
 {
-    wxListHeaderDataList::Node *node = m_columns.Item( col );
+    wxListHeaderDataList::compatibility_iterator node = m_columns.Item( col );
     wxCHECK_RET( node, _T("invalid column index in GetColumn") );
 
     wxListHeaderData *column = node->GetData();
@@ -3629,7 +3632,7 @@ void wxListMainWindow::GetColumn( int col, wxListItem &item ) const
 
 int wxListMainWindow::GetColumnWidth( int col ) const
 {
-    wxListHeaderDataList::Node *node = m_columns.Item( col );
+    wxListHeaderDataList::compatibility_iterator node = m_columns.Item( col );
     wxCHECK_MSG( node, 0, _T("invalid column index") );
 
     wxListHeaderData *column = node->GetData();
@@ -4106,12 +4109,13 @@ void wxListMainWindow::DeleteItem( long lindex )
 
 void wxListMainWindow::DeleteColumn( int col )
 {
-    wxListHeaderDataList::Node *node = m_columns.Item( col );
+    wxListHeaderDataList::compatibility_iterator node = m_columns.Item( col );
 
     wxCHECK_RET( node, wxT("invalid column index in DeleteColumn()") );
 
     m_dirty = TRUE;
-    m_columns.DeleteNode( node );
+    delete node->GetData();
+    m_columns.Erase( node );
 
     if ( !IsVirtual() )
     {
@@ -4119,8 +4123,9 @@ void wxListMainWindow::DeleteColumn( int col )
         for ( size_t i = 0; i < m_lines.GetCount(); i++ )
         {
             wxListLineData * const line = GetLine(i);
-            wxListItemDataList::Node *n = line->m_items.Item( col );
-            line->m_items.DeleteNode(n);
+            wxListItemDataList::compatibility_iterator n = line->m_items.Item( col );
+            delete n->GetData();
+            line->m_items.Erase(n);
         }
     }
 
@@ -4171,7 +4176,7 @@ void wxListMainWindow::DeleteAllItems()
 
 void wxListMainWindow::DeleteEverything()
 {
-    m_columns.Clear();
+    WX_CLEAR_LIST(wxListHeaderDataList, m_columns);
 
     DeleteAllItems();
 }
@@ -4321,7 +4326,7 @@ void wxListMainWindow::InsertColumn( long col, wxListItem &item )
         bool insert = (col >= 0) && ((size_t)col < m_columns.GetCount());
         if ( insert )
         {
-            wxListHeaderDataList::Node *node = m_columns.Item( col );
+            wxListHeaderDataList::compatibility_iterator node = m_columns.Item( col );
             m_columns.Insert( node, column );
         }
         else
index 38dd0fdfee1d99dac7f4c8bc1cb990b911a03e26..49cb50fb98f969aa2e5657732aff48ff9912f147 100644 (file)
@@ -503,7 +503,7 @@ bool wxGenericPrintSetupDialog::TransferDataFromWindow()
         int selectedItem = m_paperTypeChoice->GetSelection();
         if (selectedItem != -1)
         {
-            wxPrintPaperType *paper = (wxPrintPaperType*)wxThePrintPaperDatabase->Item(selectedItem)->GetData();
+            wxPrintPaperType *paper = wxThePrintPaperDatabase->Item(selectedItem);
             if (paper != NULL)
               m_printData.SetPaperId( paper->GetId());
         }
@@ -527,7 +527,7 @@ wxComboBox *wxGenericPrintSetupDialog::CreatePaperTypeChoice(int *x, int *y)
 
     for (size_t i = 0; i < n; i++)
     {
-        wxPrintPaperType *paper = (wxPrintPaperType *)wxThePrintPaperDatabase->Item(i)->GetData();
+        wxPrintPaperType *paper = wxThePrintPaperDatabase->Item(i);
         choices[i] = paper->GetName();
         if (m_printData.GetPaperId() == paper->GetId())
             sel = i;
@@ -611,7 +611,7 @@ wxGenericPageSetupDialog::wxGenericPageSetupDialog( wxWindow *parent,
 
     for (size_t i = 0; i < n; i++)
     {
-        wxPrintPaperType *paper = (wxPrintPaperType *)wxThePrintPaperDatabase->Item(i)->GetData();
+        wxPrintPaperType *paper = wxThePrintPaperDatabase->Item(i);
         choices[i] = paper->GetName();
     }
 
@@ -774,7 +774,7 @@ bool wxGenericPageSetupDialog::TransferDataFromWindow()
         int selectedItem = m_paperTypeChoice->GetSelection();
         if (selectedItem != -1)
         {
-            wxPrintPaperType *paper = (wxPrintPaperType*)wxThePrintPaperDatabase->Item(selectedItem)->GetData();
+            wxPrintPaperType *paper = wxThePrintPaperDatabase->Item(selectedItem);
             if ( paper )
             {
                 m_pageData.SetPaperSize(wxSize(paper->GetWidth()/10, paper->GetHeight()/10));
@@ -801,7 +801,7 @@ wxComboBox *wxGenericPageSetupDialog::CreatePaperTypeChoice(int *x, int *y)
 
     for (size_t i = 0; i < n; i++)
     {
-        wxPrintPaperType *paper = (wxPrintPaperType *)wxThePrintPaperDatabase->Item(i)->GetData();
+        wxPrintPaperType *paper = wxThePrintPaperDatabase->Item(i);
         choices[i] = paper->GetName();
     }
 
index 127333729656e83d7eccc93bdeab02351d488c17..8aceb7f09d359d75c442b80e5387614fa717b15e 100644 (file)
@@ -276,7 +276,7 @@ bool wxToolBarSimple::Realize()
     int maxToolHeight = 0;
 
     // Find the maximum tool width and height
-    wxToolBarToolsList::Node *node = m_tools.GetFirst();
+    wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
     while ( node )
     {
         wxToolBarToolSimple *tool = (wxToolBarToolSimple *)node->GetData();
@@ -382,7 +382,7 @@ void wxToolBarSimple::OnPaint (wxPaintEvent& WXUNUSED(event))
         return;
     count++;
 
-    for ( wxToolBarToolsList::Node *node = m_tools.GetFirst();
+    for ( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
           node;
           node = node->GetNext() )
     {
@@ -651,7 +651,7 @@ void wxToolBarSimple::SetRows(int nRows)
 wxToolBarToolBase *wxToolBarSimple::FindToolForPosition(wxCoord x,
                                                         wxCoord y) const
 {
-    wxToolBarToolsList::Node *node = m_tools.GetFirst();
+    wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
     while (node)
     {
         wxToolBarToolSimple *tool = (wxToolBarToolSimple *)node->GetData();
index b04477bdd413790c13825defd7900669fef02254..05b88cc2ae702c37f9b29a45687a49d1f321f6f2 100644 (file)
@@ -156,7 +156,7 @@ void wxChoice::DoSetItemClientData( int n, void* clientData )
 {
     wxCHECK_RET( m_widget != NULL, wxT("invalid choice control") );
 
-    wxNode *node = m_clientList.Item( n );
+    wxList::compatibility_iterator node = m_clientList.Item( n );
     wxCHECK_RET( node, wxT("invalid index in wxChoice::DoSetItemClientData") );
 
     node->SetData( (wxObject*) clientData );
@@ -166,7 +166,7 @@ void* wxChoice::DoGetItemClientData( int n ) const
 {
     wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid choice control") );
 
-    wxNode *node = m_clientList.Item( n );
+    wxList::compatibility_iterator node = m_clientList.Item( n );
     wxCHECK_MSG( node, NULL, wxT("invalid index in wxChoice::DoGetItemClientData") );
 
     return node->GetData();
@@ -176,7 +176,7 @@ void wxChoice::DoSetItemClientObject( int n, wxClientData* clientData )
 {
     wxCHECK_RET( m_widget != NULL, wxT("invalid choice control") );
 
-    wxNode *node = m_clientList.Item( n );
+    wxList::compatibility_iterator node = m_clientList.Item( n );
     wxCHECK_RET( node, wxT("invalid index in wxChoice::DoSetItemClientObject") );
 
     // wxItemContainer already deletes data for us
@@ -188,7 +188,7 @@ wxClientData* wxChoice::DoGetItemClientObject( int n ) const
 {
     wxCHECK_MSG( m_widget != NULL, (wxClientData*) NULL, wxT("invalid choice control") );
 
-    wxNode *node = m_clientList.Item( n );
+    wxList::compatibility_iterator node = m_clientList.Item( n );
     wxCHECK_MSG( node, (wxClientData *)NULL,
                  wxT("invalid index in wxChoice::DoGetItemClientObject") );
 
@@ -208,7 +208,7 @@ void wxChoice::Clear()
         // destroy the data (due to Robert's idea of using wxList<wxObject>
         // and not wxList<wxClientData> we can't just say
         // m_clientList.DeleteContents(TRUE) - this would crash!
-        wxNode *node = m_clientList.GetFirst();
+        wxList::compatibility_iterator node = m_clientList.GetFirst();
         while ( node )
         {
             delete (wxClientData *)node->GetData();
index c57698a100ec6cb66f9b848f5c97b229aa761c5b..ce9b00c4c19b839a6d854f581f1b605411b39415 100644 (file)
@@ -156,12 +156,13 @@ wxColour::wxColour( unsigned char red, unsigned char green, unsigned char blue )
     M_COLDATA->m_color.pixel = 0;
 }
 
+
+
 void wxColour::InitFromName( const wxString &colourName )
 {
-    wxNode *node = (wxNode *) NULL;
-    if ( (wxTheColourDatabase) && (node = wxTheColourDatabase->Find(colourName)) )
+    wxColour* col = NULL;
+    if ( (wxTheColourDatabase) && (col = wxTheColourDatabase->FindColourNoAdd(colourName)) )
     {
-        wxColour *col = (wxColour*)node->GetData();
         UnRef();
         if (col) Ref( *col );
     }
index 13d19d958b4b3ff85b4ee2296a081d92529cb76d..7db2b2f7505746ab5983294633b6378d734a46fa 100644 (file)
@@ -197,7 +197,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
 
 wxComboBox::~wxComboBox()
 {
-    wxNode *node = m_clientObjectList.GetFirst();
+    wxList::compatibility_iterator node = m_clientObjectList.GetFirst();
     while (node)
     {
         wxClientData *cd = (wxClientData*)node->GetData();
@@ -360,7 +360,7 @@ void wxComboBox::SetClientData( int n, void* clientData )
 {
     wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
 
-    wxNode *node = m_clientDataList.Item( n );
+    wxList::compatibility_iterator node = m_clientDataList.Item( n );
     if (!node) return;
 
     node->SetData( (wxObject*) clientData );
@@ -370,7 +370,7 @@ void* wxComboBox::GetClientData( int n ) const
 {
     wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid combobox") );
 
-    wxNode *node = m_clientDataList.Item( n );
+    wxList::compatibility_iterator node = m_clientDataList.Item( n );
 
     return node ? node->GetData() : NULL;
 }
@@ -379,7 +379,7 @@ void wxComboBox::SetClientObject( int n, wxClientData* clientData )
 {
     wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
 
-    wxNode *node = m_clientObjectList.Item( n );
+    wxList::compatibility_iterator node = m_clientObjectList.Item( n );
     if (!node) return;
 
     wxClientData *cd = (wxClientData*) node->GetData();
@@ -392,7 +392,7 @@ wxClientData* wxComboBox::GetClientObject( int n ) const
 {
     wxCHECK_MSG( m_widget != NULL, (wxClientData*)NULL, wxT("invalid combobox") );
 
-    wxNode *node = m_clientObjectList.Item( n );
+    wxList::compatibility_iterator node = m_clientObjectList.Item( n );
 
     return node ? (wxClientData*) node->GetData() : NULL;
 }
@@ -406,7 +406,7 @@ void wxComboBox::Clear()
     GtkWidget *list = GTK_COMBO(m_widget)->list;
     gtk_list_clear_items( GTK_LIST(list), 0, Number() );
 
-    wxNode *node = m_clientObjectList.GetFirst();
+    wxList::compatibility_iterator node = m_clientObjectList.GetFirst();
     while (node)
     {
         wxClientData *cd = (wxClientData*)node->GetData();
@@ -440,18 +440,18 @@ void wxComboBox::Delete( int n )
     gtk_list_remove_items( listbox, list );
     g_list_free( list );
 
-    wxNode *node = m_clientObjectList.Item( n );
+    wxList::compatibility_iterator node = m_clientObjectList.Item( n );
     if (node)
     {
         wxClientData *cd = (wxClientData*)node->GetData();
         if (cd) delete cd;
-        m_clientObjectList.DeleteNode( node );
+        m_clientObjectList.Erase( node );
     }
 
     node = m_clientDataList.Item( n );
     if (node)
-        m_clientDataList.DeleteNode( node );
-
+        m_clientDataList.Erase( node );
+    
     EnableEvents();
 }
 
index da155214957bb0466d8019affdd85445a6f7565b..fc1783f95459a5ac3fd05d00c10d44410636896f 100644 (file)
@@ -448,7 +448,7 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
             if (index != GetCount())
             {
                 GtkAddItem( items[n], index );
-                wxNode *node = m_clientList.Item( index );
+                wxList::compatibility_iterator node = m_clientList.Item( index );
                 m_clientList.Insert( node, (wxObject*) NULL );
             }
             else
@@ -471,7 +471,7 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
         }
         else
         {
-            wxNode *node = m_clientList.Item( pos );
+            wxList::compatibility_iterator node = m_clientList.Item( pos );
             for ( size_t n = 0; n < nItems; n++ )
             {
                 GtkAddItem( items[n], pos+n );
@@ -497,7 +497,7 @@ int wxListBox::DoAppend( const wxString& item )
         {
            GtkAddItem( item, index );
 
-           wxNode *node = m_clientList.Item( index );
+           wxList::compatibility_iterator node = m_clientList.Item( index );
            m_clientList.Insert( node, (wxObject *)NULL );
 
            return index;
@@ -619,7 +619,7 @@ void wxListBox::Clear()
         // destroy the data (due to Robert's idea of using wxList<wxObject>
         // and not wxList<wxClientData> we can't just say
         // m_clientList.DeleteContents(TRUE) - this would crash!
-        wxNode *node = m_clientList.GetFirst();
+        wxList::compatibility_iterator node = m_clientList.GetFirst();
         while ( node )
         {
             delete (wxClientData *)node->GetData();
@@ -644,7 +644,7 @@ void wxListBox::Delete( int n )
     gtk_list_remove_items( m_list, list );
     g_list_free( list );
 
-    wxNode *node = m_clientList.Item( n );
+    wxList::compatibility_iterator node = m_clientList.Item( n );
     if ( node )
     {
         if ( m_clientDataItemsType == wxClientData_Object )
@@ -653,7 +653,7 @@ void wxListBox::Delete( int n )
             delete cd;
         }
 
-        m_clientList.DeleteNode( node );
+        m_clientList.Erase( node );
     }
 
     if ( m_strings )
@@ -668,7 +668,7 @@ void wxListBox::DoSetItemClientData( int n, void* clientData )
 {
     wxCHECK_RET( m_widget != NULL, wxT("invalid listbox control") );
 
-    wxNode *node = m_clientList.Item( n );
+    wxList::compatibility_iterator node = m_clientList.Item( n );
     wxCHECK_RET( node, wxT("invalid index in wxListBox::DoSetItemClientData") );
 
     node->SetData( (wxObject*) clientData );
@@ -678,7 +678,7 @@ void* wxListBox::DoGetItemClientData( int n ) const
 {
     wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid listbox control") );
 
-    wxNode *node = m_clientList.Item( n );
+    wxList::compatibility_iterator node = m_clientList.Item( n );
     wxCHECK_MSG( node, NULL, wxT("invalid index in wxListBox::DoGetItemClientData") );
 
     return node->GetData();
@@ -688,7 +688,7 @@ void wxListBox::DoSetItemClientObject( int n, wxClientData* clientData )
 {
     wxCHECK_RET( m_widget != NULL, wxT("invalid listbox control") );
 
-    wxNode *node = m_clientList.Item( n );
+    wxList::compatibility_iterator node = m_clientList.Item( n );
     wxCHECK_RET( node, wxT("invalid index in wxListBox::DoSetItemClientObject") );
 
     // wxItemContainer already deletes data for us
@@ -700,7 +700,7 @@ wxClientData* wxListBox::DoGetItemClientObject( int n ) const
 {
     wxCHECK_MSG( m_widget != NULL, (wxClientData*) NULL, wxT("invalid listbox control") );
 
-    wxNode *node = m_clientList.Item( n );
+    wxList::compatibility_iterator node = m_clientList.Item( n );
     wxCHECK_MSG( node, (wxClientData *)NULL,
                  wxT("invalid index in wxListBox::DoGetItemClientObject") );
 
index 08f0a4e5dbafff31b66425a355324f88015c511c..8cf797cd63e507f9bc87e7fb3a564db43aa363ad 100644 (file)
@@ -75,7 +75,7 @@ gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget),
 
     child = (wxMDIChildFrame*) NULL;
 
-    wxWindowList::Node  *node = client_window->GetChildren().GetFirst();
+    wxWindowList::compatibility_iterator node = client_window->GetChildren().GetFirst();
     while (node)
     {
         wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame );
@@ -170,7 +170,7 @@ void wxMDIParentFrame::OnInternalIdle()
     wxMDIChildFrame *active_child_frame = GetActiveChild();
     bool visible_child_menu = false;
 
-    wxWindowList::Node     *node = m_clientWindow->GetChildren().GetFirst();
+    wxWindowList::compatibility_iterator node = m_clientWindow->GetChildren().GetFirst();
     while (node)
     {
         wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame );
@@ -247,7 +247,7 @@ wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
     GtkNotebookPage* page = (GtkNotebookPage*) (g_list_nth(notebook->children,i)->data);
     if (!page) return (wxMDIChildFrame*) NULL;
 
-    wxWindowList::Node  *node = m_clientWindow->GetChildren().GetFirst();
+    wxWindowList::compatibility_iterator node = m_clientWindow->GetChildren().GetFirst();
     while (node)
     {
         wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame );
index dea54b9e727bbbea0e9c66aca0501ee1f6aa67a5..c3593081d8e8496aac462b18d5b23d67b4a97896 100644 (file)
@@ -200,8 +200,6 @@ wxMenuBar::wxMenuBar( long style )
         return;
     }
 
-    m_menus.DeleteContents( TRUE );
-
     /* GTK 1.2.0 doesn't have gtk_item_factory_get_item(), but GTK 1.2.1 has. */
 #if GTK_CHECK_VERSION(1, 2, 1)
     m_accel = gtk_accel_group_new();
@@ -241,8 +239,6 @@ wxMenuBar::wxMenuBar()
         return;
     }
 
-    m_menus.DeleteContents( TRUE );
-
     /* GTK 1.2.0 doesn't have gtk_item_factory_get_item(), but GTK 1.2.1 has. */
 #if GTK_CHECK_VERSION(1, 2, 1)
     m_accel = gtk_accel_group_new();
@@ -275,7 +271,7 @@ static void wxMenubarUnsetInvokingWindow( wxMenu *menu, wxWindow *win )
     /* support for native hot keys */
     gtk_accel_group_detach( menu->m_accel, ACCEL_OBJ_CAST(top_frame->m_widget) );
 
-    wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
+    wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
     while (node)
     {
         wxMenuItem *menuitem = node->GetData();
@@ -300,7 +296,7 @@ static void wxMenubarSetInvokingWindow( wxMenu *menu, wxWindow *win )
         gtk_accel_group_attach( menu->m_accel, obj );
 #endif // GTK+ 1.2.1+
 
-    wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
+    wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
     while (node)
     {
         wxMenuItem *menuitem = node->GetData();
@@ -324,7 +320,7 @@ void wxMenuBar::SetInvokingWindow( wxWindow *win )
         gtk_accel_group_attach( m_accel, obj );
 #endif // GTK+ 1.2.1+
 
-    wxMenuList::Node *node = m_menus.GetFirst();
+    wxMenuList::compatibility_iterator node = m_menus.GetFirst();
     while (node)
     {
         wxMenu *menu = node->GetData();
@@ -345,7 +341,7 @@ void wxMenuBar::UnsetInvokingWindow( wxWindow *win )
     gtk_accel_group_detach( m_accel, ACCEL_OBJ_CAST(top_frame->m_widget) );
 #endif // GTK+ 1.2.1+
 
-    wxMenuList::Node *node = m_menus.GetFirst();
+    wxMenuList::compatibility_iterator node = m_menus.GetFirst();
     while (node)
     {
         wxMenu *menu = node->GetData();
@@ -474,7 +470,7 @@ wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title)
 static wxMenu *CopyMenu (wxMenu *menu)
 {
     wxMenu *menucopy = new wxMenu ();
-    wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
+    wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
     while (node)
     {
         wxMenuItem *item = node->GetData();
@@ -552,7 +548,7 @@ static int FindMenuItemRecursive( const wxMenu *menu, const wxString &menuString
             return res;
     }
 
-    wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
+    wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
     while (node)
     {
         wxMenuItem *item = node->GetData();
@@ -567,7 +563,7 @@ static int FindMenuItemRecursive( const wxMenu *menu, const wxString &menuString
 
 int wxMenuBar::FindMenuItem( const wxString &menuString, const wxString &itemString ) const
 {
-    wxMenuList::Node *node = m_menus.GetFirst();
+    wxMenuList::compatibility_iterator node = m_menus.GetFirst();
     while (node)
     {
         wxMenu *menu = node->GetData();
@@ -585,7 +581,7 @@ static wxMenuItem* FindMenuItemByIdRecursive(const wxMenu* menu, int id)
 {
     wxMenuItem* result = menu->FindChildItem(id);
 
-    wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
+    wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
     while ( node && result == NULL )
     {
         wxMenuItem *item = node->GetData();
@@ -602,7 +598,7 @@ static wxMenuItem* FindMenuItemByIdRecursive(const wxMenu* menu, int id)
 wxMenuItem* wxMenuBar::FindItem( int id, wxMenu **menuForItem ) const
 {
     wxMenuItem* result = 0;
-    wxMenuList::Node *node = m_menus.GetFirst();
+    wxMenuList::compatibility_iterator node = m_menus.GetFirst();
     while (node && result == 0)
     {
         wxMenu *menu = node->GetData();
@@ -620,7 +616,7 @@ wxMenuItem* wxMenuBar::FindItem( int id, wxMenu **menuForItem ) const
 
 void wxMenuBar::EnableTop( size_t pos, bool flag )
 {
-    wxMenuList::Node *node = m_menus.Item( pos );
+    wxMenuList::compatibility_iterator node = m_menus.Item( pos );
 
     wxCHECK_RET( node, wxT("menu not found") );
 
@@ -632,7 +628,7 @@ void wxMenuBar::EnableTop( size_t pos, bool flag )
 
 wxString wxMenuBar::GetLabelTop( size_t pos ) const
 {
-    wxMenuList::Node *node = m_menus.Item( pos );
+    wxMenuList::compatibility_iterator node = m_menus.Item( pos );
 
     wxCHECK_MSG( node, wxT("invalid"), wxT("menu not found") );
 
@@ -659,7 +655,7 @@ wxString wxMenuBar::GetLabelTop( size_t pos ) const
 
 void wxMenuBar::SetLabelTop( size_t pos, const wxString& label )
 {
-    wxMenuList::Node *node = m_menus.Item( pos );
+    wxMenuList::compatibility_iterator node = m_menus.Item( pos );
 
     wxCHECK_RET( node, wxT("menu not found") );
 
@@ -1122,7 +1118,7 @@ void wxMenu::Init()
 
 wxMenu::~wxMenu()
 {
-   m_items.Clear();
+   WX_CLEAR_LIST(wxMenuItemList, m_items);
 
    if ( GTK_IS_WIDGET( m_menu ))
        gtk_widget_destroy( m_menu );
@@ -1398,7 +1394,7 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
 
 int wxMenu::FindMenuIdByMenuItem( GtkWidget *menuItem ) const
 {
-    wxMenuItemList::Node    *node = m_items.GetFirst();
+    wxMenuItemList::compatibility_iterator node = m_items.GetFirst();
     while (node)
     {
         wxMenuItem *item = node->GetData();
index a904117fafdaa86163c93026d6394db2ecdd105a..33aa5ab39dd33d0c06752820d54791d4f007cb77 100644 (file)
@@ -240,7 +240,6 @@ void wxNotebook::Init()
     m_inSwitchPage = FALSE;
 
     m_imageList = (wxImageList *) NULL;
-    m_pagesData.DeleteContents( TRUE );
     m_selection = -1;
     m_themeEnabled = TRUE;
 }
@@ -567,7 +566,9 @@ wxNotebookPage *wxNotebook::DoRemovePage( int page )
 
     gtk_notebook_remove_page( GTK_NOTEBOOK(m_widget), page );
 
-    m_pagesData.DeleteObject(GetNotebookPage(page));
+    wxGtkNotebookPage* p = GetNotebookPage(page);
+    m_pagesData.DeleteObject(p);
+    delete p;
 
     return client;
 }
index 3d70c8d4e10a25b6057e8ad01fd2c8b55f50e52e..855f838e87afe52993699c1a109bfbe3301aa2ce 100644 (file)
@@ -80,7 +80,7 @@ static gint gtk_radiobox_keypress_callback( GtkWidget *widget, GdkEventKey *gdk_
         return FALSE;
     }
 
-    wxNode *node = rb->m_boxes.Find( (wxObject*) widget );
+    wxList::compatibility_iterator node = rb->m_boxes.Find( (wxObject*) widget );
     if (!node)
     {
         return FALSE;
@@ -260,7 +260,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
 
 wxRadioBox::~wxRadioBox()
 {
-    wxNode *node = m_boxes.GetFirst();
+    wxList::compatibility_iterator node = m_boxes.GetFirst();
     while (node)
     {
         GtkWidget *button = GTK_WIDGET( node->GetData() );
@@ -314,7 +314,7 @@ wxSize wxRadioBox::LayoutItems()
             y = 15;
 
             int max_len = 0;
-            wxNode *node = m_boxes.Item( j*num_of_rows );
+            wxList::compatibility_iterator node = m_boxes.Item( j*num_of_rows );
             for (int i1 = 0; i1< num_of_rows; i1++)
             {
                 GtkWidget *button = GTK_WIDGET( node->GetData() );
@@ -359,7 +359,7 @@ wxSize wxRadioBox::LayoutItems()
     {
         int max = 0;
 
-        wxNode *node = m_boxes.GetFirst();
+        wxList::compatibility_iterator node = m_boxes.GetFirst();
         while (node)
         {
             GtkWidget *button = GTK_WIDGET( node->GetData() );
@@ -405,7 +405,7 @@ bool wxRadioBox::Show( bool show )
     if ((m_windowStyle & wxNO_BORDER) != 0)
         gtk_widget_hide( m_widget );
 
-    wxNode *node = m_boxes.GetFirst();
+    wxList::compatibility_iterator node = m_boxes.GetFirst();
     while (node)
     {
         GtkWidget *button = GTK_WIDGET( node->GetData() );
@@ -424,7 +424,7 @@ int wxRadioBox::FindString( const wxString &find ) const
 
     int count = 0;
 
-    wxNode *node = m_boxes.GetFirst();
+    wxList::compatibility_iterator node = m_boxes.GetFirst();
     while (node)
     {
         GtkLabel *label = GTK_LABEL( BUTTON_CHILD(node->GetData()) );
@@ -450,7 +450,7 @@ void wxRadioBox::SetFocus()
 
     if (m_boxes.GetCount() == 0) return;
 
-    wxNode *node = m_boxes.GetFirst();
+    wxList::compatibility_iterator node = m_boxes.GetFirst();
     while (node)
     {
         GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->GetData() );
@@ -467,7 +467,7 @@ void wxRadioBox::SetSelection( int n )
 {
     wxCHECK_RET( m_widget != NULL, wxT("invalid radiobox") );
 
-    wxNode *node = m_boxes.Item( n );
+    wxList::compatibility_iterator node = m_boxes.Item( n );
 
     wxCHECK_RET( node, wxT("radiobox wrong index") );
 
@@ -486,7 +486,7 @@ int wxRadioBox::GetSelection(void) const
 
     int count = 0;
 
-    wxNode *node = m_boxes.GetFirst();
+    wxList::compatibility_iterator node = m_boxes.GetFirst();
     while (node)
     {
         GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->GetData() );
@@ -504,7 +504,7 @@ wxString wxRadioBox::GetString( int n ) const
 {
     wxCHECK_MSG( m_widget != NULL, wxT(""), wxT("invalid radiobox") );
 
-    wxNode *node = m_boxes.Item( n );
+    wxList::compatibility_iterator node = m_boxes.Item( n );
 
     wxCHECK_MSG( node, wxT(""), wxT("radiobox wrong index") );
 
@@ -532,7 +532,7 @@ void wxRadioBox::SetString( int item, const wxString& label )
 {
     wxCHECK_RET( m_widget != NULL, wxT("invalid radiobox") );
 
-    wxNode *node = m_boxes.Item( item );
+    wxList::compatibility_iterator node = m_boxes.Item( item );
 
     wxCHECK_RET( node, wxT("radiobox wrong index") );
 
@@ -546,7 +546,7 @@ bool wxRadioBox::Enable( bool enable )
     if ( !wxControl::Enable( enable ) )
         return FALSE;
 
-    wxNode *node = m_boxes.GetFirst();
+    wxList::compatibility_iterator node = m_boxes.GetFirst();
     while (node)
     {
         GtkButton *button = GTK_BUTTON( node->GetData() );
@@ -564,7 +564,7 @@ void wxRadioBox::Enable( int item, bool enable )
 {
     wxCHECK_RET( m_widget != NULL, wxT("invalid radiobox") );
 
-    wxNode *node = m_boxes.Item( item );
+    wxList::compatibility_iterator node = m_boxes.Item( item );
 
     wxCHECK_RET( node, wxT("radiobox wrong index") );
 
@@ -579,7 +579,7 @@ void wxRadioBox::Show( int item, bool show )
 {
     wxCHECK_RET( m_widget != NULL, wxT("invalid radiobox") );
 
-    wxNode *node = m_boxes.Item( item );
+    wxList::compatibility_iterator node = m_boxes.Item( item );
 
     wxCHECK_RET( node, wxT("radiobox wrong index") );
 
@@ -595,7 +595,7 @@ wxString wxRadioBox::GetStringSelection() const
 {
     wxCHECK_MSG( m_widget != NULL, wxT(""), wxT("invalid radiobox") );
 
-    wxNode *node = m_boxes.GetFirst();
+    wxList::compatibility_iterator node = m_boxes.GetFirst();
     while (node)
     {
         GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->GetData() );
@@ -645,7 +645,7 @@ void wxRadioBox::SetNumberOfRowsOrCols( int WXUNUSED(n) )
 
 void wxRadioBox::GtkDisableEvents()
 {
-    wxNode *node = m_boxes.GetFirst();
+    wxList::compatibility_iterator node = m_boxes.GetFirst();
     while (node)
     {
         gtk_signal_disconnect_by_func( GTK_OBJECT(node->GetData()),
@@ -657,7 +657,7 @@ void wxRadioBox::GtkDisableEvents()
 
 void wxRadioBox::GtkEnableEvents()
 {
-    wxNode *node = m_boxes.GetFirst();
+    wxList::compatibility_iterator node = m_boxes.GetFirst();
     while (node)
     {
         gtk_signal_connect( GTK_OBJECT(node->GetData()), "clicked",
@@ -673,7 +673,7 @@ void wxRadioBox::ApplyWidgetStyle()
 
     gtk_widget_set_style( m_widget, m_widgetStyle );
 
-    wxNode *node = m_boxes.GetFirst();
+    wxList::compatibility_iterator node = m_boxes.GetFirst();
     while (node)
     {
         GtkWidget *widget = GTK_WIDGET( node->GetData() );
@@ -688,7 +688,7 @@ void wxRadioBox::ApplyWidgetStyle()
 #if wxUSE_TOOLTIPS
 void wxRadioBox::ApplyToolTip( GtkTooltips *tips, const wxChar *tip )
 {
-    wxNode *node = m_boxes.GetFirst();
+    wxList::compatibility_iterator node = m_boxes.GetFirst();
     while (node)
     {
         GtkWidget *widget = GTK_WIDGET( node->GetData() );
@@ -702,7 +702,7 @@ bool wxRadioBox::IsOwnGtkWindow( GdkWindow *window )
 {
     if (window == m_widget->window) return TRUE;
 
-    wxNode *node = m_boxes.GetFirst();
+    wxList::compatibility_iterator node = m_boxes.GetFirst();
     while (node)
     {
         GtkWidget *button = GTK_WIDGET( node->GetData() );
index 49a6ddb76b338eaf74502482c6c1fad36ce09d6d..3bc0caaa13a4cd38be63e7da53919d28afe1aebb 100644 (file)
@@ -94,7 +94,7 @@ bool wxRadioButton::Create( wxWindow *parent,
     {
         // search backward for last group start
         wxRadioButton *chief = (wxRadioButton*) NULL;
-        wxWindowList::Node *node = parent->GetChildren().GetLast();
+        wxWindowList::compatibility_iterator node = parent->GetChildren().GetLast();
         while (node)
         {
             wxWindow *child = node->GetData();
index 2832d625373a2f03468fc634ae82f0ec03996f75..5c47efac8b6a86b30cf8f51a55483d26b24c085f 100644 (file)
@@ -433,8 +433,9 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
 
                 if ( tool->IsRadio() )
                 {
-                    wxToolBarToolsList::Node *node = pos ? m_tools.Item(pos - 1)
-                                                         : NULL;
+                    wxToolBarToolsList::compatibility_iterator node;
+                    if ( pos ) node = m_tools.Item(pos - 1);
+
                     while ( node )
                     {
                         wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
@@ -660,7 +661,7 @@ void wxToolBar::OnInternalIdle()
             gdk_window_set_cursor( m_widget->window, cursor.GetCursor() );
         }
 
-        wxToolBarToolsList::Node *node = m_tools.GetFirst();
+        wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
         while ( node )
         {
             wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
index 13eda5a41d732b61a8d055f14db806e026bdb474..9f1d174de781119f482c34ed184789c2c7142b9c 100644 (file)
@@ -345,7 +345,7 @@ wxWindow *wxFindFocusedChild(wxWindowGTK *win)
     if ( winFocus == win )
         return (wxWindow *)win;
 
-    for ( wxWindowList::Node *node = win->GetChildren().GetFirst();
+    for ( wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst();
           node;
           node = node->GetNext() )
     {
@@ -1405,7 +1405,7 @@ wxWindowGTK *FindWindowForMouseEvent(wxWindowGTK *win, wxCoord& x, wxCoord& y)
         yy += pizza->yoffset;
     }
 
-    wxWindowList::Node  *node = win->GetChildren().GetFirst();
+    wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst();
     while (node)
     {
         wxWindowGTK *child = node->GetData();
@@ -3274,7 +3274,7 @@ static void wxWindowNotifyEnable(wxWindowGTK* win, bool enable)
     // Recurse, so that children have the opportunity to Do The Right Thing
     // and reset colours that have been messed up by a parent's (really ancestor's)
     // Enable call
-    for ( wxWindowList::Node *node = win->GetChildren().GetFirst();
+    for ( wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst();
           node;
           node = node->GetNext() )
     {
@@ -4141,7 +4141,7 @@ void gtk_pop_hide_callback( GtkWidget *WXUNUSED(widget), bool* is_waiting  )
 static void SetInvokingWindow( wxMenu *menu, wxWindowGTK *win )
 {
     menu->SetInvokingWindow( win );
-    wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
+    wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
     while (node)
     {
         wxMenuItem *menuitem = node->GetData();
index b04477bdd413790c13825defd7900669fef02254..05b88cc2ae702c37f9b29a45687a49d1f321f6f2 100644 (file)
@@ -156,7 +156,7 @@ void wxChoice::DoSetItemClientData( int n, void* clientData )
 {
     wxCHECK_RET( m_widget != NULL, wxT("invalid choice control") );
 
-    wxNode *node = m_clientList.Item( n );
+    wxList::compatibility_iterator node = m_clientList.Item( n );
     wxCHECK_RET( node, wxT("invalid index in wxChoice::DoSetItemClientData") );
 
     node->SetData( (wxObject*) clientData );
@@ -166,7 +166,7 @@ void* wxChoice::DoGetItemClientData( int n ) const
 {
     wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid choice control") );
 
-    wxNode *node = m_clientList.Item( n );
+    wxList::compatibility_iterator node = m_clientList.Item( n );
     wxCHECK_MSG( node, NULL, wxT("invalid index in wxChoice::DoGetItemClientData") );
 
     return node->GetData();
@@ -176,7 +176,7 @@ void wxChoice::DoSetItemClientObject( int n, wxClientData* clientData )
 {
     wxCHECK_RET( m_widget != NULL, wxT("invalid choice control") );
 
-    wxNode *node = m_clientList.Item( n );
+    wxList::compatibility_iterator node = m_clientList.Item( n );
     wxCHECK_RET( node, wxT("invalid index in wxChoice::DoSetItemClientObject") );
 
     // wxItemContainer already deletes data for us
@@ -188,7 +188,7 @@ wxClientData* wxChoice::DoGetItemClientObject( int n ) const
 {
     wxCHECK_MSG( m_widget != NULL, (wxClientData*) NULL, wxT("invalid choice control") );
 
-    wxNode *node = m_clientList.Item( n );
+    wxList::compatibility_iterator node = m_clientList.Item( n );
     wxCHECK_MSG( node, (wxClientData *)NULL,
                  wxT("invalid index in wxChoice::DoGetItemClientObject") );
 
@@ -208,7 +208,7 @@ void wxChoice::Clear()
         // destroy the data (due to Robert's idea of using wxList<wxObject>
         // and not wxList<wxClientData> we can't just say
         // m_clientList.DeleteContents(TRUE) - this would crash!
-        wxNode *node = m_clientList.GetFirst();
+        wxList::compatibility_iterator node = m_clientList.GetFirst();
         while ( node )
         {
             delete (wxClientData *)node->GetData();
index c57698a100ec6cb66f9b848f5c97b229aa761c5b..ce9b00c4c19b839a6d854f581f1b605411b39415 100644 (file)
@@ -156,12 +156,13 @@ wxColour::wxColour( unsigned char red, unsigned char green, unsigned char blue )
     M_COLDATA->m_color.pixel = 0;
 }
 
+
+
 void wxColour::InitFromName( const wxString &colourName )
 {
-    wxNode *node = (wxNode *) NULL;
-    if ( (wxTheColourDatabase) && (node = wxTheColourDatabase->Find(colourName)) )
+    wxColour* col = NULL;
+    if ( (wxTheColourDatabase) && (col = wxTheColourDatabase->FindColourNoAdd(colourName)) )
     {
-        wxColour *col = (wxColour*)node->GetData();
         UnRef();
         if (col) Ref( *col );
     }
index 13d19d958b4b3ff85b4ee2296a081d92529cb76d..7db2b2f7505746ab5983294633b6378d734a46fa 100644 (file)
@@ -197,7 +197,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
 
 wxComboBox::~wxComboBox()
 {
-    wxNode *node = m_clientObjectList.GetFirst();
+    wxList::compatibility_iterator node = m_clientObjectList.GetFirst();
     while (node)
     {
         wxClientData *cd = (wxClientData*)node->GetData();
@@ -360,7 +360,7 @@ void wxComboBox::SetClientData( int n, void* clientData )
 {
     wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
 
-    wxNode *node = m_clientDataList.Item( n );
+    wxList::compatibility_iterator node = m_clientDataList.Item( n );
     if (!node) return;
 
     node->SetData( (wxObject*) clientData );
@@ -370,7 +370,7 @@ void* wxComboBox::GetClientData( int n ) const
 {
     wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid combobox") );
 
-    wxNode *node = m_clientDataList.Item( n );
+    wxList::compatibility_iterator node = m_clientDataList.Item( n );
 
     return node ? node->GetData() : NULL;
 }
@@ -379,7 +379,7 @@ void wxComboBox::SetClientObject( int n, wxClientData* clientData )
 {
     wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
 
-    wxNode *node = m_clientObjectList.Item( n );
+    wxList::compatibility_iterator node = m_clientObjectList.Item( n );
     if (!node) return;
 
     wxClientData *cd = (wxClientData*) node->GetData();
@@ -392,7 +392,7 @@ wxClientData* wxComboBox::GetClientObject( int n ) const
 {
     wxCHECK_MSG( m_widget != NULL, (wxClientData*)NULL, wxT("invalid combobox") );
 
-    wxNode *node = m_clientObjectList.Item( n );
+    wxList::compatibility_iterator node = m_clientObjectList.Item( n );
 
     return node ? (wxClientData*) node->GetData() : NULL;
 }
@@ -406,7 +406,7 @@ void wxComboBox::Clear()
     GtkWidget *list = GTK_COMBO(m_widget)->list;
     gtk_list_clear_items( GTK_LIST(list), 0, Number() );
 
-    wxNode *node = m_clientObjectList.GetFirst();
+    wxList::compatibility_iterator node = m_clientObjectList.GetFirst();
     while (node)
     {
         wxClientData *cd = (wxClientData*)node->GetData();
@@ -440,18 +440,18 @@ void wxComboBox::Delete( int n )
     gtk_list_remove_items( listbox, list );
     g_list_free( list );
 
-    wxNode *node = m_clientObjectList.Item( n );
+    wxList::compatibility_iterator node = m_clientObjectList.Item( n );
     if (node)
     {
         wxClientData *cd = (wxClientData*)node->GetData();
         if (cd) delete cd;
-        m_clientObjectList.DeleteNode( node );
+        m_clientObjectList.Erase( node );
     }
 
     node = m_clientDataList.Item( n );
     if (node)
-        m_clientDataList.DeleteNode( node );
-
+        m_clientDataList.Erase( node );
+    
     EnableEvents();
 }
 
index da155214957bb0466d8019affdd85445a6f7565b..fc1783f95459a5ac3fd05d00c10d44410636896f 100644 (file)
@@ -448,7 +448,7 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
             if (index != GetCount())
             {
                 GtkAddItem( items[n], index );
-                wxNode *node = m_clientList.Item( index );
+                wxList::compatibility_iterator node = m_clientList.Item( index );
                 m_clientList.Insert( node, (wxObject*) NULL );
             }
             else
@@ -471,7 +471,7 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
         }
         else
         {
-            wxNode *node = m_clientList.Item( pos );
+            wxList::compatibility_iterator node = m_clientList.Item( pos );
             for ( size_t n = 0; n < nItems; n++ )
             {
                 GtkAddItem( items[n], pos+n );
@@ -497,7 +497,7 @@ int wxListBox::DoAppend( const wxString& item )
         {
            GtkAddItem( item, index );
 
-           wxNode *node = m_clientList.Item( index );
+           wxList::compatibility_iterator node = m_clientList.Item( index );
            m_clientList.Insert( node, (wxObject *)NULL );
 
            return index;
@@ -619,7 +619,7 @@ void wxListBox::Clear()
         // destroy the data (due to Robert's idea of using wxList<wxObject>
         // and not wxList<wxClientData> we can't just say
         // m_clientList.DeleteContents(TRUE) - this would crash!
-        wxNode *node = m_clientList.GetFirst();
+        wxList::compatibility_iterator node = m_clientList.GetFirst();
         while ( node )
         {
             delete (wxClientData *)node->GetData();
@@ -644,7 +644,7 @@ void wxListBox::Delete( int n )
     gtk_list_remove_items( m_list, list );
     g_list_free( list );
 
-    wxNode *node = m_clientList.Item( n );
+    wxList::compatibility_iterator node = m_clientList.Item( n );
     if ( node )
     {
         if ( m_clientDataItemsType == wxClientData_Object )
@@ -653,7 +653,7 @@ void wxListBox::Delete( int n )
             delete cd;
         }
 
-        m_clientList.DeleteNode( node );
+        m_clientList.Erase( node );
     }
 
     if ( m_strings )
@@ -668,7 +668,7 @@ void wxListBox::DoSetItemClientData( int n, void* clientData )
 {
     wxCHECK_RET( m_widget != NULL, wxT("invalid listbox control") );
 
-    wxNode *node = m_clientList.Item( n );
+    wxList::compatibility_iterator node = m_clientList.Item( n );
     wxCHECK_RET( node, wxT("invalid index in wxListBox::DoSetItemClientData") );
 
     node->SetData( (wxObject*) clientData );
@@ -678,7 +678,7 @@ void* wxListBox::DoGetItemClientData( int n ) const
 {
     wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid listbox control") );
 
-    wxNode *node = m_clientList.Item( n );
+    wxList::compatibility_iterator node = m_clientList.Item( n );
     wxCHECK_MSG( node, NULL, wxT("invalid index in wxListBox::DoGetItemClientData") );
 
     return node->GetData();
@@ -688,7 +688,7 @@ void wxListBox::DoSetItemClientObject( int n, wxClientData* clientData )
 {
     wxCHECK_RET( m_widget != NULL, wxT("invalid listbox control") );
 
-    wxNode *node = m_clientList.Item( n );
+    wxList::compatibility_iterator node = m_clientList.Item( n );
     wxCHECK_RET( node, wxT("invalid index in wxListBox::DoSetItemClientObject") );
 
     // wxItemContainer already deletes data for us
@@ -700,7 +700,7 @@ wxClientData* wxListBox::DoGetItemClientObject( int n ) const
 {
     wxCHECK_MSG( m_widget != NULL, (wxClientData*) NULL, wxT("invalid listbox control") );
 
-    wxNode *node = m_clientList.Item( n );
+    wxList::compatibility_iterator node = m_clientList.Item( n );
     wxCHECK_MSG( node, (wxClientData *)NULL,
                  wxT("invalid index in wxListBox::DoGetItemClientObject") );
 
index 08f0a4e5dbafff31b66425a355324f88015c511c..8cf797cd63e507f9bc87e7fb3a564db43aa363ad 100644 (file)
@@ -75,7 +75,7 @@ gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget),
 
     child = (wxMDIChildFrame*) NULL;
 
-    wxWindowList::Node  *node = client_window->GetChildren().GetFirst();
+    wxWindowList::compatibility_iterator node = client_window->GetChildren().GetFirst();
     while (node)
     {
         wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame );
@@ -170,7 +170,7 @@ void wxMDIParentFrame::OnInternalIdle()
     wxMDIChildFrame *active_child_frame = GetActiveChild();
     bool visible_child_menu = false;
 
-    wxWindowList::Node     *node = m_clientWindow->GetChildren().GetFirst();
+    wxWindowList::compatibility_iterator node = m_clientWindow->GetChildren().GetFirst();
     while (node)
     {
         wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame );
@@ -247,7 +247,7 @@ wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
     GtkNotebookPage* page = (GtkNotebookPage*) (g_list_nth(notebook->children,i)->data);
     if (!page) return (wxMDIChildFrame*) NULL;
 
-    wxWindowList::Node  *node = m_clientWindow->GetChildren().GetFirst();
+    wxWindowList::compatibility_iterator node = m_clientWindow->GetChildren().GetFirst();
     while (node)
     {
         wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame );
index dea54b9e727bbbea0e9c66aca0501ee1f6aa67a5..c3593081d8e8496aac462b18d5b23d67b4a97896 100644 (file)
@@ -200,8 +200,6 @@ wxMenuBar::wxMenuBar( long style )
         return;
     }
 
-    m_menus.DeleteContents( TRUE );
-
     /* GTK 1.2.0 doesn't have gtk_item_factory_get_item(), but GTK 1.2.1 has. */
 #if GTK_CHECK_VERSION(1, 2, 1)
     m_accel = gtk_accel_group_new();
@@ -241,8 +239,6 @@ wxMenuBar::wxMenuBar()
         return;
     }
 
-    m_menus.DeleteContents( TRUE );
-
     /* GTK 1.2.0 doesn't have gtk_item_factory_get_item(), but GTK 1.2.1 has. */
 #if GTK_CHECK_VERSION(1, 2, 1)
     m_accel = gtk_accel_group_new();
@@ -275,7 +271,7 @@ static void wxMenubarUnsetInvokingWindow( wxMenu *menu, wxWindow *win )
     /* support for native hot keys */
     gtk_accel_group_detach( menu->m_accel, ACCEL_OBJ_CAST(top_frame->m_widget) );
 
-    wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
+    wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
     while (node)
     {
         wxMenuItem *menuitem = node->GetData();
@@ -300,7 +296,7 @@ static void wxMenubarSetInvokingWindow( wxMenu *menu, wxWindow *win )
         gtk_accel_group_attach( menu->m_accel, obj );
 #endif // GTK+ 1.2.1+
 
-    wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
+    wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
     while (node)
     {
         wxMenuItem *menuitem = node->GetData();
@@ -324,7 +320,7 @@ void wxMenuBar::SetInvokingWindow( wxWindow *win )
         gtk_accel_group_attach( m_accel, obj );
 #endif // GTK+ 1.2.1+
 
-    wxMenuList::Node *node = m_menus.GetFirst();
+    wxMenuList::compatibility_iterator node = m_menus.GetFirst();
     while (node)
     {
         wxMenu *menu = node->GetData();
@@ -345,7 +341,7 @@ void wxMenuBar::UnsetInvokingWindow( wxWindow *win )
     gtk_accel_group_detach( m_accel, ACCEL_OBJ_CAST(top_frame->m_widget) );
 #endif // GTK+ 1.2.1+
 
-    wxMenuList::Node *node = m_menus.GetFirst();
+    wxMenuList::compatibility_iterator node = m_menus.GetFirst();
     while (node)
     {
         wxMenu *menu = node->GetData();
@@ -474,7 +470,7 @@ wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title)
 static wxMenu *CopyMenu (wxMenu *menu)
 {
     wxMenu *menucopy = new wxMenu ();
-    wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
+    wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
     while (node)
     {
         wxMenuItem *item = node->GetData();
@@ -552,7 +548,7 @@ static int FindMenuItemRecursive( const wxMenu *menu, const wxString &menuString
             return res;
     }
 
-    wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
+    wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
     while (node)
     {
         wxMenuItem *item = node->GetData();
@@ -567,7 +563,7 @@ static int FindMenuItemRecursive( const wxMenu *menu, const wxString &menuString
 
 int wxMenuBar::FindMenuItem( const wxString &menuString, const wxString &itemString ) const
 {
-    wxMenuList::Node *node = m_menus.GetFirst();
+    wxMenuList::compatibility_iterator node = m_menus.GetFirst();
     while (node)
     {
         wxMenu *menu = node->GetData();
@@ -585,7 +581,7 @@ static wxMenuItem* FindMenuItemByIdRecursive(const wxMenu* menu, int id)
 {
     wxMenuItem* result = menu->FindChildItem(id);
 
-    wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
+    wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
     while ( node && result == NULL )
     {
         wxMenuItem *item = node->GetData();
@@ -602,7 +598,7 @@ static wxMenuItem* FindMenuItemByIdRecursive(const wxMenu* menu, int id)
 wxMenuItem* wxMenuBar::FindItem( int id, wxMenu **menuForItem ) const
 {
     wxMenuItem* result = 0;
-    wxMenuList::Node *node = m_menus.GetFirst();
+    wxMenuList::compatibility_iterator node = m_menus.GetFirst();
     while (node && result == 0)
     {
         wxMenu *menu = node->GetData();
@@ -620,7 +616,7 @@ wxMenuItem* wxMenuBar::FindItem( int id, wxMenu **menuForItem ) const
 
 void wxMenuBar::EnableTop( size_t pos, bool flag )
 {
-    wxMenuList::Node *node = m_menus.Item( pos );
+    wxMenuList::compatibility_iterator node = m_menus.Item( pos );
 
     wxCHECK_RET( node, wxT("menu not found") );
 
@@ -632,7 +628,7 @@ void wxMenuBar::EnableTop( size_t pos, bool flag )
 
 wxString wxMenuBar::GetLabelTop( size_t pos ) const
 {
-    wxMenuList::Node *node = m_menus.Item( pos );
+    wxMenuList::compatibility_iterator node = m_menus.Item( pos );
 
     wxCHECK_MSG( node, wxT("invalid"), wxT("menu not found") );
 
@@ -659,7 +655,7 @@ wxString wxMenuBar::GetLabelTop( size_t pos ) const
 
 void wxMenuBar::SetLabelTop( size_t pos, const wxString& label )
 {
-    wxMenuList::Node *node = m_menus.Item( pos );
+    wxMenuList::compatibility_iterator node = m_menus.Item( pos );
 
     wxCHECK_RET( node, wxT("menu not found") );
 
@@ -1122,7 +1118,7 @@ void wxMenu::Init()
 
 wxMenu::~wxMenu()
 {
-   m_items.Clear();
+   WX_CLEAR_LIST(wxMenuItemList, m_items);
 
    if ( GTK_IS_WIDGET( m_menu ))
        gtk_widget_destroy( m_menu );
@@ -1398,7 +1394,7 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
 
 int wxMenu::FindMenuIdByMenuItem( GtkWidget *menuItem ) const
 {
-    wxMenuItemList::Node    *node = m_items.GetFirst();
+    wxMenuItemList::compatibility_iterator node = m_items.GetFirst();
     while (node)
     {
         wxMenuItem *item = node->GetData();
index a904117fafdaa86163c93026d6394db2ecdd105a..33aa5ab39dd33d0c06752820d54791d4f007cb77 100644 (file)
@@ -240,7 +240,6 @@ void wxNotebook::Init()
     m_inSwitchPage = FALSE;
 
     m_imageList = (wxImageList *) NULL;
-    m_pagesData.DeleteContents( TRUE );
     m_selection = -1;
     m_themeEnabled = TRUE;
 }
@@ -567,7 +566,9 @@ wxNotebookPage *wxNotebook::DoRemovePage( int page )
 
     gtk_notebook_remove_page( GTK_NOTEBOOK(m_widget), page );
 
-    m_pagesData.DeleteObject(GetNotebookPage(page));
+    wxGtkNotebookPage* p = GetNotebookPage(page);
+    m_pagesData.DeleteObject(p);
+    delete p;
 
     return client;
 }
index 3d70c8d4e10a25b6057e8ad01fd2c8b55f50e52e..855f838e87afe52993699c1a109bfbe3301aa2ce 100644 (file)
@@ -80,7 +80,7 @@ static gint gtk_radiobox_keypress_callback( GtkWidget *widget, GdkEventKey *gdk_
         return FALSE;
     }
 
-    wxNode *node = rb->m_boxes.Find( (wxObject*) widget );
+    wxList::compatibility_iterator node = rb->m_boxes.Find( (wxObject*) widget );
     if (!node)
     {
         return FALSE;
@@ -260,7 +260,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
 
 wxRadioBox::~wxRadioBox()
 {
-    wxNode *node = m_boxes.GetFirst();
+    wxList::compatibility_iterator node = m_boxes.GetFirst();
     while (node)
     {
         GtkWidget *button = GTK_WIDGET( node->GetData() );
@@ -314,7 +314,7 @@ wxSize wxRadioBox::LayoutItems()
             y = 15;
 
             int max_len = 0;
-            wxNode *node = m_boxes.Item( j*num_of_rows );
+            wxList::compatibility_iterator node = m_boxes.Item( j*num_of_rows );
             for (int i1 = 0; i1< num_of_rows; i1++)
             {
                 GtkWidget *button = GTK_WIDGET( node->GetData() );
@@ -359,7 +359,7 @@ wxSize wxRadioBox::LayoutItems()
     {
         int max = 0;
 
-        wxNode *node = m_boxes.GetFirst();
+        wxList::compatibility_iterator node = m_boxes.GetFirst();
         while (node)
         {
             GtkWidget *button = GTK_WIDGET( node->GetData() );
@@ -405,7 +405,7 @@ bool wxRadioBox::Show( bool show )
     if ((m_windowStyle & wxNO_BORDER) != 0)
         gtk_widget_hide( m_widget );
 
-    wxNode *node = m_boxes.GetFirst();
+    wxList::compatibility_iterator node = m_boxes.GetFirst();
     while (node)
     {
         GtkWidget *button = GTK_WIDGET( node->GetData() );
@@ -424,7 +424,7 @@ int wxRadioBox::FindString( const wxString &find ) const
 
     int count = 0;
 
-    wxNode *node = m_boxes.GetFirst();
+    wxList::compatibility_iterator node = m_boxes.GetFirst();
     while (node)
     {
         GtkLabel *label = GTK_LABEL( BUTTON_CHILD(node->GetData()) );
@@ -450,7 +450,7 @@ void wxRadioBox::SetFocus()
 
     if (m_boxes.GetCount() == 0) return;
 
-    wxNode *node = m_boxes.GetFirst();
+    wxList::compatibility_iterator node = m_boxes.GetFirst();
     while (node)
     {
         GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->GetData() );
@@ -467,7 +467,7 @@ void wxRadioBox::SetSelection( int n )
 {
     wxCHECK_RET( m_widget != NULL, wxT("invalid radiobox") );
 
-    wxNode *node = m_boxes.Item( n );
+    wxList::compatibility_iterator node = m_boxes.Item( n );
 
     wxCHECK_RET( node, wxT("radiobox wrong index") );
 
@@ -486,7 +486,7 @@ int wxRadioBox::GetSelection(void) const
 
     int count = 0;
 
-    wxNode *node = m_boxes.GetFirst();
+    wxList::compatibility_iterator node = m_boxes.GetFirst();
     while (node)
     {
         GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->GetData() );
@@ -504,7 +504,7 @@ wxString wxRadioBox::GetString( int n ) const
 {
     wxCHECK_MSG( m_widget != NULL, wxT(""), wxT("invalid radiobox") );
 
-    wxNode *node = m_boxes.Item( n );
+    wxList::compatibility_iterator node = m_boxes.Item( n );
 
     wxCHECK_MSG( node, wxT(""), wxT("radiobox wrong index") );
 
@@ -532,7 +532,7 @@ void wxRadioBox::SetString( int item, const wxString& label )
 {
     wxCHECK_RET( m_widget != NULL, wxT("invalid radiobox") );
 
-    wxNode *node = m_boxes.Item( item );
+    wxList::compatibility_iterator node = m_boxes.Item( item );
 
     wxCHECK_RET( node, wxT("radiobox wrong index") );
 
@@ -546,7 +546,7 @@ bool wxRadioBox::Enable( bool enable )
     if ( !wxControl::Enable( enable ) )
         return FALSE;
 
-    wxNode *node = m_boxes.GetFirst();
+    wxList::compatibility_iterator node = m_boxes.GetFirst();
     while (node)
     {
         GtkButton *button = GTK_BUTTON( node->GetData() );
@@ -564,7 +564,7 @@ void wxRadioBox::Enable( int item, bool enable )
 {
     wxCHECK_RET( m_widget != NULL, wxT("invalid radiobox") );
 
-    wxNode *node = m_boxes.Item( item );
+    wxList::compatibility_iterator node = m_boxes.Item( item );
 
     wxCHECK_RET( node, wxT("radiobox wrong index") );
 
@@ -579,7 +579,7 @@ void wxRadioBox::Show( int item, bool show )
 {
     wxCHECK_RET( m_widget != NULL, wxT("invalid radiobox") );
 
-    wxNode *node = m_boxes.Item( item );
+    wxList::compatibility_iterator node = m_boxes.Item( item );
 
     wxCHECK_RET( node, wxT("radiobox wrong index") );
 
@@ -595,7 +595,7 @@ wxString wxRadioBox::GetStringSelection() const
 {
     wxCHECK_MSG( m_widget != NULL, wxT(""), wxT("invalid radiobox") );
 
-    wxNode *node = m_boxes.GetFirst();
+    wxList::compatibility_iterator node = m_boxes.GetFirst();
     while (node)
     {
         GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->GetData() );
@@ -645,7 +645,7 @@ void wxRadioBox::SetNumberOfRowsOrCols( int WXUNUSED(n) )
 
 void wxRadioBox::GtkDisableEvents()
 {
-    wxNode *node = m_boxes.GetFirst();
+    wxList::compatibility_iterator node = m_boxes.GetFirst();
     while (node)
     {
         gtk_signal_disconnect_by_func( GTK_OBJECT(node->GetData()),
@@ -657,7 +657,7 @@ void wxRadioBox::GtkDisableEvents()
 
 void wxRadioBox::GtkEnableEvents()
 {
-    wxNode *node = m_boxes.GetFirst();
+    wxList::compatibility_iterator node = m_boxes.GetFirst();
     while (node)
     {
         gtk_signal_connect( GTK_OBJECT(node->GetData()), "clicked",
@@ -673,7 +673,7 @@ void wxRadioBox::ApplyWidgetStyle()
 
     gtk_widget_set_style( m_widget, m_widgetStyle );
 
-    wxNode *node = m_boxes.GetFirst();
+    wxList::compatibility_iterator node = m_boxes.GetFirst();
     while (node)
     {
         GtkWidget *widget = GTK_WIDGET( node->GetData() );
@@ -688,7 +688,7 @@ void wxRadioBox::ApplyWidgetStyle()
 #if wxUSE_TOOLTIPS
 void wxRadioBox::ApplyToolTip( GtkTooltips *tips, const wxChar *tip )
 {
-    wxNode *node = m_boxes.GetFirst();
+    wxList::compatibility_iterator node = m_boxes.GetFirst();
     while (node)
     {
         GtkWidget *widget = GTK_WIDGET( node->GetData() );
@@ -702,7 +702,7 @@ bool wxRadioBox::IsOwnGtkWindow( GdkWindow *window )
 {
     if (window == m_widget->window) return TRUE;
 
-    wxNode *node = m_boxes.GetFirst();
+    wxList::compatibility_iterator node = m_boxes.GetFirst();
     while (node)
     {
         GtkWidget *button = GTK_WIDGET( node->GetData() );
index 49a6ddb76b338eaf74502482c6c1fad36ce09d6d..3bc0caaa13a4cd38be63e7da53919d28afe1aebb 100644 (file)
@@ -94,7 +94,7 @@ bool wxRadioButton::Create( wxWindow *parent,
     {
         // search backward for last group start
         wxRadioButton *chief = (wxRadioButton*) NULL;
-        wxWindowList::Node *node = parent->GetChildren().GetLast();
+        wxWindowList::compatibility_iterator node = parent->GetChildren().GetLast();
         while (node)
         {
             wxWindow *child = node->GetData();
index 2832d625373a2f03468fc634ae82f0ec03996f75..5c47efac8b6a86b30cf8f51a55483d26b24c085f 100644 (file)
@@ -433,8 +433,9 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
 
                 if ( tool->IsRadio() )
                 {
-                    wxToolBarToolsList::Node *node = pos ? m_tools.Item(pos - 1)
-                                                         : NULL;
+                    wxToolBarToolsList::compatibility_iterator node;
+                    if ( pos ) node = m_tools.Item(pos - 1);
+
                     while ( node )
                     {
                         wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
@@ -660,7 +661,7 @@ void wxToolBar::OnInternalIdle()
             gdk_window_set_cursor( m_widget->window, cursor.GetCursor() );
         }
 
-        wxToolBarToolsList::Node *node = m_tools.GetFirst();
+        wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
         while ( node )
         {
             wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
index 13eda5a41d732b61a8d055f14db806e026bdb474..9f1d174de781119f482c34ed184789c2c7142b9c 100644 (file)
@@ -345,7 +345,7 @@ wxWindow *wxFindFocusedChild(wxWindowGTK *win)
     if ( winFocus == win )
         return (wxWindow *)win;
 
-    for ( wxWindowList::Node *node = win->GetChildren().GetFirst();
+    for ( wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst();
           node;
           node = node->GetNext() )
     {
@@ -1405,7 +1405,7 @@ wxWindowGTK *FindWindowForMouseEvent(wxWindowGTK *win, wxCoord& x, wxCoord& y)
         yy += pizza->yoffset;
     }
 
-    wxWindowList::Node  *node = win->GetChildren().GetFirst();
+    wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst();
     while (node)
     {
         wxWindowGTK *child = node->GetData();
@@ -3274,7 +3274,7 @@ static void wxWindowNotifyEnable(wxWindowGTK* win, bool enable)
     // Recurse, so that children have the opportunity to Do The Right Thing
     // and reset colours that have been messed up by a parent's (really ancestor's)
     // Enable call
-    for ( wxWindowList::Node *node = win->GetChildren().GetFirst();
+    for ( wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst();
           node;
           node = node->GetNext() )
     {
@@ -4141,7 +4141,7 @@ void gtk_pop_hide_callback( GtkWidget *WXUNUSED(widget), bool* is_waiting  )
 static void SetInvokingWindow( wxMenu *menu, wxWindowGTK *win )
 {
     menu->SetInvokingWindow( win );
-    wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
+    wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
     while (node)
     {
         wxMenuItem *menuitem = node->GetData();
index 1748fef73d74fc28b183dec96ab2fdabd5cf782c..67726f7456e702e6607e4bbddde2be0c549a3acc 100644 (file)
@@ -271,7 +271,7 @@ void wxHtmlHelpController::AddGrabIfNeeded()
     
     // Check if there are any modal windows present,
     // in which case we need to add a grab.
-    for ( wxWindowList::Node * node = wxTopLevelWindows.GetFirst();
+    for ( wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
           node;
           node = node->GetNext() )
     {
index d51186b7653ad3ee1b23e74e257b4cb85fc88727..e4e1a2e6813636b65dd90e9d2575db4da712f326 100644 (file)
@@ -1069,7 +1069,6 @@ BEGIN_EVENT_TABLE(wxHtmlHelpFrameOptionsDialog, wxDialog)
     EVT_SPINCTRL(-1, wxHtmlHelpFrameOptionsDialog::OnUpdateSpin)
 END_EVENT_TABLE()
 
-
 void wxHtmlHelpFrame::OptionsDialog()
 {
     wxHtmlHelpFrameOptionsDialog dlg(this);
@@ -1081,7 +1080,7 @@ void wxHtmlHelpFrame::OptionsDialog()
         enu.EnumerateFacenames();
         m_NormalFonts = new wxArrayString;
         *m_NormalFonts = *enu.GetFacenames();
-        m_NormalFonts->Sort();
+        m_NormalFonts->Sort(wxStringSortAscending);
     }
     if (m_FixedFonts == NULL)
     {
@@ -1089,7 +1088,7 @@ void wxHtmlHelpFrame::OptionsDialog()
         enu.EnumerateFacenames(wxFONTENCODING_SYSTEM, TRUE);
         m_FixedFonts = new wxArrayString;
         *m_FixedFonts = *enu.GetFacenames();
-        m_FixedFonts->Sort();
+        m_FixedFonts->Sort(wxStringSortAscending);
     }
     
     // VS: We want to show the font that is actually used by wxHtmlWindow.
index efd6d9349e45b4fcbb96126adc62fc7428fcef41..be7d11a616aa894405e2347c14a70ba802cd0830 100644 (file)
@@ -82,11 +82,18 @@ wxHtmlParser::~wxHtmlParser()
 {
     while (RestoreState()) {}
     DestroyDOMTree();
-    
+
+    if (m_HandlersStack)
+    {
+        wxList& tmp = *m_HandlersStack;
+        wxList::iterator it, en;
+        for( it = tmp.begin(), en = tmp.end(); it != en; ++it )
+            delete (wxHashTable*)*it;
+        tmp.clear();
+    }
     delete m_HandlersStack;
     m_HandlersHash.Clear();
-    m_HandlersList.DeleteContents(TRUE);
-    m_HandlersList.Clear();
+    WX_CLEAR_LIST(wxList, m_HandlersList);
     delete m_entitiesParser;
 }
 
@@ -351,10 +358,9 @@ void wxHtmlParser::PushTagHandler(wxHtmlTagHandler *handler, wxString tags)
     if (m_HandlersStack == NULL)
     {
         m_HandlersStack = new wxList;
-        m_HandlersStack->DeleteContents(TRUE);
     }
 
-    m_HandlersStack->Insert(new wxHashTable(m_HandlersHash));
+    m_HandlersStack->Insert((wxObject*)new wxHashTable(m_HandlersHash));
 
     while (tokenizer.HasMoreTokens())
     {
@@ -366,16 +372,17 @@ void wxHtmlParser::PushTagHandler(wxHtmlTagHandler *handler, wxString tags)
 
 void wxHtmlParser::PopTagHandler()
 {
-    wxNode *first;
+    wxList::compatibility_iterator first;
 
     if (m_HandlersStack == NULL ||
-        (first = m_HandlersStack->GetFirst()) == NULL)
+        !(first = m_HandlersStack->GetFirst()))
     {
         wxLogWarning(_("Warning: attempt to remove HTML tag handler from empty stack."));
         return;
     }
     m_HandlersHash = *((wxHashTable*) first->GetData());
-    m_HandlersStack->DeleteNode(first);
+    delete (wxHashTable*) first->GetData();
+    m_HandlersStack->Erase(first);
 }
 
 void wxHtmlParser::SetSourceAndSaveState(const wxString& src)
index 8afb3a1fba18612860bd286e074430afabdb47e5..261bb4b8d682ef2325bb38655e4001be15792bca 100644 (file)
@@ -203,6 +203,8 @@ wxHtmlWindow::~wxHtmlWindow()
 
     if (m_Cell) delete m_Cell;
 
+    WX_CLEAR_LIST(wxHtmlProcessorList, *m_Processors);
+
     delete m_Parser;
     delete m_FS;
     delete m_History;
@@ -248,11 +250,11 @@ bool wxHtmlWindow::SetPage(const wxString& source)
     // pass HTML through registered processors:
     if (m_Processors || m_GlobalProcessors)
     {
-        wxHtmlProcessorList::Node *nodeL, *nodeG;
+        wxHtmlProcessorList::compatibility_iterator nodeL, nodeG;
         int prL, prG;
 
-        nodeL = (m_Processors) ? m_Processors->GetFirst() : NULL;
-        nodeG = (m_GlobalProcessors) ? m_GlobalProcessors->GetFirst() : NULL;
+        nodeL = (m_Processors) ? m_Processors->GetFirst() : wxHtmlProcessorList::compatibility_iterator();
+        nodeG = (m_GlobalProcessors) ? m_GlobalProcessors->GetFirst() : wxHtmlProcessorList::compatibility_iterator();
 
         // VS: there are two lists, global and local, both of them sorted by
         //     priority. Since we have to go through _both_ lists with
@@ -374,7 +376,7 @@ bool wxHtmlWindow::LoadPage(const wxString& location)
 
         else
         {
-            wxNode *node;
+            wxList::compatibility_iterator node;
             wxString src = wxEmptyString;
 
             if (m_RelatedStatusBar != -1)
@@ -653,9 +655,8 @@ void wxHtmlWindow::AddProcessor(wxHtmlProcessor *processor)
     if (!m_Processors)
     {
         m_Processors = new wxHtmlProcessorList;
-        m_Processors->DeleteContents(TRUE);
     }
-    wxHtmlProcessorList::Node *node;
+    wxHtmlProcessorList::compatibility_iterator node;
 
     for (node = m_Processors->GetFirst(); node; node = node->GetNext())
     {
@@ -673,9 +674,8 @@ void wxHtmlWindow::AddProcessor(wxHtmlProcessor *processor)
     if (!m_GlobalProcessors)
     {
         m_GlobalProcessors = new wxHtmlProcessorList;
-        m_GlobalProcessors->DeleteContents(TRUE);
     }
-    wxHtmlProcessorList::Node *node;
+    wxHtmlProcessorList::compatibility_iterator node;
 
     for (node = m_GlobalProcessors->GetFirst(); node; node = node->GetNext())
     {
@@ -697,8 +697,9 @@ wxHtmlProcessorList *wxHtmlWindow::m_GlobalProcessors = NULL;
 void wxHtmlWindow::CleanUpStatics()
 {
     wxDELETE(m_DefaultFilter);
-    m_Filters.DeleteContents(TRUE);
-    m_Filters.Clear();
+    WX_CLEAR_LIST(wxList, m_Filters);
+    if (m_GlobalProcessors)
+        WX_CLEAR_LIST(wxHtmlProcessorList, *m_GlobalProcessors);
     wxDELETE(m_GlobalProcessors);
 }
 
index 6f4912caeefb1e79e6b768651a91ab4beaa8a35b..14b443a30ef27767f5c46f0ddad495bafcf135bf 100644 (file)
@@ -169,8 +169,7 @@ wxHtmlPrintout::~wxHtmlPrintout()
 
 void wxHtmlPrintout::CleanUpStatics()
 {
-    m_Filters.DeleteContents(TRUE);
-    m_Filters.Clear();
+    WX_CLEAR_LIST(wxList, m_Filters);
 }
 
 // Adds input filter
@@ -293,7 +292,7 @@ void wxHtmlPrintout::SetHtmlFile(const wxString& htmlfile)
     wxHtmlFilterHTML defaultFilter;
     wxString doc;
 
-    wxNode* node = m_Filters.GetFirst();
+    wxList::compatibility_iterator node = m_Filters.GetFirst();
     while (node)
     {
         wxHtmlFilter *h = (wxHtmlFilter*) node->GetData();
index 4a5de2de4d6f7858ca8517dfd1b903b02c934e87..8410b01988210c3b3a2e6eb868e1121d88ff8b96 100644 (file)
@@ -74,7 +74,7 @@ wxHtmlWinParser::wxHtmlWinParser(wxHtmlWindow *wnd) : wxHtmlParser()
     }
 
     // fill in wxHtmlParser's tables:
-    wxNode *node = m_Modules.GetFirst();
+    wxList::compatibility_iterator node = m_Modules.GetFirst();
     while (node)
     {
         wxHtmlTagsModule *mod = (wxHtmlTagsModule*) node->GetData();
index f54a3164bf9dff6b019846534a1a7f74ba57aaee..698b38d7cb0cbf949bfd3c2dddd3e9a9fe98b9ed 100644 (file)
@@ -191,7 +191,7 @@ bool wxDialog::IsModal() const
 
 bool wxDialog::IsModalShowing() const
 {
-    return wxModalDialogs.Find((wxDialog *)this) != NULL; // const_cast
+    return wxModalDialogs.Find((wxDialog *)this); // const_cast
 }
 
 wxWindow *wxDialog::FindSuitableParent() const
index 27d08e5447e07ea6084675c7d1137c2899fe3d8a..1e033933994393466fdf8a1994e5ed17aa03b97c 100644 (file)
@@ -345,7 +345,7 @@ int wxFileDialog::ShowModal()
             if ( m_dir.Last() != _T('\\') )
                 dir += _T('\\');
 
-            m_fileNames.Sort();
+            m_fileNames.Sort(wxStringSortAscending);
             m_path = dir + m_fileName;
         }
         else
index b4a87c8cc49c69198adcede77813ba2787632a4d..76bba0ef4b8bc592a88add4332833ebcf2399041 100644 (file)
@@ -455,7 +455,7 @@ void wxFrame::PositionToolBar()
 // on the desktop, but are iconized/restored with it
 void wxFrame::IconizeChildFrames(bool bIconize)
 {
-    for ( wxWindowList::Node *node = GetChildren().GetFirst();
+    for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
           node;
           node = node->GetNext() )
     {
index 1e7606bcbece9ba0b1cac7626429025c383743f4..2bf6f0bce07ebdfd1b17e555930c8edc1afff53f 100644 (file)
@@ -236,7 +236,7 @@ bool wxGDIImage::RemoveHandler(const wxString& name)
 
 wxGDIImageHandler *wxGDIImage::FindHandler(const wxString& name)
 {
-    wxGDIImageHandlerList::Node *node = ms_handlers.GetFirst();
+    wxGDIImageHandlerList::compatibility_iterator node = ms_handlers.GetFirst();
     while ( node )
     {
         wxGDIImageHandler *handler = node->GetData();
@@ -251,7 +251,7 @@ wxGDIImageHandler *wxGDIImage::FindHandler(const wxString& name)
 wxGDIImageHandler *wxGDIImage::FindHandler(const wxString& extension,
                                            long type)
 {
-    wxGDIImageHandlerList::Node *node = ms_handlers.GetFirst();
+    wxGDIImageHandlerList::compatibility_iterator node = ms_handlers.GetFirst();
     while ( node )
     {
         wxGDIImageHandler *handler = node->GetData();
@@ -268,7 +268,7 @@ wxGDIImageHandler *wxGDIImage::FindHandler(const wxString& extension,
 
 wxGDIImageHandler *wxGDIImage::FindHandler(long type)
 {
-    wxGDIImageHandlerList::Node *node = ms_handlers.GetFirst();
+    wxGDIImageHandlerList::compatibility_iterator node = ms_handlers.GetFirst();
     while ( node )
     {
         wxGDIImageHandler *handler = node->GetData();
@@ -283,13 +283,13 @@ wxGDIImageHandler *wxGDIImage::FindHandler(long type)
 
 void wxGDIImage::CleanUpHandlers()
 {
-    wxGDIImageHandlerList::Node *node = ms_handlers.GetFirst();
+    wxGDIImageHandlerList::compatibility_iterator node = ms_handlers.GetFirst();
     while ( node )
     {
         wxGDIImageHandler *handler = node->GetData();
-        wxGDIImageHandlerList::Node *next = node->GetNext();
+        wxGDIImageHandlerList::compatibility_iterator next = node->GetNext();
         delete handler;
-        delete node;
+        ms_handlers.Erase( node );
         node = next;
     }
 }
index 6089dcde74aca6eef0956c8a3bfd18e42385eb63..fa8de4d5d2aef70da699ebb9f95a84a3105b3cd6 100644 (file)
@@ -558,7 +558,7 @@ bool wxMDIParentFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND hwnd)
 
     if ( IsMdiCommandId(id) )
     {
-        wxWindowList::Node *node = GetChildren().GetFirst();
+        wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
         while ( node )
         {
             wxWindow *child = node->GetData();
@@ -1246,7 +1246,7 @@ void wxMDIClientWindow::DoSetSize(int x, int y, int width, int height, int sizeF
     {
         if (GetParent())
         {
-            wxWindowList::Node *node = GetParent()->GetChildren().GetFirst();
+            wxWindowList::compatibility_iterator node = GetParent()->GetChildren().GetFirst();
             while (node)
             {
                 wxWindow *child = node->GetData();
index f3c898b413d3fd4bf032af08dda1a7859e0fbb31..761bd75da688df04f6affdaa9036af01433b52ba 100644 (file)
@@ -163,7 +163,7 @@ void wxMenu::UpdateAccel(wxMenuItem *item)
     if ( item->IsSubMenu() )
     {
         wxMenu *submenu = item->GetSubMenu();
-        wxMenuItemList::Node *node = submenu->GetMenuItems().GetFirst();
+        wxMenuItemList::compatibility_iterator node = submenu->GetMenuItems().GetFirst();
         while ( node )
         {
             UpdateAccel(node->GetData());
@@ -329,7 +329,7 @@ bool wxMenu::DoAppend(wxMenuItem *item)
         {
             // we need to update its end item
             item->SetRadioGroupStart(m_startRadioGroup);
-            wxMenuItemList::Node *node = GetMenuItems().Item(m_startRadioGroup);
+            wxMenuItemList::compatibility_iterator node = GetMenuItems().Item(m_startRadioGroup);
 
             if ( node )
             {
@@ -369,7 +369,7 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
 {
     // we need to find the items position in the child list
     size_t pos;
-    wxMenuItemList::Node *node = GetMenuItems().GetFirst();
+    wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
     for ( pos = 0; node; pos++ )
     {
         if ( node->GetData() == item )
@@ -590,11 +590,12 @@ WXHMENU wxMenuBar::Create()
     }
     else
     {
-        size_t count = GetMenuCount();
-        for ( size_t i = 0; i < count; i++ )
+        size_t count = GetMenuCount(), i;
+        wxMenuList::iterator it;
+        for ( i = 0, it = m_menus.begin(); i < count; i++, it++ )
         {
             if ( !::AppendMenu((HMENU)m_hMenu, MF_POPUP | MF_STRING,
-                               (UINT)m_menus[i]->GetHMenu(),
+                               (UINT)(*it)->GetHMenu(),
                                m_titles[i]) )
             {
                 wxLogLastError(wxT("AppendMenu"));
@@ -811,9 +812,10 @@ void wxMenuBar::RebuildAccelTable()
     // merge the accelerators of all menus into one accel table
     size_t nAccelCount = 0;
     size_t i, count = GetMenuCount();
-    for ( i = 0; i < count; i++ )
+    wxMenuList::iterator it;
+    for ( i = 0, it = m_menus.begin(); i < count; i++, it++ )
     {
-        nAccelCount += m_menus[i]->GetAccelCount();
+        nAccelCount += (*it)->GetAccelCount();
     }
 
     if ( nAccelCount )
@@ -821,9 +823,9 @@ void wxMenuBar::RebuildAccelTable()
         wxAcceleratorEntry *accelEntries = new wxAcceleratorEntry[nAccelCount];
 
         nAccelCount = 0;
-        for ( i = 0; i < count; i++ )
+        for ( i = 0, it = m_menus.begin(); i < count; i++, it++ )
         {
-            nAccelCount += m_menus[i]->CopyAccels(&accelEntries[nAccelCount]);
+            nAccelCount += (*it)->CopyAccels(&accelEntries[nAccelCount]);
         }
 
         m_accelTable = wxAcceleratorTable(nAccelCount, accelEntries);
index b9f3ca853fd7b25f93c8fc0427e9d7ca0625c142..887b57f94469ea0c599d7e1d6f8bea88e1a568fb 100644 (file)
@@ -262,7 +262,7 @@ void wxMenuItem::Check(bool check)
 #endif // __WIN32__
 
         // also uncheck all the other items in this radio group
-        wxMenuItemList::Node *node = items.Item(start);
+        wxMenuItemList::compatibility_iterator node = items.Item(start);
         for ( int n = start; n <= end && node; n++ )
         {
             if ( n != pos )
index 0b2b1ee94e81df75d52c86999484903654ca3120..778cd6094149e48dfc21a7e96c3ba63ccb53635d 100644 (file)
@@ -135,7 +135,7 @@ wxWindow* wxWindow::GetWindowChild1(wxWindowID id)
     if ( m_windowId == id )
         return this;
 
-    wxWindowList::Node *node = GetChildren().GetFirst();
+    wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
     while ( node )
     {
         wxWindow* child = node->GetData();
index aee70d403494ef873eafc9e18d2772ab7fc13a04..4cff6cf1e3e1af2ada229bf821fc8f7386d9dd64 100644 (file)
@@ -114,14 +114,14 @@ void wxRadioButton::SetValue(bool value)
     if ( value )
     {
         const wxWindowList& siblings = GetParent()->GetChildren();
-        wxWindowList::Node *nodeThis = siblings.Find(this);
+        wxWindowList::compatibility_iterator nodeThis = siblings.Find(this);
         wxCHECK_RET( nodeThis, _T("radio button not a child of its parent?") );
 
         // if it's not the first item of the group ...
         if ( !HasFlag(wxRB_GROUP) )
         {
             // ... turn off all radio buttons before it
-            for ( wxWindowList::Node *nodeBefore = nodeThis->GetPrevious();
+            for ( wxWindowList::compatibility_iterator nodeBefore = nodeThis->GetPrevious();
                   nodeBefore;
                   nodeBefore = nodeBefore->GetPrevious() )
             {
@@ -146,7 +146,7 @@ void wxRadioButton::SetValue(bool value)
         }
 
         // ... and also turn off all buttons after this one
-        for ( wxWindowList::Node *nodeAfter = nodeThis->GetNext();
+        for ( wxWindowList::compatibility_iterator nodeAfter = nodeThis->GetNext();
               nodeAfter;
               nodeAfter = nodeAfter->GetNext() )
         {
index 4c868c06a559df7310e13b4606ac80aa1246f1d4..4a76e3e01814bab2a55b9cb6e0fa9757cc3cfce0 100644 (file)
@@ -237,7 +237,7 @@ void wxTaskBarIcon::_OnRButtonDClick(wxEvent& e)  { OnRButtonDClick(e); }
 
 wxTaskBarIcon* wxTaskBarIcon::FindObjectForHWND(WXHWND hWnd)
 {
-    wxTaskBarIconList::Node *node = sm_taskBarIcons.GetFirst();
+    wxTaskBarIconList::compatibility_iterator node = sm_taskBarIcons.GetFirst();
     while (node)
     {
         wxTaskBarIcon *obj = node->GetData();
index 3f0bc66692d72ef97bd19ce2148358a30ab5293c..4fa970dc549324140347e113e755beedd45fd014 100644 (file)
@@ -278,7 +278,7 @@ void wxToolBar::Recreate()
     }
 
     // reparent all our children under the new toolbar
-    for ( wxWindowList::Node *node = m_children.GetFirst();
+    for ( wxWindowList::compatibility_iterator node = m_children.GetFirst();
           node;
           node = node->GetNext() )
     {
@@ -394,7 +394,7 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool)
     // first determine the position of the first button to delete: it may be
     // different from pos if we use several separators to cover the space used
     // by a control
-    wxToolBarToolsList::Node *node;
+    wxToolBarToolsList::compatibility_iterator node;
     for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
     {
         wxToolBarToolBase *tool2 = node->GetData();
@@ -485,7 +485,7 @@ bool wxToolBar::Realize()
     // First, add the bitmap: we use one bitmap for all toolbar buttons
     // ----------------------------------------------------------------
 
-    wxToolBarToolsList::Node *node;
+    wxToolBarToolsList::compatibility_iterator node;
     int bitmapId = 0;
 
     wxSize sizeBmp;
@@ -1021,7 +1021,7 @@ static
 wxToolBarToolBase *GetItemSkippingDummySpacers(const wxToolBarToolsList& tools,
                                                size_t index )
 {
-    wxToolBarToolsList::Node* current = tools.GetFirst();
+    wxToolBarToolsList::compatibility_iterator current = tools.GetFirst();
 
     for ( ; current != 0; current = current->GetNext() )
     {
@@ -1225,7 +1225,7 @@ bool wxToolBar::HandlePaint(WXWPARAM wParam, WXLPARAM lParam)
     // any here
 
     // first of all, do we have any controls at all?
-    wxToolBarToolsList::Node *node;
+    wxToolBarToolsList::compatibility_iterator node;
     for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
     {
         if ( node->GetData()->IsControl() )
index 0fe07b64a3ef841b1fd38e24a5b8e8177e7fad7b..822ece8f3577d0e1dac104cf33b00e1d43ba4866 100644 (file)
@@ -23,6 +23,7 @@
 #if wxUSE_TIMER
 
 #ifndef WX_PRECOMP
+    #include "wx/hashmap.h"
     #include "wx/setup.h"
     #include "wx/window.h"
     #include "wx/list.h"
 // private functions
 // ----------------------------------------------------------------------------
 
-wxList wxTimerList(wxKEY_INTEGER);
+WX_DECLARE_HASH_MAP( long,
+                     wxTimer*,
+                     wxIntegerHash,
+                     wxIntegerEqual,
+                     wxTimerMap );
+
+wxTimerMap wxTimerList;
 UINT WINAPI _EXPORT wxTimerProc(HWND hwnd, WORD, int idTimer, DWORD);
 
 // ----------------------------------------------------------------------------
@@ -75,9 +82,11 @@ void wxTimer::Init()
 
 wxTimer::~wxTimer()
 {
+    long id = m_id;
+
     wxTimer::Stop();
 
-    wxTimerList.DeleteObject(this);
+    wxTimerList.erase(id);
 }
 
 bool wxTimer::Start(int milliseconds, bool oneShot)
@@ -94,7 +103,7 @@ bool wxTimer::Start(int milliseconds, bool oneShot)
 
     if ( m_id > 0 )
     {
-        wxTimerList.Append(m_id, this);
+        wxTimerList[m_id] = this;
 
         return true;
     }
@@ -112,7 +121,7 @@ void wxTimer::Stop()
     {
         ::KillTimer(NULL, (UINT)m_id);
 
-        wxTimerList.DeleteObject(this);
+        wxTimerList.erase(m_id);
     }
 
     m_id = 0;
@@ -136,11 +145,13 @@ void wxProcessTimer(wxTimer& timer)
 
 UINT WINAPI _EXPORT wxTimerProc(HWND WXUNUSED(hwnd), WORD, int idTimer, DWORD)
 {
-    wxNode *node = wxTimerList.Find((long)idTimer);
+    
+    wxTimerMap::iterator node = wxTimerList.find((long)idTimer);
 
-    wxCHECK_MSG( node, 0, wxT("bogus timer id in wxTimerProc") );
+    wxCHECK_MSG( node != wxTimerList.end(), 0,
+                 wxT("bogus timer id in wxTimerProc") );
 
-    wxProcessTimer(*(wxTimer *)node->GetData());
+    wxProcessTimer(*(node->second));
 
     return 0;
 }
index 59a4cccf424a56157cecfc38e9a68ad3ad40632f..78b92eaffdd66db497d7e352491735ff80cb8df6 100644 (file)
@@ -725,7 +725,8 @@ wxTreeCtrl::~wxTreeCtrl()
     // delete any attributes
     if ( m_hasAnyAttr )
     {
-        for ( wxNode *node = m_attrs.Next(); node; node = m_attrs.Next() )
+        for ( wxHashTable::compatibility_iterator node = m_attrs.Next();
+              node; node = m_attrs.Next() )
         {
             delete (wxTreeItemAttr *)node->GetData();
         }
index df95abf3a7043890ac7e7b31491f58d31aa2de56..1e04a1e23da57f44a7df2f198077f0e87b6f51f8 100644 (file)
@@ -262,7 +262,7 @@ wxWindow *wxWindowMSW::FindItem(long id) const
     }
 #endif // wxUSE_CONTROLS
 
-    wxWindowList::Node *current = GetChildren().GetFirst();
+    wxWindowList::compatibility_iterator current = GetChildren().GetFirst();
     while (current)
     {
         wxWindow *childWin = current->GetData();
@@ -280,7 +280,7 @@ wxWindow *wxWindowMSW::FindItem(long id) const
 // Find an item given the MS Windows handle
 wxWindow *wxWindowMSW::FindItemByHWND(WXHWND hWnd, bool controlOnly) const
 {
-    wxWindowList::Node *current = GetChildren().GetFirst();
+    wxWindowList::compatibility_iterator current = GetChildren().GetFirst();
     while (current)
     {
         wxWindow *parent = current->GetData();
@@ -517,7 +517,7 @@ bool wxWindowMSW::Enable(bool enable)
     // well but when it is enabled back, only those of the children which
     // hadn't been already disabled in the beginning should be enabled again,
     // so we have to keep the list of those children
-    for ( wxWindowList::Node *node = GetChildren().GetFirst();
+    for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
           node;
           node = node->GetNext() )
     {
@@ -1946,7 +1946,7 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg)
             {
                 // passimistic by default
                 canSafelyCallIsDlgMsg = FALSE;
-                for ( wxWindowList::Node *node = GetChildren().GetFirst();
+                for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
                       node;
                       node = node->GetNext() )
                 {
@@ -2955,7 +2955,7 @@ bool wxWindowMSW::HandleNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
     //     correct button tooltips
 #if 0
     // try all our children
-    wxWindowList::Node *node = GetChildren().GetFirst();
+    wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
     while ( node )
     {
         wxWindow *child = node->GetData();
@@ -3612,7 +3612,7 @@ void wxWindowMSW::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(event))
         // FIXME-MT
         gs_hasStdCmap = FALSE;
     }
-    wxWindowList::Node *node = GetChildren().GetFirst();
+    wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
     while ( node )
     {
         // Only propagate to non-top-level windows because Windows already
index 7431369b7ff7d27a43015b4e753c1487bb6be2b5..24b56a9ebfceb49199a8d6510fc1f9256f4cd131 100644 (file)
@@ -158,9 +158,9 @@ wxColour::wxColour( unsigned char red, unsigned char green, unsigned char blue )
 void wxColour::InitFromName( const wxString &colourName )
 {
     wxNode *node = (wxNode *) NULL;
-    if ( (wxTheColourDatabase) && (node = wxTheColourDatabase->Find(colourName)) )
+    wxColour* col;
+    if ( (wxTheColourDatabase) && (col = wxTheColourDatabase->FindColourNoAdd(colourName)) )
     {
-        wxColour *col = (wxColour*)node->GetData();
         UnRef();
         if (col) Ref( *col );
     }