STL-ification patch for wxMSW and wxGTK.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21876 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Mattia Barbon
2003-07-10 19:55:12 +00:00
parent 6992d326eb
commit 222ed1d678
73 changed files with 668 additions and 623 deletions

View File

@@ -114,7 +114,7 @@ protected:
int m_maxNoCommands; int m_maxNoCommands;
wxList m_commands; wxList m_commands;
wxNode* m_currentCommand; wxList::compatibility_iterator m_currentCommand;
#if wxUSE_MENUS #if wxUSE_MENUS
wxMenu* m_commandEditMenu; wxMenu* m_commandEditMenu;

View File

@@ -260,6 +260,7 @@ class WXDLLEXPORT wxDataObjectComposite : public wxDataObject
public: public:
// ctor // ctor
wxDataObjectComposite(); wxDataObjectComposite();
virtual ~wxDataObjectComposite();
// add data object (it will be deleted by wxDataObjectComposite, hence it // add data object (it will be deleted by wxDataObjectComposite, hence it
// must be allocated on the heap) whose format will become the preferred // must be allocated on the heap) whose format will become the preferred

View File

@@ -377,11 +377,11 @@ typedef wxInt8 wxDash;
class WXDLLEXPORT wxPenList : public wxList class WXDLLEXPORT wxPenList : public wxList
{ {
DECLARE_DYNAMIC_CLASS(wxPenList) // DECLARE_DYNAMIC_CLASS(wxPenList)
public: public:
wxPenList() { } wxPenList() { }
~wxPenList(); virtual ~wxPenList();
void AddPen(wxPen *pen); void AddPen(wxPen *pen);
void RemovePen(wxPen *pen); void RemovePen(wxPen *pen);
@@ -390,11 +390,11 @@ public:
class WXDLLEXPORT wxBrushList : public wxList class WXDLLEXPORT wxBrushList : public wxList
{ {
DECLARE_DYNAMIC_CLASS(wxBrushList) // DECLARE_DYNAMIC_CLASS(wxBrushList)
public: public:
wxBrushList() { } wxBrushList() { }
~wxBrushList(); virtual ~wxBrushList();
void AddBrush(wxBrush *brush); void AddBrush(wxBrush *brush);
void RemoveBrush(wxBrush *brush); void RemoveBrush(wxBrush *brush);
@@ -403,11 +403,11 @@ public:
class WXDLLEXPORT wxFontList : public wxList class WXDLLEXPORT wxFontList : public wxList
{ {
DECLARE_DYNAMIC_CLASS(wxFontList) // DECLARE_DYNAMIC_CLASS(wxFontList)
public: public:
wxFontList() { } wxFontList() { }
~wxFontList(); virtual ~wxFontList();
void AddFont(wxFont *font); void AddFont(wxFont *font);
void RemoveFont(wxFont *font); void RemoveFont(wxFont *font);
@@ -417,16 +417,19 @@ public:
wxFontEncoding encoding = wxFONTENCODING_DEFAULT); wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
}; };
class WXDLLEXPORT wxColourDatabase : public wxList class WXDLLEXPORT wxStringToColourHashMap;
class WXDLLEXPORT wxColourDatabase
{ {
DECLARE_CLASS(wxColourDatabase) // DECLARE_CLASS(wxColourDatabase)
public: public:
wxColourDatabase(int type); wxColourDatabase();
~wxColourDatabase() ; virtual ~wxColourDatabase() ;
// Not const because it may add a name to the database // Not const because it may add a name to the database
wxColour *FindColour(const wxString& colour) ; wxColour *FindColour(const wxString& colour) ;
wxColour *FindColourNoAdd(const wxString& colour) const;
wxString FindName(const wxColour& colour) const; wxString FindName(const wxColour& colour) const;
void Initialize(); void Initialize();
#ifdef __WXPM__ #ifdef __WXPM__
@@ -434,15 +437,19 @@ public:
long* m_palTable; long* m_palTable;
size_t m_nSize; size_t m_nSize;
#endif #endif
private:
wxColour* FindColour(const wxString& colour, bool add);
wxStringToColourHashMap* m_map;
}; };
class WXDLLEXPORT wxBitmapList : public wxList class WXDLLEXPORT wxBitmapList : public wxList
{ {
DECLARE_DYNAMIC_CLASS(wxBitmapList) // DECLARE_DYNAMIC_CLASS(wxBitmapList)
public: public:
wxBitmapList(); wxBitmapList();
~wxBitmapList(); virtual ~wxBitmapList();
void AddBitmap(wxBitmap *bitmap); void AddBitmap(wxBitmap *bitmap);
void RemoveBitmap(wxBitmap *bitmap); void RemoveBitmap(wxBitmap *bitmap);
@@ -452,11 +459,13 @@ class WXDLLEXPORT wxResourceCache: public wxList
{ {
public: public:
wxResourceCache() { } wxResourceCache() { }
#if !wxUSE_STL
wxResourceCache(const unsigned int keyType) : wxList(keyType) { } wxResourceCache(const unsigned int keyType) : wxList(keyType) { }
~wxResourceCache(); #endif
virtual ~wxResourceCache();
private: private:
DECLARE_DYNAMIC_CLASS(wxResourceCache) // DECLARE_DYNAMIC_CLASS(wxResourceCache)
}; };
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@@ -69,10 +69,14 @@ private:
DECLARE_DYNAMIC_CLASS(wxPrintPaperType) DECLARE_DYNAMIC_CLASS(wxPrintPaperType)
}; };
class WXDLLEXPORT wxPrintPaperDatabase: public wxList class WXDLLEXPORT wxStringToPrintPaperTypeHashMap;
class WXDLLEXPORT wxPrintPaperTypeList;
class WXDLLEXPORT wxPrintPaperDatabase
{ {
public: public:
wxPrintPaperDatabase(); wxPrintPaperDatabase();
~wxPrintPaperDatabase();
void CreateDatabase(); void CreateDatabase();
void ClearDatabase(); void ClearDatabase();
@@ -104,8 +108,13 @@ public:
// Get the paper size // Get the paper size
wxPaperSize GetSize(const wxSize& size); wxPaperSize GetSize(const wxSize& size);
//
wxPrintPaperType* Item(size_t index) const;
size_t GetCount() const;
private: private:
DECLARE_DYNAMIC_CLASS(wxPrintPaperDatabase) wxStringToPrintPaperTypeHashMap* m_map;
wxPrintPaperTypeList* m_list;
// DECLARE_DYNAMIC_CLASS(wxPrintPaperDatabase)
}; };
WXDLLEXPORT_DATA(extern wxPrintPaperDatabase*) wxThePrintPaperDatabase; WXDLLEXPORT_DATA(extern wxPrintPaperDatabase*) wxThePrintPaperDatabase;

View File

@@ -85,7 +85,7 @@ bool wxAppBase::Initialize(int& argc, wxChar **argv)
wxPendingEventsLocker = new wxCriticalSection; wxPendingEventsLocker = new wxCriticalSection;
#endif #endif
wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING); wxTheColourDatabase = new wxColourDatabase;
wxTheColourDatabase->Initialize(); wxTheColourDatabase->Initialize();
wxInitializeStockLists(); wxInitializeStockLists();
@@ -189,7 +189,7 @@ void wxAppBase::SetActive(bool active, wxWindow * WXUNUSED(lastFocus))
void wxAppBase::DeletePendingObjects() void wxAppBase::DeletePendingObjects()
{ {
wxNode *node = wxPendingDelete.GetFirst(); wxList::compatibility_iterator node = wxPendingDelete.GetFirst();
while (node) while (node)
{ {
wxObject *obj = node->GetData(); wxObject *obj = node->GetData();
@@ -197,7 +197,7 @@ void wxAppBase::DeletePendingObjects()
delete obj; delete obj;
if (wxPendingDelete.Member(obj)) if (wxPendingDelete.Member(obj))
delete node; wxPendingDelete.Erase(node);
// Deleting one object may have deleted other pending // Deleting one object may have deleted other pending
// objects, so start from beginning of list again. // objects, so start from beginning of list again.
@@ -208,7 +208,7 @@ void wxAppBase::DeletePendingObjects()
// Returns TRUE if more time is needed. // Returns TRUE if more time is needed.
bool wxAppBase::ProcessIdle() bool wxAppBase::ProcessIdle()
{ {
wxWindowList::Node* node = wxTopLevelWindows.GetFirst(); wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
node = wxTopLevelWindows.GetFirst(); node = wxTopLevelWindows.GetFirst();
while (node) while (node)
{ {
@@ -231,7 +231,7 @@ bool wxAppBase::SendIdleEvents()
{ {
bool needMore = FALSE; bool needMore = FALSE;
wxWindowList::Node* node = wxTopLevelWindows.GetFirst(); wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
while (node) while (node)
{ {
wxWindow* win = node->GetData(); wxWindow* win = node->GetData();
@@ -257,7 +257,7 @@ bool wxAppBase::SendIdleEvents(wxWindow* win)
needMore = event.MoreRequested(); needMore = event.MoreRequested();
} }
wxWindowList::Node *node = win->GetChildren().GetFirst(); wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst();
while ( node ) while ( node )
{ {
wxWindow *win = node->GetData(); wxWindow *win = node->GetData();

View File

@@ -114,7 +114,6 @@ wxArtProviderCache *wxArtProvider::sm_cache = NULL;
if ( !sm_providers ) if ( !sm_providers )
{ {
sm_providers = new wxArtProvidersList; sm_providers = new wxArtProvidersList;
sm_providers->DeleteContents(TRUE);
sm_cache = new wxArtProviderCache; 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, FALSE, _T("no wxArtProvider exists") );
wxCHECK_MSG( sm_providers->GetCount() > 0, FALSE, _T("wxArtProviders stack is empty") ); 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(); sm_cache->Clear();
return TRUE; return TRUE;
} }
@@ -138,6 +138,7 @@ wxArtProviderCache *wxArtProvider::sm_cache = NULL;
if ( sm_providers->DeleteObject(provider) ) if ( sm_providers->DeleteObject(provider) )
{ {
delete provider;
sm_cache->Clear(); sm_cache->Clear();
return TRUE; return TRUE;
} }
@@ -165,7 +166,7 @@ wxArtProviderCache *wxArtProvider::sm_cache = NULL;
wxBitmap bmp; wxBitmap bmp;
if ( !sm_cache->GetBitmap(hashId, &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()) node; node = node->GetNext())
{ {
bmp = node->GetData()->CreateBitmap(id, client, size); bmp = node->GetData()->CreateBitmap(id, client, size);

View File

@@ -64,7 +64,6 @@ wxCommand::~wxCommand()
wxCommandProcessor::wxCommandProcessor(int maxCommands) wxCommandProcessor::wxCommandProcessor(int maxCommands)
{ {
m_maxNoCommands = maxCommands; m_maxNoCommands = maxCommands;
m_currentCommand = (wxNode *) NULL;
#if wxUSE_MENUS #if wxUSE_MENUS
m_commandEditMenu = (wxMenu *) NULL; m_commandEditMenu = (wxMenu *) NULL;
#endif // wxUSE_MENUS #endif // wxUSE_MENUS
@@ -114,10 +113,10 @@ void wxCommandProcessor::Store(wxCommand *command)
if ( (int)m_commands.GetCount() == m_maxNoCommands ) if ( (int)m_commands.GetCount() == m_maxNoCommands )
{ {
wxNode *firstNode = m_commands.GetFirst(); wxList::compatibility_iterator firstNode = m_commands.GetFirst();
wxCommand *firstCommand = (wxCommand *)firstNode->GetData(); wxCommand *firstCommand = (wxCommand *)firstNode->GetData();
delete firstCommand; delete firstCommand;
delete firstNode; m_commands.Erase(firstNode);
} }
// Correct a bug: we must chop off the current 'branch' // Correct a bug: we must chop off the current 'branch'
@@ -126,12 +125,12 @@ void wxCommandProcessor::Store(wxCommand *command)
ClearCommands(); ClearCommands();
else else
{ {
wxNode *node = m_currentCommand->GetNext(); wxList::compatibility_iterator node = m_currentCommand->GetNext();
while (node) while (node)
{ {
wxNode *next = node->GetNext(); wxList::compatibility_iterator next = node->GetNext();
delete (wxCommand *)node->GetData(); delete (wxCommand *)node->GetData();
delete node; m_commands.Erase(node);
node = next; node = next;
} }
} }
@@ -160,7 +159,7 @@ bool wxCommandProcessor::Undo()
bool wxCommandProcessor::Redo() bool wxCommandProcessor::Redo()
{ {
wxCommand *redoCommand = (wxCommand *) NULL; wxCommand *redoCommand = (wxCommand *) NULL;
wxNode *redoNode = (wxNode *) NULL; wxList::compatibility_iterator redoNode;
if ( m_currentCommand ) if ( m_currentCommand )
{ {
@@ -202,13 +201,13 @@ bool wxCommandProcessor::CanUndo() const
bool wxCommandProcessor::CanRedo() const bool wxCommandProcessor::CanRedo() const
{ {
if ((m_currentCommand != (wxNode*) NULL) && (m_currentCommand->GetNext() == (wxNode*) NULL)) if (m_currentCommand && !m_currentCommand->GetNext())
return FALSE; return FALSE;
if ((m_currentCommand != (wxNode*) NULL) && (m_currentCommand->GetNext() != (wxNode*) NULL)) if (m_currentCommand && m_currentCommand->GetNext())
return TRUE; return TRUE;
if ((m_currentCommand == (wxNode*) NULL) && (m_commands.GetCount() > 0)) if (!m_currentCommand && (m_commands.GetCount() > 0))
return TRUE; return TRUE;
return FALSE; return FALSE;
@@ -300,15 +299,15 @@ wxString wxCommandProcessor::GetRedoMenuLabel() const
void wxCommandProcessor::ClearCommands() void wxCommandProcessor::ClearCommands()
{ {
wxNode *node = m_commands.GetFirst(); wxList::compatibility_iterator node = m_commands.GetFirst();
while (node) while (node)
{ {
wxCommand *command = (wxCommand *)node->GetData(); wxCommand *command = (wxCommand *)node->GetData();
delete command; delete command;
delete node; m_commands.Erase(node);
node = m_commands.GetFirst(); node = m_commands.GetFirst();
} }
m_currentCommand = (wxNode *) NULL; m_currentCommand = wxList::compatibility_iterator();
} }

View File

@@ -61,7 +61,7 @@ bool wxControlContainer::AcceptsFocus() const
// otherwise we can accept focus either if we have no children at all // 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 // (in this case we're probably not used as a container) or only when
// at least one child will accept focus // at least one child will accept focus
wxWindowList::Node *node = m_winParent->GetChildren().GetFirst(); wxWindowList::compatibility_iterator node = m_winParent->GetChildren().GetFirst();
if ( !node ) if ( !node )
return TRUE; 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 // the node of the children list from which we should start looking for the
// next acceptable child // 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 // 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 // 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(); node = forward ? children.GetFirst() : children.GetLast();
// we want to cycle over all nodes // we want to cycle over all nodes
start_node = (wxWindowList::Node *)NULL; start_node = wxWindowList::compatibility_iterator();
} }
else else
{ {
@@ -224,7 +224,7 @@ void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event )
} }
else else
{ {
start_node = (wxWindowList::Node *)NULL; start_node = wxWindowList::compatibility_iterator();
} }
if ( !start_node && m_winLastFocused ) 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 // 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 ) while ( node )
{ {
wxWindow *child = node->GetData(); wxWindow *child = node->GetData();

View File

@@ -73,7 +73,7 @@ void wxDCBase::DrawLines(const wxList *list, wxCoord xoffset, wxCoord yoffset)
wxPoint *points = new wxPoint[n]; wxPoint *points = new wxPoint[n];
int i = 0; 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(); wxPoint *point = (wxPoint *)node->GetData();
points[i].x = point->x; points[i].x = point->x;
@@ -94,7 +94,7 @@ void wxDCBase::DrawPolygon(const wxList *list,
wxPoint *points = new wxPoint[n]; wxPoint *points = new wxPoint[n];
int i = 0; 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(); wxPoint *point = (wxPoint *)node->GetData();
points[i].x = point->x; points[i].x = point->x;
@@ -131,7 +131,7 @@ void wxDCBase::DrawSpline(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoor
DrawSpline(&point_list); 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(); wxPoint *p = (wxPoint *)node->GetData();
delete p; 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) static void wx_spline_draw_point_array(wxDCBase *dc)
{ {
dc->DrawLines(&wx_spline_point_list, 0, 0 ); 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) while (node)
{ {
wxPoint *point = (wxPoint *)node->GetData(); wxPoint *point = (wxPoint *)node->GetData();
delete point; delete point;
delete node; wx_spline_point_list.Erase(node);
node = wx_spline_point_list.GetFirst(); 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 cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;
double x1, y1, x2, y2; double x1, y1, x2, y2;
wxNode *node = points->GetFirst(); wxList::compatibility_iterator node = points->GetFirst();
p = (wxPoint *)node->GetData(); p = (wxPoint *)node->GetData();
x1 = p->x; x1 = p->x;
@@ -290,7 +290,7 @@ void wxDCBase::DoDrawSpline( wxList *points )
wx_spline_add_point(x1, y1); wx_spline_add_point(x1, y1);
while ((node = node->GetNext()) != NULL) while ((node = node->GetNext()))
{ {
p = (wxPoint *)node->GetData(); p = (wxPoint *)node->GetData();
x1 = x2; x1 = x2;

View File

@@ -97,14 +97,17 @@ bool wxDataObjectBase::IsSupported(const wxDataFormat& format,
wxDataObjectComposite::wxDataObjectComposite() wxDataObjectComposite::wxDataObjectComposite()
{ {
m_preferred = 0; m_preferred = 0;
}
m_dataObjects.DeleteContents(TRUE); wxDataObjectComposite::~wxDataObjectComposite()
{
WX_CLEAR_LIST(wxSimpleDataObjectList, m_dataObjects);
} }
wxDataObjectSimple * wxDataObjectSimple *
wxDataObjectComposite::GetObject(const wxDataFormat& format) const wxDataObjectComposite::GetObject(const wxDataFormat& format) const
{ {
wxSimpleDataObjectList::Node *node = m_dataObjects.GetFirst(); wxSimpleDataObjectList::compatibility_iterator node = m_dataObjects.GetFirst();
while ( node ) while ( node )
{ {
wxDataObjectSimple *dataObj = node->GetData(); wxDataObjectSimple *dataObj = node->GetData();
@@ -131,7 +134,7 @@ void wxDataObjectComposite::Add(wxDataObjectSimple *dataObject, bool preferred)
wxDataFormat wxDataFormat
wxDataObjectComposite::GetPreferredFormat(Direction WXUNUSED(dir)) const 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") ); wxCHECK_MSG( node, wxFormatInvalid, wxT("no preferred format") );
@@ -189,7 +192,7 @@ void wxDataObjectComposite::GetAllFormats(wxDataFormat *formats,
Direction WXUNUSED(dir)) const Direction WXUNUSED(dir)) const
{ {
size_t n = 0; size_t n = 0;
wxSimpleDataObjectList::Node *node; wxSimpleDataObjectList::compatibility_iterator node;
for ( node = m_dataObjects.GetFirst(); node; node = node->GetNext() ) for ( node = m_dataObjects.GetFirst(); node; node = node->GetNext() )
{ {
// TODO if ( !outputOnlyToo ) && this one counts ... // TODO if ( !outputOnlyToo ) && this one counts ...

View File

@@ -184,14 +184,14 @@ bool wxDocument::DeleteAllViews()
{ {
wxDocManager* manager = GetDocumentManager(); wxDocManager* manager = GetDocumentManager();
wxNode *node = m_documentViews.GetFirst(); wxList::compatibility_iterator node = m_documentViews.GetFirst();
while (node) while (node)
{ {
wxView *view = (wxView *)node->GetData(); wxView *view = (wxView *)node->GetData();
if (!view->Close()) if (!view->Close())
return FALSE; return FALSE;
wxNode *next = node->GetNext(); wxList::compatibility_iterator next = node->GetNext();
delete view; // Deletes node implicitly delete view; // Deletes node implicitly
node = next; node = next;
@@ -276,7 +276,7 @@ bool wxDocument::SaveAs()
SetTitle(wxFileNameFromPath(fileName)); SetTitle(wxFileNameFromPath(fileName));
// Notify the views that the filename has changed // Notify the views that the filename has changed
wxNode *node = m_documentViews.GetFirst(); wxList::compatibility_iterator node = m_documentViews.GetFirst();
while (node) while (node)
{ {
wxView *view = (wxView *)node->GetData(); wxView *view = (wxView *)node->GetData();
@@ -525,7 +525,7 @@ void wxDocument::OnChangedViewList()
void wxDocument::UpdateAllViews(wxView *sender, wxObject *hint) void wxDocument::UpdateAllViews(wxView *sender, wxObject *hint)
{ {
wxNode *node = m_documentViews.GetFirst(); wxList::compatibility_iterator node = m_documentViews.GetFirst();
while (node) while (node)
{ {
wxView *view = (wxView *)node->GetData(); wxView *view = (wxView *)node->GetData();
@@ -537,7 +537,7 @@ void wxDocument::UpdateAllViews(wxView *sender, wxObject *hint)
void wxDocument::NotifyClosing() void wxDocument::NotifyClosing()
{ {
wxNode *node = m_documentViews.GetFirst(); wxList::compatibility_iterator node = m_documentViews.GetFirst();
while (node) while (node)
{ {
wxView *view = (wxView *)node->GetData(); wxView *view = (wxView *)node->GetData();
@@ -552,7 +552,7 @@ void wxDocument::SetFilename(const wxString& filename, bool notifyViews)
if ( notifyViews ) if ( notifyViews )
{ {
// Notify the views that the filename has changed // Notify the views that the filename has changed
wxNode *node = m_documentViews.GetFirst(); wxList::compatibility_iterator node = m_documentViews.GetFirst();
while (node) while (node)
{ {
wxView *view = (wxView *)node->GetData(); wxView *view = (wxView *)node->GetData();
@@ -806,11 +806,11 @@ bool wxDocManager::CloseDocument(wxDocument* doc, bool force)
bool wxDocManager::CloseDocuments(bool force) bool wxDocManager::CloseDocuments(bool force)
{ {
wxNode *node = m_docs.GetFirst(); wxList::compatibility_iterator node = m_docs.GetFirst();
while (node) while (node)
{ {
wxDocument *doc = (wxDocument *)node->GetData(); wxDocument *doc = (wxDocument *)node->GetData();
wxNode *next = node->GetNext(); wxList::compatibility_iterator next = node->GetNext();
if (!CloseDocument(doc, force)) if (!CloseDocument(doc, force))
return FALSE; return FALSE;
@@ -828,11 +828,11 @@ bool wxDocManager::Clear(bool force)
if (!CloseDocuments(force)) if (!CloseDocuments(force))
return FALSE; return FALSE;
wxNode *node = m_templates.GetFirst(); wxList::compatibility_iterator node = m_templates.GetFirst();
while (node) while (node)
{ {
wxDocTemplate *templ = (wxDocTemplate*) node->GetData(); wxDocTemplate *templ = (wxDocTemplate*) node->GetData();
wxNode* next = node->GetNext(); wxList::compatibility_iterator next = node->GetNext();
delete templ; delete templ;
node = next; node = next;
} }
@@ -1530,7 +1530,7 @@ wxDocTemplate *wxDocManager::SelectDocumentPath(wxDocTemplate **templates,
wxDocTemplate *wxDocManager::SelectDocumentType(wxDocTemplate **templates, wxDocTemplate *wxDocManager::SelectDocumentType(wxDocTemplate **templates,
int noTemplates, bool sort) int noTemplates, bool sort)
{ {
wxArrayString strings(sort); wxArrayString strings;
wxDocTemplate **data = new wxDocTemplate *[noTemplates]; wxDocTemplate **data = new wxDocTemplate *[noTemplates];
int i; int i;
int n = 0; int n = 0;
@@ -1562,6 +1562,7 @@ wxDocTemplate *wxDocManager::SelectDocumentType(wxDocTemplate **templates,
if (sort) if (sort)
{ {
strings.Sort(wxStringSortAscending);
// Yes, this will be slow, but template lists // Yes, this will be slow, but template lists
// are typically short. // are typically short.
int j; int j;
@@ -1610,7 +1611,7 @@ wxDocTemplate *wxDocManager::SelectDocumentType(wxDocTemplate **templates,
wxDocTemplate *wxDocManager::SelectViewType(wxDocTemplate **templates, wxDocTemplate *wxDocManager::SelectViewType(wxDocTemplate **templates,
int noTemplates, bool sort) int noTemplates, bool sort)
{ {
wxArrayString strings(sort); wxArrayString strings;
wxDocTemplate **data = new wxDocTemplate *[noTemplates]; wxDocTemplate **data = new wxDocTemplate *[noTemplates];
int i; int i;
int n = 0; int n = 0;
@@ -1640,6 +1641,7 @@ wxDocTemplate *wxDocManager::SelectViewType(wxDocTemplate **templates,
if (sort) if (sort)
{ {
strings.Sort(wxStringSortAscending);
// Yes, this will be slow, but template lists // Yes, this will be slow, but template lists
// are typically short. // are typically short.
int j; 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. // Move existing files (if any) down so we can insert file at beginning.
if (m_fileHistoryN < m_fileMaxFiles) if (m_fileHistoryN < m_fileMaxFiles)
{ {
wxNode* node = m_fileMenus.GetFirst(); wxList::compatibility_iterator node = m_fileMenus.GetFirst();
while (node) while (node)
{ {
wxMenu* menu = (wxMenu*) node->GetData(); wxMenu* menu = (wxMenu*) node->GetData();
@@ -2067,7 +2069,7 @@ void wxFileHistory::AddFileToHistory(const wxString& file)
wxString buf; wxString buf;
buf.Printf(s_MRUEntryFormat, i + 1, pathInMenu.c_str()); buf.Printf(s_MRUEntryFormat, i + 1, pathInMenu.c_str());
wxNode* node = m_fileMenus.GetFirst(); wxList::compatibility_iterator node = m_fileMenus.GetFirst();
while (node) while (node)
{ {
wxMenu* menu = (wxMenu*) node->GetData(); wxMenu* menu = (wxMenu*) node->GetData();
@@ -2092,7 +2094,7 @@ void wxFileHistory::RemoveFileFromHistory(size_t i)
m_fileHistory[j] = m_fileHistory[j + 1]; m_fileHistory[j] = m_fileHistory[j + 1];
} }
wxNode* node = m_fileMenus.GetFirst(); wxList::compatibility_iterator node = m_fileMenus.GetFirst();
while ( node ) while ( node )
{ {
wxMenu* menu = (wxMenu*) node->GetData(); 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 // delete the last separator too if no more files are left
if ( m_fileHistoryN == 1 ) if ( m_fileHistoryN == 1 )
{ {
wxMenuItemList::Node *node = menu->GetMenuItems().GetLast(); wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetLast();
if ( node ) if ( node )
{ {
wxMenuItem *menuItem = node->GetData(); wxMenuItem *menuItem = node->GetData();
@@ -2196,7 +2198,7 @@ void wxFileHistory::AddFilesToMenu()
{ {
if (m_fileHistoryN > 0) if (m_fileHistoryN > 0)
{ {
wxNode* node = m_fileMenus.GetFirst(); wxList::compatibility_iterator node = m_fileMenus.GetFirst();
while (node) while (node)
{ {
wxMenu* menu = (wxMenu*) node->GetData(); wxMenu* menu = (wxMenu*) node->GetData();

View File

@@ -37,6 +37,7 @@
#include "wx/dc.h" #include "wx/dc.h"
#include "wx/utils.h" #include "wx/utils.h"
#include "wx/settings.h" #include "wx/settings.h"
#include "wx/hashmap.h"
#include "wx/log.h" #include "wx/log.h"
#include <string.h> #include <string.h>
@@ -63,12 +64,12 @@
#include "wx/mac/private.h" #include "wx/mac/private.h"
#include "wx/mac/uma.h" #include "wx/mac/uma.h"
#endif #endif
IMPLEMENT_CLASS(wxColourDatabase, wxList) //IMPLEMENT_CLASS(wxColourDatabase, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxFontList, wxList) //IMPLEMENT_DYNAMIC_CLASS(wxFontList, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxPenList, wxList) //IMPLEMENT_DYNAMIC_CLASS(wxPenList, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxBrushList, wxList) //IMPLEMENT_DYNAMIC_CLASS(wxBrushList, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxBitmapList, wxList) //IMPLEMENT_DYNAMIC_CLASS(wxBitmapList, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxResourceCache, wxList) //IMPLEMENT_DYNAMIC_CLASS(wxResourceCache, wxList)
IMPLEMENT_ABSTRACT_CLASS(wxDCBase, wxObject) IMPLEMENT_ABSTRACT_CLASS(wxDCBase, wxObject)
@@ -186,21 +187,22 @@ bool wxRect::Intersects(const wxRect& rect) const
return r.width != 0; 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 () wxColourDatabase::~wxColourDatabase ()
{ {
// Cleanup Colour allocated in Initialize() typedef wxStringToColourHashMap::iterator iterator;
wxNode *node = GetFirst ();
while (node) for( iterator it = m_map->begin(), en = m_map->end(); it != en; ++it )
{ delete it->second;
wxColour *col = (wxColour *) node->GetData ();
wxNode *next = node->GetNext (); delete m_map;
delete col; m_map = NULL;
node = next;
}
#ifdef __WXPM__ #ifdef __WXPM__
delete [] m_palTable; delete [] m_palTable;
#endif #endif
@@ -298,7 +300,7 @@ void wxColourDatabase::Initialize ()
for ( n = 0; n < WXSIZEOF(wxColourTable); n++ ) for ( n = 0; n < WXSIZEOF(wxColourTable); n++ )
{ {
const wxColourDesc& cc = 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__ #ifdef __WXPM__
m_palTable = new long[n]; m_palTable = new long[n];
@@ -321,6 +323,16 @@ void wxColourDatabase::Initialize ()
*/ */
wxColour *wxColourDatabase::FindColour(const wxString& colour) 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 // VZ: make the comparaison case insensitive and also match both grey and
// gray // gray
@@ -330,17 +342,14 @@ wxColour *wxColourDatabase::FindColour(const wxString& colour)
if ( !colName2.Replace(_T("GRAY"), _T("GREY")) ) if ( !colName2.Replace(_T("GRAY"), _T("GREY")) )
colName2.clear(); colName2.clear();
wxNode *node = GetFirst(); wxStringToColourHashMap::iterator it = m_map->find(colName);
while ( node ) if ( it == m_map->end() )
{ it = m_map->find(colName2);
const wxChar *key = node->GetKeyString(); if ( it != m_map->end() )
if ( colName == key || colName2 == key ) return it->second;
{
return (wxColour *)node->GetData();
}
node = node->GetNext(); if ( !add )
} return NULL;
#ifdef __WXMSW__ #ifdef __WXMSW__
return NULL; return NULL;
@@ -372,7 +381,7 @@ wxColour *wxColourDatabase::FindColour(const wxString& colour)
delete col; delete col;
return (wxColour *) NULL; return (wxColour *) NULL;
} }
Append( colour, col ); (*m_map)[colour] = col;
return col; return col;
#endif #endif
@@ -400,7 +409,7 @@ wxColour *wxColourDatabase::FindColour(const wxString& colour)
#endif #endif
wxColour *col = new wxColour(r, g, b); wxColour *col = new wxColour(r, g, b);
Append(colour, col); (*m_map)[colour] = col;
return col; return col;
#endif // __X__ #endif // __X__
@@ -408,29 +417,21 @@ wxColour *wxColourDatabase::FindColour(const wxString& colour)
wxString wxColourDatabase::FindName (const wxColour& colour) const wxString wxColourDatabase::FindName (const wxColour& colour) const
{ {
wxString name;
unsigned char red = colour.Red (); unsigned char red = colour.Red ();
unsigned char green = colour.Green (); unsigned char green = colour.Green ();
unsigned char blue = colour.Blue (); 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) if (col->Red () == red && col->Green () == green && col->Blue () == blue)
{ return it->first;
const wxChar *found = node->GetKeyString();
if ( found )
{
name = found;
break;
}
}
} }
return name; return wxEmptyString;
} }
void wxInitializeStockLists() void wxInitializeStockLists()
@@ -589,11 +590,11 @@ wxBitmapList::wxBitmapList()
wxBitmapList::~wxBitmapList () wxBitmapList::~wxBitmapList ()
{ {
wxNode *node = GetFirst (); wxList::compatibility_iterator node = GetFirst ();
while (node) while (node)
{ {
wxBitmap *bitmap = (wxBitmap *) node->GetData (); wxBitmap *bitmap = (wxBitmap *) node->GetData ();
wxNode *next = node->GetNext (); wxList::compatibility_iterator next = node->GetNext ();
if (bitmap->GetVisible()) if (bitmap->GetVisible())
delete bitmap; delete bitmap;
node = next; node = next;
@@ -603,11 +604,11 @@ wxBitmapList::~wxBitmapList ()
// Pen and Brush lists // Pen and Brush lists
wxPenList::~wxPenList () wxPenList::~wxPenList ()
{ {
wxNode *node = GetFirst (); wxList::compatibility_iterator node = GetFirst ();
while (node) while (node)
{ {
wxPen *pen = (wxPen *) node->GetData (); wxPen *pen = (wxPen *) node->GetData ();
wxNode *next = node->GetNext (); wxList::compatibility_iterator next = node->GetNext ();
if (pen->GetVisible()) if (pen->GetVisible())
delete pen; delete pen;
node = next; node = next;
@@ -626,7 +627,7 @@ void wxPenList::RemovePen (wxPen * pen)
wxPen *wxPenList::FindOrCreatePen (const wxColour& colour, int width, int style) 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 (); wxPen *each_pen = (wxPen *) node->GetData ();
if (each_pen && if (each_pen &&
@@ -658,11 +659,11 @@ wxPen *wxPenList::FindOrCreatePen (const wxColour& colour, int width, int style)
wxBrushList::~wxBrushList () wxBrushList::~wxBrushList ()
{ {
wxNode *node = GetFirst (); wxList::compatibility_iterator node = GetFirst ();
while (node) while (node)
{ {
wxBrush *brush = (wxBrush *) node->GetData (); wxBrush *brush = (wxBrush *) node->GetData ();
wxNode *next = node->GetNext (); wxList::compatibility_iterator next = node->GetNext ();
if (brush && brush->GetVisible()) if (brush && brush->GetVisible())
delete brush; delete brush;
node = next; node = next;
@@ -676,7 +677,7 @@ void wxBrushList::AddBrush (wxBrush * brush)
wxBrush *wxBrushList::FindOrCreateBrush (const wxColour& colour, int style) 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 (); wxBrush *each_brush = (wxBrush *) node->GetData ();
if (each_brush && if (each_brush &&
@@ -713,7 +714,7 @@ void wxBrushList::RemoveBrush (wxBrush * brush)
wxFontList::~wxFontList () wxFontList::~wxFontList ()
{ {
wxNode *node = GetFirst (); wxList::compatibility_iterator node = GetFirst ();
while (node) while (node)
{ {
// Only delete objects that are 'visible', i.e. // Only delete objects that are 'visible', i.e.
@@ -721,7 +722,7 @@ wxFontList::~wxFontList ()
// where the pointers are expected to be shared // where the pointers are expected to be shared
// (and therefore not deleted by any one part of an app). // (and therefore not deleted by any one part of an app).
wxFont *font = (wxFont *) node->GetData (); wxFont *font = (wxFont *) node->GetData ();
wxNode *next = node->GetNext (); wxList::compatibility_iterator next = node->GetNext ();
if (font->GetVisible()) if (font->GetVisible())
delete font; delete font;
node = next; node = next;
@@ -747,7 +748,7 @@ wxFont *wxFontList::FindOrCreateFont(int pointSize,
wxFontEncoding encoding) wxFontEncoding encoding)
{ {
wxFont *font = (wxFont *)NULL; wxFont *font = (wxFont *)NULL;
wxNode *node; wxList::compatibility_iterator node;
for ( node = GetFirst(); node; node = node->GetNext() ) for ( node = GetFirst(); node; node = node->GetNext() )
{ {
font = (wxFont *)node->GetData(); font = (wxFont *)node->GetData();
@@ -845,7 +846,7 @@ wxSize wxGetDisplaySizeMM()
wxResourceCache::~wxResourceCache () wxResourceCache::~wxResourceCache ()
{ {
wxNode *node = GetFirst (); wxList::compatibility_iterator node = GetFirst ();
while (node) { while (node) {
wxObject *item = (wxObject *)node->GetData(); wxObject *item = (wxObject *)node->GetData();
delete item; delete item;

View File

@@ -1128,7 +1128,7 @@ bool wxImage::CanRead( wxInputStream &stream )
{ {
const wxList& list = GetHandlers(); 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(); wxImageHandler *handler=(wxImageHandler*)node->GetData();
if (handler->CanRead( stream )) if (handler->CanRead( stream ))
@@ -1146,7 +1146,7 @@ int wxImage::GetImageCount( wxInputStream &stream, long type )
{ {
wxList &list=GetHandlers(); 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(); handler=(wxImageHandler*)node->GetData();
if ( handler->CanRead(stream) ) if ( handler->CanRead(stream) )
@@ -1189,7 +1189,7 @@ bool wxImage::LoadFile( wxInputStream& stream, long type, int index )
{ {
wxList &list=GetHandlers(); 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(); handler=(wxImageHandler*)node->GetData();
if ( handler->CanRead(stream) ) if ( handler->CanRead(stream) )
@@ -1266,9 +1266,6 @@ bool wxImage::SaveFile( wxOutputStream& stream, const wxString& mimetype ) const
void wxImage::AddHandler( wxImageHandler *handler ) 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. // Check for an existing handler of the type being added.
if (FindHandler( handler->GetType() ) == 0) if (FindHandler( handler->GetType() ) == 0)
{ {
@@ -1290,9 +1287,6 @@ void wxImage::AddHandler( wxImageHandler *handler )
void wxImage::InsertHandler( 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. // Check for an existing handler of the type being added.
if (FindHandler( handler->GetType() ) == 0) if (FindHandler( handler->GetType() ) == 0)
{ {
@@ -1313,6 +1307,7 @@ bool wxImage::RemoveHandler( const wxString& name )
if (handler) if (handler)
{ {
sm_handlers.DeleteObject(handler); sm_handlers.DeleteObject(handler);
delete handler;
return true; return true;
} }
else else
@@ -1321,7 +1316,7 @@ bool wxImage::RemoveHandler( const wxString& name )
wxImageHandler *wxImage::FindHandler( const wxString& name ) wxImageHandler *wxImage::FindHandler( const wxString& name )
{ {
wxNode *node = sm_handlers.GetFirst(); wxList::compatibility_iterator node = sm_handlers.GetFirst();
while (node) while (node)
{ {
wxImageHandler *handler = (wxImageHandler*)node->GetData(); wxImageHandler *handler = (wxImageHandler*)node->GetData();
@@ -1334,7 +1329,7 @@ wxImageHandler *wxImage::FindHandler( const wxString& name )
wxImageHandler *wxImage::FindHandler( const wxString& extension, long bitmapType ) wxImageHandler *wxImage::FindHandler( const wxString& extension, long bitmapType )
{ {
wxNode *node = sm_handlers.GetFirst(); wxList::compatibility_iterator node = sm_handlers.GetFirst();
while (node) while (node)
{ {
wxImageHandler *handler = (wxImageHandler*)node->GetData(); wxImageHandler *handler = (wxImageHandler*)node->GetData();
@@ -1348,7 +1343,7 @@ wxImageHandler *wxImage::FindHandler( const wxString& extension, long bitmapType
wxImageHandler *wxImage::FindHandler( long bitmapType ) wxImageHandler *wxImage::FindHandler( long bitmapType )
{ {
wxNode *node = sm_handlers.GetFirst(); wxList::compatibility_iterator node = sm_handlers.GetFirst();
while (node) while (node)
{ {
wxImageHandler *handler = (wxImageHandler *)node->GetData(); wxImageHandler *handler = (wxImageHandler *)node->GetData();
@@ -1360,7 +1355,7 @@ wxImageHandler *wxImage::FindHandler( long bitmapType )
wxImageHandler *wxImage::FindHandlerMime( const wxString& mimetype ) wxImageHandler *wxImage::FindHandlerMime( const wxString& mimetype )
{ {
wxNode *node = sm_handlers.GetFirst(); wxList::compatibility_iterator node = sm_handlers.GetFirst();
while (node) while (node)
{ {
wxImageHandler *handler = (wxImageHandler *)node->GetData(); wxImageHandler *handler = (wxImageHandler *)node->GetData();
@@ -1379,24 +1374,24 @@ void wxImage::InitStandardHandlers()
void wxImage::CleanUpHandlers() void wxImage::CleanUpHandlers()
{ {
wxNode *node = sm_handlers.GetFirst(); wxList::compatibility_iterator node = sm_handlers.GetFirst();
while (node) while (node)
{ {
wxImageHandler *handler = (wxImageHandler *)node->GetData(); wxImageHandler *handler = (wxImageHandler *)node->GetData();
wxNode *next = node->GetNext(); wxList::compatibility_iterator next = node->GetNext();
delete handler; delete handler;
delete node;
node = next; node = next;
} }
}
sm_handlers.Clear();
}
wxString wxImage::GetImageExtWildcard() wxString wxImage::GetImageExtWildcard()
{ {
wxString fmts; wxString fmts;
wxList& Handlers = wxImage::GetHandlers(); wxList& Handlers = wxImage::GetHandlers();
wxNode* Node = Handlers.GetFirst(); wxList::compatibility_iterator Node = Handlers.GetFirst();
while ( Node ) while ( Node )
{ {
wxImageHandler* Handler = (wxImageHandler*)Node->GetData(); wxImageHandler* Handler = (wxImageHandler*)Node->GetData();
@@ -1408,7 +1403,6 @@ wxString wxImage::GetImageExtWildcard()
return wxT("(") + fmts + wxT(")|") + fmts; return wxT("(") + fmts + wxT(")|") + fmts;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxImageHandler // wxImageHandler
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -734,7 +734,7 @@ int wxIndividualLayoutConstraint::GetEdge(wxEdge which,
// If the edge or dimension belongs to the parent, then we know the // If the edge or dimension belongs to the parent, then we know the
// dimension is obtainable immediately. E.g. a wxExpandSizer may contain a // dimension is obtainable immediately. E.g. a wxExpandSizer may contain a
// button (but the button's true parent is a panel, not the sizer) // 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) switch (which)
{ {

View File

@@ -276,8 +276,6 @@ void wxMenuItemBase::SetAccel(wxAcceleratorEntry *accel)
void wxMenuBase::Init(long style) void wxMenuBase::Init(long style)
{ {
m_items.DeleteContents(TRUE);
m_menuBar = (wxMenuBar *)NULL; m_menuBar = (wxMenuBar *)NULL;
m_menuParent = (wxMenu *)NULL; m_menuParent = (wxMenu *)NULL;
@@ -289,7 +287,7 @@ void wxMenuBase::Init(long style)
wxMenuBase::~wxMenuBase() 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. // 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()") ); 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()") ); wxCHECK_MSG( node, FALSE, wxT("invalid index in wxMenu::Insert()") );
m_items.Insert(node, item); m_items.Insert(node, item);
@@ -367,15 +365,14 @@ wxMenuItem *wxMenuBase::Remove(wxMenuItem *item)
wxMenuItem *wxMenuBase::DoRemove(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 // 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") ); 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 // we detach the item, but we do delete the list node (i.e. don't call
// DetachNode() here!) // DetachNode() here!)
node->SetData((wxMenuItem *)NULL); // to prevent it from deleting the item m_items.Erase(node);
m_items.DeleteNode(node);
// item isn't attached to anything any more // item isn't attached to anything any more
item->SetMenu((wxMenu *)NULL); item->SetMenu((wxMenu *)NULL);
@@ -433,7 +430,7 @@ bool wxMenuBase::DoDestroy(wxMenuItem *item)
int wxMenuBase::FindItem(const wxString& text) const int wxMenuBase::FindItem(const wxString& text) const
{ {
wxString label = wxMenuItem::GetLabelFromText(text); wxString label = wxMenuItem::GetLabelFromText(text);
for ( wxMenuItemList::Node *node = m_items.GetFirst(); for ( wxMenuItemList::compatibility_iterator node = m_items.GetFirst();
node; node;
node = node->GetNext() ) node = node->GetNext() )
{ {
@@ -464,7 +461,7 @@ wxMenuItem *wxMenuBase::FindItem(int itemId, wxMenu **itemMenu) const
*itemMenu = NULL; *itemMenu = NULL;
wxMenuItem *item = NULL; wxMenuItem *item = NULL;
for ( wxMenuItemList::Node *node = m_items.GetFirst(); for ( wxMenuItemList::compatibility_iterator node = m_items.GetFirst();
node && !item; node && !item;
node = node->GetNext() ) 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 *wxMenuBase::FindChildItem(int id, size_t *ppos) const
{ {
wxMenuItem *item = (wxMenuItem *)NULL; wxMenuItem *item = (wxMenuItem *)NULL;
wxMenuItemList::Node *node = GetMenuItems().GetFirst(); wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
size_t pos; size_t pos;
for ( pos = 0; node; pos++ ) for ( pos = 0; node; pos++ )
@@ -541,7 +538,7 @@ void wxMenuBase::UpdateUI(wxEvtHandler* source)
if ( !source ) if ( !source )
source = this; source = this;
wxMenuItemList::Node* node = GetMenuItems().GetFirst(); wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
while ( node ) while ( node )
{ {
wxMenuItem* item = node->GetData(); wxMenuItem* item = node->GetData();
@@ -714,17 +711,13 @@ wxString wxMenuBase::GetHelpString( int id ) const
wxMenuBarBase::wxMenuBarBase() wxMenuBarBase::wxMenuBarBase()
{ {
// we own the menus when we get them
m_menus.DeleteContents(TRUE);
// not attached yet // not attached yet
m_menuBarFrame = NULL; m_menuBarFrame = NULL;
} }
wxMenuBarBase::~wxMenuBarBase() wxMenuBarBase::~wxMenuBarBase()
{ {
// nothing to do, the list will delete the menus because of the call to WX_CLEAR_LIST(wxMenuList, m_menus);
// DeleteContents() above
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -734,7 +727,7 @@ wxMenuBarBase::~wxMenuBarBase()
wxMenu *wxMenuBarBase::GetMenu(size_t pos) const 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()") ); wxCHECK_MSG( node, NULL, wxT("bad index in wxMenuBar::GetMenu()") );
return node->GetData(); 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") ); 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()") ); wxCHECK_MSG( node, FALSE, wxT("bad index in wxMenuBar::Insert()") );
m_menus.Insert(node, menu); 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") ); 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()") ); wxCHECK_MSG( node, NULL, wxT("bad index in wxMenuBar::Replace()") );
wxMenu *menuOld = node->GetData(); wxMenu *menuOld = node->GetData();
@@ -790,16 +783,14 @@ wxMenu *wxMenuBarBase::Replace(size_t pos, wxMenu *menu,
wxMenu *wxMenuBarBase::Remove(size_t pos) 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()") ); wxCHECK_MSG( node, NULL, wxT("bad index in wxMenuBar::Remove()") );
node = m_menus.DetachNode(node);
wxCHECK( node, NULL ); // unexpected
wxMenu *menu = node->GetData(); wxMenu *menu = node->GetData();
wxCHECK( node, NULL ); // unexpected
m_menus.Erase(node);
menu->Detach(); menu->Detach();
delete node;
return menu; return menu;
} }
@@ -851,10 +842,11 @@ wxMenuItem *wxMenuBarBase::FindItem(int id, wxMenu **menu) const
*menu = NULL; *menu = NULL;
wxMenuItem *item = NULL; wxMenuItem *item = NULL;
size_t count = GetMenuCount(); size_t count = GetMenuCount(), i;
for ( size_t i = 0; !item && (i < count); 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; return item;
@@ -865,7 +857,7 @@ int wxMenuBarBase::FindMenuItem(const wxString& menu, const wxString& item) cons
wxString label = wxMenuItem::GetLabelFromText(menu); wxString label = wxMenuItem::GetLabelFromText(menu);
int i = 0; int i = 0;
wxMenuList::Node *node; wxMenuList::compatibility_iterator node;
for ( node = m_menus.GetFirst(); node; node = node->GetNext(), i++ ) for ( node = m_menus.GetFirst(); node; node = node->GetNext(), i++ )
{ {
if ( label == wxMenuItem::GetLabelFromText(GetLabelTop(i)) ) if ( label == wxMenuItem::GetLabelFromText(GetLabelTop(i)) )

View File

@@ -33,6 +33,7 @@
#include "wx/paper.h" #include "wx/paper.h"
#include "wx/module.h" #include "wx/module.h"
#include "wx/hashmap.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@@ -49,7 +50,7 @@
// End __WXMSW__ // End __WXMSW__
IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperType, wxObject) IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperType, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperDatabase, wxList) // IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperDatabase, wxList)
/* /*
* Paper size database for all platforms * Paper size database for all platforms
@@ -83,11 +84,22 @@ wxSize wxPrintPaperType::GetSizeDeviceUnits() const
* Print paper database for PostScript * 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* wxThePrintPaperDatabase = (wxPrintPaperDatabase*) NULL;
wxPrintPaperDatabase::wxPrintPaperDatabase():wxList(wxKEY_STRING) wxPrintPaperDatabase::wxPrintPaperDatabase()
{ {
DeleteContents(TRUE); m_map = new wxStringToPrintPaperTypeHashMap;
m_list = new wxPrintPaperTypeList;
}
wxPrintPaperDatabase::~wxPrintPaperDatabase()
{
ClearDatabase();
} }
void wxPrintPaperDatabase::CreateDatabase() void wxPrintPaperDatabase::CreateDatabase()
@@ -175,66 +187,75 @@ void wxPrintPaperDatabase::CreateDatabase()
void wxPrintPaperDatabase::ClearDatabase() 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) 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) 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) wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(const wxString& name)
{ {
wxNode *node = Find(name); wxStringToPrintPaperTypeHashMap::iterator it = m_map->find(name);
if (node) if (it != m_map->end())
return (wxPrintPaperType *)node->GetData(); return it->second;
else else
return (wxPrintPaperType *) NULL; return NULL;
} }
wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(wxPaperSize id) wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(wxPaperSize id)
{ {
wxNode *node = GetFirst(); typedef wxStringToPrintPaperTypeHashMap::iterator iterator;
while (node)
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) if (paperType->GetId() == id)
return paperType; return paperType;
node = node->GetNext();
} }
return (wxPrintPaperType *) NULL;
return NULL;
} }
wxPrintPaperType *wxPrintPaperDatabase::FindPaperTypeByPlatformId(int id) wxPrintPaperType *wxPrintPaperDatabase::FindPaperTypeByPlatformId(int id)
{ {
wxNode *node = GetFirst(); typedef wxStringToPrintPaperTypeHashMap::iterator iterator;
while (node)
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) if (paperType->GetPlatformId() == id)
return paperType; return paperType;
node = node->GetNext();
} }
return (wxPrintPaperType *) NULL;
return NULL;
} }
wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(const wxSize& sz) wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(const wxSize& sz)
{ {
wxNode *node = GetFirst(); typedef wxStringToPrintPaperTypeHashMap::iterator iterator;
while (node)
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() ; wxSize paperSize = paperType->GetSize() ;
if ( abs( paperSize.x - sz.x ) < 10 && abs( paperSize.y - sz.y ) < 10 ) if ( abs( paperSize.x - sz.x ) < 10 && abs( paperSize.y - sz.y ) < 10 )
return paperType; return paperType;
node = node->GetNext();
} }
return (wxPrintPaperType *) NULL;
return NULL;
} }
// Convert name to size id // Convert name to size id
@@ -277,6 +298,17 @@ wxPaperSize wxPrintPaperDatabase::GetSize(const wxSize& size)
return wxPAPER_NONE; 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 // A module to allow initialization/cleanup of print paper
// things without calling these functions from app.cpp. // things without calling these functions from app.cpp.

View File

@@ -277,12 +277,11 @@ int wxSizerItem::GetOption() const
wxSizer::wxSizer() wxSizer::wxSizer()
: m_minSize( wxSize( 0, 0 ) ) : m_minSize( wxSize( 0, 0 ) )
{ {
m_children.DeleteContents( true );
} }
wxSizer::~wxSizer() wxSizer::~wxSizer()
{ {
Clear(); WX_CLEAR_LIST(wxSizerItemList, m_children);
} }
void wxSizer::Add( wxWindow *window, int proportion, int flag, int border, wxObject* userData ) 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") ); wxASSERT_MSG( sizer, _T("Removing NULL sizer") );
wxSizerItemList::Node *node = m_children.GetFirst(); wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node) while (node)
{ {
wxSizerItem *item = node->GetData(); wxSizerItem *item = node->GetData();
if (item->GetSizer() == sizer) if (item->GetSizer() == sizer)
return m_children.DeleteNode( node ); {
delete item;
m_children.Erase( node );
return true;
}
node = node->GetNext(); node = node->GetNext();
} }
@@ -405,7 +408,7 @@ bool wxSizer::Remove( int index )
false, false,
_T("Remove index is out of range") ); _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") ); wxCHECK_MSG( node, false, _T("Failed to find child node") );
@@ -414,14 +417,16 @@ bool wxSizer::Remove( int index )
if( item->IsWindow() ) if( item->IsWindow() )
item->GetWindow()->SetContainingSizer( NULL ); item->GetWindow()->SetContainingSizer( NULL );
return m_children.DeleteNode( node ); delete item;
m_children.Erase( node );
return true;
} }
bool wxSizer::Detach( wxSizer *sizer ) bool wxSizer::Detach( wxSizer *sizer )
{ {
wxASSERT_MSG( sizer, _T("Detaching NULL sizer") ); wxASSERT_MSG( sizer, _T("Detaching NULL sizer") );
wxSizerItemList::Node *node = m_children.GetFirst(); wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node) while (node)
{ {
wxSizerItem *item = node->GetData(); wxSizerItem *item = node->GetData();
@@ -429,7 +434,8 @@ bool wxSizer::Detach( wxSizer *sizer )
if (item->GetSizer() == sizer) if (item->GetSizer() == sizer)
{ {
item->DetachSizer(); item->DetachSizer();
return m_children.DeleteNode( node ); m_children.Erase( node );
return true;
} }
node = node->GetNext(); node = node->GetNext();
} }
@@ -441,7 +447,7 @@ bool wxSizer::Detach( wxWindow *window )
{ {
wxASSERT_MSG( window, _T("Detaching NULL window") ); wxASSERT_MSG( window, _T("Detaching NULL window") );
wxSizerItemList::Node *node = m_children.GetFirst(); wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node) while (node)
{ {
wxSizerItem *item = node->GetData(); wxSizerItem *item = node->GetData();
@@ -449,7 +455,8 @@ bool wxSizer::Detach( wxWindow *window )
if (item->GetWindow() == window) if (item->GetWindow() == window)
{ {
item->GetWindow()->SetContainingSizer( NULL ); item->GetWindow()->SetContainingSizer( NULL );
return m_children.DeleteNode( node ); m_children.Erase( node );
return true;
} }
node = node->GetNext(); node = node->GetNext();
} }
@@ -463,7 +470,7 @@ bool wxSizer::Detach( int index )
false, false,
_T("Detach index is out of range") ); _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") ); wxCHECK_MSG( node, false, _T("Failed to find child node") );
@@ -474,13 +481,14 @@ bool wxSizer::Detach( int index )
else if( item->IsWindow() ) else if( item->IsWindow() )
item->GetWindow()->SetContainingSizer( NULL ); item->GetWindow()->SetContainingSizer( NULL );
return m_children.DeleteNode( node ); m_children.Erase( node );
return true;
} }
void wxSizer::Clear( bool delete_windows ) void wxSizer::Clear( bool delete_windows )
{ {
// First clear the ContainingSizer pointers // First clear the ContainingSizer pointers
wxSizerItemList::Node *node = m_children.GetFirst(); wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node) while (node)
{ {
wxSizerItem *item = node->GetData(); wxSizerItem *item = node->GetData();
@@ -495,12 +503,12 @@ void wxSizer::Clear( bool delete_windows )
DeleteWindows(); DeleteWindows();
// Now empty the list // Now empty the list
m_children.Clear(); WX_CLEAR_LIST(wxSizerItemList, m_children);
} }
void wxSizer::DeleteWindows() void wxSizer::DeleteWindows()
{ {
wxSizerItemList::Node *node = m_children.GetFirst(); wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node) while (node)
{ {
wxSizerItem *item = node->GetData(); wxSizerItem *item = node->GetData();
@@ -662,7 +670,7 @@ bool wxSizer::DoSetItemMinSize( wxWindow *window, int width, int height )
// Is it our immediate child? // Is it our immediate child?
wxSizerItemList::Node *node = m_children.GetFirst(); wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node) while (node)
{ {
wxSizerItem *item = node->GetData(); wxSizerItem *item = node->GetData();
@@ -700,7 +708,7 @@ bool wxSizer::DoSetItemMinSize( wxSizer *sizer, int width, int height )
// Is it our immediate child? // Is it our immediate child?
wxSizerItemList::Node *node = m_children.GetFirst(); wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node) while (node)
{ {
wxSizerItem *item = node->GetData(); 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 ) 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") ); 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") ); wxASSERT_MSG( window, _T("Show for NULL window") );
wxSizerItemList::Node *node = m_children.GetFirst(); wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node) while (node)
{ {
wxSizerItem *item = node->GetData(); wxSizerItem *item = node->GetData();
@@ -776,7 +784,7 @@ void wxSizer::Show( wxSizer *sizer, bool show )
{ {
wxASSERT_MSG( sizer, _T("Show for NULL sizer") ); wxASSERT_MSG( sizer, _T("Show for NULL sizer") );
wxSizerItemList::Node *node = m_children.GetFirst(); wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node) while (node)
{ {
wxSizerItem *item = node->GetData(); wxSizerItem *item = node->GetData();
@@ -800,7 +808,7 @@ void wxSizer::Show( size_t index, bool show )
void wxSizer::ShowItems( bool show ) void wxSizer::ShowItems( bool show )
{ {
wxSizerItemList::Node *node = m_children.GetFirst(); wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node) while (node)
{ {
node->GetData()->Show( show ); node->GetData()->Show( show );
@@ -810,7 +818,7 @@ void wxSizer::ShowItems( bool show )
bool wxSizer::IsShown( wxWindow *window ) const bool wxSizer::IsShown( wxWindow *window ) const
{ {
wxSizerItemList::Node *node = m_children.GetFirst(); wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node) while (node)
{ {
wxSizerItem *item = node->GetData(); wxSizerItem *item = node->GetData();
@@ -829,7 +837,7 @@ bool wxSizer::IsShown( wxWindow *window ) const
bool wxSizer::IsShown( wxSizer *sizer ) const bool wxSizer::IsShown( wxSizer *sizer ) const
{ {
wxSizerItemList::Node *node = m_children.GetFirst(); wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node) while (node)
{ {
wxSizerItem *item = node->GetData(); wxSizerItem *item = node->GetData();
@@ -923,7 +931,7 @@ void wxGridSizer::RecalcSizes()
int i = r * ncols + c; int i = r * ncols + c;
if (i < nitems) 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") ); wxASSERT_MSG( node, _T("Failed to find SizerItemList node") );
@@ -945,7 +953,7 @@ wxSize wxGridSizer::CalcMin()
int w = 0; int w = 0;
int h = 0; int h = 0;
wxSizerItemList::Node *node = m_children.GetFirst(); wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node) while (node)
{ {
wxSizerItem *item = node->GetData(); wxSizerItem *item = node->GetData();
@@ -1136,7 +1144,7 @@ void wxFlexGridSizer::RecalcSizes()
int i = r * ncols + c; int i = r * ncols + c;
if (i < nitems) 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") ); 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 ) for( s = m_colWidths.GetCount(), i = 0; i < s; ++i )
m_colWidths[ i ] = -1; m_colWidths[ i ] = -1;
wxSizerItemList::Node *node = m_children.GetFirst(); wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
i = 0; i = 0;
while (node) while (node)
@@ -1286,7 +1294,7 @@ void wxBoxSizer::RecalcSizes()
wxPoint pt( m_position ); wxPoint pt( m_position );
wxSizerItemList::Node *node = m_children.GetFirst(); wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node) while (node)
{ {
wxSizerItem *item = node->GetData(); wxSizerItem *item = node->GetData();
@@ -1368,7 +1376,7 @@ wxSize wxBoxSizer::CalcMin()
// Find how long each stretch unit needs to be // Find how long each stretch unit needs to be
int stretchSize = 1; int stretchSize = 1;
wxSizerItemList::Node *node = m_children.GetFirst(); wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node) while (node)
{ {
@@ -1539,7 +1547,7 @@ wxSize wxNotebookSizer::CalcMin()
int maxX = 0; int maxX = 0;
int maxY = 0; int maxY = 0;
wxWindowList::Node *node = m_notebook->GetChildren().GetFirst(); wxWindowList::compatibility_iterator node = m_notebook->GetChildren().GetFirst();
while (node) while (node)
{ {
wxWindow *item = node->GetData(); wxWindow *item = node->GetData();

View File

@@ -234,7 +234,8 @@ void wxStatusBarBase::FreeStacks()
{ {
if(m_statusTextStacks[i]) if(m_statusTextStacks[i])
{ {
m_statusTextStacks[i]->Clear(); wxListString& t = *m_statusTextStacks[i];
WX_CLEAR_LIST(wxListString, t);
delete m_statusTextStacks[i]; delete m_statusTextStacks[i];
} }
} }
@@ -257,10 +258,11 @@ void wxStatusBarBase::PopStatusText(int number)
{ {
wxListString *st = GetStatusStack(number); wxListString *st = GetStatusStack(number);
wxCHECK_RET( st, _T("Unbalanced PushStatusText/PopStatusText") ); wxCHECK_RET( st, _T("Unbalanced PushStatusText/PopStatusText") );
wxListString::Node *top = st->GetFirst(); wxListString::compatibility_iterator top = st->GetFirst();
SetStatusText(*top->GetData(), number); SetStatusText(*top->GetData(), number);
st->DeleteNode(top); delete top->GetData();
st->Erase(top);
if(st->GetCount() == 0) if(st->GetCount() == 0)
{ {
delete st; delete st;
@@ -288,7 +290,6 @@ wxListString *wxStatusBarBase::GetOrCreateStatusStack(int i)
if(!m_statusTextStacks[i]) if(!m_statusTextStacks[i])
{ {
m_statusTextStacks[i] = new wxListString(); m_statusTextStacks[i] = new wxListString();
m_statusTextStacks[i]->DeleteContents(TRUE);
} }
return m_statusTextStacks[i]; return m_statusTextStacks[i];

View File

@@ -125,8 +125,6 @@ wxToolBarToolBase::~wxToolBarToolBase()
wxToolBarBase::wxToolBarBase() wxToolBarBase::wxToolBarBase()
{ {
// the list owns the pointers // the list owns the pointers
m_tools.DeleteContents(TRUE);
m_xMargin = m_yMargin = 0; m_xMargin = m_yMargin = 0;
m_maxRows = m_maxCols = 0; m_maxRows = m_maxCols = 0;
@@ -224,7 +222,7 @@ wxToolBarToolBase *wxToolBarBase::InsertControl(size_t pos, wxControl *control)
wxControl *wxToolBarBase::FindControl( int id ) wxControl *wxToolBarBase::FindControl( int id )
{ {
for ( wxToolBarToolsList::Node* node = m_tools.GetFirst(); for ( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
node; node;
node = node->GetNext() ) node = node->GetNext() )
{ {
@@ -279,7 +277,7 @@ wxToolBarToolBase *wxToolBarBase::InsertSeparator(size_t pos)
wxToolBarToolBase *wxToolBarBase::RemoveTool(int id) wxToolBarToolBase *wxToolBarBase::RemoveTool(int id)
{ {
size_t pos = 0; size_t pos = 0;
wxToolBarToolsList::Node *node; wxToolBarToolsList::compatibility_iterator node;
for ( node = m_tools.GetFirst(); node; node = node->GetNext() ) for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
{ {
if ( node->GetData()->GetId() == id ) if ( node->GetData()->GetId() == id )
@@ -301,10 +299,7 @@ wxToolBarToolBase *wxToolBarBase::RemoveTool(int id)
return (wxToolBarToolBase *)NULL; return (wxToolBarToolBase *)NULL;
} }
// the node would delete the data, so set it to NULL to avoid this m_tools.Erase(node);
node->SetData(NULL);
m_tools.DeleteNode(node);
return tool; return tool;
} }
@@ -314,14 +309,15 @@ bool wxToolBarBase::DeleteToolByPos(size_t pos)
wxCHECK_MSG( pos < GetToolsCount(), FALSE, wxCHECK_MSG( pos < GetToolsCount(), FALSE,
_T("invalid position in wxToolBar::DeleteToolByPos()") ); _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()) ) if ( !DoDeleteTool(pos, node->GetData()) )
{ {
return FALSE; return FALSE;
} }
m_tools.DeleteNode(node); delete node->GetData();
m_tools.Erase(node);
return TRUE; return TRUE;
} }
@@ -329,7 +325,7 @@ bool wxToolBarBase::DeleteToolByPos(size_t pos)
bool wxToolBarBase::DeleteTool(int id) bool wxToolBarBase::DeleteTool(int id)
{ {
size_t pos = 0; size_t pos = 0;
wxToolBarToolsList::Node *node; wxToolBarToolsList::compatibility_iterator node;
for ( node = m_tools.GetFirst(); node; node = node->GetNext() ) for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
{ {
if ( node->GetData()->GetId() == id ) if ( node->GetData()->GetId() == id )
@@ -343,7 +339,8 @@ bool wxToolBarBase::DeleteTool(int id)
return FALSE; return FALSE;
} }
m_tools.DeleteNode(node); delete node->GetData();
m_tools.Erase(node);
return TRUE; return TRUE;
} }
@@ -352,7 +349,7 @@ wxToolBarToolBase *wxToolBarBase::FindById(int id) const
{ {
wxToolBarToolBase *tool = (wxToolBarToolBase *)NULL; wxToolBarToolBase *tool = (wxToolBarToolBase *)NULL;
for ( wxToolBarToolsList::Node *node = m_tools.GetFirst(); for ( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
node; node;
node = node->GetNext() ) node = node->GetNext() )
{ {
@@ -371,7 +368,7 @@ wxToolBarToolBase *wxToolBarBase::FindById(int id) const
void wxToolBarBase::ClearTools() void wxToolBarBase::ClearTools()
{ {
m_tools.Clear(); WX_CLEAR_LIST(wxToolBarToolsList, m_tools);
} }
bool wxToolBarBase::Realize() bool wxToolBarBase::Realize()
@@ -381,6 +378,7 @@ bool wxToolBarBase::Realize()
wxToolBarBase::~wxToolBarBase() 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 int wxToolBarBase::GetToolPos(int id) const
{ {
size_t pos = 0; size_t pos = 0;
wxToolBarToolsList::Node *node; wxToolBarToolsList::compatibility_iterator node;
for ( node = m_tools.GetFirst(); node; node = node->GetNext() ) for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
{ {
@@ -587,7 +585,7 @@ void wxToolBarBase::UpdateWindowUI(long flags)
wxEvtHandler* evtHandler = GetEventHandler() ; wxEvtHandler* evtHandler = GetEventHandler() ;
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

@@ -161,7 +161,7 @@ void wxTopLevelWindowBase::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

@@ -73,20 +73,9 @@ bool wxTextValidator::Copy(const wxTextValidator& val)
m_validatorStyle = val.m_validatorStyle ; m_validatorStyle = val.m_validatorStyle ;
m_stringValue = val.m_stringValue ; m_stringValue = val.m_stringValue ;
wxStringList::Node *node = val.m_includeList.GetFirst() ; m_includeList = val.m_includeList;
while ( node ) m_excludeList = val.m_excludeList;
{
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();
}
return TRUE; return TRUE;
} }
@@ -232,38 +221,12 @@ bool wxTextValidator::TransferFromWindow(void)
void wxTextValidator::SetIncludeList(const wxStringList& list) void wxTextValidator::SetIncludeList(const wxStringList& list)
{ {
/* m_includeList = 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();
}
} }
void wxTextValidator::SetExcludeList(const wxStringList& list) void wxTextValidator::SetExcludeList(const wxStringList& list)
{ {
/* m_excludeList = 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();
}
} }
void wxTextValidator::OnChar(wxKeyEvent& event) void wxTextValidator::OnChar(wxKeyEvent& event)

View File

@@ -114,7 +114,6 @@ void wxWindowBase::InitBase()
// no window yet, no parent nor children // no window yet, no parent nor children
m_parent = (wxWindow *)NULL; m_parent = (wxWindow *)NULL;
m_windowId = -1; m_windowId = -1;
m_children.DeleteContents( FALSE ); // don't auto delete node data
// no constraints on the minimal window size // no constraints on the minimal window size
m_minWidth = m_minWidth =
@@ -263,7 +262,7 @@ wxWindowBase::~wxWindowBase()
// Just in case we've loaded a top-level window via LoadNativeDialog but // Just in case we've loaded a top-level window via LoadNativeDialog but
// we weren't a dialog class // we weren't a dialog class
wxTopLevelWindows.DeleteObject(this); wxTopLevelWindows.DeleteObject((wxWindow*)this);
wxASSERT_MSG( GetChildren().GetCount() == 0, wxT("children not destroyed") ); wxASSERT_MSG( GetChildren().GetCount() == 0, wxT("children not destroyed") );
@@ -344,7 +343,7 @@ bool wxWindowBase::Close(bool force)
bool wxWindowBase::DestroyChildren() bool wxWindowBase::DestroyChildren()
{ {
wxWindowList::Node *node; wxWindowList::compatibility_iterator node;
for ( ;; ) for ( ;; )
{ {
// we iterate until the list becomes empty // we iterate until the list becomes empty
@@ -520,7 +519,7 @@ wxSize wxWindowBase::DoGetBestSize() const
int maxX = 0, int maxX = 0,
maxY = 0; maxY = 0;
for ( wxWindowList::Node *node = GetChildren().GetFirst(); for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
node; node;
node = node->GetNext() ) node = node->GetNext() )
{ {
@@ -554,7 +553,7 @@ wxSize wxWindowBase::DoGetBestSize() const
int maxX = 0, int maxX = 0,
maxY = 0; maxY = 0;
for ( wxWindowList::Node *node = GetChildren().GetFirst(); for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
node; node;
node = node->GetNext() ) 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 // 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 // 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 // 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); child->SetParent(this);
} }
@@ -718,8 +717,8 @@ void wxWindowBase::RemoveChild(wxWindowBase *child)
{ {
wxCHECK_RET( child, wxT("can't remove a NULL child") ); wxCHECK_RET( child, wxT("can't remove a NULL child") );
GetChildren().DeleteObject(child); GetChildren().DeleteObject((wxWindow *)child);
child->SetParent((wxWindow *)NULL); child->SetParent(NULL);
} }
bool wxWindowBase::Reparent(wxWindowBase *newParent) bool wxWindowBase::Reparent(wxWindowBase *newParent)
@@ -738,7 +737,7 @@ bool wxWindowBase::Reparent(wxWindowBase *newParent)
} }
else else
{ {
wxTopLevelWindows.DeleteObject(this); wxTopLevelWindows.DeleteObject((wxWindow *)this);
} }
// add it to the new one // add it to the new one
@@ -748,7 +747,7 @@ bool wxWindowBase::Reparent(wxWindowBase *newParent)
} }
else else
{ {
wxTopLevelWindows.Append(this); wxTopLevelWindows.Append((wxWindow *)this);
} }
return TRUE; return TRUE;
@@ -988,7 +987,7 @@ wxWindow *wxWindowBase::FindWindow( long id )
return (wxWindow *)this; return (wxWindow *)this;
wxWindowBase *res = (wxWindow *)NULL; wxWindowBase *res = (wxWindow *)NULL;
wxWindowList::Node *node; wxWindowList::compatibility_iterator node;
for ( node = m_children.GetFirst(); node && !res; node = node->GetNext() ) for ( node = m_children.GetFirst(); node && !res; node = node->GetNext() )
{ {
wxWindowBase *child = node->GetData(); wxWindowBase *child = node->GetData();
@@ -1004,7 +1003,7 @@ wxWindow *wxWindowBase::FindWindow( const wxString& name )
return (wxWindow *)this; return (wxWindow *)this;
wxWindowBase *res = (wxWindow *)NULL; wxWindowBase *res = (wxWindow *)NULL;
wxWindowList::Node *node; wxWindowList::compatibility_iterator node;
for ( node = m_children.GetFirst(); node && !res; node = node->GetNext() ) for ( node = m_children.GetFirst(); node && !res; node = node->GetNext() )
{ {
wxWindow *child = node->GetData(); wxWindow *child = node->GetData();
@@ -1060,7 +1059,7 @@ wxWindow *wxFindWindowRecursively(const wxWindow *parent,
return (wxWindow *)parent; return (wxWindow *)parent;
// It wasn't, so check all its children // 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 = node->GetNext() ) node = node->GetNext() )
{ {
@@ -1090,7 +1089,7 @@ wxWindow *wxFindWindowHelper(const wxWindow *parent,
} }
// start at very top of wx's windows // start at very top of wx's windows
for ( wxWindowList::Node * node = wxTopLevelWindows.GetFirst(); for ( wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
node; node;
node = node->GetNext() ) node = node->GetNext() )
{ {
@@ -1142,7 +1141,7 @@ void wxWindowBase::MakeModal(bool modal)
// Disable all other windows // Disable all other windows
if ( IsTopLevel() ) if ( IsTopLevel() )
{ {
wxWindowList::Node *node = wxTopLevelWindows.GetFirst(); wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
while (node) while (node)
{ {
wxWindow *win = node->GetData(); wxWindow *win = node->GetData();
@@ -1159,7 +1158,7 @@ bool wxWindowBase::Validate()
#if wxUSE_VALIDATORS #if wxUSE_VALIDATORS
bool recurse = (GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY) != 0; bool recurse = (GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY) != 0;
wxWindowList::Node *node; wxWindowList::compatibility_iterator node;
for ( node = m_children.GetFirst(); node; node = node->GetNext() ) for ( node = m_children.GetFirst(); node; node = node->GetNext() )
{ {
wxWindowBase *child = node->GetData(); wxWindowBase *child = node->GetData();
@@ -1184,7 +1183,7 @@ bool wxWindowBase::TransferDataToWindow()
#if wxUSE_VALIDATORS #if wxUSE_VALIDATORS
bool recurse = (GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY) != 0; bool recurse = (GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY) != 0;
wxWindowList::Node *node; wxWindowList::compatibility_iterator node;
for ( node = m_children.GetFirst(); node; node = node->GetNext() ) for ( node = m_children.GetFirst(); node; node = node->GetNext() )
{ {
wxWindowBase *child = node->GetData(); wxWindowBase *child = node->GetData();
@@ -1218,7 +1217,7 @@ bool wxWindowBase::TransferDataFromWindow()
#if wxUSE_VALIDATORS #if wxUSE_VALIDATORS
bool recurse = (GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY) != 0; bool recurse = (GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY) != 0;
wxWindowList::Node *node; wxWindowList::compatibility_iterator node;
for ( node = m_children.GetFirst(); node; node = node->GetNext() ) for ( node = m_children.GetFirst(); node; node = node->GetNext() )
{ {
wxWindow *child = node->GetData(); wxWindow *child = node->GetData();
@@ -1409,15 +1408,15 @@ void wxWindowBase::AddConstraintReference(wxWindowBase *otherWin)
{ {
if ( !m_constraintsInvolvedIn ) if ( !m_constraintsInvolvedIn )
m_constraintsInvolvedIn = new wxWindowList; m_constraintsInvolvedIn = new wxWindowList;
if ( !m_constraintsInvolvedIn->Find(otherWin) ) if ( !m_constraintsInvolvedIn->Find((wxWindow *)otherWin) )
m_constraintsInvolvedIn->Append(otherWin); m_constraintsInvolvedIn->Append((wxWindow *)otherWin);
} }
// REMOVE back-pointer to other windows we're involved with. // REMOVE back-pointer to other windows we're involved with.
void wxWindowBase::RemoveConstraintReference(wxWindowBase *otherWin) void wxWindowBase::RemoveConstraintReference(wxWindowBase *otherWin)
{ {
if ( m_constraintsInvolvedIn ) if ( m_constraintsInvolvedIn )
m_constraintsInvolvedIn->DeleteObject(otherWin); m_constraintsInvolvedIn->DeleteObject((wxWindow *)otherWin);
} }
// Reset any constraints that mention this window // Reset any constraints that mention this window
@@ -1425,7 +1424,7 @@ void wxWindowBase::DeleteRelatedConstraints()
{ {
if ( m_constraintsInvolvedIn ) if ( m_constraintsInvolvedIn )
{ {
wxWindowList::Node *node = m_constraintsInvolvedIn->GetFirst(); wxWindowList::compatibility_iterator node = m_constraintsInvolvedIn->GetFirst();
while (node) while (node)
{ {
wxWindow *win = node->GetData(); wxWindow *win = node->GetData();
@@ -1444,8 +1443,8 @@ void wxWindowBase::DeleteRelatedConstraints()
constr->centreY.ResetIfWin(this); constr->centreY.ResetIfWin(this);
} }
wxWindowList::Node *next = node->GetNext(); wxWindowList::compatibility_iterator next = node->GetNext();
delete node; m_constraintsInvolvedIn->Erase(node);
node = next; node = next;
} }
@@ -1559,7 +1558,7 @@ bool wxWindowBase::DoPhase(int phase)
int noChanges = 0; int noChanges = 0;
// loop over all children setting their constraints // loop over all children setting their constraints
for ( wxWindowList::Node *node = GetChildren().GetFirst(); for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
node; node;
node = node->GetNext() ) node = node->GetNext() )
{ {
@@ -1612,7 +1611,7 @@ void wxWindowBase::ResetConstraints()
constr->centreY.SetDone(FALSE); constr->centreY.SetDone(FALSE);
} }
wxWindowList::Node *node = GetChildren().GetFirst(); wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
while (node) while (node)
{ {
wxWindow *win = node->GetData(); wxWindow *win = node->GetData();
@@ -1654,7 +1653,7 @@ void wxWindowBase::SetConstraintSizes(bool recurse)
if ( recurse ) if ( recurse )
{ {
wxWindowList::Node *node = GetChildren().GetFirst(); wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
while (node) while (node)
{ {
wxWindow *win = node->GetData(); wxWindow *win = node->GetData();
@@ -1782,7 +1781,7 @@ void wxWindowBase::UpdateWindowUI(long flags)
if (flags & wxUPDATE_UI_RECURSE) if (flags & wxUPDATE_UI_RECURSE)
{ {
wxWindowList::Node* node = GetChildren().GetFirst(); wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
while (node) while (node)
{ {
wxWindow* child = (wxWindow*) node->GetData(); wxWindow* child = (wxWindow*) node->GetData();
@@ -1836,7 +1835,7 @@ void wxWindowBase::ProcessInternalIdle()
{ {
OnInternalIdle(); OnInternalIdle();
wxWindowList::Node *node = GetChildren().GetFirst(); wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
while (node) while (node)
{ {
wxWindow *child = node->GetData(); wxWindow *child = node->GetData();
@@ -1882,7 +1881,7 @@ wxPoint wxWindowBase::ConvertDialogToPixels(const wxPoint& pt)
// propagate the colour change event to the subwindows // propagate the colour change event to the subwindows
void wxWindowBase::OnSysColourChanged(wxSysColourChangedEvent& event) void wxWindowBase::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
@@ -2004,6 +2003,7 @@ wxAccessible* wxWindowBase::CreateAccessible()
#endif #endif
#if !wxUSE_STL
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// list classes implementation // list classes implementation
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -2012,6 +2012,7 @@ void wxWindowListNode::DeleteData()
{ {
delete (wxWindow *)GetData(); delete (wxWindow *)GetData();
} }
#endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// borders // borders
@@ -2271,7 +2272,7 @@ wxAccStatus wxWindowAccessible::Navigate(wxNavDir navDir, int fromId,
case wxNAVDIR_DOWN: case wxNAVDIR_DOWN:
case wxNAVDIR_NEXT: case wxNAVDIR_NEXT:
{ {
wxWindowList::Node *node = NULL; wxWindowList::compatibility_iterator node = NULL;
if (fromId == 0) if (fromId == 0)
{ {
// Can't navigate to sibling of this window // Can't navigate to sibling of this window
@@ -2284,7 +2285,7 @@ wxAccStatus wxWindowAccessible::Navigate(wxNavDir navDir, int fromId,
else else
{ {
if (fromId <= (int) GetWindow()->GetChildren().GetCount()) if (fromId <= (int) GetWindow()->GetChildren().GetCount())
node = (wxWindowList::Node*) GetWindow()->GetChildren().Nth(fromId-1); node = GetWindow()->GetChildren().Nth(fromId-1);
} }
if (node && node->GetNext()) if (node && node->GetNext())
@@ -2300,7 +2301,7 @@ wxAccStatus wxWindowAccessible::Navigate(wxNavDir navDir, int fromId,
case wxNAVDIR_UP: case wxNAVDIR_UP:
case wxNAVDIR_PREVIOUS: case wxNAVDIR_PREVIOUS:
{ {
wxWindowList::Node *node = NULL; wxWindowList::compatibility_iterator node = NULL;
if (fromId == 0) if (fromId == 0)
{ {
// Can't navigate to sibling of this window // Can't navigate to sibling of this window
@@ -2313,7 +2314,7 @@ wxAccStatus wxWindowAccessible::Navigate(wxNavDir navDir, int fromId,
else else
{ {
if (fromId <= (int) GetWindow()->GetChildren().GetCount()) if (fromId <= (int) GetWindow()->GetChildren().GetCount())
node = (wxWindowList::Node*) GetWindow()->GetChildren().Nth(fromId-1); node = GetWindow()->GetChildren().Nth(fromId-1);
} }
if (node && node->GetPrevious()) if (node && node->GetPrevious())

View File

@@ -55,16 +55,19 @@ class wxAccelRefData : public wxObjectRefData
public: public:
wxAccelRefData() wxAccelRefData()
{ {
m_accels.DeleteContents(TRUE);
} }
wxAccelRefData(const wxAccelRefData& data) wxAccelRefData(const wxAccelRefData& data)
: wxObjectRefData() : wxObjectRefData()
{ {
m_accels.DeleteContents(TRUE);
m_accels = data.m_accels; m_accels = data.m_accels;
} }
virtual ~wxAccelRefData()
{
WX_CLEAR_LIST(wxAccelList, m_accels);
}
wxAccelList m_accels; wxAccelList m_accels;
}; };
@@ -133,14 +136,15 @@ void wxAcceleratorTable::Remove(const wxAcceleratorEntry& entry)
{ {
AllocExclusive(); AllocExclusive();
wxAccelList::Node *node = M_ACCELDATA->m_accels.GetFirst(); wxAccelList::compatibility_iterator node = M_ACCELDATA->m_accels.GetFirst();
while ( node ) while ( node )
{ {
const wxAcceleratorEntry *entryCur = node->GetData(); const wxAcceleratorEntry *entryCur = node->GetData();
if ( *entryCur == entry ) if ( *entryCur == entry )
{ {
M_ACCELDATA->m_accels.DeleteNode(node); delete node->GetData();
M_ACCELDATA->m_accels.Erase(node);
return; return;
} }
@@ -164,7 +168,7 @@ wxAcceleratorTable::GetEntry(const wxKeyEvent& event) const
return NULL; return NULL;
} }
wxAccelList::Node *node = M_ACCELDATA->m_accels.GetFirst(); wxAccelList::compatibility_iterator node = M_ACCELDATA->m_accels.GetFirst();
while ( node ) while ( node )
{ {
const wxAcceleratorEntry *entry = node->GetData(); const wxAcceleratorEntry *entry = node->GetData();

View File

@@ -1564,7 +1564,7 @@ void wxPostScriptDC::DoDrawSpline( wxList *points )
double a, b, c, d, x1, y1, x2, y2, x3, y3; double a, b, c, d, x1, y1, x2, y2, x3, y3;
wxPoint *p, *q; wxPoint *p, *q;
wxNode *node = points->GetFirst(); wxList::compatibility_iterator node = points->GetFirst();
p = (wxPoint *)node->GetData(); p = (wxPoint *)node->GetData();
x1 = p->x; x1 = p->x;
y1 = p->y; y1 = p->y;
@@ -1586,7 +1586,7 @@ void wxPostScriptDC::DoDrawSpline( wxList *points )
CalcBoundingBox( (wxCoord)x1, (wxCoord)y1 ); CalcBoundingBox( (wxCoord)x1, (wxCoord)y1 );
CalcBoundingBox( (wxCoord)x3, (wxCoord)y3 ); CalcBoundingBox( (wxCoord)x3, (wxCoord)y3 );
while ((node = node->GetNext()) != NULL) while ((node = node->GetNext()))
{ {
q = (wxPoint *)node->GetData(); q = (wxPoint *)node->GetData();

View 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, // Function which is called by quick sort. We want to override the default wxArrayString behaviour,
// and sort regardless of case. // 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); return strFirst->CmpNoCase(*strSecond);
} }
@@ -725,7 +722,7 @@ void wxGenericDirCtrl::ExpandDir(wxTreeItemId parentId)
while (d.GetNext(& eachFilename)); while (d.GetNext(& eachFilename));
} }
} }
dirs.Sort((wxArrayString::CompareFunction) wxDirCtrlStringCompareFunction); dirs.Sort(wxDirCtrlStringCompareFunction);
// Now do the filenames -- but only if we're allowed to // Now do the filenames -- but only if we're allowed to
if ((GetWindowStyle() & wxDIRCTRL_DIR_ONLY) == 0) if ((GetWindowStyle() & wxDIRCTRL_DIR_ONLY) == 0)
@@ -748,7 +745,7 @@ void wxGenericDirCtrl::ExpandDir(wxTreeItemId parentId)
while (d.GetNext(& eachFilename)); while (d.GetNext(& eachFilename));
} }
} }
filenames.Sort((wxArrayString::CompareFunction) wxDirCtrlStringCompareFunction); filenames.Sort(wxDirCtrlStringCompareFunction);
} }
// Add the sorted dirs // Add the sorted dirs
@@ -1369,7 +1366,11 @@ wxFileIconsTable::wxFileIconsTable()
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; if (m_smallImageList) delete m_smallImageList;
} }
@@ -1380,7 +1381,6 @@ void wxFileIconsTable::Create()
m_HashTable = new wxHashTable(wxKEY_STRING); m_HashTable = new wxHashTable(wxKEY_STRING);
m_smallImageList = new wxImageList(16, 16); m_smallImageList = new wxImageList(16, 16);
m_HashTable->DeleteContents(TRUE);
// folder: // folder:
m_smallImageList->Add(wxArtProvider::GetBitmap(wxART_FOLDER, wxART_CMN_DIALOG)); m_smallImageList->Add(wxArtProvider::GetBitmap(wxART_FOLDER, wxART_CMN_DIALOG));
// folder_open // folder_open
@@ -1401,6 +1401,7 @@ void wxFileIconsTable::Create()
if (GetIconID(wxEmptyString, _T("application/x-executable")) == file) if (GetIconID(wxEmptyString, _T("application/x-executable")) == file)
{ {
m_smallImageList->Add(wxArtProvider::GetBitmap(wxART_EXECUTABLE_FILE, wxART_CMN_DIALOG)); m_smallImageList->Add(wxArtProvider::GetBitmap(wxART_EXECUTABLE_FILE, wxART_CMN_DIALOG));
delete m_HashTable->Get(_T("exe"));
m_HashTable->Delete(_T("exe")); m_HashTable->Delete(_T("exe"));
m_HashTable->Put(_T("exe"), new wxFileIconEntry(executable)); m_HashTable->Put(_T("exe"), new wxFileIconEntry(executable));
} }

View File

@@ -62,7 +62,6 @@ bool wxGenericImageList::Create( int width, int height, bool WXUNUSED(mask), int
bool wxGenericImageList::Create() bool wxGenericImageList::Create()
{ {
m_images.DeleteContents( TRUE );
return TRUE; return TRUE;
} }
@@ -92,7 +91,7 @@ int wxGenericImageList::Add( const wxBitmap& bitmap, const wxColour& maskColour
const wxBitmap *wxGenericImageList::GetBitmap( int index ) const 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") ); 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 ) 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") ); 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) if (index == (int) m_images.GetCount() - 1)
{ {
m_images.DeleteNode( node ); delete node->GetData();
m_images.Erase( node );
m_images.Append( newBitmap ); m_images.Append( newBitmap );
} }
else else
{ {
wxNode *next = node->GetNext(); wxList::compatibility_iterator next = node->GetNext();
m_images.DeleteNode( node ); delete node->GetData();
m_images.Erase( node );
m_images.Insert( next, newBitmap ); m_images.Insert( next, newBitmap );
} }
@@ -134,17 +135,19 @@ bool wxGenericImageList::Replace( int index, const wxBitmap &bitmap )
bool wxGenericImageList::Remove( int index ) 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") ); wxCHECK_MSG( node, FALSE, wxT("wrong index in image list") );
m_images.DeleteNode( node ); delete node->GetData();
m_images.Erase( node );
return TRUE; return TRUE;
} }
bool wxGenericImageList::RemoveAll() bool wxGenericImageList::RemoveAll()
{ {
WX_CLEAR_LIST(wxList, m_images);
m_images.Clear(); m_images.Clear();
return TRUE; return TRUE;
@@ -155,7 +158,7 @@ bool wxGenericImageList::GetSize( int index, int &width, int &height ) const
width = 0; width = 0;
height = 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") ); 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, bool wxGenericImageList::Draw( int index, wxDC &dc, int x, int y,
int flags, bool WXUNUSED(solidBackground) ) 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") ); wxCHECK_MSG( node, FALSE, wxT("wrong index in image list") );

View File

@@ -195,7 +195,7 @@ bool wxLayoutAlgorithm::LayoutMDIFrame(wxMDIParentFrame* frame, wxRect* r)
wxCalculateLayoutEvent event; wxCalculateLayoutEvent event;
event.SetRect(rect); event.SetRect(rect);
wxWindowList::Node *node = frame->GetChildren().GetFirst(); wxWindowList::compatibility_iterator node = frame->GetChildren().GetFirst();
while (node) while (node)
{ {
wxWindow* win = node->GetData(); 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 // Find the last layout-aware window, so we can make it fill all remaining
// space. // space.
wxWindow *lastAwareWindow = NULL; wxWindow *lastAwareWindow = NULL;
wxWindowList::Node *node = parent->GetChildren().GetFirst(); wxWindowList::compatibility_iterator node = parent->GetChildren().GetFirst();
while (node) while (node)
{ {

View File

@@ -289,7 +289,11 @@ public:
public: public:
wxListLineData(wxListMainWindow *owner); wxListLineData(wxListMainWindow *owner);
~wxListLineData() { delete m_gi; } ~wxListLineData()
{
WX_CLEAR_LIST(wxListItemDataList, m_items);
delete m_gi;
}
// are we in report mode? // are we in report mode?
inline bool InReportView() const; inline bool InReportView() const;
@@ -1090,7 +1094,6 @@ inline bool wxListLineData::IsVirtual() const
wxListLineData::wxListLineData( wxListMainWindow *owner ) wxListLineData::wxListLineData( wxListMainWindow *owner )
{ {
m_owner = owner; m_owner = owner;
m_items.DeleteContents( TRUE );
if ( InReportView() ) if ( InReportView() )
{ {
@@ -1108,7 +1111,7 @@ wxListLineData::wxListLineData( wxListMainWindow *owner )
void wxListLineData::CalculateSize( wxDC *dc, int spacing ) 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??") ); wxCHECK_RET( node, _T("no subitems at all??") );
wxListItemData *item = node->GetData(); wxListItemData *item = node->GetData();
@@ -1218,7 +1221,7 @@ void wxListLineData::SetPosition( int x, int y,
int window_width, int window_width,
int spacing ) int spacing )
{ {
wxListItemDataList::Node *node = m_items.GetFirst(); wxListItemDataList::compatibility_iterator node = m_items.GetFirst();
wxCHECK_RET( node, _T("no subitems at all??") ); wxCHECK_RET( node, _T("no subitems at all??") );
wxListItemData *item = node->GetData(); wxListItemData *item = node->GetData();
@@ -1291,7 +1294,7 @@ void wxListLineData::InitItems( int num )
void wxListLineData::SetItem( int index, const wxListItem &info ) 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") ); wxCHECK_RET( node, _T("invalid column index in SetItem") );
wxListItemData *item = node->GetData(); wxListItemData *item = node->GetData();
@@ -1300,7 +1303,7 @@ void wxListLineData::SetItem( int index, const wxListItem &info )
void wxListLineData::GetItem( int index, 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) if (node)
{ {
wxListItemData *item = node->GetData(); wxListItemData *item = node->GetData();
@@ -1312,7 +1315,7 @@ wxString wxListLineData::GetText(int index) const
{ {
wxString s; wxString s;
wxListItemDataList::Node *node = m_items.Item( index ); wxListItemDataList::compatibility_iterator node = m_items.Item( index );
if (node) if (node)
{ {
wxListItemData *item = node->GetData(); wxListItemData *item = node->GetData();
@@ -1324,7 +1327,7 @@ wxString wxListLineData::GetText(int index) const
void wxListLineData::SetText( int index, const wxString s ) 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) if (node)
{ {
wxListItemData *item = node->GetData(); wxListItemData *item = node->GetData();
@@ -1334,7 +1337,7 @@ void wxListLineData::SetText( int index, const wxString s )
void wxListLineData::SetImage( int index, int image ) 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()") ); wxCHECK_RET( node, _T("invalid column index in SetImage()") );
wxListItemData *item = node->GetData(); wxListItemData *item = node->GetData();
@@ -1343,7 +1346,7 @@ void wxListLineData::SetImage( int index, int image )
int wxListLineData::GetImage( int index ) const 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()") ); wxCHECK_MSG( node, -1, _T("invalid column index in GetImage()") );
wxListItemData *item = node->GetData(); wxListItemData *item = node->GetData();
@@ -1352,7 +1355,7 @@ int wxListLineData::GetImage( int index ) const
wxListItemAttr *wxListLineData::GetAttr() 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()") ); wxCHECK_MSG( node, NULL, _T("invalid column index in GetAttr()") );
wxListItemData *item = node->GetData(); wxListItemData *item = node->GetData();
@@ -1361,7 +1364,7 @@ wxListItemAttr *wxListLineData::GetAttr() const
void wxListLineData::SetAttr(wxListItemAttr *attr) 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()") ); wxCHECK_RET( node, _T("invalid column index in SetAttr()") );
wxListItemData *item = node->GetData(); wxListItemData *item = node->GetData();
@@ -1434,7 +1437,7 @@ bool wxListLineData::SetAttributes(wxDC *dc,
void wxListLineData::Draw( 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??") ); wxCHECK_RET( node, _T("no subitems at all??") );
bool highlighted = IsHighlighted(); bool highlighted = IsHighlighted();
@@ -1481,7 +1484,7 @@ void wxListLineData::DrawInReportMode( wxDC *dc,
y = rect.y + (LINE_SPACING + EXTRA_HEIGHT) / 2; y = rect.y + (LINE_SPACING + EXTRA_HEIGHT) / 2;
size_t col = 0; size_t col = 0;
for ( wxListItemDataList::Node *node = m_items.GetFirst(); for ( wxListItemDataList::compatibility_iterator node = m_items.GetFirst();
node; node;
node = node->GetNext(), col++ ) node = node->GetNext(), col++ )
{ {
@@ -2169,7 +2172,6 @@ END_EVENT_TABLE()
void wxListMainWindow::Init() void wxListMainWindow::Init()
{ {
m_columns.DeleteContents( TRUE );
m_dirty = TRUE; m_dirty = TRUE;
m_countVirt = 0; m_countVirt = 0;
m_lineFrom = m_lineFrom =
@@ -2265,6 +2267,7 @@ wxListMainWindow::wxListMainWindow( wxWindow *parent,
wxListMainWindow::~wxListMainWindow() wxListMainWindow::~wxListMainWindow()
{ {
DoDeleteAllItems(); DoDeleteAllItems();
WX_CLEAR_LIST(wxListHeaderDataList, m_columns);
delete m_highlightBrush; delete m_highlightBrush;
delete m_highlightUnfocusedBrush; delete m_highlightUnfocusedBrush;
@@ -3506,7 +3509,7 @@ int wxListMainWindow::GetItemSpacing( bool isSmall )
void wxListMainWindow::SetColumn( int col, wxListItem &item ) 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") ); wxCHECK_RET( node, _T("invalid column index in SetColumn") );
@@ -3539,7 +3542,7 @@ void wxListMainWindow::SetColumnWidth( int col, int width )
if ( headerWin ) if ( headerWin )
headerWin->m_dirty = TRUE; 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?") ); wxCHECK_RET( node, _T("no column?") );
wxListHeaderData *column = node->GetData(); wxListHeaderData *column = node->GetData();
@@ -3567,7 +3570,7 @@ void wxListMainWindow::SetColumnWidth( int col, int width )
for ( size_t i = 0; i < count; i++ ) for ( size_t i = 0; i < count; i++ )
{ {
wxListLineData *line = GetLine(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?") ); wxCHECK_RET( n, _T("no subitem?") );
@@ -3620,7 +3623,7 @@ int wxListMainWindow::GetHeaderWidth() const
void wxListMainWindow::GetColumn( int col, wxListItem &item ) 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") ); wxCHECK_RET( node, _T("invalid column index in GetColumn") );
wxListHeaderData *column = node->GetData(); wxListHeaderData *column = node->GetData();
@@ -3629,7 +3632,7 @@ void wxListMainWindow::GetColumn( int col, wxListItem &item ) const
int wxListMainWindow::GetColumnWidth( int col ) 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") ); wxCHECK_MSG( node, 0, _T("invalid column index") );
wxListHeaderData *column = node->GetData(); wxListHeaderData *column = node->GetData();
@@ -4106,12 +4109,13 @@ void wxListMainWindow::DeleteItem( long lindex )
void wxListMainWindow::DeleteColumn( int col ) 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()") ); wxCHECK_RET( node, wxT("invalid column index in DeleteColumn()") );
m_dirty = TRUE; m_dirty = TRUE;
m_columns.DeleteNode( node ); delete node->GetData();
m_columns.Erase( node );
if ( !IsVirtual() ) if ( !IsVirtual() )
{ {
@@ -4119,8 +4123,9 @@ void wxListMainWindow::DeleteColumn( int col )
for ( size_t i = 0; i < m_lines.GetCount(); i++ ) for ( size_t i = 0; i < m_lines.GetCount(); i++ )
{ {
wxListLineData * const line = GetLine(i); wxListLineData * const line = GetLine(i);
wxListItemDataList::Node *n = line->m_items.Item( col ); wxListItemDataList::compatibility_iterator n = line->m_items.Item( col );
line->m_items.DeleteNode(n); delete n->GetData();
line->m_items.Erase(n);
} }
} }
@@ -4171,7 +4176,7 @@ void wxListMainWindow::DeleteAllItems()
void wxListMainWindow::DeleteEverything() void wxListMainWindow::DeleteEverything()
{ {
m_columns.Clear(); WX_CLEAR_LIST(wxListHeaderDataList, m_columns);
DeleteAllItems(); DeleteAllItems();
} }
@@ -4321,7 +4326,7 @@ void wxListMainWindow::InsertColumn( long col, wxListItem &item )
bool insert = (col >= 0) && ((size_t)col < m_columns.GetCount()); bool insert = (col >= 0) && ((size_t)col < m_columns.GetCount());
if ( insert ) if ( insert )
{ {
wxListHeaderDataList::Node *node = m_columns.Item( col ); wxListHeaderDataList::compatibility_iterator node = m_columns.Item( col );
m_columns.Insert( node, column ); m_columns.Insert( node, column );
} }
else else

View File

@@ -503,7 +503,7 @@ bool wxGenericPrintSetupDialog::TransferDataFromWindow()
int selectedItem = m_paperTypeChoice->GetSelection(); int selectedItem = m_paperTypeChoice->GetSelection();
if (selectedItem != -1) if (selectedItem != -1)
{ {
wxPrintPaperType *paper = (wxPrintPaperType*)wxThePrintPaperDatabase->Item(selectedItem)->GetData(); wxPrintPaperType *paper = wxThePrintPaperDatabase->Item(selectedItem);
if (paper != NULL) if (paper != NULL)
m_printData.SetPaperId( paper->GetId()); m_printData.SetPaperId( paper->GetId());
} }
@@ -527,7 +527,7 @@ wxComboBox *wxGenericPrintSetupDialog::CreatePaperTypeChoice(int *x, int *y)
for (size_t i = 0; i < n; i++) for (size_t i = 0; i < n; i++)
{ {
wxPrintPaperType *paper = (wxPrintPaperType *)wxThePrintPaperDatabase->Item(i)->GetData(); wxPrintPaperType *paper = wxThePrintPaperDatabase->Item(i);
choices[i] = paper->GetName(); choices[i] = paper->GetName();
if (m_printData.GetPaperId() == paper->GetId()) if (m_printData.GetPaperId() == paper->GetId())
sel = i; sel = i;
@@ -611,7 +611,7 @@ wxGenericPageSetupDialog::wxGenericPageSetupDialog( wxWindow *parent,
for (size_t i = 0; i < n; i++) for (size_t i = 0; i < n; i++)
{ {
wxPrintPaperType *paper = (wxPrintPaperType *)wxThePrintPaperDatabase->Item(i)->GetData(); wxPrintPaperType *paper = wxThePrintPaperDatabase->Item(i);
choices[i] = paper->GetName(); choices[i] = paper->GetName();
} }
@@ -774,7 +774,7 @@ bool wxGenericPageSetupDialog::TransferDataFromWindow()
int selectedItem = m_paperTypeChoice->GetSelection(); int selectedItem = m_paperTypeChoice->GetSelection();
if (selectedItem != -1) if (selectedItem != -1)
{ {
wxPrintPaperType *paper = (wxPrintPaperType*)wxThePrintPaperDatabase->Item(selectedItem)->GetData(); wxPrintPaperType *paper = wxThePrintPaperDatabase->Item(selectedItem);
if ( paper ) if ( paper )
{ {
m_pageData.SetPaperSize(wxSize(paper->GetWidth()/10, paper->GetHeight()/10)); 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++) for (size_t i = 0; i < n; i++)
{ {
wxPrintPaperType *paper = (wxPrintPaperType *)wxThePrintPaperDatabase->Item(i)->GetData(); wxPrintPaperType *paper = wxThePrintPaperDatabase->Item(i);
choices[i] = paper->GetName(); choices[i] = paper->GetName();
} }

View File

@@ -276,7 +276,7 @@ bool wxToolBarSimple::Realize()
int maxToolHeight = 0; int maxToolHeight = 0;
// Find the maximum tool width and height // Find the maximum tool width and height
wxToolBarToolsList::Node *node = m_tools.GetFirst(); wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
while ( node ) while ( node )
{ {
wxToolBarToolSimple *tool = (wxToolBarToolSimple *)node->GetData(); wxToolBarToolSimple *tool = (wxToolBarToolSimple *)node->GetData();
@@ -382,7 +382,7 @@ void wxToolBarSimple::OnPaint (wxPaintEvent& WXUNUSED(event))
return; return;
count++; count++;
for ( wxToolBarToolsList::Node *node = m_tools.GetFirst(); for ( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
node; node;
node = node->GetNext() ) node = node->GetNext() )
{ {
@@ -651,7 +651,7 @@ void wxToolBarSimple::SetRows(int nRows)
wxToolBarToolBase *wxToolBarSimple::FindToolForPosition(wxCoord x, wxToolBarToolBase *wxToolBarSimple::FindToolForPosition(wxCoord x,
wxCoord y) const wxCoord y) const
{ {
wxToolBarToolsList::Node *node = m_tools.GetFirst(); wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
while (node) while (node)
{ {
wxToolBarToolSimple *tool = (wxToolBarToolSimple *)node->GetData(); wxToolBarToolSimple *tool = (wxToolBarToolSimple *)node->GetData();

View File

@@ -156,7 +156,7 @@ void wxChoice::DoSetItemClientData( int n, void* clientData )
{ {
wxCHECK_RET( m_widget != NULL, wxT("invalid choice control") ); 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") ); wxCHECK_RET( node, wxT("invalid index in wxChoice::DoSetItemClientData") );
node->SetData( (wxObject*) clientData ); node->SetData( (wxObject*) clientData );
@@ -166,7 +166,7 @@ void* wxChoice::DoGetItemClientData( int n ) const
{ {
wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid choice control") ); 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") ); wxCHECK_MSG( node, NULL, wxT("invalid index in wxChoice::DoGetItemClientData") );
return node->GetData(); return node->GetData();
@@ -176,7 +176,7 @@ void wxChoice::DoSetItemClientObject( int n, wxClientData* clientData )
{ {
wxCHECK_RET( m_widget != NULL, wxT("invalid choice control") ); 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") ); wxCHECK_RET( node, wxT("invalid index in wxChoice::DoSetItemClientObject") );
// wxItemContainer already deletes data for us // 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") ); 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, wxCHECK_MSG( node, (wxClientData *)NULL,
wxT("invalid index in wxChoice::DoGetItemClientObject") ); 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> // destroy the data (due to Robert's idea of using wxList<wxObject>
// and not wxList<wxClientData> we can't just say // and not wxList<wxClientData> we can't just say
// m_clientList.DeleteContents(TRUE) - this would crash! // m_clientList.DeleteContents(TRUE) - this would crash!
wxNode *node = m_clientList.GetFirst(); wxList::compatibility_iterator node = m_clientList.GetFirst();
while ( node ) while ( node )
{ {
delete (wxClientData *)node->GetData(); delete (wxClientData *)node->GetData();

View File

@@ -156,12 +156,13 @@ wxColour::wxColour( unsigned char red, unsigned char green, unsigned char blue )
M_COLDATA->m_color.pixel = 0; M_COLDATA->m_color.pixel = 0;
} }
void wxColour::InitFromName( const wxString &colourName ) void wxColour::InitFromName( const wxString &colourName )
{ {
wxNode *node = (wxNode *) NULL; wxColour* col = NULL;
if ( (wxTheColourDatabase) && (node = wxTheColourDatabase->Find(colourName)) ) if ( (wxTheColourDatabase) && (col = wxTheColourDatabase->FindColourNoAdd(colourName)) )
{ {
wxColour *col = (wxColour*)node->GetData();
UnRef(); UnRef();
if (col) Ref( *col ); if (col) Ref( *col );
} }

View File

@@ -197,7 +197,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
wxComboBox::~wxComboBox() wxComboBox::~wxComboBox()
{ {
wxNode *node = m_clientObjectList.GetFirst(); wxList::compatibility_iterator node = m_clientObjectList.GetFirst();
while (node) while (node)
{ {
wxClientData *cd = (wxClientData*)node->GetData(); wxClientData *cd = (wxClientData*)node->GetData();
@@ -360,7 +360,7 @@ void wxComboBox::SetClientData( int n, void* clientData )
{ {
wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") ); 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; if (!node) return;
node->SetData( (wxObject*) clientData ); node->SetData( (wxObject*) clientData );
@@ -370,7 +370,7 @@ void* wxComboBox::GetClientData( int n ) const
{ {
wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid combobox") ); 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; return node ? node->GetData() : NULL;
} }
@@ -379,7 +379,7 @@ void wxComboBox::SetClientObject( int n, wxClientData* clientData )
{ {
wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") ); 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; if (!node) return;
wxClientData *cd = (wxClientData*) node->GetData(); 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") ); 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; return node ? (wxClientData*) node->GetData() : NULL;
} }
@@ -406,7 +406,7 @@ void wxComboBox::Clear()
GtkWidget *list = GTK_COMBO(m_widget)->list; GtkWidget *list = GTK_COMBO(m_widget)->list;
gtk_list_clear_items( GTK_LIST(list), 0, Number() ); gtk_list_clear_items( GTK_LIST(list), 0, Number() );
wxNode *node = m_clientObjectList.GetFirst(); wxList::compatibility_iterator node = m_clientObjectList.GetFirst();
while (node) while (node)
{ {
wxClientData *cd = (wxClientData*)node->GetData(); wxClientData *cd = (wxClientData*)node->GetData();
@@ -440,17 +440,17 @@ void wxComboBox::Delete( int n )
gtk_list_remove_items( listbox, list ); gtk_list_remove_items( listbox, list );
g_list_free( list ); g_list_free( list );
wxNode *node = m_clientObjectList.Item( n ); wxList::compatibility_iterator node = m_clientObjectList.Item( n );
if (node) if (node)
{ {
wxClientData *cd = (wxClientData*)node->GetData(); wxClientData *cd = (wxClientData*)node->GetData();
if (cd) delete cd; if (cd) delete cd;
m_clientObjectList.DeleteNode( node ); m_clientObjectList.Erase( node );
} }
node = m_clientDataList.Item( n ); node = m_clientDataList.Item( n );
if (node) if (node)
m_clientDataList.DeleteNode( node ); m_clientDataList.Erase( node );
EnableEvents(); EnableEvents();
} }

View File

@@ -448,7 +448,7 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
if (index != GetCount()) if (index != GetCount())
{ {
GtkAddItem( items[n], index ); GtkAddItem( items[n], index );
wxNode *node = m_clientList.Item( index ); wxList::compatibility_iterator node = m_clientList.Item( index );
m_clientList.Insert( node, (wxObject*) NULL ); m_clientList.Insert( node, (wxObject*) NULL );
} }
else else
@@ -471,7 +471,7 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
} }
else else
{ {
wxNode *node = m_clientList.Item( pos ); wxList::compatibility_iterator node = m_clientList.Item( pos );
for ( size_t n = 0; n < nItems; n++ ) for ( size_t n = 0; n < nItems; n++ )
{ {
GtkAddItem( items[n], pos+n ); GtkAddItem( items[n], pos+n );
@@ -497,7 +497,7 @@ int wxListBox::DoAppend( const wxString& item )
{ {
GtkAddItem( item, index ); GtkAddItem( item, index );
wxNode *node = m_clientList.Item( index ); wxList::compatibility_iterator node = m_clientList.Item( index );
m_clientList.Insert( node, (wxObject *)NULL ); m_clientList.Insert( node, (wxObject *)NULL );
return index; return index;
@@ -619,7 +619,7 @@ void wxListBox::Clear()
// destroy the data (due to Robert's idea of using wxList<wxObject> // destroy the data (due to Robert's idea of using wxList<wxObject>
// and not wxList<wxClientData> we can't just say // and not wxList<wxClientData> we can't just say
// m_clientList.DeleteContents(TRUE) - this would crash! // m_clientList.DeleteContents(TRUE) - this would crash!
wxNode *node = m_clientList.GetFirst(); wxList::compatibility_iterator node = m_clientList.GetFirst();
while ( node ) while ( node )
{ {
delete (wxClientData *)node->GetData(); delete (wxClientData *)node->GetData();
@@ -644,7 +644,7 @@ void wxListBox::Delete( int n )
gtk_list_remove_items( m_list, list ); gtk_list_remove_items( m_list, list );
g_list_free( list ); g_list_free( list );
wxNode *node = m_clientList.Item( n ); wxList::compatibility_iterator node = m_clientList.Item( n );
if ( node ) if ( node )
{ {
if ( m_clientDataItemsType == wxClientData_Object ) if ( m_clientDataItemsType == wxClientData_Object )
@@ -653,7 +653,7 @@ void wxListBox::Delete( int n )
delete cd; delete cd;
} }
m_clientList.DeleteNode( node ); m_clientList.Erase( node );
} }
if ( m_strings ) if ( m_strings )
@@ -668,7 +668,7 @@ void wxListBox::DoSetItemClientData( int n, void* clientData )
{ {
wxCHECK_RET( m_widget != NULL, wxT("invalid listbox control") ); 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") ); wxCHECK_RET( node, wxT("invalid index in wxListBox::DoSetItemClientData") );
node->SetData( (wxObject*) clientData ); node->SetData( (wxObject*) clientData );
@@ -678,7 +678,7 @@ void* wxListBox::DoGetItemClientData( int n ) const
{ {
wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid listbox control") ); 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") ); wxCHECK_MSG( node, NULL, wxT("invalid index in wxListBox::DoGetItemClientData") );
return node->GetData(); return node->GetData();
@@ -688,7 +688,7 @@ void wxListBox::DoSetItemClientObject( int n, wxClientData* clientData )
{ {
wxCHECK_RET( m_widget != NULL, wxT("invalid listbox control") ); 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") ); wxCHECK_RET( node, wxT("invalid index in wxListBox::DoSetItemClientObject") );
// wxItemContainer already deletes data for us // 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") ); 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, wxCHECK_MSG( node, (wxClientData *)NULL,
wxT("invalid index in wxListBox::DoGetItemClientObject") ); wxT("invalid index in wxListBox::DoGetItemClientObject") );

View File

@@ -75,7 +75,7 @@ gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget),
child = (wxMDIChildFrame*) NULL; child = (wxMDIChildFrame*) NULL;
wxWindowList::Node *node = client_window->GetChildren().GetFirst(); wxWindowList::compatibility_iterator node = client_window->GetChildren().GetFirst();
while (node) while (node)
{ {
wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame ); wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame );
@@ -170,7 +170,7 @@ void wxMDIParentFrame::OnInternalIdle()
wxMDIChildFrame *active_child_frame = GetActiveChild(); wxMDIChildFrame *active_child_frame = GetActiveChild();
bool visible_child_menu = false; bool visible_child_menu = false;
wxWindowList::Node *node = m_clientWindow->GetChildren().GetFirst(); wxWindowList::compatibility_iterator node = m_clientWindow->GetChildren().GetFirst();
while (node) while (node)
{ {
wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame ); 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); GtkNotebookPage* page = (GtkNotebookPage*) (g_list_nth(notebook->children,i)->data);
if (!page) return (wxMDIChildFrame*) NULL; if (!page) return (wxMDIChildFrame*) NULL;
wxWindowList::Node *node = m_clientWindow->GetChildren().GetFirst(); wxWindowList::compatibility_iterator node = m_clientWindow->GetChildren().GetFirst();
while (node) while (node)
{ {
wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame ); wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame );

View File

@@ -200,8 +200,6 @@ wxMenuBar::wxMenuBar( long style )
return; return;
} }
m_menus.DeleteContents( TRUE );
/* GTK 1.2.0 doesn't have gtk_item_factory_get_item(), but GTK 1.2.1 has. */ /* 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) #if GTK_CHECK_VERSION(1, 2, 1)
m_accel = gtk_accel_group_new(); m_accel = gtk_accel_group_new();
@@ -241,8 +239,6 @@ wxMenuBar::wxMenuBar()
return; return;
} }
m_menus.DeleteContents( TRUE );
/* GTK 1.2.0 doesn't have gtk_item_factory_get_item(), but GTK 1.2.1 has. */ /* 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) #if GTK_CHECK_VERSION(1, 2, 1)
m_accel = gtk_accel_group_new(); m_accel = gtk_accel_group_new();
@@ -275,7 +271,7 @@ static void wxMenubarUnsetInvokingWindow( wxMenu *menu, wxWindow *win )
/* support for native hot keys */ /* support for native hot keys */
gtk_accel_group_detach( menu->m_accel, ACCEL_OBJ_CAST(top_frame->m_widget) ); 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) while (node)
{ {
wxMenuItem *menuitem = node->GetData(); wxMenuItem *menuitem = node->GetData();
@@ -300,7 +296,7 @@ static void wxMenubarSetInvokingWindow( wxMenu *menu, wxWindow *win )
gtk_accel_group_attach( menu->m_accel, obj ); gtk_accel_group_attach( menu->m_accel, obj );
#endif // GTK+ 1.2.1+ #endif // GTK+ 1.2.1+
wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst(); wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
while (node) while (node)
{ {
wxMenuItem *menuitem = node->GetData(); wxMenuItem *menuitem = node->GetData();
@@ -324,7 +320,7 @@ void wxMenuBar::SetInvokingWindow( wxWindow *win )
gtk_accel_group_attach( m_accel, obj ); gtk_accel_group_attach( m_accel, obj );
#endif // GTK+ 1.2.1+ #endif // GTK+ 1.2.1+
wxMenuList::Node *node = m_menus.GetFirst(); wxMenuList::compatibility_iterator node = m_menus.GetFirst();
while (node) while (node)
{ {
wxMenu *menu = node->GetData(); 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) ); gtk_accel_group_detach( m_accel, ACCEL_OBJ_CAST(top_frame->m_widget) );
#endif // GTK+ 1.2.1+ #endif // GTK+ 1.2.1+
wxMenuList::Node *node = m_menus.GetFirst(); wxMenuList::compatibility_iterator node = m_menus.GetFirst();
while (node) while (node)
{ {
wxMenu *menu = node->GetData(); wxMenu *menu = node->GetData();
@@ -474,7 +470,7 @@ wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title)
static wxMenu *CopyMenu (wxMenu *menu) static wxMenu *CopyMenu (wxMenu *menu)
{ {
wxMenu *menucopy = new wxMenu (); wxMenu *menucopy = new wxMenu ();
wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst(); wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
while (node) while (node)
{ {
wxMenuItem *item = node->GetData(); wxMenuItem *item = node->GetData();
@@ -552,7 +548,7 @@ static int FindMenuItemRecursive( const wxMenu *menu, const wxString &menuString
return res; return res;
} }
wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst(); wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
while (node) while (node)
{ {
wxMenuItem *item = node->GetData(); 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 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) while (node)
{ {
wxMenu *menu = node->GetData(); wxMenu *menu = node->GetData();
@@ -585,7 +581,7 @@ static wxMenuItem* FindMenuItemByIdRecursive(const wxMenu* menu, int id)
{ {
wxMenuItem* result = menu->FindChildItem(id); wxMenuItem* result = menu->FindChildItem(id);
wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst(); wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
while ( node && result == NULL ) while ( node && result == NULL )
{ {
wxMenuItem *item = node->GetData(); 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* wxMenuBar::FindItem( int id, wxMenu **menuForItem ) const
{ {
wxMenuItem* result = 0; wxMenuItem* result = 0;
wxMenuList::Node *node = m_menus.GetFirst(); wxMenuList::compatibility_iterator node = m_menus.GetFirst();
while (node && result == 0) while (node && result == 0)
{ {
wxMenu *menu = node->GetData(); wxMenu *menu = node->GetData();
@@ -620,7 +616,7 @@ wxMenuItem* wxMenuBar::FindItem( int id, wxMenu **menuForItem ) const
void wxMenuBar::EnableTop( size_t pos, bool flag ) 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") ); 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 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") ); 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 ) 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") ); wxCHECK_RET( node, wxT("menu not found") );
@@ -1122,7 +1118,7 @@ void wxMenu::Init()
wxMenu::~wxMenu() wxMenu::~wxMenu()
{ {
m_items.Clear(); WX_CLEAR_LIST(wxMenuItemList, m_items);
if ( GTK_IS_WIDGET( m_menu )) if ( GTK_IS_WIDGET( m_menu ))
gtk_widget_destroy( m_menu ); gtk_widget_destroy( m_menu );
@@ -1398,7 +1394,7 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
int wxMenu::FindMenuIdByMenuItem( GtkWidget *menuItem ) const int wxMenu::FindMenuIdByMenuItem( GtkWidget *menuItem ) const
{ {
wxMenuItemList::Node *node = m_items.GetFirst(); wxMenuItemList::compatibility_iterator node = m_items.GetFirst();
while (node) while (node)
{ {
wxMenuItem *item = node->GetData(); wxMenuItem *item = node->GetData();

View File

@@ -240,7 +240,6 @@ void wxNotebook::Init()
m_inSwitchPage = FALSE; m_inSwitchPage = FALSE;
m_imageList = (wxImageList *) NULL; m_imageList = (wxImageList *) NULL;
m_pagesData.DeleteContents( TRUE );
m_selection = -1; m_selection = -1;
m_themeEnabled = TRUE; m_themeEnabled = TRUE;
} }
@@ -567,7 +566,9 @@ wxNotebookPage *wxNotebook::DoRemovePage( int page )
gtk_notebook_remove_page( GTK_NOTEBOOK(m_widget), 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; return client;
} }

View File

@@ -80,7 +80,7 @@ static gint gtk_radiobox_keypress_callback( GtkWidget *widget, GdkEventKey *gdk_
return FALSE; return FALSE;
} }
wxNode *node = rb->m_boxes.Find( (wxObject*) widget ); wxList::compatibility_iterator node = rb->m_boxes.Find( (wxObject*) widget );
if (!node) if (!node)
{ {
return FALSE; return FALSE;
@@ -260,7 +260,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
wxRadioBox::~wxRadioBox() wxRadioBox::~wxRadioBox()
{ {
wxNode *node = m_boxes.GetFirst(); wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node) while (node)
{ {
GtkWidget *button = GTK_WIDGET( node->GetData() ); GtkWidget *button = GTK_WIDGET( node->GetData() );
@@ -314,7 +314,7 @@ wxSize wxRadioBox::LayoutItems()
y = 15; y = 15;
int max_len = 0; 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++) for (int i1 = 0; i1< num_of_rows; i1++)
{ {
GtkWidget *button = GTK_WIDGET( node->GetData() ); GtkWidget *button = GTK_WIDGET( node->GetData() );
@@ -359,7 +359,7 @@ wxSize wxRadioBox::LayoutItems()
{ {
int max = 0; int max = 0;
wxNode *node = m_boxes.GetFirst(); wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node) while (node)
{ {
GtkWidget *button = GTK_WIDGET( node->GetData() ); GtkWidget *button = GTK_WIDGET( node->GetData() );
@@ -405,7 +405,7 @@ bool wxRadioBox::Show( bool show )
if ((m_windowStyle & wxNO_BORDER) != 0) if ((m_windowStyle & wxNO_BORDER) != 0)
gtk_widget_hide( m_widget ); gtk_widget_hide( m_widget );
wxNode *node = m_boxes.GetFirst(); wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node) while (node)
{ {
GtkWidget *button = GTK_WIDGET( node->GetData() ); GtkWidget *button = GTK_WIDGET( node->GetData() );
@@ -424,7 +424,7 @@ int wxRadioBox::FindString( const wxString &find ) const
int count = 0; int count = 0;
wxNode *node = m_boxes.GetFirst(); wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node) while (node)
{ {
GtkLabel *label = GTK_LABEL( BUTTON_CHILD(node->GetData()) ); GtkLabel *label = GTK_LABEL( BUTTON_CHILD(node->GetData()) );
@@ -450,7 +450,7 @@ void wxRadioBox::SetFocus()
if (m_boxes.GetCount() == 0) return; if (m_boxes.GetCount() == 0) return;
wxNode *node = m_boxes.GetFirst(); wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node) while (node)
{ {
GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->GetData() ); GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->GetData() );
@@ -467,7 +467,7 @@ void wxRadioBox::SetSelection( int n )
{ {
wxCHECK_RET( m_widget != NULL, wxT("invalid radiobox") ); 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") ); wxCHECK_RET( node, wxT("radiobox wrong index") );
@@ -486,7 +486,7 @@ int wxRadioBox::GetSelection(void) const
int count = 0; int count = 0;
wxNode *node = m_boxes.GetFirst(); wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node) while (node)
{ {
GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->GetData() ); 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") ); 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") ); 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") ); 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") ); wxCHECK_RET( node, wxT("radiobox wrong index") );
@@ -546,7 +546,7 @@ bool wxRadioBox::Enable( bool enable )
if ( !wxControl::Enable( enable ) ) if ( !wxControl::Enable( enable ) )
return FALSE; return FALSE;
wxNode *node = m_boxes.GetFirst(); wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node) while (node)
{ {
GtkButton *button = GTK_BUTTON( node->GetData() ); 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") ); 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") ); 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") ); 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") ); wxCHECK_RET( node, wxT("radiobox wrong index") );
@@ -595,7 +595,7 @@ wxString wxRadioBox::GetStringSelection() const
{ {
wxCHECK_MSG( m_widget != NULL, wxT(""), wxT("invalid radiobox") ); wxCHECK_MSG( m_widget != NULL, wxT(""), wxT("invalid radiobox") );
wxNode *node = m_boxes.GetFirst(); wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node) while (node)
{ {
GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->GetData() ); GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->GetData() );
@@ -645,7 +645,7 @@ void wxRadioBox::SetNumberOfRowsOrCols( int WXUNUSED(n) )
void wxRadioBox::GtkDisableEvents() void wxRadioBox::GtkDisableEvents()
{ {
wxNode *node = m_boxes.GetFirst(); wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node) while (node)
{ {
gtk_signal_disconnect_by_func( GTK_OBJECT(node->GetData()), gtk_signal_disconnect_by_func( GTK_OBJECT(node->GetData()),
@@ -657,7 +657,7 @@ void wxRadioBox::GtkDisableEvents()
void wxRadioBox::GtkEnableEvents() void wxRadioBox::GtkEnableEvents()
{ {
wxNode *node = m_boxes.GetFirst(); wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node) while (node)
{ {
gtk_signal_connect( GTK_OBJECT(node->GetData()), "clicked", gtk_signal_connect( GTK_OBJECT(node->GetData()), "clicked",
@@ -673,7 +673,7 @@ void wxRadioBox::ApplyWidgetStyle()
gtk_widget_set_style( m_widget, m_widgetStyle ); gtk_widget_set_style( m_widget, m_widgetStyle );
wxNode *node = m_boxes.GetFirst(); wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node) while (node)
{ {
GtkWidget *widget = GTK_WIDGET( node->GetData() ); GtkWidget *widget = GTK_WIDGET( node->GetData() );
@@ -688,7 +688,7 @@ void wxRadioBox::ApplyWidgetStyle()
#if wxUSE_TOOLTIPS #if wxUSE_TOOLTIPS
void wxRadioBox::ApplyToolTip( GtkTooltips *tips, const wxChar *tip ) void wxRadioBox::ApplyToolTip( GtkTooltips *tips, const wxChar *tip )
{ {
wxNode *node = m_boxes.GetFirst(); wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node) while (node)
{ {
GtkWidget *widget = GTK_WIDGET( node->GetData() ); GtkWidget *widget = GTK_WIDGET( node->GetData() );
@@ -702,7 +702,7 @@ bool wxRadioBox::IsOwnGtkWindow( GdkWindow *window )
{ {
if (window == m_widget->window) return TRUE; if (window == m_widget->window) return TRUE;
wxNode *node = m_boxes.GetFirst(); wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node) while (node)
{ {
GtkWidget *button = GTK_WIDGET( node->GetData() ); GtkWidget *button = GTK_WIDGET( node->GetData() );

View File

@@ -94,7 +94,7 @@ bool wxRadioButton::Create( wxWindow *parent,
{ {
// 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

@@ -433,8 +433,9 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
if ( tool->IsRadio() ) if ( tool->IsRadio() )
{ {
wxToolBarToolsList::Node *node = pos ? m_tools.Item(pos - 1) wxToolBarToolsList::compatibility_iterator node;
: NULL; if ( pos ) node = m_tools.Item(pos - 1);
while ( node ) while ( node )
{ {
wxToolBarTool *tool = (wxToolBarTool *)node->GetData(); wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
@@ -660,7 +661,7 @@ void wxToolBar::OnInternalIdle()
gdk_window_set_cursor( m_widget->window, cursor.GetCursor() ); gdk_window_set_cursor( m_widget->window, cursor.GetCursor() );
} }
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

@@ -345,7 +345,7 @@ wxWindow *wxFindFocusedChild(wxWindowGTK *win)
if ( winFocus == win ) if ( winFocus == win )
return (wxWindow *)win; return (wxWindow *)win;
for ( wxWindowList::Node *node = win->GetChildren().GetFirst(); for ( wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst();
node; node;
node = node->GetNext() ) node = node->GetNext() )
{ {
@@ -1405,7 +1405,7 @@ wxWindowGTK *FindWindowForMouseEvent(wxWindowGTK *win, wxCoord& x, wxCoord& y)
yy += pizza->yoffset; yy += pizza->yoffset;
} }
wxWindowList::Node *node = win->GetChildren().GetFirst(); wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst();
while (node) while (node)
{ {
wxWindowGTK *child = node->GetData(); 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 // 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) // and reset colours that have been messed up by a parent's (really ancestor's)
// Enable call // Enable call
for ( wxWindowList::Node *node = win->GetChildren().GetFirst(); for ( wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst();
node; node;
node = node->GetNext() ) 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 ) static void SetInvokingWindow( wxMenu *menu, wxWindowGTK *win )
{ {
menu->SetInvokingWindow( win ); menu->SetInvokingWindow( win );
wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst(); wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
while (node) while (node)
{ {
wxMenuItem *menuitem = node->GetData(); wxMenuItem *menuitem = node->GetData();

View File

@@ -156,7 +156,7 @@ void wxChoice::DoSetItemClientData( int n, void* clientData )
{ {
wxCHECK_RET( m_widget != NULL, wxT("invalid choice control") ); 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") ); wxCHECK_RET( node, wxT("invalid index in wxChoice::DoSetItemClientData") );
node->SetData( (wxObject*) clientData ); node->SetData( (wxObject*) clientData );
@@ -166,7 +166,7 @@ void* wxChoice::DoGetItemClientData( int n ) const
{ {
wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid choice control") ); 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") ); wxCHECK_MSG( node, NULL, wxT("invalid index in wxChoice::DoGetItemClientData") );
return node->GetData(); return node->GetData();
@@ -176,7 +176,7 @@ void wxChoice::DoSetItemClientObject( int n, wxClientData* clientData )
{ {
wxCHECK_RET( m_widget != NULL, wxT("invalid choice control") ); 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") ); wxCHECK_RET( node, wxT("invalid index in wxChoice::DoSetItemClientObject") );
// wxItemContainer already deletes data for us // 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") ); 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, wxCHECK_MSG( node, (wxClientData *)NULL,
wxT("invalid index in wxChoice::DoGetItemClientObject") ); 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> // destroy the data (due to Robert's idea of using wxList<wxObject>
// and not wxList<wxClientData> we can't just say // and not wxList<wxClientData> we can't just say
// m_clientList.DeleteContents(TRUE) - this would crash! // m_clientList.DeleteContents(TRUE) - this would crash!
wxNode *node = m_clientList.GetFirst(); wxList::compatibility_iterator node = m_clientList.GetFirst();
while ( node ) while ( node )
{ {
delete (wxClientData *)node->GetData(); delete (wxClientData *)node->GetData();

View File

@@ -156,12 +156,13 @@ wxColour::wxColour( unsigned char red, unsigned char green, unsigned char blue )
M_COLDATA->m_color.pixel = 0; M_COLDATA->m_color.pixel = 0;
} }
void wxColour::InitFromName( const wxString &colourName ) void wxColour::InitFromName( const wxString &colourName )
{ {
wxNode *node = (wxNode *) NULL; wxColour* col = NULL;
if ( (wxTheColourDatabase) && (node = wxTheColourDatabase->Find(colourName)) ) if ( (wxTheColourDatabase) && (col = wxTheColourDatabase->FindColourNoAdd(colourName)) )
{ {
wxColour *col = (wxColour*)node->GetData();
UnRef(); UnRef();
if (col) Ref( *col ); if (col) Ref( *col );
} }

View File

@@ -197,7 +197,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
wxComboBox::~wxComboBox() wxComboBox::~wxComboBox()
{ {
wxNode *node = m_clientObjectList.GetFirst(); wxList::compatibility_iterator node = m_clientObjectList.GetFirst();
while (node) while (node)
{ {
wxClientData *cd = (wxClientData*)node->GetData(); wxClientData *cd = (wxClientData*)node->GetData();
@@ -360,7 +360,7 @@ void wxComboBox::SetClientData( int n, void* clientData )
{ {
wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") ); 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; if (!node) return;
node->SetData( (wxObject*) clientData ); node->SetData( (wxObject*) clientData );
@@ -370,7 +370,7 @@ void* wxComboBox::GetClientData( int n ) const
{ {
wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid combobox") ); 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; return node ? node->GetData() : NULL;
} }
@@ -379,7 +379,7 @@ void wxComboBox::SetClientObject( int n, wxClientData* clientData )
{ {
wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") ); 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; if (!node) return;
wxClientData *cd = (wxClientData*) node->GetData(); 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") ); 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; return node ? (wxClientData*) node->GetData() : NULL;
} }
@@ -406,7 +406,7 @@ void wxComboBox::Clear()
GtkWidget *list = GTK_COMBO(m_widget)->list; GtkWidget *list = GTK_COMBO(m_widget)->list;
gtk_list_clear_items( GTK_LIST(list), 0, Number() ); gtk_list_clear_items( GTK_LIST(list), 0, Number() );
wxNode *node = m_clientObjectList.GetFirst(); wxList::compatibility_iterator node = m_clientObjectList.GetFirst();
while (node) while (node)
{ {
wxClientData *cd = (wxClientData*)node->GetData(); wxClientData *cd = (wxClientData*)node->GetData();
@@ -440,17 +440,17 @@ void wxComboBox::Delete( int n )
gtk_list_remove_items( listbox, list ); gtk_list_remove_items( listbox, list );
g_list_free( list ); g_list_free( list );
wxNode *node = m_clientObjectList.Item( n ); wxList::compatibility_iterator node = m_clientObjectList.Item( n );
if (node) if (node)
{ {
wxClientData *cd = (wxClientData*)node->GetData(); wxClientData *cd = (wxClientData*)node->GetData();
if (cd) delete cd; if (cd) delete cd;
m_clientObjectList.DeleteNode( node ); m_clientObjectList.Erase( node );
} }
node = m_clientDataList.Item( n ); node = m_clientDataList.Item( n );
if (node) if (node)
m_clientDataList.DeleteNode( node ); m_clientDataList.Erase( node );
EnableEvents(); EnableEvents();
} }

View File

@@ -448,7 +448,7 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
if (index != GetCount()) if (index != GetCount())
{ {
GtkAddItem( items[n], index ); GtkAddItem( items[n], index );
wxNode *node = m_clientList.Item( index ); wxList::compatibility_iterator node = m_clientList.Item( index );
m_clientList.Insert( node, (wxObject*) NULL ); m_clientList.Insert( node, (wxObject*) NULL );
} }
else else
@@ -471,7 +471,7 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
} }
else else
{ {
wxNode *node = m_clientList.Item( pos ); wxList::compatibility_iterator node = m_clientList.Item( pos );
for ( size_t n = 0; n < nItems; n++ ) for ( size_t n = 0; n < nItems; n++ )
{ {
GtkAddItem( items[n], pos+n ); GtkAddItem( items[n], pos+n );
@@ -497,7 +497,7 @@ int wxListBox::DoAppend( const wxString& item )
{ {
GtkAddItem( item, index ); GtkAddItem( item, index );
wxNode *node = m_clientList.Item( index ); wxList::compatibility_iterator node = m_clientList.Item( index );
m_clientList.Insert( node, (wxObject *)NULL ); m_clientList.Insert( node, (wxObject *)NULL );
return index; return index;
@@ -619,7 +619,7 @@ void wxListBox::Clear()
// destroy the data (due to Robert's idea of using wxList<wxObject> // destroy the data (due to Robert's idea of using wxList<wxObject>
// and not wxList<wxClientData> we can't just say // and not wxList<wxClientData> we can't just say
// m_clientList.DeleteContents(TRUE) - this would crash! // m_clientList.DeleteContents(TRUE) - this would crash!
wxNode *node = m_clientList.GetFirst(); wxList::compatibility_iterator node = m_clientList.GetFirst();
while ( node ) while ( node )
{ {
delete (wxClientData *)node->GetData(); delete (wxClientData *)node->GetData();
@@ -644,7 +644,7 @@ void wxListBox::Delete( int n )
gtk_list_remove_items( m_list, list ); gtk_list_remove_items( m_list, list );
g_list_free( list ); g_list_free( list );
wxNode *node = m_clientList.Item( n ); wxList::compatibility_iterator node = m_clientList.Item( n );
if ( node ) if ( node )
{ {
if ( m_clientDataItemsType == wxClientData_Object ) if ( m_clientDataItemsType == wxClientData_Object )
@@ -653,7 +653,7 @@ void wxListBox::Delete( int n )
delete cd; delete cd;
} }
m_clientList.DeleteNode( node ); m_clientList.Erase( node );
} }
if ( m_strings ) if ( m_strings )
@@ -668,7 +668,7 @@ void wxListBox::DoSetItemClientData( int n, void* clientData )
{ {
wxCHECK_RET( m_widget != NULL, wxT("invalid listbox control") ); 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") ); wxCHECK_RET( node, wxT("invalid index in wxListBox::DoSetItemClientData") );
node->SetData( (wxObject*) clientData ); node->SetData( (wxObject*) clientData );
@@ -678,7 +678,7 @@ void* wxListBox::DoGetItemClientData( int n ) const
{ {
wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid listbox control") ); 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") ); wxCHECK_MSG( node, NULL, wxT("invalid index in wxListBox::DoGetItemClientData") );
return node->GetData(); return node->GetData();
@@ -688,7 +688,7 @@ void wxListBox::DoSetItemClientObject( int n, wxClientData* clientData )
{ {
wxCHECK_RET( m_widget != NULL, wxT("invalid listbox control") ); 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") ); wxCHECK_RET( node, wxT("invalid index in wxListBox::DoSetItemClientObject") );
// wxItemContainer already deletes data for us // 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") ); 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, wxCHECK_MSG( node, (wxClientData *)NULL,
wxT("invalid index in wxListBox::DoGetItemClientObject") ); wxT("invalid index in wxListBox::DoGetItemClientObject") );

View File

@@ -75,7 +75,7 @@ gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget),
child = (wxMDIChildFrame*) NULL; child = (wxMDIChildFrame*) NULL;
wxWindowList::Node *node = client_window->GetChildren().GetFirst(); wxWindowList::compatibility_iterator node = client_window->GetChildren().GetFirst();
while (node) while (node)
{ {
wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame ); wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame );
@@ -170,7 +170,7 @@ void wxMDIParentFrame::OnInternalIdle()
wxMDIChildFrame *active_child_frame = GetActiveChild(); wxMDIChildFrame *active_child_frame = GetActiveChild();
bool visible_child_menu = false; bool visible_child_menu = false;
wxWindowList::Node *node = m_clientWindow->GetChildren().GetFirst(); wxWindowList::compatibility_iterator node = m_clientWindow->GetChildren().GetFirst();
while (node) while (node)
{ {
wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame ); 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); GtkNotebookPage* page = (GtkNotebookPage*) (g_list_nth(notebook->children,i)->data);
if (!page) return (wxMDIChildFrame*) NULL; if (!page) return (wxMDIChildFrame*) NULL;
wxWindowList::Node *node = m_clientWindow->GetChildren().GetFirst(); wxWindowList::compatibility_iterator node = m_clientWindow->GetChildren().GetFirst();
while (node) while (node)
{ {
wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame ); wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame );

View File

@@ -200,8 +200,6 @@ wxMenuBar::wxMenuBar( long style )
return; return;
} }
m_menus.DeleteContents( TRUE );
/* GTK 1.2.0 doesn't have gtk_item_factory_get_item(), but GTK 1.2.1 has. */ /* 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) #if GTK_CHECK_VERSION(1, 2, 1)
m_accel = gtk_accel_group_new(); m_accel = gtk_accel_group_new();
@@ -241,8 +239,6 @@ wxMenuBar::wxMenuBar()
return; return;
} }
m_menus.DeleteContents( TRUE );
/* GTK 1.2.0 doesn't have gtk_item_factory_get_item(), but GTK 1.2.1 has. */ /* 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) #if GTK_CHECK_VERSION(1, 2, 1)
m_accel = gtk_accel_group_new(); m_accel = gtk_accel_group_new();
@@ -275,7 +271,7 @@ static void wxMenubarUnsetInvokingWindow( wxMenu *menu, wxWindow *win )
/* support for native hot keys */ /* support for native hot keys */
gtk_accel_group_detach( menu->m_accel, ACCEL_OBJ_CAST(top_frame->m_widget) ); 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) while (node)
{ {
wxMenuItem *menuitem = node->GetData(); wxMenuItem *menuitem = node->GetData();
@@ -300,7 +296,7 @@ static void wxMenubarSetInvokingWindow( wxMenu *menu, wxWindow *win )
gtk_accel_group_attach( menu->m_accel, obj ); gtk_accel_group_attach( menu->m_accel, obj );
#endif // GTK+ 1.2.1+ #endif // GTK+ 1.2.1+
wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst(); wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
while (node) while (node)
{ {
wxMenuItem *menuitem = node->GetData(); wxMenuItem *menuitem = node->GetData();
@@ -324,7 +320,7 @@ void wxMenuBar::SetInvokingWindow( wxWindow *win )
gtk_accel_group_attach( m_accel, obj ); gtk_accel_group_attach( m_accel, obj );
#endif // GTK+ 1.2.1+ #endif // GTK+ 1.2.1+
wxMenuList::Node *node = m_menus.GetFirst(); wxMenuList::compatibility_iterator node = m_menus.GetFirst();
while (node) while (node)
{ {
wxMenu *menu = node->GetData(); 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) ); gtk_accel_group_detach( m_accel, ACCEL_OBJ_CAST(top_frame->m_widget) );
#endif // GTK+ 1.2.1+ #endif // GTK+ 1.2.1+
wxMenuList::Node *node = m_menus.GetFirst(); wxMenuList::compatibility_iterator node = m_menus.GetFirst();
while (node) while (node)
{ {
wxMenu *menu = node->GetData(); wxMenu *menu = node->GetData();
@@ -474,7 +470,7 @@ wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title)
static wxMenu *CopyMenu (wxMenu *menu) static wxMenu *CopyMenu (wxMenu *menu)
{ {
wxMenu *menucopy = new wxMenu (); wxMenu *menucopy = new wxMenu ();
wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst(); wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
while (node) while (node)
{ {
wxMenuItem *item = node->GetData(); wxMenuItem *item = node->GetData();
@@ -552,7 +548,7 @@ static int FindMenuItemRecursive( const wxMenu *menu, const wxString &menuString
return res; return res;
} }
wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst(); wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
while (node) while (node)
{ {
wxMenuItem *item = node->GetData(); 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 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) while (node)
{ {
wxMenu *menu = node->GetData(); wxMenu *menu = node->GetData();
@@ -585,7 +581,7 @@ static wxMenuItem* FindMenuItemByIdRecursive(const wxMenu* menu, int id)
{ {
wxMenuItem* result = menu->FindChildItem(id); wxMenuItem* result = menu->FindChildItem(id);
wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst(); wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
while ( node && result == NULL ) while ( node && result == NULL )
{ {
wxMenuItem *item = node->GetData(); 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* wxMenuBar::FindItem( int id, wxMenu **menuForItem ) const
{ {
wxMenuItem* result = 0; wxMenuItem* result = 0;
wxMenuList::Node *node = m_menus.GetFirst(); wxMenuList::compatibility_iterator node = m_menus.GetFirst();
while (node && result == 0) while (node && result == 0)
{ {
wxMenu *menu = node->GetData(); wxMenu *menu = node->GetData();
@@ -620,7 +616,7 @@ wxMenuItem* wxMenuBar::FindItem( int id, wxMenu **menuForItem ) const
void wxMenuBar::EnableTop( size_t pos, bool flag ) 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") ); 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 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") ); 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 ) 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") ); wxCHECK_RET( node, wxT("menu not found") );
@@ -1122,7 +1118,7 @@ void wxMenu::Init()
wxMenu::~wxMenu() wxMenu::~wxMenu()
{ {
m_items.Clear(); WX_CLEAR_LIST(wxMenuItemList, m_items);
if ( GTK_IS_WIDGET( m_menu )) if ( GTK_IS_WIDGET( m_menu ))
gtk_widget_destroy( m_menu ); gtk_widget_destroy( m_menu );
@@ -1398,7 +1394,7 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
int wxMenu::FindMenuIdByMenuItem( GtkWidget *menuItem ) const int wxMenu::FindMenuIdByMenuItem( GtkWidget *menuItem ) const
{ {
wxMenuItemList::Node *node = m_items.GetFirst(); wxMenuItemList::compatibility_iterator node = m_items.GetFirst();
while (node) while (node)
{ {
wxMenuItem *item = node->GetData(); wxMenuItem *item = node->GetData();

View File

@@ -240,7 +240,6 @@ void wxNotebook::Init()
m_inSwitchPage = FALSE; m_inSwitchPage = FALSE;
m_imageList = (wxImageList *) NULL; m_imageList = (wxImageList *) NULL;
m_pagesData.DeleteContents( TRUE );
m_selection = -1; m_selection = -1;
m_themeEnabled = TRUE; m_themeEnabled = TRUE;
} }
@@ -567,7 +566,9 @@ wxNotebookPage *wxNotebook::DoRemovePage( int page )
gtk_notebook_remove_page( GTK_NOTEBOOK(m_widget), 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; return client;
} }

View File

@@ -80,7 +80,7 @@ static gint gtk_radiobox_keypress_callback( GtkWidget *widget, GdkEventKey *gdk_
return FALSE; return FALSE;
} }
wxNode *node = rb->m_boxes.Find( (wxObject*) widget ); wxList::compatibility_iterator node = rb->m_boxes.Find( (wxObject*) widget );
if (!node) if (!node)
{ {
return FALSE; return FALSE;
@@ -260,7 +260,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
wxRadioBox::~wxRadioBox() wxRadioBox::~wxRadioBox()
{ {
wxNode *node = m_boxes.GetFirst(); wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node) while (node)
{ {
GtkWidget *button = GTK_WIDGET( node->GetData() ); GtkWidget *button = GTK_WIDGET( node->GetData() );
@@ -314,7 +314,7 @@ wxSize wxRadioBox::LayoutItems()
y = 15; y = 15;
int max_len = 0; 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++) for (int i1 = 0; i1< num_of_rows; i1++)
{ {
GtkWidget *button = GTK_WIDGET( node->GetData() ); GtkWidget *button = GTK_WIDGET( node->GetData() );
@@ -359,7 +359,7 @@ wxSize wxRadioBox::LayoutItems()
{ {
int max = 0; int max = 0;
wxNode *node = m_boxes.GetFirst(); wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node) while (node)
{ {
GtkWidget *button = GTK_WIDGET( node->GetData() ); GtkWidget *button = GTK_WIDGET( node->GetData() );
@@ -405,7 +405,7 @@ bool wxRadioBox::Show( bool show )
if ((m_windowStyle & wxNO_BORDER) != 0) if ((m_windowStyle & wxNO_BORDER) != 0)
gtk_widget_hide( m_widget ); gtk_widget_hide( m_widget );
wxNode *node = m_boxes.GetFirst(); wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node) while (node)
{ {
GtkWidget *button = GTK_WIDGET( node->GetData() ); GtkWidget *button = GTK_WIDGET( node->GetData() );
@@ -424,7 +424,7 @@ int wxRadioBox::FindString( const wxString &find ) const
int count = 0; int count = 0;
wxNode *node = m_boxes.GetFirst(); wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node) while (node)
{ {
GtkLabel *label = GTK_LABEL( BUTTON_CHILD(node->GetData()) ); GtkLabel *label = GTK_LABEL( BUTTON_CHILD(node->GetData()) );
@@ -450,7 +450,7 @@ void wxRadioBox::SetFocus()
if (m_boxes.GetCount() == 0) return; if (m_boxes.GetCount() == 0) return;
wxNode *node = m_boxes.GetFirst(); wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node) while (node)
{ {
GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->GetData() ); GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->GetData() );
@@ -467,7 +467,7 @@ void wxRadioBox::SetSelection( int n )
{ {
wxCHECK_RET( m_widget != NULL, wxT("invalid radiobox") ); 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") ); wxCHECK_RET( node, wxT("radiobox wrong index") );
@@ -486,7 +486,7 @@ int wxRadioBox::GetSelection(void) const
int count = 0; int count = 0;
wxNode *node = m_boxes.GetFirst(); wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node) while (node)
{ {
GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->GetData() ); 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") ); 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") ); 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") ); 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") ); wxCHECK_RET( node, wxT("radiobox wrong index") );
@@ -546,7 +546,7 @@ bool wxRadioBox::Enable( bool enable )
if ( !wxControl::Enable( enable ) ) if ( !wxControl::Enable( enable ) )
return FALSE; return FALSE;
wxNode *node = m_boxes.GetFirst(); wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node) while (node)
{ {
GtkButton *button = GTK_BUTTON( node->GetData() ); 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") ); 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") ); 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") ); 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") ); wxCHECK_RET( node, wxT("radiobox wrong index") );
@@ -595,7 +595,7 @@ wxString wxRadioBox::GetStringSelection() const
{ {
wxCHECK_MSG( m_widget != NULL, wxT(""), wxT("invalid radiobox") ); wxCHECK_MSG( m_widget != NULL, wxT(""), wxT("invalid radiobox") );
wxNode *node = m_boxes.GetFirst(); wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node) while (node)
{ {
GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->GetData() ); GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->GetData() );
@@ -645,7 +645,7 @@ void wxRadioBox::SetNumberOfRowsOrCols( int WXUNUSED(n) )
void wxRadioBox::GtkDisableEvents() void wxRadioBox::GtkDisableEvents()
{ {
wxNode *node = m_boxes.GetFirst(); wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node) while (node)
{ {
gtk_signal_disconnect_by_func( GTK_OBJECT(node->GetData()), gtk_signal_disconnect_by_func( GTK_OBJECT(node->GetData()),
@@ -657,7 +657,7 @@ void wxRadioBox::GtkDisableEvents()
void wxRadioBox::GtkEnableEvents() void wxRadioBox::GtkEnableEvents()
{ {
wxNode *node = m_boxes.GetFirst(); wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node) while (node)
{ {
gtk_signal_connect( GTK_OBJECT(node->GetData()), "clicked", gtk_signal_connect( GTK_OBJECT(node->GetData()), "clicked",
@@ -673,7 +673,7 @@ void wxRadioBox::ApplyWidgetStyle()
gtk_widget_set_style( m_widget, m_widgetStyle ); gtk_widget_set_style( m_widget, m_widgetStyle );
wxNode *node = m_boxes.GetFirst(); wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node) while (node)
{ {
GtkWidget *widget = GTK_WIDGET( node->GetData() ); GtkWidget *widget = GTK_WIDGET( node->GetData() );
@@ -688,7 +688,7 @@ void wxRadioBox::ApplyWidgetStyle()
#if wxUSE_TOOLTIPS #if wxUSE_TOOLTIPS
void wxRadioBox::ApplyToolTip( GtkTooltips *tips, const wxChar *tip ) void wxRadioBox::ApplyToolTip( GtkTooltips *tips, const wxChar *tip )
{ {
wxNode *node = m_boxes.GetFirst(); wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node) while (node)
{ {
GtkWidget *widget = GTK_WIDGET( node->GetData() ); GtkWidget *widget = GTK_WIDGET( node->GetData() );
@@ -702,7 +702,7 @@ bool wxRadioBox::IsOwnGtkWindow( GdkWindow *window )
{ {
if (window == m_widget->window) return TRUE; if (window == m_widget->window) return TRUE;
wxNode *node = m_boxes.GetFirst(); wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node) while (node)
{ {
GtkWidget *button = GTK_WIDGET( node->GetData() ); GtkWidget *button = GTK_WIDGET( node->GetData() );

View File

@@ -94,7 +94,7 @@ bool wxRadioButton::Create( wxWindow *parent,
{ {
// 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

@@ -433,8 +433,9 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
if ( tool->IsRadio() ) if ( tool->IsRadio() )
{ {
wxToolBarToolsList::Node *node = pos ? m_tools.Item(pos - 1) wxToolBarToolsList::compatibility_iterator node;
: NULL; if ( pos ) node = m_tools.Item(pos - 1);
while ( node ) while ( node )
{ {
wxToolBarTool *tool = (wxToolBarTool *)node->GetData(); wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
@@ -660,7 +661,7 @@ void wxToolBar::OnInternalIdle()
gdk_window_set_cursor( m_widget->window, cursor.GetCursor() ); gdk_window_set_cursor( m_widget->window, cursor.GetCursor() );
} }
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

@@ -345,7 +345,7 @@ wxWindow *wxFindFocusedChild(wxWindowGTK *win)
if ( winFocus == win ) if ( winFocus == win )
return (wxWindow *)win; return (wxWindow *)win;
for ( wxWindowList::Node *node = win->GetChildren().GetFirst(); for ( wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst();
node; node;
node = node->GetNext() ) node = node->GetNext() )
{ {
@@ -1405,7 +1405,7 @@ wxWindowGTK *FindWindowForMouseEvent(wxWindowGTK *win, wxCoord& x, wxCoord& y)
yy += pizza->yoffset; yy += pizza->yoffset;
} }
wxWindowList::Node *node = win->GetChildren().GetFirst(); wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst();
while (node) while (node)
{ {
wxWindowGTK *child = node->GetData(); 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 // 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) // and reset colours that have been messed up by a parent's (really ancestor's)
// Enable call // Enable call
for ( wxWindowList::Node *node = win->GetChildren().GetFirst(); for ( wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst();
node; node;
node = node->GetNext() ) 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 ) static void SetInvokingWindow( wxMenu *menu, wxWindowGTK *win )
{ {
menu->SetInvokingWindow( win ); menu->SetInvokingWindow( win );
wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst(); wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
while (node) while (node)
{ {
wxMenuItem *menuitem = node->GetData(); wxMenuItem *menuitem = node->GetData();

View File

@@ -271,7 +271,7 @@ void wxHtmlHelpController::AddGrabIfNeeded()
// Check if there are any modal windows present, // Check if there are any modal windows present,
// in which case we need to add a grab. // 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 = node->GetNext() ) node = node->GetNext() )
{ {

View File

@@ -1069,7 +1069,6 @@ BEGIN_EVENT_TABLE(wxHtmlHelpFrameOptionsDialog, wxDialog)
EVT_SPINCTRL(-1, wxHtmlHelpFrameOptionsDialog::OnUpdateSpin) EVT_SPINCTRL(-1, wxHtmlHelpFrameOptionsDialog::OnUpdateSpin)
END_EVENT_TABLE() END_EVENT_TABLE()
void wxHtmlHelpFrame::OptionsDialog() void wxHtmlHelpFrame::OptionsDialog()
{ {
wxHtmlHelpFrameOptionsDialog dlg(this); wxHtmlHelpFrameOptionsDialog dlg(this);
@@ -1081,7 +1080,7 @@ void wxHtmlHelpFrame::OptionsDialog()
enu.EnumerateFacenames(); enu.EnumerateFacenames();
m_NormalFonts = new wxArrayString; m_NormalFonts = new wxArrayString;
*m_NormalFonts = *enu.GetFacenames(); *m_NormalFonts = *enu.GetFacenames();
m_NormalFonts->Sort(); m_NormalFonts->Sort(wxStringSortAscending);
} }
if (m_FixedFonts == NULL) if (m_FixedFonts == NULL)
{ {
@@ -1089,7 +1088,7 @@ void wxHtmlHelpFrame::OptionsDialog()
enu.EnumerateFacenames(wxFONTENCODING_SYSTEM, TRUE); enu.EnumerateFacenames(wxFONTENCODING_SYSTEM, TRUE);
m_FixedFonts = new wxArrayString; m_FixedFonts = new wxArrayString;
*m_FixedFonts = *enu.GetFacenames(); *m_FixedFonts = *enu.GetFacenames();
m_FixedFonts->Sort(); m_FixedFonts->Sort(wxStringSortAscending);
} }
// VS: We want to show the font that is actually used by wxHtmlWindow. // VS: We want to show the font that is actually used by wxHtmlWindow.

View File

@@ -83,10 +83,17 @@ wxHtmlParser::~wxHtmlParser()
while (RestoreState()) {} while (RestoreState()) {}
DestroyDOMTree(); 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; delete m_HandlersStack;
m_HandlersHash.Clear(); m_HandlersHash.Clear();
m_HandlersList.DeleteContents(TRUE); WX_CLEAR_LIST(wxList, m_HandlersList);
m_HandlersList.Clear();
delete m_entitiesParser; delete m_entitiesParser;
} }
@@ -351,10 +358,9 @@ void wxHtmlParser::PushTagHandler(wxHtmlTagHandler *handler, wxString tags)
if (m_HandlersStack == NULL) if (m_HandlersStack == NULL)
{ {
m_HandlersStack = new wxList; 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()) while (tokenizer.HasMoreTokens())
{ {
@@ -366,16 +372,17 @@ void wxHtmlParser::PushTagHandler(wxHtmlTagHandler *handler, wxString tags)
void wxHtmlParser::PopTagHandler() void wxHtmlParser::PopTagHandler()
{ {
wxNode *first; wxList::compatibility_iterator first;
if (m_HandlersStack == NULL || if (m_HandlersStack == NULL ||
(first = m_HandlersStack->GetFirst()) == NULL) !(first = m_HandlersStack->GetFirst()))
{ {
wxLogWarning(_("Warning: attempt to remove HTML tag handler from empty stack.")); wxLogWarning(_("Warning: attempt to remove HTML tag handler from empty stack."));
return; return;
} }
m_HandlersHash = *((wxHashTable*) first->GetData()); m_HandlersHash = *((wxHashTable*) first->GetData());
m_HandlersStack->DeleteNode(first); delete (wxHashTable*) first->GetData();
m_HandlersStack->Erase(first);
} }
void wxHtmlParser::SetSourceAndSaveState(const wxString& src) void wxHtmlParser::SetSourceAndSaveState(const wxString& src)

View File

@@ -203,6 +203,8 @@ wxHtmlWindow::~wxHtmlWindow()
if (m_Cell) delete m_Cell; if (m_Cell) delete m_Cell;
WX_CLEAR_LIST(wxHtmlProcessorList, *m_Processors);
delete m_Parser; delete m_Parser;
delete m_FS; delete m_FS;
delete m_History; delete m_History;
@@ -248,11 +250,11 @@ bool wxHtmlWindow::SetPage(const wxString& source)
// pass HTML through registered processors: // pass HTML through registered processors:
if (m_Processors || m_GlobalProcessors) if (m_Processors || m_GlobalProcessors)
{ {
wxHtmlProcessorList::Node *nodeL, *nodeG; wxHtmlProcessorList::compatibility_iterator nodeL, nodeG;
int prL, prG; int prL, prG;
nodeL = (m_Processors) ? m_Processors->GetFirst() : NULL; nodeL = (m_Processors) ? m_Processors->GetFirst() : wxHtmlProcessorList::compatibility_iterator();
nodeG = (m_GlobalProcessors) ? m_GlobalProcessors->GetFirst() : NULL; nodeG = (m_GlobalProcessors) ? m_GlobalProcessors->GetFirst() : wxHtmlProcessorList::compatibility_iterator();
// VS: there are two lists, global and local, both of them sorted by // VS: there are two lists, global and local, both of them sorted by
// priority. Since we have to go through _both_ lists with // priority. Since we have to go through _both_ lists with
@@ -374,7 +376,7 @@ bool wxHtmlWindow::LoadPage(const wxString& location)
else else
{ {
wxNode *node; wxList::compatibility_iterator node;
wxString src = wxEmptyString; wxString src = wxEmptyString;
if (m_RelatedStatusBar != -1) if (m_RelatedStatusBar != -1)
@@ -653,9 +655,8 @@ void wxHtmlWindow::AddProcessor(wxHtmlProcessor *processor)
if (!m_Processors) if (!m_Processors)
{ {
m_Processors = new wxHtmlProcessorList; m_Processors = new wxHtmlProcessorList;
m_Processors->DeleteContents(TRUE);
} }
wxHtmlProcessorList::Node *node; wxHtmlProcessorList::compatibility_iterator node;
for (node = m_Processors->GetFirst(); node; node = node->GetNext()) for (node = m_Processors->GetFirst(); node; node = node->GetNext())
{ {
@@ -673,9 +674,8 @@ void wxHtmlWindow::AddProcessor(wxHtmlProcessor *processor)
if (!m_GlobalProcessors) if (!m_GlobalProcessors)
{ {
m_GlobalProcessors = new wxHtmlProcessorList; m_GlobalProcessors = new wxHtmlProcessorList;
m_GlobalProcessors->DeleteContents(TRUE);
} }
wxHtmlProcessorList::Node *node; wxHtmlProcessorList::compatibility_iterator node;
for (node = m_GlobalProcessors->GetFirst(); node; node = node->GetNext()) for (node = m_GlobalProcessors->GetFirst(); node; node = node->GetNext())
{ {
@@ -697,8 +697,9 @@ wxHtmlProcessorList *wxHtmlWindow::m_GlobalProcessors = NULL;
void wxHtmlWindow::CleanUpStatics() void wxHtmlWindow::CleanUpStatics()
{ {
wxDELETE(m_DefaultFilter); wxDELETE(m_DefaultFilter);
m_Filters.DeleteContents(TRUE); WX_CLEAR_LIST(wxList, m_Filters);
m_Filters.Clear(); if (m_GlobalProcessors)
WX_CLEAR_LIST(wxHtmlProcessorList, *m_GlobalProcessors);
wxDELETE(m_GlobalProcessors); wxDELETE(m_GlobalProcessors);
} }

View File

@@ -169,8 +169,7 @@ wxHtmlPrintout::~wxHtmlPrintout()
void wxHtmlPrintout::CleanUpStatics() void wxHtmlPrintout::CleanUpStatics()
{ {
m_Filters.DeleteContents(TRUE); WX_CLEAR_LIST(wxList, m_Filters);
m_Filters.Clear();
} }
// Adds input filter // Adds input filter
@@ -293,7 +292,7 @@ void wxHtmlPrintout::SetHtmlFile(const wxString& htmlfile)
wxHtmlFilterHTML defaultFilter; wxHtmlFilterHTML defaultFilter;
wxString doc; wxString doc;
wxNode* node = m_Filters.GetFirst(); wxList::compatibility_iterator node = m_Filters.GetFirst();
while (node) while (node)
{ {
wxHtmlFilter *h = (wxHtmlFilter*) node->GetData(); wxHtmlFilter *h = (wxHtmlFilter*) node->GetData();

View File

@@ -74,7 +74,7 @@ wxHtmlWinParser::wxHtmlWinParser(wxHtmlWindow *wnd) : wxHtmlParser()
} }
// fill in wxHtmlParser's tables: // fill in wxHtmlParser's tables:
wxNode *node = m_Modules.GetFirst(); wxList::compatibility_iterator node = m_Modules.GetFirst();
while (node) while (node)
{ {
wxHtmlTagsModule *mod = (wxHtmlTagsModule*) node->GetData(); wxHtmlTagsModule *mod = (wxHtmlTagsModule*) node->GetData();

View File

@@ -191,7 +191,7 @@ bool wxDialog::IsModal() const
bool wxDialog::IsModalShowing() const bool wxDialog::IsModalShowing() const
{ {
return wxModalDialogs.Find((wxDialog *)this) != NULL; // const_cast return wxModalDialogs.Find((wxDialog *)this); // const_cast
} }
wxWindow *wxDialog::FindSuitableParent() const wxWindow *wxDialog::FindSuitableParent() const

View File

@@ -345,7 +345,7 @@ int wxFileDialog::ShowModal()
if ( m_dir.Last() != _T('\\') ) if ( m_dir.Last() != _T('\\') )
dir += _T('\\'); dir += _T('\\');
m_fileNames.Sort(); m_fileNames.Sort(wxStringSortAscending);
m_path = dir + m_fileName; m_path = dir + m_fileName;
} }
else else

View File

@@ -455,7 +455,7 @@ void wxFrame::PositionToolBar()
// on the desktop, but are iconized/restored with it // on the desktop, but are iconized/restored with it
void wxFrame::IconizeChildFrames(bool bIconize) void wxFrame::IconizeChildFrames(bool bIconize)
{ {
for ( wxWindowList::Node *node = GetChildren().GetFirst(); for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
node; node;
node = node->GetNext() ) node = node->GetNext() )
{ {

View File

@@ -236,7 +236,7 @@ bool wxGDIImage::RemoveHandler(const wxString& name)
wxGDIImageHandler *wxGDIImage::FindHandler(const wxString& name) wxGDIImageHandler *wxGDIImage::FindHandler(const wxString& name)
{ {
wxGDIImageHandlerList::Node *node = ms_handlers.GetFirst(); wxGDIImageHandlerList::compatibility_iterator node = ms_handlers.GetFirst();
while ( node ) while ( node )
{ {
wxGDIImageHandler *handler = node->GetData(); wxGDIImageHandler *handler = node->GetData();
@@ -251,7 +251,7 @@ wxGDIImageHandler *wxGDIImage::FindHandler(const wxString& name)
wxGDIImageHandler *wxGDIImage::FindHandler(const wxString& extension, wxGDIImageHandler *wxGDIImage::FindHandler(const wxString& extension,
long type) long type)
{ {
wxGDIImageHandlerList::Node *node = ms_handlers.GetFirst(); wxGDIImageHandlerList::compatibility_iterator node = ms_handlers.GetFirst();
while ( node ) while ( node )
{ {
wxGDIImageHandler *handler = node->GetData(); wxGDIImageHandler *handler = node->GetData();
@@ -268,7 +268,7 @@ wxGDIImageHandler *wxGDIImage::FindHandler(const wxString& extension,
wxGDIImageHandler *wxGDIImage::FindHandler(long type) wxGDIImageHandler *wxGDIImage::FindHandler(long type)
{ {
wxGDIImageHandlerList::Node *node = ms_handlers.GetFirst(); wxGDIImageHandlerList::compatibility_iterator node = ms_handlers.GetFirst();
while ( node ) while ( node )
{ {
wxGDIImageHandler *handler = node->GetData(); wxGDIImageHandler *handler = node->GetData();
@@ -283,13 +283,13 @@ wxGDIImageHandler *wxGDIImage::FindHandler(long type)
void wxGDIImage::CleanUpHandlers() void wxGDIImage::CleanUpHandlers()
{ {
wxGDIImageHandlerList::Node *node = ms_handlers.GetFirst(); wxGDIImageHandlerList::compatibility_iterator node = ms_handlers.GetFirst();
while ( node ) while ( node )
{ {
wxGDIImageHandler *handler = node->GetData(); wxGDIImageHandler *handler = node->GetData();
wxGDIImageHandlerList::Node *next = node->GetNext(); wxGDIImageHandlerList::compatibility_iterator next = node->GetNext();
delete handler; delete handler;
delete node; ms_handlers.Erase( node );
node = next; node = next;
} }
} }

View File

@@ -558,7 +558,7 @@ bool wxMDIParentFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND hwnd)
if ( IsMdiCommandId(id) ) if ( IsMdiCommandId(id) )
{ {
wxWindowList::Node *node = GetChildren().GetFirst(); wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
while ( node ) while ( node )
{ {
wxWindow *child = node->GetData(); wxWindow *child = node->GetData();
@@ -1246,7 +1246,7 @@ void wxMDIClientWindow::DoSetSize(int x, int y, int width, int height, int sizeF
{ {
if (GetParent()) if (GetParent())
{ {
wxWindowList::Node *node = GetParent()->GetChildren().GetFirst(); wxWindowList::compatibility_iterator node = GetParent()->GetChildren().GetFirst();
while (node) while (node)
{ {
wxWindow *child = node->GetData(); wxWindow *child = node->GetData();

View File

@@ -163,7 +163,7 @@ void wxMenu::UpdateAccel(wxMenuItem *item)
if ( item->IsSubMenu() ) if ( item->IsSubMenu() )
{ {
wxMenu *submenu = item->GetSubMenu(); wxMenu *submenu = item->GetSubMenu();
wxMenuItemList::Node *node = submenu->GetMenuItems().GetFirst(); wxMenuItemList::compatibility_iterator node = submenu->GetMenuItems().GetFirst();
while ( node ) while ( node )
{ {
UpdateAccel(node->GetData()); UpdateAccel(node->GetData());
@@ -329,7 +329,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 )
{ {
@@ -369,7 +369,7 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
{ {
// we need to find the items position in the child list // we need to find the items position in the child list
size_t pos; size_t pos;
wxMenuItemList::Node *node = GetMenuItems().GetFirst(); wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
for ( pos = 0; node; pos++ ) for ( pos = 0; node; pos++ )
{ {
if ( node->GetData() == item ) if ( node->GetData() == item )
@@ -590,11 +590,12 @@ WXHMENU wxMenuBar::Create()
} }
else else
{ {
size_t count = GetMenuCount(); size_t count = GetMenuCount(), i;
for ( size_t i = 0; i < count; i++ ) wxMenuList::iterator it;
for ( i = 0, it = m_menus.begin(); i < count; i++, it++ )
{ {
if ( !::AppendMenu((HMENU)m_hMenu, MF_POPUP | MF_STRING, if ( !::AppendMenu((HMENU)m_hMenu, MF_POPUP | MF_STRING,
(UINT)m_menus[i]->GetHMenu(), (UINT)(*it)->GetHMenu(),
m_titles[i]) ) m_titles[i]) )
{ {
wxLogLastError(wxT("AppendMenu")); wxLogLastError(wxT("AppendMenu"));
@@ -811,9 +812,10 @@ void wxMenuBar::RebuildAccelTable()
// merge the accelerators of all menus into one accel table // merge the accelerators of all menus into one accel table
size_t nAccelCount = 0; size_t nAccelCount = 0;
size_t i, count = GetMenuCount(); 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 ) if ( nAccelCount )
@@ -821,9 +823,9 @@ void wxMenuBar::RebuildAccelTable()
wxAcceleratorEntry *accelEntries = new wxAcceleratorEntry[nAccelCount]; wxAcceleratorEntry *accelEntries = new wxAcceleratorEntry[nAccelCount];
nAccelCount = 0; 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); m_accelTable = wxAcceleratorTable(nAccelCount, accelEntries);

View File

@@ -262,7 +262,7 @@ void wxMenuItem::Check(bool check)
#endif // __WIN32__ #endif // __WIN32__
// 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 )

View File

@@ -135,7 +135,7 @@ wxWindow* wxWindow::GetWindowChild1(wxWindowID id)
if ( m_windowId == id ) if ( m_windowId == id )
return this; return this;
wxWindowList::Node *node = GetChildren().GetFirst(); wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
while ( node ) while ( node )
{ {
wxWindow* child = node->GetData(); wxWindow* child = node->GetData();

View File

@@ -114,14 +114,14 @@ void wxRadioButton::SetValue(bool value)
if ( value ) if ( value )
{ {
const wxWindowList& siblings = GetParent()->GetChildren(); 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?") ); wxCHECK_RET( nodeThis, _T("radio button not a child of its parent?") );
// if it's not the first item of the group ... // if it's not the first item of the group ...
if ( !HasFlag(wxRB_GROUP) ) if ( !HasFlag(wxRB_GROUP) )
{ {
// ... turn off all radio buttons before it // ... turn off all radio buttons before it
for ( wxWindowList::Node *nodeBefore = nodeThis->GetPrevious(); for ( wxWindowList::compatibility_iterator nodeBefore = nodeThis->GetPrevious();
nodeBefore; nodeBefore;
nodeBefore = nodeBefore->GetPrevious() ) nodeBefore = nodeBefore->GetPrevious() )
{ {
@@ -146,7 +146,7 @@ void wxRadioButton::SetValue(bool value)
} }
// ... and also turn off all buttons after this one // ... 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 = nodeAfter->GetNext() ) nodeAfter = nodeAfter->GetNext() )
{ {

View File

@@ -237,7 +237,7 @@ void wxTaskBarIcon::_OnRButtonDClick(wxEvent& e) { OnRButtonDClick(e); }
wxTaskBarIcon* wxTaskBarIcon::FindObjectForHWND(WXHWND hWnd) wxTaskBarIcon* wxTaskBarIcon::FindObjectForHWND(WXHWND hWnd)
{ {
wxTaskBarIconList::Node *node = sm_taskBarIcons.GetFirst(); wxTaskBarIconList::compatibility_iterator node = sm_taskBarIcons.GetFirst();
while (node) while (node)
{ {
wxTaskBarIcon *obj = node->GetData(); wxTaskBarIcon *obj = node->GetData();

View File

@@ -278,7 +278,7 @@ void wxToolBar::Recreate()
} }
// reparent all our children under the new toolbar // 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 = node->GetNext() ) 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 // 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 // different from pos if we use several separators to cover the space used
// by a control // by a control
wxToolBarToolsList::Node *node; wxToolBarToolsList::compatibility_iterator node;
for ( node = m_tools.GetFirst(); node; node = node->GetNext() ) for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
{ {
wxToolBarToolBase *tool2 = node->GetData(); wxToolBarToolBase *tool2 = node->GetData();
@@ -485,7 +485,7 @@ bool wxToolBar::Realize()
// First, add the bitmap: we use one bitmap for all toolbar buttons // First, add the bitmap: we use one bitmap for all toolbar buttons
// ---------------------------------------------------------------- // ----------------------------------------------------------------
wxToolBarToolsList::Node *node; wxToolBarToolsList::compatibility_iterator node;
int bitmapId = 0; int bitmapId = 0;
wxSize sizeBmp; wxSize sizeBmp;
@@ -1021,7 +1021,7 @@ static
wxToolBarToolBase *GetItemSkippingDummySpacers(const wxToolBarToolsList& tools, wxToolBarToolBase *GetItemSkippingDummySpacers(const wxToolBarToolsList& tools,
size_t index ) size_t index )
{ {
wxToolBarToolsList::Node* current = tools.GetFirst(); wxToolBarToolsList::compatibility_iterator current = tools.GetFirst();
for ( ; current != 0; current = current->GetNext() ) for ( ; current != 0; current = current->GetNext() )
{ {
@@ -1225,7 +1225,7 @@ bool wxToolBar::HandlePaint(WXWPARAM wParam, WXLPARAM lParam)
// any here // any here
// first of all, do we have any controls at all? // 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() ) for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
{ {
if ( node->GetData()->IsControl() ) if ( node->GetData()->IsControl() )

View File

@@ -23,6 +23,7 @@
#if wxUSE_TIMER #if wxUSE_TIMER
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/hashmap.h"
#include "wx/setup.h" #include "wx/setup.h"
#include "wx/window.h" #include "wx/window.h"
#include "wx/list.h" #include "wx/list.h"
@@ -40,7 +41,13 @@
// private functions // 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); UINT WINAPI _EXPORT wxTimerProc(HWND hwnd, WORD, int idTimer, DWORD);
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -75,9 +82,11 @@ void wxTimer::Init()
wxTimer::~wxTimer() wxTimer::~wxTimer()
{ {
long id = m_id;
wxTimer::Stop(); wxTimer::Stop();
wxTimerList.DeleteObject(this); wxTimerList.erase(id);
} }
bool wxTimer::Start(int milliseconds, bool oneShot) bool wxTimer::Start(int milliseconds, bool oneShot)
@@ -94,7 +103,7 @@ bool wxTimer::Start(int milliseconds, bool oneShot)
if ( m_id > 0 ) if ( m_id > 0 )
{ {
wxTimerList.Append(m_id, this); wxTimerList[m_id] = this;
return true; return true;
} }
@@ -112,7 +121,7 @@ void wxTimer::Stop()
{ {
::KillTimer(NULL, (UINT)m_id); ::KillTimer(NULL, (UINT)m_id);
wxTimerList.DeleteObject(this); wxTimerList.erase(m_id);
} }
m_id = 0; m_id = 0;
@@ -136,11 +145,13 @@ void wxProcessTimer(wxTimer& timer)
UINT WINAPI _EXPORT wxTimerProc(HWND WXUNUSED(hwnd), WORD, int idTimer, DWORD) UINT WINAPI _EXPORT wxTimerProc(HWND WXUNUSED(hwnd), WORD, int idTimer, DWORD)
{ {
wxNode *node = wxTimerList.Find((long)idTimer);
wxCHECK_MSG( node, 0, wxT("bogus timer id in wxTimerProc") ); wxTimerMap::iterator node = wxTimerList.find((long)idTimer);
wxProcessTimer(*(wxTimer *)node->GetData()); wxCHECK_MSG( node != wxTimerList.end(), 0,
wxT("bogus timer id in wxTimerProc") );
wxProcessTimer(*(node->second));
return 0; return 0;
} }

View File

@@ -725,7 +725,8 @@ wxTreeCtrl::~wxTreeCtrl()
// delete any attributes // delete any attributes
if ( m_hasAnyAttr ) 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(); delete (wxTreeItemAttr *)node->GetData();
} }

View File

@@ -262,7 +262,7 @@ wxWindow *wxWindowMSW::FindItem(long id) const
} }
#endif // wxUSE_CONTROLS #endif // wxUSE_CONTROLS
wxWindowList::Node *current = GetChildren().GetFirst(); wxWindowList::compatibility_iterator current = GetChildren().GetFirst();
while (current) while (current)
{ {
wxWindow *childWin = current->GetData(); wxWindow *childWin = current->GetData();
@@ -280,7 +280,7 @@ wxWindow *wxWindowMSW::FindItem(long id) const
// Find an item given the MS Windows handle // Find an item given the MS Windows handle
wxWindow *wxWindowMSW::FindItemByHWND(WXHWND hWnd, bool controlOnly) const wxWindow *wxWindowMSW::FindItemByHWND(WXHWND hWnd, bool controlOnly) const
{ {
wxWindowList::Node *current = GetChildren().GetFirst(); wxWindowList::compatibility_iterator current = GetChildren().GetFirst();
while (current) while (current)
{ {
wxWindow *parent = current->GetData(); 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 // 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, // hadn't been already disabled in the beginning should be enabled again,
// so we have to keep the list of those children // 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 = node->GetNext() ) node = node->GetNext() )
{ {
@@ -1946,7 +1946,7 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg)
{ {
// passimistic by default // passimistic by default
canSafelyCallIsDlgMsg = FALSE; canSafelyCallIsDlgMsg = FALSE;
for ( wxWindowList::Node *node = GetChildren().GetFirst(); for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
node; node;
node = node->GetNext() ) node = node->GetNext() )
{ {
@@ -2955,7 +2955,7 @@ bool wxWindowMSW::HandleNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
// correct button tooltips // correct button tooltips
#if 0 #if 0
// try all our children // try all our children
wxWindowList::Node *node = GetChildren().GetFirst(); wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
while ( node ) while ( node )
{ {
wxWindow *child = node->GetData(); wxWindow *child = node->GetData();
@@ -3612,7 +3612,7 @@ void wxWindowMSW::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(event))
// FIXME-MT // FIXME-MT
gs_hasStdCmap = FALSE; gs_hasStdCmap = FALSE;
} }
wxWindowList::Node *node = GetChildren().GetFirst(); wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
while ( node ) while ( node )
{ {
// Only propagate to non-top-level windows because Windows already // Only propagate to non-top-level windows because Windows already

View File

@@ -158,9 +158,9 @@ wxColour::wxColour( unsigned char red, unsigned char green, unsigned char blue )
void wxColour::InitFromName( const wxString &colourName ) void wxColour::InitFromName( const wxString &colourName )
{ {
wxNode *node = (wxNode *) NULL; wxNode *node = (wxNode *) NULL;
if ( (wxTheColourDatabase) && (node = wxTheColourDatabase->Find(colourName)) ) wxColour* col;
if ( (wxTheColourDatabase) && (col = wxTheColourDatabase->FindColourNoAdd(colourName)) )
{ {
wxColour *col = (wxColour*)node->GetData();
UnRef(); UnRef();
if (col) Ref( *col ); if (col) Ref( *col );
} }