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
This commit is contained in:
Mattia Barbon
2003-07-21 20:00:38 +00:00
parent a381fd1c0a
commit ac32ba44a1
22 changed files with 117 additions and 96 deletions

View File

@@ -60,7 +60,7 @@ bool wxBitmapBase::RemoveHandler(const wxString& name)
wxBitmapHandler *wxBitmapBase::FindHandler(const wxString& name) wxBitmapHandler *wxBitmapBase::FindHandler(const wxString& name)
{ {
wxList::Node *node = sm_handlers.GetFirst(); wxList::compatibility_iterator node = sm_handlers.GetFirst();
while ( node ) while ( node )
{ {
wxBitmapHandler *handler = (wxBitmapHandler *)node->GetData(); wxBitmapHandler *handler = (wxBitmapHandler *)node->GetData();
@@ -73,7 +73,7 @@ wxBitmapHandler *wxBitmapBase::FindHandler(const wxString& name)
wxBitmapHandler *wxBitmapBase::FindHandler(const wxString& extension, wxBitmapType bitmapType) wxBitmapHandler *wxBitmapBase::FindHandler(const wxString& extension, wxBitmapType bitmapType)
{ {
wxList::Node *node = sm_handlers.GetFirst(); wxList::compatibility_iterator node = sm_handlers.GetFirst();
while ( node ) while ( node )
{ {
wxBitmapHandler *handler = (wxBitmapHandler *)node->GetData(); wxBitmapHandler *handler = (wxBitmapHandler *)node->GetData();
@@ -87,7 +87,7 @@ wxBitmapHandler *wxBitmapBase::FindHandler(const wxString& extension, wxBitmapTy
wxBitmapHandler *wxBitmapBase::FindHandler(wxBitmapType bitmapType) wxBitmapHandler *wxBitmapBase::FindHandler(wxBitmapType bitmapType)
{ {
wxList::Node *node = sm_handlers.GetFirst(); wxList::compatibility_iterator node = sm_handlers.GetFirst();
while ( node ) while ( node )
{ {
wxBitmapHandler *handler = (wxBitmapHandler *)node->GetData(); wxBitmapHandler *handler = (wxBitmapHandler *)node->GetData();
@@ -100,13 +100,13 @@ wxBitmapHandler *wxBitmapBase::FindHandler(wxBitmapType bitmapType)
void wxBitmapBase::CleanUpHandlers() void wxBitmapBase::CleanUpHandlers()
{ {
wxList::Node *node = sm_handlers.GetFirst(); wxList::compatibility_iterator node = sm_handlers.GetFirst();
while ( node ) while ( node )
{ {
wxBitmapHandler *handler = (wxBitmapHandler *)node->GetData(); wxBitmapHandler *handler = (wxBitmapHandler *)node->GetData();
wxList::Node *next = node->GetNext(); wxList::compatibility_iterator next = node->GetNext();
delete handler; delete handler;
delete node; sm_handlers.Erase(node);
node = next; node = next;
} }
} }

View File

@@ -590,7 +590,7 @@ void wxGenericMDIChildFrame::OnSize(wxSizeEvent& WXUNUSED(event))
{ {
// do we have _exactly_ one child? // do we have _exactly_ one child?
wxWindow *child = (wxWindow *)NULL; wxWindow *child = (wxWindow *)NULL;
for ( wxWindowList::Node *node = GetChildren().GetFirst(); for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
node; node;
node = node->GetNext() ) node = node->GetNext() )
{ {

View File

@@ -127,7 +127,7 @@ void wxButton::SetDefault()
// wxButton in the same row, correction is straighforward: we set // wxButton in the same row, correction is straighforward: we set
// resource for all wxButton in this parent (but not sub panels) // 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 ()) node; node = node->GetNext ())
{ {
wxWindow *win = node->GetData (); wxWindow *win = node->GetData ();

View File

@@ -222,7 +222,7 @@ void wxChoice::Delete(int n)
Widget w = (Widget)m_widgetArray[n]; Widget w = (Widget)m_widgetArray[n];
XtRemoveCallback(w, XmNactivateCallback, (XtCallbackProc)wxChoiceCallback, XtRemoveCallback(w, XmNactivateCallback, (XtCallbackProc)wxChoiceCallback,
(XtPointer)this); (XtPointer)this);
m_stringList.DeleteNode(m_stringList.Item(n)); m_stringList.Erase(m_stringList.Item(n));
m_widgetArray.RemoveAt(size_t(n)); m_widgetArray.RemoveAt(size_t(n));
m_clientDataDict.Delete(n, HasClientObjectData()); m_clientDataDict.Delete(n, HasClientObjectData());
@@ -267,7 +267,7 @@ int wxChoice::GetSelection() const
if (!s.IsEmpty()) if (!s.IsEmpty())
{ {
int i = 0; int i = 0;
for (wxStringListNode* node = m_stringList.GetFirst (); for (wxStringList::compatibility_iterator node = m_stringList.GetFirst ();
node; node = node->GetNext ()) node; node = node->GetNext ())
{ {
if (wxStrcmp(node->GetData(), s.c_str()) == 0) if (wxStrcmp(node->GetData(), s.c_str()) == 0)
@@ -287,7 +287,7 @@ void wxChoice::SetSelection(int n)
{ {
m_inSetValue = TRUE; m_inSetValue = TRUE;
wxStringListNode *node = m_stringList.Item(n); wxStringList::compatibility_iterator node = m_stringList.Item(n);
if (node) if (node)
{ {
#if 0 #if 0
@@ -318,7 +318,7 @@ void wxChoice::SetSelection(int n)
int wxChoice::FindString(const wxString& s) const int wxChoice::FindString(const wxString& s) const
{ {
int i = 0; int i = 0;
for (wxStringListNode* node = m_stringList.GetFirst(); for (wxStringList::compatibility_iterator node = m_stringList.GetFirst();
node; node = node->GetNext ()) node; node = node->GetNext ())
{ {
if (s == node->GetData()) if (s == node->GetData())
@@ -332,7 +332,7 @@ int wxChoice::FindString(const wxString& s) const
wxString wxChoice::GetString(int n) const wxString wxChoice::GetString(int n) const
{ {
wxStringListNode *node = m_stringList.Item(n); wxStringList::compatibility_iterator node = m_stringList.Item(n);
if (node) if (node)
return node->GetData(); return node->GetData();
else else
@@ -523,7 +523,7 @@ wxSize wxChoice::GetItemsSize() const
// get my // get my
GetTextExtent( "|", &x, &my ); GetTextExtent( "|", &x, &my );
wxStringList::Node* curr = m_stringList.GetFirst(); wxStringList::compatibility_iterator curr = m_stringList.GetFirst();
while( curr ) while( curr )
{ {
GetTextExtent( curr->GetData(), &x, &y ); GetTextExtent( curr->GetData(), &x, &y );

View File

@@ -195,7 +195,7 @@ wxClipboard::~wxClipboard()
void wxClipboard::Clear() void wxClipboard::Clear()
{ {
wxDataObjectList::Node* node = m_data.GetFirst(); wxDataObjectList::compatibility_iterator node = m_data.GetFirst();
while (node) while (node)
{ {
delete node->GetData(); delete node->GetData();
@@ -203,7 +203,7 @@ void wxClipboard::Clear()
} }
m_data.Clear(); m_data.Clear();
for( wxDataIdToDataObjectList::Node* node2 = m_idToObject.GetFirst(); for( wxDataIdToDataObjectList::compatibility_iterator node2 = m_idToObject.GetFirst();
node2; node2 = node2->GetNext() ) node2; node2 = node2->GetNext() )
delete node->GetData(); delete node->GetData();
m_idToObject.Clear(); m_idToObject.Clear();
@@ -244,7 +244,7 @@ void wxClipboardCallback( Widget xwidget, long* data_id,
wxDataObject* dobj = NULL; wxDataObject* dobj = NULL;
size_t size = 0; size_t size = 0;
for( wxDataIdToDataObjectList::Node* node2 = for( wxDataIdToDataObjectList::compatibility_iterator node2 =
wxTheClipboard->m_idToObject.GetFirst(); wxTheClipboard->m_idToObject.GetFirst();
node2; node2 = node2->GetNext() ) node2; node2 = node2->GetNext() )
{ {

View File

@@ -69,7 +69,7 @@ wxCursorRefData::wxCursorRefData()
wxCursorRefData::~wxCursorRefData() wxCursorRefData::~wxCursorRefData()
{ {
wxXCursorList::Node* node = m_cursors.GetFirst(); wxXCursorList::compatibility_iterator node = m_cursors.GetFirst();
while (node) while (node)
{ {
wxXCursor* c = node->GetData(); wxXCursor* c = node->GetData();
@@ -299,7 +299,7 @@ WXCursor wxCursor::GetXCursor(WXDisplay* display)
{ {
if (!M_CURSORDATA) if (!M_CURSORDATA)
return (WXCursor) 0; return (WXCursor) 0;
wxXCursorList::Node* node = M_CURSORDATA->m_cursors.GetFirst(); wxXCursorList::compatibility_iterator node = M_CURSORDATA->m_cursors.GetFirst();
while (node) while (node)
{ {
wxXCursor* c = node->GetData(); wxXCursor* c = node->GetData();
@@ -452,7 +452,7 @@ wxXSetBusyCursor (wxWindow * win, wxCursor * cursor)
XFlush (display); XFlush (display);
for(wxWindowList::Node *node = win->GetChildren().GetFirst (); node; for(wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst (); node;
node = node->GetNext()) node = node->GetNext())
{ {
wxWindow *child = node->GetData (); wxWindow *child = node->GetData ();
@@ -466,7 +466,7 @@ void wxBeginBusyCursor(wxCursor *cursor)
wxBusyCursorCount++; wxBusyCursorCount++;
if (wxBusyCursorCount == 1) if (wxBusyCursorCount == 1)
{ {
for(wxWindowList::Node *node = wxTopLevelWindows.GetFirst (); node; for(wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst (); node;
node = node->GetNext()) node = node->GetNext())
{ {
wxWindow *win = node->GetData (); wxWindow *win = node->GetData ();
@@ -484,7 +484,7 @@ void wxEndBusyCursor()
wxBusyCursorCount--; wxBusyCursorCount--;
if (wxBusyCursorCount == 0) if (wxBusyCursorCount == 0)
{ {
for(wxWindowList::Node *node = wxTopLevelWindows.GetFirst (); node; for(wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst (); node;
node = node->GetNext()) node = node->GetNext())
{ {
wxWindow *win = node->GetData (); wxWindow *win = node->GetData ();

View File

@@ -188,7 +188,7 @@ void wxFontRefData::Init(int pointSize,
wxFontRefData::~wxFontRefData() wxFontRefData::~wxFontRefData()
{ {
wxList::Node* node = m_fonts.GetFirst(); wxList::compatibility_iterator node = m_fonts.GetFirst();
while (node) while (node)
{ {
wxXFont* f = (wxXFont*) node->GetData(); 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; int pointSize = (M_FONTDATA->m_pointSize * 10 * intScale) / 100;
// search existing fonts first // search existing fonts first
wxList::Node* node = M_FONTDATA->m_fonts.GetFirst(); wxList::compatibility_iterator node = M_FONTDATA->m_fonts.GetFirst();
while (node) while (node)
{ {
wxXFont* f = (wxXFont*) node->GetData(); wxXFont* f = (wxXFont*) node->GetData();

View File

@@ -581,7 +581,7 @@ void wxFrame::OnActivate(wxActivateEvent& event)
if (!event.GetActive()) if (!event.GetActive())
return; return;
for(wxWindowList::Node *node = GetChildren().GetFirst(); node; for(wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); node;
node = node->GetNext()) node = node->GetNext())
{ {
// Find a child that's a subwindow, but not a dialog box. // Find a child that's a subwindow, but not a dialog box.

View File

@@ -151,7 +151,7 @@ void wxMenu::SetTitle(const wxString& label)
{ {
m_title = label; m_title = label;
wxMenuItemList::Node *node = GetMenuItems().GetFirst(); wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
if ( !node ) if ( !node )
return; return;
@@ -334,7 +334,7 @@ int wxMenuBar::FindMenuItem (const wxString& menuString, const wxString& itemStr
{ {
wxStripMenuCodes (wxConstCast(m_titles[i].c_str(), char), buf2); wxStripMenuCodes (wxConstCast(m_titles[i].c_str(), char), buf2);
if (strcmp (buf1, buf2) == 0) if (strcmp (buf1, buf2) == 0)
return m_menus[i]->FindItem (itemString); return m_menus.Item(i)->GetData()->FindItem (itemString);
} }
return -1; return -1;
} }
@@ -347,7 +347,7 @@ wxMenuItem *wxMenuBar::FindItem(int id, wxMenu ** itemMenu) const
wxMenuItem *item = NULL; wxMenuItem *item = NULL;
size_t menuCount = GetMenuCount(); size_t menuCount = GetMenuCount();
for (size_t i = 0; i < menuCount; i++) 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 item;
return NULL; return NULL;
} }
@@ -442,12 +442,13 @@ void wxMenu::DestroyWidgetAndDetach()
wxMenu *menuParent = GetParent(); wxMenu *menuParent = GetParent();
if ( menuParent ) if ( menuParent )
{ {
wxMenuItemList::Node *node = menuParent->GetMenuItems().GetFirst(); wxMenuItemList::compatibility_iterator node = menuParent->GetMenuItems().GetFirst();
while ( node ) while ( node )
{ {
if ( node->GetData()->GetSubMenu() == this ) if ( node->GetData()->GetSubMenu() == this )
{ {
menuParent->GetMenuItems().DeleteNode(node); delete node->GetData();
menuParent->GetMenuItems().Erase(node);
break; break;
} }
@@ -513,7 +514,7 @@ WXWidget wxMenu::CreateMenu (wxMenuBar * menuBar, WXWidget parent, wxMenu * topM
m_menuBar = menuBar; m_menuBar = menuBar;
m_topLevelMenu = topMenu; m_topLevelMenu = topMenu;
for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst(); for ( wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
node; node;
node = node->GetNext() ) node = node->GetNext() )
{ {
@@ -534,7 +535,7 @@ WXWidget wxMenu::CreateMenu (wxMenuBar * menuBar, WXWidget parent, wxMenu * topM
// do a CreateMenu again. // do a CreateMenu again.
void wxMenu::DestroyMenu (bool full) void wxMenu::DestroyMenu (bool full)
{ {
for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst(); for ( wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
node; node;
node = node->GetNext() ) node = node->GetNext() )
{ {
@@ -569,7 +570,7 @@ WXWidget wxMenu::FindMenuItem (int id, wxMenuItem ** it) const
return m_buttonWidget; return m_buttonWidget;
} }
for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst(); for ( wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
node; node;
node = node->GetNext() ) node = node->GetNext() )
{ {
@@ -604,7 +605,7 @@ void wxMenu::SetBackgroundColour(const wxColour& col)
if (m_buttonWidget) if (m_buttonWidget)
wxDoChangeBackgroundColour(m_buttonWidget, (wxColour&) col, TRUE); wxDoChangeBackgroundColour(m_buttonWidget, (wxColour&) col, TRUE);
for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst(); for ( wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
node; node;
node = node->GetNext() ) node = node->GetNext() )
{ {
@@ -627,7 +628,7 @@ void wxMenu::SetForegroundColour(const wxColour& col)
if (m_buttonWidget) if (m_buttonWidget)
wxDoChangeForegroundColour(m_buttonWidget, (wxColour&) col); wxDoChangeForegroundColour(m_buttonWidget, (wxColour&) col);
for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst(); for ( wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
node; node;
node = node->GetNext() ) node = node->GetNext() )
{ {
@@ -661,7 +662,7 @@ void wxMenu::ChangeFont(bool keepOriginalSize)
NULL); NULL);
} }
for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst(); for ( wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
node; node;
node = node->GetNext() ) node = node->GetNext() )
{ {
@@ -692,7 +693,7 @@ bool wxMenuBar::SetBackgroundColour(const wxColour& col)
size_t menuCount = GetMenuCount(); size_t menuCount = GetMenuCount();
for (size_t i = 0; i < menuCount; i++) for (size_t i = 0; i < menuCount; i++)
m_menus[i]->SetBackgroundColour((wxColour&) col); m_menus.Item(i)->GetData()->SetBackgroundColour((wxColour&) col);
return TRUE; return TRUE;
} }
@@ -705,7 +706,7 @@ bool wxMenuBar::SetForegroundColour(const wxColour& col)
size_t menuCount = GetMenuCount(); size_t menuCount = GetMenuCount();
for (size_t i = 0; i < menuCount; i++) for (size_t i = 0; i < menuCount; i++)
m_menus[i]->SetForegroundColour((wxColour&) col); m_menus.Item(i)->GetData()->SetForegroundColour((wxColour&) col);
return TRUE; return TRUE;
} }
@@ -722,7 +723,7 @@ bool wxMenuBar::SetFont(const wxFont& font)
size_t menuCount = GetMenuCount(); size_t menuCount = GetMenuCount();
for (size_t i = 0; i < menuCount; i++) for (size_t i = 0; i < menuCount; i++)
m_menus[i]->SetFont(font); m_menus.Item(i)->GetData()->SetFont(font);
return TRUE; return TRUE;
} }

View File

@@ -77,7 +77,7 @@ wxPaletteRefData::~wxPaletteRefData()
{ {
Display *display = (Display*) NULL; Display *display = (Display*) NULL;
wxList::Node *node, *next; wxList::compatibility_iterator node, next;
for (node = m_palettes.GetFirst(); node; node = next) { for (node = m_palettes.GetFirst(); node; node = next) {
wxXPalette *c = (wxXPalette *)node->GetData(); wxXPalette *c = (wxXPalette *)node->GetData();
@@ -104,7 +104,7 @@ wxPaletteRefData::~wxPaletteRefData()
XFreeColormap(display, cmap); XFreeColormap(display, cmap);
next = node->GetNext(); next = node->GetNext();
m_palettes.DeleteNode(node); m_palettes.Erase(node);
delete c; delete c;
} }
} }
@@ -192,7 +192,7 @@ WXColormap wxPalette::GetXColormap(WXDisplay* display) const
if (!M_PALETTEDATA || (M_PALETTEDATA->m_palettes.GetCount() == 0)) if (!M_PALETTEDATA || (M_PALETTEDATA->m_palettes.GetCount() == 0))
return wxTheApp->GetMainColormap(display); return wxTheApp->GetMainColormap(display);
wxList::Node* node = M_PALETTEDATA->m_palettes.GetFirst(); wxList::compatibility_iterator node = M_PALETTEDATA->m_palettes.GetFirst();
if (!display && node) if (!display && node)
{ {
wxXPalette* p = (wxXPalette*) node->GetData(); wxXPalette* p = (wxXPalette*) node->GetData();
@@ -320,7 +320,7 @@ unsigned long *wxPalette::GetXPixArray(WXDisplay *display, int *n)
{ {
if (!M_PALETTEDATA) if (!M_PALETTEDATA)
return (unsigned long*) 0; return (unsigned long*) 0;
wxList::Node *node; wxList::compatibility_iterator node;
for (node = M_PALETTEDATA->m_palettes.GetFirst(); node; for (node = M_PALETTEDATA->m_palettes.GetFirst(); node;
node = node->GetNext()) node = node->GetNext())

View File

@@ -110,7 +110,7 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
{ {
/* search backward for last group start */ /* search backward for last group start */
wxRadioButton *chief = (wxRadioButton*) NULL; wxRadioButton *chief = (wxRadioButton*) NULL;
wxWindowList::Node *node = parent->GetChildren().GetLast(); wxWindowList::compatibility_iterator node = parent->GetChildren().GetLast();
while (node) while (node)
{ {
wxWindow *child = node->GetData(); wxWindow *child = node->GetData();

View File

@@ -281,7 +281,7 @@ bool wxToolBar::Realize()
Pixmap pixmap, insensPixmap; Pixmap pixmap, insensPixmap;
wxBitmap bmp, insensBmp; wxBitmap bmp, insensBmp;
wxToolBarToolsList::Node *node = m_tools.GetFirst(); wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
while ( node ) while ( node )
{ {
wxToolBarTool *tool = (wxToolBarTool *)node->GetData(); wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
@@ -507,7 +507,7 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool)
int packing = GetToolPacking(); int packing = GetToolPacking();
int offset = 0; int offset = 0;
for( wxToolBarToolsList::Node *node = m_tools.GetFirst(); for( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
node; node = node->GetNext() ) node; node = node->GetNext() )
{ {
wxToolBarTool *t = (wxToolBarTool*)node->GetData(); 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 wxToolBarToolBase *wxToolBar::FindToolByWidget(WXWidget w) const
{ {
wxToolBarToolsList::Node* node = m_tools.GetFirst(); wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
while ( node ) while ( node )
{ {
wxToolBarTool *tool = (wxToolBarTool *)node->GetData(); wxToolBarTool *tool = (wxToolBarTool *)node->GetData();

View File

@@ -145,7 +145,7 @@ public:
} }
// find the menu item at given position // 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 // refresh the given item
void RefreshItem(wxMenuItem *item); void RefreshItem(wxMenuItem *item);
@@ -183,10 +183,10 @@ protected:
void ResetCurrent(); void ResetCurrent();
// set the current node and item withotu refreshing anything // 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 // 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 // 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 // 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; } bool HasOpenSubmenu() const { return m_hasOpenSubMenu; }
// get previous node after the current one // 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 // 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 // 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 // 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: private:
// the menu we show // the menu we show
wxMenu *m_menu; wxMenu *m_menu;
// the menu node corresponding to the current item // the menu node corresponding to the current item
wxMenuItemList::Node *m_nodeCurrent; wxMenuItemList::compatibility_iterator m_nodeCurrent;
// do we currently have an opened submenu? // do we currently have an opened submenu?
bool m_hasOpenSubMenu; bool m_hasOpenSubMenu;
@@ -328,19 +328,23 @@ wxPopupMenuWindow::~wxPopupMenuWindow()
void wxPopupMenuWindow::ResetCurrent() void wxPopupMenuWindow::ResetCurrent()
{ {
#if wxUSE_STL
SetCurrent(wxMenuItemList::compatibility_iterator());
#else
SetCurrent(NULL); SetCurrent(NULL);
#endif
} }
void wxPopupMenuWindow::SetCurrent(wxMenuItemList::Node *node) void wxPopupMenuWindow::SetCurrent(wxMenuItemList::compatibility_iterator node)
{ {
m_nodeCurrent = node; m_nodeCurrent = node;
} }
void wxPopupMenuWindow::ChangeCurrent(wxMenuItemList::Node *node) void wxPopupMenuWindow::ChangeCurrent(wxMenuItemList::compatibility_iterator node)
{ {
if ( node != m_nodeCurrent ) if ( node != m_nodeCurrent )
{ {
wxMenuItemList::Node *nodeOldCurrent = m_nodeCurrent; wxMenuItemList::compatibility_iterator nodeOldCurrent = m_nodeCurrent;
m_nodeCurrent = node; 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 the last node if there had been no previously selected one
return m_nodeCurrent ? GetPrevNode(m_nodeCurrent) return m_nodeCurrent ? GetPrevNode(m_nodeCurrent)
: m_menu->GetMenuItems().GetLast(); : m_menu->GetMenuItems().GetLast();
} }
wxMenuItemList::Node * wxMenuItemList::compatibility_iterator
wxPopupMenuWindow::GetPrevNode(wxMenuItemList::Node *node) const wxPopupMenuWindow::GetPrevNode(wxMenuItemList::compatibility_iterator node) const
{ {
if ( node ) if ( node )
{ {
@@ -387,15 +391,15 @@ wxPopupMenuWindow::GetPrevNode(wxMenuItemList::Node *node) const
return node; 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 the first node if there had been no previously selected one
return m_nodeCurrent ? GetNextNode(m_nodeCurrent) return m_nodeCurrent ? GetNextNode(m_nodeCurrent)
: m_menu->GetMenuItems().GetFirst(); : m_menu->GetMenuItems().GetFirst();
} }
wxMenuItemList::Node * wxMenuItemList::compatibility_iterator
wxPopupMenuWindow::GetNextNode(wxMenuItemList::Node *node) const wxPopupMenuWindow::GetNextNode(wxMenuItemList::compatibility_iterator node) const
{ {
if ( node ) if ( node )
{ {
@@ -488,7 +492,7 @@ void wxPopupMenuWindow::DismissAndNotify()
// wxPopupMenuWindow geometry // wxPopupMenuWindow geometry
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
wxMenuItemList::Node * wxMenuItemList::compatibility_iterator
wxPopupMenuWindow::GetMenuItemFromPoint(const wxPoint& pt) const wxPopupMenuWindow::GetMenuItemFromPoint(const wxPoint& pt) const
{ {
// we only use the y coord normally, but still check x in case the point is // 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 ) if ( wxWindow::HitTest(pt) == wxHT_WINDOW_INSIDE )
{ {
wxCoord y = 0; wxCoord y = 0;
for ( wxMenuItemList::Node *node = m_menu->GetMenuItems().GetFirst(); for ( wxMenuItemList::compatibility_iterator node = m_menu->GetMenuItems().GetFirst();
node; node;
node = node->GetNext() ) node = node->GetNext() )
{ {
@@ -510,7 +514,11 @@ wxPopupMenuWindow::GetMenuItemFromPoint(const wxPoint& pt) const
} }
} }
#if wxUSE_STL
return wxMenuItemList::compatibility_iterator();
#else
return NULL; return NULL;
#endif
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -544,7 +552,7 @@ void wxPopupMenuWindow::DoDraw(wxControlRenderer *renderer)
wxCoord y = 0; wxCoord y = 0;
const wxMenuGeometryInfo& gi = m_menu->GetGeometryInfo(); 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 = node->GetNext() ) node = node->GetNext() )
{ {
@@ -692,7 +700,7 @@ bool wxPopupMenuWindow::ProcessLeftDown(wxMouseEvent& event)
void wxPopupMenuWindow::OnLeftUp(wxMouseEvent& event) void wxPopupMenuWindow::OnLeftUp(wxMouseEvent& event)
{ {
wxMenuItemList::Node *node = GetMenuItemFromPoint(event.GetPosition()); wxMenuItemList::compatibility_iterator node = GetMenuItemFromPoint(event.GetPosition());
if ( node ) if ( node )
{ {
ActivateItem(node->GetData(), WithMouse); ActivateItem(node->GetData(), WithMouse);
@@ -726,7 +734,7 @@ void wxPopupMenuWindow::OnMouseMove(wxMouseEvent& event)
void wxPopupMenuWindow::ProcessMouseMove(const wxPoint& pt) 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 // don't reset current to NULL here, we only do it when the mouse leaves
// the window (see below) // the window (see below)
@@ -817,7 +825,11 @@ void wxPopupMenuWindow::OnMouseLeave(wxMouseEvent& event)
if ( resetCurrent ) if ( resetCurrent )
{ {
#if wxUSE_STL
ChangeCurrent(wxMenuItemList::compatibility_iterator());
#else
ChangeCurrent(NULL); ChangeCurrent(NULL);
#endif
} }
} }
@@ -889,9 +901,9 @@ bool wxPopupMenuWindow::ProcessKeyDown(int key)
{ {
bool up = key == WXK_UP; bool up = key == WXK_UP;
wxMenuItemList::Node *nodeStart = up ? GetPrevNode() wxMenuItemList::compatibility_iterator nodeStart = up ? GetPrevNode()
: GetNextNode(), : GetNextNode(),
*node = nodeStart; node = nodeStart;
while ( node && node->GetData()->IsSeparator() ) while ( node && node->GetData()->IsSeparator() )
{ {
node = up ? GetPrevNode(node) : GetNextNode(node); node = up ? GetPrevNode(node) : GetNextNode(node);
@@ -900,7 +912,11 @@ bool wxPopupMenuWindow::ProcessKeyDown(int key)
{ {
// nothing but separators and disabled items in this // nothing but separators and disabled items in this
// menu, break out // menu, break out
#if wxUSE_STL
node = wxMenuItemList::compatibility_iterator();
#else
node = NULL; node = NULL;
#endif
} }
} }
@@ -934,7 +950,7 @@ bool wxPopupMenuWindow::ProcessKeyDown(int key)
// we want to start from the item after this one because // 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 // if we're already on the item with the given accel we want to
// go to the next one, not to stay in place // 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? // do we have more than one item with this accel?
bool notUnique = FALSE; bool notUnique = FALSE;
@@ -944,8 +960,12 @@ bool wxPopupMenuWindow::ProcessKeyDown(int key)
// loop through all items searching for the item with this // loop through all items searching for the item with this
// accel // accel
wxMenuItemList::Node *node = nodeStart, wxMenuItemList::compatibility_iterator node = nodeStart,
*nodeFound = NULL; #if wxUSE_STL
nodeFound = wxMenuItemList::compatibility_iterator();
#else
nodeFound = NULL;
#endif
for ( ;; ) for ( ;; )
{ {
item = node->GetData(); item = node->GetData();
@@ -1113,7 +1133,7 @@ bool wxMenu::DoAppend(wxMenuItem *item)
{ {
// we need to update its end item // we need to update its end item
item->SetRadioGroupStart(m_startRadioGroup); item->SetRadioGroupStart(m_startRadioGroup);
wxMenuItemList::Node *node = GetMenuItems().Item(m_startRadioGroup); wxMenuItemList::compatibility_iterator node = GetMenuItems().Item(m_startRadioGroup);
if ( node ) if ( node )
{ {
@@ -1398,7 +1418,7 @@ bool wxMenu::ProcessAccelEvent(const wxKeyEvent& event)
} }
// try our submenus // try our submenus
for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst(); for ( wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
node; node;
node = node->GetNext() ) node = node->GetNext() )
{ {
@@ -1584,7 +1604,7 @@ void wxMenuItem::Check(bool check)
} }
// also uncheck all the other items in this radio group // 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++ ) for ( int n = start; n <= end && node; n++ )
{ {
if ( n != pos ) if ( n != pos )
@@ -2335,7 +2355,7 @@ int wxMenuBar::FindNextItemForAccel(int idxStart, int key, bool *unique) const
bool wxMenuBar::ProcessAccelEvent(const wxKeyEvent& event) bool wxMenuBar::ProcessAccelEvent(const wxKeyEvent& event)
{ {
size_t n = 0; size_t n = 0;
for ( wxMenuList::Node *node = m_menus.GetFirst(); for ( wxMenuList::compatibility_iterator node = m_menus.GetFirst();
node; node;
node = node->GetNext(), n++ ) node = node->GetNext(), n++ )
{ {

View File

@@ -78,7 +78,7 @@ void wxRadioButton::OnCheck()
// find the radio button which is the first in the group, i.e. the one // find the radio button which is the first in the group, i.e. the one
// with wxRB_GROUP style // with wxRB_GROUP style
const wxWindowList& siblings = GetParent()->GetChildren(); const wxWindowList& siblings = GetParent()->GetChildren();
wxWindowList::Node *nodeStart = siblings.Find(this); wxWindowList::compatibility_iterator nodeStart = siblings.Find(this);
while ( nodeStart ) while ( nodeStart )
{ {
// stop if we found a radio button with wxRB_GROUP style or it we // stop if we found a radio button with wxRB_GROUP style or it we

View File

@@ -2155,7 +2155,7 @@ wxMenuGeometryInfo *wxGTKRenderer::GetMenuGeometry(wxWindow *win,
widthAccelMax = 0, widthAccelMax = 0,
widthBmpMax = MENU_LEFT_MARGIN; widthBmpMax = MENU_LEFT_MARGIN;
for ( wxMenuItemList::Node *node = menu.GetMenuItems().GetFirst(); for ( wxMenuItemList::compatibility_iterator node = menu.GetMenuItems().GetFirst();
node; node;
node = node->GetNext() ) node = node->GetNext() )
{ {

View File

@@ -3122,7 +3122,7 @@ wxMenuGeometryInfo *wxWin32Renderer::GetMenuGeometry(wxWindow *win,
widthAccelMax = 0, widthAccelMax = 0,
widthBmpMax = MENU_LEFT_MARGIN; widthBmpMax = MENU_LEFT_MARGIN;
for ( wxMenuItemList::Node *node = menu.GetMenuItems().GetFirst(); for ( wxMenuItemList::compatibility_iterator node = menu.GetMenuItems().GetFirst();
node; node;
node = node->GetNext() ) node = node->GetNext() )
{ {

View File

@@ -211,7 +211,7 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const
return NULL; return NULL;
} }
for ( wxToolBarToolsList::Node *node = m_tools.GetFirst(); for ( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
node; node;
node = node->GetNext() ) node = node->GetNext() )
{ {
@@ -444,7 +444,7 @@ void wxToolBar::DoLayout()
*pCur = IsVertical() ? &y : &x; *pCur = IsVertical() ? &y : &x;
// calculate the positions of all elements // calculate the positions of all elements
for ( wxToolBarToolsList::Node *node = m_tools.GetFirst(); for ( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
node; node;
node = node->GetNext() ) node = node->GetNext() )
{ {
@@ -568,7 +568,7 @@ void wxToolBar::DoDraw(wxControlRenderer *renderer)
GetRectLimits(rectUpdate, &start, &end); GetRectLimits(rectUpdate, &start, &end);
// and redraw all the tools intersecting it // 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 = node->GetNext() ) node = node->GetNext() )
{ {

View File

@@ -393,7 +393,7 @@ void wxWindow::Refresh(bool eraseBackground, const wxRect *rectClient)
wxWindowNative::Refresh(eraseBackground, &rectWin); wxWindowNative::Refresh(eraseBackground, &rectWin);
// Refresh all sub controls if any. // Refresh all sub controls if any.
wxWindowList::Node *node = GetChildren().GetFirst(); wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
while ( node ) while ( node )
{ {
wxWindow *win = node->GetData(); wxWindow *win = node->GetData();
@@ -954,7 +954,7 @@ void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect)
// scroll children accordingly: // scroll children accordingly:
wxPoint offset(dx, dy); wxPoint offset(dx, dy);
for (wxWindowList::Node *node = GetChildren().GetFirst(); for (wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
node; node = node->GetNext()) node; node = node->GetNext())
{ {
wxWindow *child = node->GetData(); wxWindow *child = node->GetData();

View File

@@ -73,7 +73,7 @@ class wxSocketTable: public wxHashTable
} }
~wxSocketTable() ~wxSocketTable()
{ {
DeleteContents(TRUE); WX_CLEAR_HASH_TABLE(*this)
} }
wxSocketTableEntry* FindEntry(int fd); 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) void wxSocketTable::FillSets(fd_set* readset, fd_set* writeset, int* highest)
{ {
BeginFind(); BeginFind();
wxNode* node = Next(); wxHashTable::compatibility_iterator node = Next();
while (node) while (node)
{ {
wxSocketTableEntry* entry = (wxSocketTableEntry*) node->GetData(); 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) void wxSocketTable::ProcessEvents(fd_set* readset, fd_set* writeset)
{ {
BeginFind(); BeginFind();
wxNode* node = Next(); wxHashTable::compatibility_iterator node = Next();
while (node) while (node)
{ {
wxSocketTableEntry* entry = (wxSocketTableEntry*) node->GetData(); wxSocketTableEntry* entry = (wxSocketTableEntry*) node->GetData();

View File

@@ -424,7 +424,7 @@ void wxFontRefData::ClearX11Fonts()
{ {
#if wxUSE_UNICODE #if wxUSE_UNICODE
#else #else
wxNode* node = m_fonts.GetFirst(); wxList::compatibility_iterator node = m_fonts.GetFirst();
while (node) while (node)
{ {
wxXFont* f = (wxXFont*) node->GetData(); 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; int pointSize = (M_FONTDATA->m_pointSize * 10 * intScale) / 100;
// search existing fonts first // search existing fonts first
wxNode* node = M_FONTDATA->m_fonts.GetFirst(); wxList::compatibility_iterator node = M_FONTDATA->m_fonts.GetFirst();
while (node) while (node)
{ {
wxXFont* f = (wxXFont*) node->GetData(); wxXFont* f = (wxXFont*) node->GetData();

View File

@@ -77,7 +77,7 @@ wxPaletteRefData::~wxPaletteRefData()
{ {
Display *display = (Display*) NULL; Display *display = (Display*) NULL;
wxNode *node, *next; wxList::compatibility_iterator node, next;
for (node = m_palettes.GetFirst(); node; node = next) { for (node = m_palettes.GetFirst(); node; node = next) {
wxXPalette *c = (wxXPalette *)node->GetData(); wxXPalette *c = (wxXPalette *)node->GetData();
@@ -106,7 +106,7 @@ wxPaletteRefData::~wxPaletteRefData()
XFreeColormap(display, cmap); XFreeColormap(display, cmap);
next = node->GetNext(); next = node->GetNext();
m_palettes.DeleteNode(node); m_palettes.Erase(node);
delete c; delete c;
} }
} }
@@ -194,7 +194,7 @@ WXColormap wxPalette::GetXColormap(WXDisplay* display) const
if (!M_PALETTEDATA || (M_PALETTEDATA->m_palettes.GetCount() == 0)) if (!M_PALETTEDATA || (M_PALETTEDATA->m_palettes.GetCount() == 0))
return wxTheApp->GetMainColormap(display); return wxTheApp->GetMainColormap(display);
wxNode* node = M_PALETTEDATA->m_palettes.GetFirst(); wxList::compatibility_iterator node = M_PALETTEDATA->m_palettes.GetFirst();
if (!display && node) if (!display && node)
{ {
wxXPalette* p = (wxXPalette*) node->GetData(); wxXPalette* p = (wxXPalette*) node->GetData();
@@ -319,7 +319,7 @@ unsigned long *wxPalette::GetXPixArray(WXDisplay *display, int *n)
{ {
if (!M_PALETTEDATA) if (!M_PALETTEDATA)
return (unsigned long*) 0; return (unsigned long*) 0;
wxNode *node; wxList::compatibility_iterator node;
for (node = M_PALETTEDATA->m_palettes.GetFirst(); node; node = node->GetNext()) for (node = M_PALETTEDATA->m_palettes.GetFirst(); node; node = node->GetNext())
{ {

View File

@@ -1261,7 +1261,7 @@ void wxWindowX11::SendNcPaintEvents()
// Responds to colour changes: passes event on to children. // Responds to colour changes: passes event on to children.
void wxWindowX11::OnSysColourChanged(wxSysColourChangedEvent& event) void wxWindowX11::OnSysColourChanged(wxSysColourChangedEvent& event)
{ {
wxWindowList::Node *node = GetChildren().GetFirst(); wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
while ( node ) while ( node )
{ {
// Only propagate to non-top-level windows // Only propagate to non-top-level windows