From ac32ba44a150c9de37a9b56ef7cb10521d0e9347 Mon Sep 17 00:00:00 2001 From: Mattia Barbon Date: Mon, 21 Jul 2003 20:00:38 +0000 Subject: [PATCH] wxX11 and wxMotif STL-ification, part 1. it does not compile. yet, but keeps the diff between my local copy and HEAD < 4000 lines... git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22209 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/bmpbase.cpp | 12 +++--- src/generic/mdig.cpp | 2 +- src/motif/button.cpp | 2 +- src/motif/choice.cpp | 12 +++--- src/motif/clipbrd.cpp | 6 +-- src/motif/cursor.cpp | 10 ++--- src/motif/font.cpp | 4 +- src/motif/frame.cpp | 2 +- src/motif/menu.cpp | 29 +++++++------- src/motif/palette.cpp | 8 ++-- src/motif/radiobut.cpp | 2 +- src/motif/toolbar.cpp | 6 +-- src/univ/menu.cpp | 82 ++++++++++++++++++++++++--------------- src/univ/radiobut.cpp | 2 +- src/univ/themes/gtk.cpp | 2 +- src/univ/themes/win32.cpp | 2 +- src/univ/toolbar.cpp | 6 +-- src/univ/winuniv.cpp | 4 +- src/x11/evtloop.cpp | 6 +-- src/x11/font.cpp | 4 +- src/x11/palette.cpp | 8 ++-- src/x11/window.cpp | 2 +- 22 files changed, 117 insertions(+), 96 deletions(-) diff --git a/src/common/bmpbase.cpp b/src/common/bmpbase.cpp index 09d1261266..951ff347c7 100644 --- a/src/common/bmpbase.cpp +++ b/src/common/bmpbase.cpp @@ -60,7 +60,7 @@ bool wxBitmapBase::RemoveHandler(const wxString& name) wxBitmapHandler *wxBitmapBase::FindHandler(const wxString& name) { - wxList::Node *node = sm_handlers.GetFirst(); + wxList::compatibility_iterator node = sm_handlers.GetFirst(); while ( node ) { wxBitmapHandler *handler = (wxBitmapHandler *)node->GetData(); @@ -73,7 +73,7 @@ wxBitmapHandler *wxBitmapBase::FindHandler(const wxString& name) wxBitmapHandler *wxBitmapBase::FindHandler(const wxString& extension, wxBitmapType bitmapType) { - wxList::Node *node = sm_handlers.GetFirst(); + wxList::compatibility_iterator node = sm_handlers.GetFirst(); while ( node ) { wxBitmapHandler *handler = (wxBitmapHandler *)node->GetData(); @@ -87,7 +87,7 @@ wxBitmapHandler *wxBitmapBase::FindHandler(const wxString& extension, wxBitmapTy wxBitmapHandler *wxBitmapBase::FindHandler(wxBitmapType bitmapType) { - wxList::Node *node = sm_handlers.GetFirst(); + wxList::compatibility_iterator node = sm_handlers.GetFirst(); while ( node ) { wxBitmapHandler *handler = (wxBitmapHandler *)node->GetData(); @@ -100,13 +100,13 @@ wxBitmapHandler *wxBitmapBase::FindHandler(wxBitmapType bitmapType) void wxBitmapBase::CleanUpHandlers() { - wxList::Node *node = sm_handlers.GetFirst(); + wxList::compatibility_iterator node = sm_handlers.GetFirst(); while ( node ) { wxBitmapHandler *handler = (wxBitmapHandler *)node->GetData(); - wxList::Node *next = node->GetNext(); + wxList::compatibility_iterator next = node->GetNext(); delete handler; - delete node; + sm_handlers.Erase(node); node = next; } } diff --git a/src/generic/mdig.cpp b/src/generic/mdig.cpp index 7919782ea5..17c5bab868 100644 --- a/src/generic/mdig.cpp +++ b/src/generic/mdig.cpp @@ -590,7 +590,7 @@ void wxGenericMDIChildFrame::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() ) { diff --git a/src/motif/button.cpp b/src/motif/button.cpp index 5272ec5984..d56e59900e 100644 --- a/src/motif/button.cpp +++ b/src/motif/button.cpp @@ -127,7 +127,7 @@ void wxButton::SetDefault() // wxButton in the same row, correction is straighforward: we set // resource for all wxButton in this parent (but not sub panels) - for (wxWindowList::Node * node = parent->GetChildren().GetFirst (); + for (wxWindowList::compatibility_iterator node = parent->GetChildren().GetFirst (); node; node = node->GetNext ()) { wxWindow *win = node->GetData (); diff --git a/src/motif/choice.cpp b/src/motif/choice.cpp index 466b14e7e5..37f3a967cf 100644 --- a/src/motif/choice.cpp +++ b/src/motif/choice.cpp @@ -222,7 +222,7 @@ void wxChoice::Delete(int n) Widget w = (Widget)m_widgetArray[n]; XtRemoveCallback(w, XmNactivateCallback, (XtCallbackProc)wxChoiceCallback, (XtPointer)this); - m_stringList.DeleteNode(m_stringList.Item(n)); + m_stringList.Erase(m_stringList.Item(n)); m_widgetArray.RemoveAt(size_t(n)); m_clientDataDict.Delete(n, HasClientObjectData()); @@ -267,7 +267,7 @@ int wxChoice::GetSelection() const if (!s.IsEmpty()) { int i = 0; - for (wxStringListNode* node = m_stringList.GetFirst (); + for (wxStringList::compatibility_iterator node = m_stringList.GetFirst (); node; node = node->GetNext ()) { if (wxStrcmp(node->GetData(), s.c_str()) == 0) @@ -287,7 +287,7 @@ void wxChoice::SetSelection(int n) { m_inSetValue = TRUE; - wxStringListNode *node = m_stringList.Item(n); + wxStringList::compatibility_iterator node = m_stringList.Item(n); if (node) { #if 0 @@ -318,7 +318,7 @@ void wxChoice::SetSelection(int n) int wxChoice::FindString(const wxString& s) const { int i = 0; - for (wxStringListNode* node = m_stringList.GetFirst(); + for (wxStringList::compatibility_iterator node = m_stringList.GetFirst(); node; node = node->GetNext ()) { if (s == node->GetData()) @@ -332,7 +332,7 @@ int wxChoice::FindString(const wxString& s) const wxString wxChoice::GetString(int n) const { - wxStringListNode *node = m_stringList.Item(n); + wxStringList::compatibility_iterator node = m_stringList.Item(n); if (node) return node->GetData(); else @@ -523,7 +523,7 @@ wxSize wxChoice::GetItemsSize() const // get my GetTextExtent( "|", &x, &my ); - wxStringList::Node* curr = m_stringList.GetFirst(); + wxStringList::compatibility_iterator curr = m_stringList.GetFirst(); while( curr ) { GetTextExtent( curr->GetData(), &x, &y ); diff --git a/src/motif/clipbrd.cpp b/src/motif/clipbrd.cpp index 275c02fd53..1d067954ff 100644 --- a/src/motif/clipbrd.cpp +++ b/src/motif/clipbrd.cpp @@ -195,7 +195,7 @@ wxClipboard::~wxClipboard() void wxClipboard::Clear() { - wxDataObjectList::Node* node = m_data.GetFirst(); + wxDataObjectList::compatibility_iterator node = m_data.GetFirst(); while (node) { delete node->GetData(); @@ -203,7 +203,7 @@ void wxClipboard::Clear() } m_data.Clear(); - for( wxDataIdToDataObjectList::Node* node2 = m_idToObject.GetFirst(); + for( wxDataIdToDataObjectList::compatibility_iterator node2 = m_idToObject.GetFirst(); node2; node2 = node2->GetNext() ) delete node->GetData(); m_idToObject.Clear(); @@ -244,7 +244,7 @@ void wxClipboardCallback( Widget xwidget, long* data_id, wxDataObject* dobj = NULL; size_t size = 0; - for( wxDataIdToDataObjectList::Node* node2 = + for( wxDataIdToDataObjectList::compatibility_iterator node2 = wxTheClipboard->m_idToObject.GetFirst(); node2; node2 = node2->GetNext() ) { diff --git a/src/motif/cursor.cpp b/src/motif/cursor.cpp index 3c5f636840..4ecaddf1b7 100644 --- a/src/motif/cursor.cpp +++ b/src/motif/cursor.cpp @@ -69,7 +69,7 @@ wxCursorRefData::wxCursorRefData() wxCursorRefData::~wxCursorRefData() { - wxXCursorList::Node* node = m_cursors.GetFirst(); + wxXCursorList::compatibility_iterator node = m_cursors.GetFirst(); while (node) { wxXCursor* c = node->GetData(); @@ -299,7 +299,7 @@ WXCursor wxCursor::GetXCursor(WXDisplay* display) { if (!M_CURSORDATA) return (WXCursor) 0; - wxXCursorList::Node* node = M_CURSORDATA->m_cursors.GetFirst(); + wxXCursorList::compatibility_iterator node = M_CURSORDATA->m_cursors.GetFirst(); while (node) { wxXCursor* c = node->GetData(); @@ -452,7 +452,7 @@ wxXSetBusyCursor (wxWindow * win, wxCursor * cursor) XFlush (display); - for(wxWindowList::Node *node = win->GetChildren().GetFirst (); node; + for(wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst (); node; node = node->GetNext()) { wxWindow *child = node->GetData (); @@ -466,7 +466,7 @@ void wxBeginBusyCursor(wxCursor *cursor) wxBusyCursorCount++; if (wxBusyCursorCount == 1) { - for(wxWindowList::Node *node = wxTopLevelWindows.GetFirst (); node; + for(wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst (); node; node = node->GetNext()) { wxWindow *win = node->GetData (); @@ -484,7 +484,7 @@ void wxEndBusyCursor() wxBusyCursorCount--; if (wxBusyCursorCount == 0) { - for(wxWindowList::Node *node = wxTopLevelWindows.GetFirst (); node; + for(wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst (); node; node = node->GetNext()) { wxWindow *win = node->GetData (); diff --git a/src/motif/font.cpp b/src/motif/font.cpp index 4e7186a805..dd3de8f55a 100644 --- a/src/motif/font.cpp +++ b/src/motif/font.cpp @@ -188,7 +188,7 @@ void wxFontRefData::Init(int pointSize, wxFontRefData::~wxFontRefData() { - wxList::Node* node = m_fonts.GetFirst(); + wxList::compatibility_iterator node = m_fonts.GetFirst(); while (node) { wxXFont* f = (wxXFont*) node->GetData(); @@ -511,7 +511,7 @@ wxXFont* wxFont::GetInternalFont(double scale, WXDisplay* display) const int pointSize = (M_FONTDATA->m_pointSize * 10 * intScale) / 100; // search existing fonts first - wxList::Node* node = M_FONTDATA->m_fonts.GetFirst(); + wxList::compatibility_iterator node = M_FONTDATA->m_fonts.GetFirst(); while (node) { wxXFont* f = (wxXFont*) node->GetData(); diff --git a/src/motif/frame.cpp b/src/motif/frame.cpp index 4e8cedb04f..ea10fe2554 100644 --- a/src/motif/frame.cpp +++ b/src/motif/frame.cpp @@ -581,7 +581,7 @@ void wxFrame::OnActivate(wxActivateEvent& event) if (!event.GetActive()) return; - for(wxWindowList::Node *node = GetChildren().GetFirst(); node; + for(wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); node; node = node->GetNext()) { // Find a child that's a subwindow, but not a dialog box. diff --git a/src/motif/menu.cpp b/src/motif/menu.cpp index 8699350bbb..c0ab807012 100644 --- a/src/motif/menu.cpp +++ b/src/motif/menu.cpp @@ -151,7 +151,7 @@ void wxMenu::SetTitle(const wxString& label) { m_title = label; - wxMenuItemList::Node *node = GetMenuItems().GetFirst(); + wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst(); if ( !node ) return; @@ -334,7 +334,7 @@ int wxMenuBar::FindMenuItem (const wxString& menuString, const wxString& itemStr { wxStripMenuCodes (wxConstCast(m_titles[i].c_str(), char), buf2); if (strcmp (buf1, buf2) == 0) - return m_menus[i]->FindItem (itemString); + return m_menus.Item(i)->GetData()->FindItem (itemString); } return -1; } @@ -347,7 +347,7 @@ wxMenuItem *wxMenuBar::FindItem(int id, wxMenu ** itemMenu) const wxMenuItem *item = NULL; size_t menuCount = GetMenuCount(); for (size_t i = 0; i < menuCount; i++) - if ((item = m_menus[i]->FindItem(id, itemMenu))) + if ((item = m_menus.Item(i)->GetData()->FindItem(id, itemMenu))) return item; return NULL; } @@ -442,12 +442,13 @@ void wxMenu::DestroyWidgetAndDetach() wxMenu *menuParent = GetParent(); if ( menuParent ) { - wxMenuItemList::Node *node = menuParent->GetMenuItems().GetFirst(); + wxMenuItemList::compatibility_iterator node = menuParent->GetMenuItems().GetFirst(); while ( node ) { if ( node->GetData()->GetSubMenu() == this ) { - menuParent->GetMenuItems().DeleteNode(node); + delete node->GetData(); + menuParent->GetMenuItems().Erase(node); break; } @@ -513,7 +514,7 @@ WXWidget wxMenu::CreateMenu (wxMenuBar * menuBar, WXWidget parent, wxMenu * topM m_menuBar = menuBar; m_topLevelMenu = topMenu; - for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst(); + for ( wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst(); node; node = node->GetNext() ) { @@ -534,7 +535,7 @@ WXWidget wxMenu::CreateMenu (wxMenuBar * menuBar, WXWidget parent, wxMenu * topM // do a CreateMenu again. void wxMenu::DestroyMenu (bool full) { - for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst(); + for ( wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst(); node; node = node->GetNext() ) { @@ -569,7 +570,7 @@ WXWidget wxMenu::FindMenuItem (int id, wxMenuItem ** it) const return m_buttonWidget; } - for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst(); + for ( wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst(); node; node = node->GetNext() ) { @@ -604,7 +605,7 @@ void wxMenu::SetBackgroundColour(const wxColour& col) if (m_buttonWidget) wxDoChangeBackgroundColour(m_buttonWidget, (wxColour&) col, TRUE); - for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst(); + for ( wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst(); node; node = node->GetNext() ) { @@ -627,7 +628,7 @@ void wxMenu::SetForegroundColour(const wxColour& col) if (m_buttonWidget) wxDoChangeForegroundColour(m_buttonWidget, (wxColour&) col); - for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst(); + for ( wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst(); node; node = node->GetNext() ) { @@ -661,7 +662,7 @@ void wxMenu::ChangeFont(bool keepOriginalSize) NULL); } - for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst(); + for ( wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst(); node; node = node->GetNext() ) { @@ -692,7 +693,7 @@ bool wxMenuBar::SetBackgroundColour(const wxColour& col) size_t menuCount = GetMenuCount(); for (size_t i = 0; i < menuCount; i++) - m_menus[i]->SetBackgroundColour((wxColour&) col); + m_menus.Item(i)->GetData()->SetBackgroundColour((wxColour&) col); return TRUE; } @@ -705,7 +706,7 @@ bool wxMenuBar::SetForegroundColour(const wxColour& col) size_t menuCount = GetMenuCount(); for (size_t i = 0; i < menuCount; i++) - m_menus[i]->SetForegroundColour((wxColour&) col); + m_menus.Item(i)->GetData()->SetForegroundColour((wxColour&) col); return TRUE; } @@ -722,7 +723,7 @@ bool wxMenuBar::SetFont(const wxFont& font) size_t menuCount = GetMenuCount(); for (size_t i = 0; i < menuCount; i++) - m_menus[i]->SetFont(font); + m_menus.Item(i)->GetData()->SetFont(font); return TRUE; } diff --git a/src/motif/palette.cpp b/src/motif/palette.cpp index 8db16a4440..48368b8e34 100644 --- a/src/motif/palette.cpp +++ b/src/motif/palette.cpp @@ -77,7 +77,7 @@ wxPaletteRefData::~wxPaletteRefData() { Display *display = (Display*) NULL; - wxList::Node *node, *next; + wxList::compatibility_iterator node, next; for (node = m_palettes.GetFirst(); node; node = next) { wxXPalette *c = (wxXPalette *)node->GetData(); @@ -104,7 +104,7 @@ wxPaletteRefData::~wxPaletteRefData() XFreeColormap(display, cmap); next = node->GetNext(); - m_palettes.DeleteNode(node); + m_palettes.Erase(node); delete c; } } @@ -192,7 +192,7 @@ WXColormap wxPalette::GetXColormap(WXDisplay* display) const if (!M_PALETTEDATA || (M_PALETTEDATA->m_palettes.GetCount() == 0)) return wxTheApp->GetMainColormap(display); - wxList::Node* node = M_PALETTEDATA->m_palettes.GetFirst(); + wxList::compatibility_iterator node = M_PALETTEDATA->m_palettes.GetFirst(); if (!display && node) { wxXPalette* p = (wxXPalette*) node->GetData(); @@ -320,7 +320,7 @@ unsigned long *wxPalette::GetXPixArray(WXDisplay *display, int *n) { if (!M_PALETTEDATA) return (unsigned long*) 0; - wxList::Node *node; + wxList::compatibility_iterator node; for (node = M_PALETTEDATA->m_palettes.GetFirst(); node; node = node->GetNext()) diff --git a/src/motif/radiobut.cpp b/src/motif/radiobut.cpp index 4cada5de0e..cedc3277b6 100644 --- a/src/motif/radiobut.cpp +++ b/src/motif/radiobut.cpp @@ -110,7 +110,7 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id, { /* 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(); diff --git a/src/motif/toolbar.cpp b/src/motif/toolbar.cpp index 6bdc23d9cd..2a75efa5b1 100644 --- a/src/motif/toolbar.cpp +++ b/src/motif/toolbar.cpp @@ -281,7 +281,7 @@ bool wxToolBar::Realize() Pixmap pixmap, insensPixmap; wxBitmap bmp, insensBmp; - wxToolBarToolsList::Node *node = m_tools.GetFirst(); + wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst(); while ( node ) { wxToolBarTool *tool = (wxToolBarTool *)node->GetData(); @@ -507,7 +507,7 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool) int packing = GetToolPacking(); int offset = 0; - for( wxToolBarToolsList::Node *node = m_tools.GetFirst(); + for( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst(); node; node = node->GetNext() ) { wxToolBarTool *t = (wxToolBarTool*)node->GetData(); @@ -644,7 +644,7 @@ void wxToolBar::DoSetSize(int x, int y, int width, int height, int sizeFlags) wxToolBarToolBase *wxToolBar::FindToolByWidget(WXWidget w) const { - wxToolBarToolsList::Node* node = m_tools.GetFirst(); + wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst(); while ( node ) { wxToolBarTool *tool = (wxToolBarTool *)node->GetData(); diff --git a/src/univ/menu.cpp b/src/univ/menu.cpp index a4e1176552..a71678454b 100644 --- a/src/univ/menu.cpp +++ b/src/univ/menu.cpp @@ -145,7 +145,7 @@ public: } // find the menu item at given position - wxMenuItemList::Node *GetMenuItemFromPoint(const wxPoint& pt) const; + wxMenuItemList::compatibility_iterator GetMenuItemFromPoint(const wxPoint& pt) const; // refresh the given item void RefreshItem(wxMenuItem *item); @@ -183,10 +183,10 @@ protected: void ResetCurrent(); // set the current node and item withotu refreshing anything - void SetCurrent(wxMenuItemList::Node *node); + void SetCurrent(wxMenuItemList::compatibility_iterator node); // change the current item refreshing the old and new items - void ChangeCurrent(wxMenuItemList::Node *node); + void ChangeCurrent(wxMenuItemList::compatibility_iterator node); // activate item, i.e. call either ClickItem() or OpenSubmenu() depending // on what it is, return TRUE if something was done (i.e. it's not a @@ -216,23 +216,23 @@ protected: bool HasOpenSubmenu() const { return m_hasOpenSubMenu; } // get previous node after the current one - wxMenuItemList::Node *GetPrevNode() const; + wxMenuItemList::compatibility_iterator GetPrevNode() const; // get previous node before the given one, wrapping if it's the first one - wxMenuItemList::Node *GetPrevNode(wxMenuItemList::Node *node) const; + wxMenuItemList::compatibility_iterator GetPrevNode(wxMenuItemList::compatibility_iterator node) const; // get next node after the current one - wxMenuItemList::Node *GetNextNode() const; + wxMenuItemList::compatibility_iterator GetNextNode() const; // get next node after the given one, wrapping if it's the last one - wxMenuItemList::Node *GetNextNode(wxMenuItemList::Node *node) const; + wxMenuItemList::compatibility_iterator GetNextNode(wxMenuItemList::compatibility_iterator node) const; private: // the menu we show wxMenu *m_menu; // the menu node corresponding to the current item - wxMenuItemList::Node *m_nodeCurrent; + wxMenuItemList::compatibility_iterator m_nodeCurrent; // do we currently have an opened submenu? bool m_hasOpenSubMenu; @@ -328,19 +328,23 @@ wxPopupMenuWindow::~wxPopupMenuWindow() void wxPopupMenuWindow::ResetCurrent() { +#if wxUSE_STL + SetCurrent(wxMenuItemList::compatibility_iterator()); +#else SetCurrent(NULL); +#endif } -void wxPopupMenuWindow::SetCurrent(wxMenuItemList::Node *node) +void wxPopupMenuWindow::SetCurrent(wxMenuItemList::compatibility_iterator node) { m_nodeCurrent = node; } -void wxPopupMenuWindow::ChangeCurrent(wxMenuItemList::Node *node) +void wxPopupMenuWindow::ChangeCurrent(wxMenuItemList::compatibility_iterator node) { if ( node != m_nodeCurrent ) { - wxMenuItemList::Node *nodeOldCurrent = m_nodeCurrent; + wxMenuItemList::compatibility_iterator nodeOldCurrent = m_nodeCurrent; m_nodeCurrent = node; @@ -364,15 +368,15 @@ void wxPopupMenuWindow::ChangeCurrent(wxMenuItemList::Node *node) } } -wxMenuItemList::Node *wxPopupMenuWindow::GetPrevNode() const +wxMenuItemList::compatibility_iterator wxPopupMenuWindow::GetPrevNode() const { // return the last node if there had been no previously selected one return m_nodeCurrent ? GetPrevNode(m_nodeCurrent) : m_menu->GetMenuItems().GetLast(); } -wxMenuItemList::Node * -wxPopupMenuWindow::GetPrevNode(wxMenuItemList::Node *node) const +wxMenuItemList::compatibility_iterator +wxPopupMenuWindow::GetPrevNode(wxMenuItemList::compatibility_iterator node) const { if ( node ) { @@ -387,15 +391,15 @@ wxPopupMenuWindow::GetPrevNode(wxMenuItemList::Node *node) const return node; } -wxMenuItemList::Node *wxPopupMenuWindow::GetNextNode() const +wxMenuItemList::compatibility_iterator wxPopupMenuWindow::GetNextNode() const { // return the first node if there had been no previously selected one return m_nodeCurrent ? GetNextNode(m_nodeCurrent) : m_menu->GetMenuItems().GetFirst(); } -wxMenuItemList::Node * -wxPopupMenuWindow::GetNextNode(wxMenuItemList::Node *node) const +wxMenuItemList::compatibility_iterator +wxPopupMenuWindow::GetNextNode(wxMenuItemList::compatibility_iterator node) const { if ( node ) { @@ -488,7 +492,7 @@ void wxPopupMenuWindow::DismissAndNotify() // wxPopupMenuWindow geometry // ---------------------------------------------------------------------------- -wxMenuItemList::Node * +wxMenuItemList::compatibility_iterator wxPopupMenuWindow::GetMenuItemFromPoint(const wxPoint& pt) const { // we only use the y coord normally, but still check x in case the point is @@ -496,7 +500,7 @@ wxPopupMenuWindow::GetMenuItemFromPoint(const wxPoint& pt) const if ( wxWindow::HitTest(pt) == wxHT_WINDOW_INSIDE ) { wxCoord y = 0; - for ( wxMenuItemList::Node *node = m_menu->GetMenuItems().GetFirst(); + for ( wxMenuItemList::compatibility_iterator node = m_menu->GetMenuItems().GetFirst(); node; node = node->GetNext() ) { @@ -510,7 +514,11 @@ wxPopupMenuWindow::GetMenuItemFromPoint(const wxPoint& pt) const } } +#if wxUSE_STL + return wxMenuItemList::compatibility_iterator(); +#else return NULL; +#endif } // ---------------------------------------------------------------------------- @@ -544,7 +552,7 @@ void wxPopupMenuWindow::DoDraw(wxControlRenderer *renderer) wxCoord y = 0; const wxMenuGeometryInfo& gi = m_menu->GetGeometryInfo(); - for ( wxMenuItemList::Node *node = m_menu->GetMenuItems().GetFirst(); + for ( wxMenuItemList::compatibility_iterator node = m_menu->GetMenuItems().GetFirst(); node; node = node->GetNext() ) { @@ -692,7 +700,7 @@ bool wxPopupMenuWindow::ProcessLeftDown(wxMouseEvent& event) void wxPopupMenuWindow::OnLeftUp(wxMouseEvent& event) { - wxMenuItemList::Node *node = GetMenuItemFromPoint(event.GetPosition()); + wxMenuItemList::compatibility_iterator node = GetMenuItemFromPoint(event.GetPosition()); if ( node ) { ActivateItem(node->GetData(), WithMouse); @@ -726,7 +734,7 @@ void wxPopupMenuWindow::OnMouseMove(wxMouseEvent& event) void wxPopupMenuWindow::ProcessMouseMove(const wxPoint& pt) { - wxMenuItemList::Node *node = GetMenuItemFromPoint(pt); + wxMenuItemList::compatibility_iterator node = GetMenuItemFromPoint(pt); // don't reset current to NULL here, we only do it when the mouse leaves // the window (see below) @@ -817,7 +825,11 @@ void wxPopupMenuWindow::OnMouseLeave(wxMouseEvent& event) if ( resetCurrent ) { +#if wxUSE_STL + ChangeCurrent(wxMenuItemList::compatibility_iterator()); +#else ChangeCurrent(NULL); +#endif } } @@ -889,9 +901,9 @@ bool wxPopupMenuWindow::ProcessKeyDown(int key) { bool up = key == WXK_UP; - wxMenuItemList::Node *nodeStart = up ? GetPrevNode() + wxMenuItemList::compatibility_iterator nodeStart = up ? GetPrevNode() : GetNextNode(), - *node = nodeStart; + node = nodeStart; while ( node && node->GetData()->IsSeparator() ) { node = up ? GetPrevNode(node) : GetNextNode(node); @@ -900,7 +912,11 @@ bool wxPopupMenuWindow::ProcessKeyDown(int key) { // nothing but separators and disabled items in this // menu, break out +#if wxUSE_STL + node = wxMenuItemList::compatibility_iterator(); +#else node = NULL; +#endif } } @@ -934,7 +950,7 @@ bool wxPopupMenuWindow::ProcessKeyDown(int key) // we want to start from the item after this one because // if we're already on the item with the given accel we want to // go to the next one, not to stay in place - wxMenuItemList::Node *nodeStart = GetNextNode(); + wxMenuItemList::compatibility_iterator nodeStart = GetNextNode(); // do we have more than one item with this accel? bool notUnique = FALSE; @@ -944,8 +960,12 @@ bool wxPopupMenuWindow::ProcessKeyDown(int key) // loop through all items searching for the item with this // accel - wxMenuItemList::Node *node = nodeStart, - *nodeFound = NULL; + wxMenuItemList::compatibility_iterator node = nodeStart, +#if wxUSE_STL + nodeFound = wxMenuItemList::compatibility_iterator(); +#else + nodeFound = NULL; +#endif for ( ;; ) { item = node->GetData(); @@ -1113,7 +1133,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 ) { @@ -1398,7 +1418,7 @@ bool wxMenu::ProcessAccelEvent(const wxKeyEvent& event) } // try our submenus - for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst(); + for ( wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst(); node; node = node->GetNext() ) { @@ -1584,7 +1604,7 @@ void wxMenuItem::Check(bool check) } // 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 ) @@ -2335,7 +2355,7 @@ int wxMenuBar::FindNextItemForAccel(int idxStart, int key, bool *unique) const bool wxMenuBar::ProcessAccelEvent(const wxKeyEvent& event) { size_t n = 0; - for ( wxMenuList::Node *node = m_menus.GetFirst(); + for ( wxMenuList::compatibility_iterator node = m_menus.GetFirst(); node; node = node->GetNext(), n++ ) { diff --git a/src/univ/radiobut.cpp b/src/univ/radiobut.cpp index f0ddaa727a..5357f948d7 100644 --- a/src/univ/radiobut.cpp +++ b/src/univ/radiobut.cpp @@ -78,7 +78,7 @@ void wxRadioButton::OnCheck() // find the radio button which is the first in the group, i.e. the one // with wxRB_GROUP style const wxWindowList& siblings = GetParent()->GetChildren(); - wxWindowList::Node *nodeStart = siblings.Find(this); + wxWindowList::compatibility_iterator nodeStart = siblings.Find(this); while ( nodeStart ) { // stop if we found a radio button with wxRB_GROUP style or it we diff --git a/src/univ/themes/gtk.cpp b/src/univ/themes/gtk.cpp index a2d98dd299..50c81098b7 100644 --- a/src/univ/themes/gtk.cpp +++ b/src/univ/themes/gtk.cpp @@ -2155,7 +2155,7 @@ wxMenuGeometryInfo *wxGTKRenderer::GetMenuGeometry(wxWindow *win, widthAccelMax = 0, widthBmpMax = MENU_LEFT_MARGIN; - for ( wxMenuItemList::Node *node = menu.GetMenuItems().GetFirst(); + for ( wxMenuItemList::compatibility_iterator node = menu.GetMenuItems().GetFirst(); node; node = node->GetNext() ) { diff --git a/src/univ/themes/win32.cpp b/src/univ/themes/win32.cpp index d1f5cde013..ef654c4ad5 100644 --- a/src/univ/themes/win32.cpp +++ b/src/univ/themes/win32.cpp @@ -3122,7 +3122,7 @@ wxMenuGeometryInfo *wxWin32Renderer::GetMenuGeometry(wxWindow *win, widthAccelMax = 0, widthBmpMax = MENU_LEFT_MARGIN; - for ( wxMenuItemList::Node *node = menu.GetMenuItems().GetFirst(); + for ( wxMenuItemList::compatibility_iterator node = menu.GetMenuItems().GetFirst(); node; node = node->GetNext() ) { diff --git a/src/univ/toolbar.cpp b/src/univ/toolbar.cpp index e3d2377750..c8ec9c1a20 100644 --- a/src/univ/toolbar.cpp +++ b/src/univ/toolbar.cpp @@ -211,7 +211,7 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const return NULL; } - for ( wxToolBarToolsList::Node *node = m_tools.GetFirst(); + for ( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst(); node; node = node->GetNext() ) { @@ -444,7 +444,7 @@ void wxToolBar::DoLayout() *pCur = IsVertical() ? &y : &x; // calculate the positions of all elements - for ( wxToolBarToolsList::Node *node = m_tools.GetFirst(); + for ( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst(); node; node = node->GetNext() ) { @@ -568,7 +568,7 @@ void wxToolBar::DoDraw(wxControlRenderer *renderer) GetRectLimits(rectUpdate, &start, &end); // and redraw all the tools intersecting it - for ( wxToolBarToolsList::Node *node = m_tools.GetFirst(); + for ( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst(); node; node = node->GetNext() ) { diff --git a/src/univ/winuniv.cpp b/src/univ/winuniv.cpp index 3d4292e5c3..f4aeb43620 100644 --- a/src/univ/winuniv.cpp +++ b/src/univ/winuniv.cpp @@ -393,7 +393,7 @@ void wxWindow::Refresh(bool eraseBackground, const wxRect *rectClient) wxWindowNative::Refresh(eraseBackground, &rectWin); // Refresh all sub controls if any. - wxWindowList::Node *node = GetChildren().GetFirst(); + wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); while ( node ) { wxWindow *win = node->GetData(); @@ -954,7 +954,7 @@ void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect) // scroll children accordingly: wxPoint offset(dx, dy); - for (wxWindowList::Node *node = GetChildren().GetFirst(); + for (wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); node; node = node->GetNext()) { wxWindow *child = node->GetData(); diff --git a/src/x11/evtloop.cpp b/src/x11/evtloop.cpp index 20da77c3e7..701d4cd973 100644 --- a/src/x11/evtloop.cpp +++ b/src/x11/evtloop.cpp @@ -73,7 +73,7 @@ class wxSocketTable: public wxHashTable } ~wxSocketTable() { - DeleteContents(TRUE); + WX_CLEAR_HASH_TABLE(*this) } wxSocketTableEntry* FindEntry(int fd); @@ -171,7 +171,7 @@ bool wxSocketTable::CallCallback(int fd, wxSocketTableType socketType) void wxSocketTable::FillSets(fd_set* readset, fd_set* writeset, int* highest) { BeginFind(); - wxNode* node = Next(); + wxHashTable::compatibility_iterator node = Next(); while (node) { wxSocketTableEntry* entry = (wxSocketTableEntry*) node->GetData(); @@ -197,7 +197,7 @@ void wxSocketTable::FillSets(fd_set* readset, fd_set* writeset, int* highest) void wxSocketTable::ProcessEvents(fd_set* readset, fd_set* writeset) { BeginFind(); - wxNode* node = Next(); + wxHashTable::compatibility_iterator node = Next(); while (node) { wxSocketTableEntry* entry = (wxSocketTableEntry*) node->GetData(); diff --git a/src/x11/font.cpp b/src/x11/font.cpp index 16aeceff70..3e57b0e444 100644 --- a/src/x11/font.cpp +++ b/src/x11/font.cpp @@ -424,7 +424,7 @@ void wxFontRefData::ClearX11Fonts() { #if wxUSE_UNICODE #else - wxNode* node = m_fonts.GetFirst(); + wxList::compatibility_iterator node = m_fonts.GetFirst(); while (node) { wxXFont* f = (wxXFont*) node->GetData(); @@ -872,7 +872,7 @@ wxXFont* wxFont::GetInternalFont(double scale, WXDisplay* display) const int pointSize = (M_FONTDATA->m_pointSize * 10 * intScale) / 100; // search existing fonts first - wxNode* node = M_FONTDATA->m_fonts.GetFirst(); + wxList::compatibility_iterator node = M_FONTDATA->m_fonts.GetFirst(); while (node) { wxXFont* f = (wxXFont*) node->GetData(); diff --git a/src/x11/palette.cpp b/src/x11/palette.cpp index 7a035ffd18..67c40ced54 100644 --- a/src/x11/palette.cpp +++ b/src/x11/palette.cpp @@ -77,7 +77,7 @@ wxPaletteRefData::~wxPaletteRefData() { Display *display = (Display*) NULL; - wxNode *node, *next; + wxList::compatibility_iterator node, next; for (node = m_palettes.GetFirst(); node; node = next) { wxXPalette *c = (wxXPalette *)node->GetData(); @@ -106,7 +106,7 @@ wxPaletteRefData::~wxPaletteRefData() XFreeColormap(display, cmap); next = node->GetNext(); - m_palettes.DeleteNode(node); + m_palettes.Erase(node); delete c; } } @@ -194,7 +194,7 @@ WXColormap wxPalette::GetXColormap(WXDisplay* display) const if (!M_PALETTEDATA || (M_PALETTEDATA->m_palettes.GetCount() == 0)) return wxTheApp->GetMainColormap(display); - wxNode* node = M_PALETTEDATA->m_palettes.GetFirst(); + wxList::compatibility_iterator node = M_PALETTEDATA->m_palettes.GetFirst(); if (!display && node) { wxXPalette* p = (wxXPalette*) node->GetData(); @@ -319,7 +319,7 @@ unsigned long *wxPalette::GetXPixArray(WXDisplay *display, int *n) { if (!M_PALETTEDATA) return (unsigned long*) 0; - wxNode *node; + wxList::compatibility_iterator node; for (node = M_PALETTEDATA->m_palettes.GetFirst(); node; node = node->GetNext()) { diff --git a/src/x11/window.cpp b/src/x11/window.cpp index 1edf8c6604..fe52bbff49 100644 --- a/src/x11/window.cpp +++ b/src/x11/window.cpp @@ -1261,7 +1261,7 @@ void wxWindowX11::SendNcPaintEvents() // Responds to colour changes: passes event on to children. void wxWindowX11::OnSysColourChanged(wxSysColourChangedEvent& event) { - wxWindowList::Node *node = GetChildren().GetFirst(); + wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); while ( node ) { // Only propagate to non-top-level windows -- 2.45.2