int m_maxNoCommands;
wxList m_commands;
- wxNode* m_currentCommand;
+ wxList::compatibility_iterator m_currentCommand;
#if wxUSE_MENUS
wxMenu* m_commandEditMenu;
public:
// ctor
wxDataObjectComposite();
+ virtual ~wxDataObjectComposite();
// add data object (it will be deleted by wxDataObjectComposite, hence it
// must be allocated on the heap) whose format will become the preferred
class WXDLLEXPORT wxPenList : public wxList
{
- DECLARE_DYNAMIC_CLASS(wxPenList)
+ // DECLARE_DYNAMIC_CLASS(wxPenList)
public:
wxPenList() { }
- ~wxPenList();
+ virtual ~wxPenList();
void AddPen(wxPen *pen);
void RemovePen(wxPen *pen);
class WXDLLEXPORT wxBrushList : public wxList
{
- DECLARE_DYNAMIC_CLASS(wxBrushList)
+ // DECLARE_DYNAMIC_CLASS(wxBrushList)
public:
wxBrushList() { }
- ~wxBrushList();
+ virtual ~wxBrushList();
void AddBrush(wxBrush *brush);
void RemoveBrush(wxBrush *brush);
class WXDLLEXPORT wxFontList : public wxList
{
- DECLARE_DYNAMIC_CLASS(wxFontList)
+ // DECLARE_DYNAMIC_CLASS(wxFontList)
public:
wxFontList() { }
- ~wxFontList();
+ virtual ~wxFontList();
void AddFont(wxFont *font);
void RemoveFont(wxFont *font);
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
};
-class WXDLLEXPORT wxColourDatabase : public wxList
+class WXDLLEXPORT wxStringToColourHashMap;
+
+class WXDLLEXPORT wxColourDatabase
{
- DECLARE_CLASS(wxColourDatabase)
+ // DECLARE_CLASS(wxColourDatabase)
public:
- wxColourDatabase(int type);
- ~wxColourDatabase() ;
+ wxColourDatabase();
+ virtual ~wxColourDatabase() ;
// Not const because it may add a name to the database
wxColour *FindColour(const wxString& colour) ;
+ wxColour *FindColourNoAdd(const wxString& colour) const;
wxString FindName(const wxColour& colour) const;
void Initialize();
#ifdef __WXPM__
long* m_palTable;
size_t m_nSize;
#endif
+private:
+ wxColour* FindColour(const wxString& colour, bool add);
+
+ wxStringToColourHashMap* m_map;
};
class WXDLLEXPORT wxBitmapList : public wxList
{
- DECLARE_DYNAMIC_CLASS(wxBitmapList)
+ // DECLARE_DYNAMIC_CLASS(wxBitmapList)
public:
wxBitmapList();
- ~wxBitmapList();
+ virtual ~wxBitmapList();
void AddBitmap(wxBitmap *bitmap);
void RemoveBitmap(wxBitmap *bitmap);
{
public:
wxResourceCache() { }
+#if !wxUSE_STL
wxResourceCache(const unsigned int keyType) : wxList(keyType) { }
- ~wxResourceCache();
+#endif
+ virtual ~wxResourceCache();
private:
- DECLARE_DYNAMIC_CLASS(wxResourceCache)
+ // DECLARE_DYNAMIC_CLASS(wxResourceCache)
};
// ---------------------------------------------------------------------------
DECLARE_DYNAMIC_CLASS(wxPrintPaperType)
};
-class WXDLLEXPORT wxPrintPaperDatabase: public wxList
+class WXDLLEXPORT wxStringToPrintPaperTypeHashMap;
+class WXDLLEXPORT wxPrintPaperTypeList;
+
+class WXDLLEXPORT wxPrintPaperDatabase
{
public:
wxPrintPaperDatabase();
+ ~wxPrintPaperDatabase();
void CreateDatabase();
void ClearDatabase();
// Get the paper size
wxPaperSize GetSize(const wxSize& size);
+ //
+ wxPrintPaperType* Item(size_t index) const;
+ size_t GetCount() const;
private:
- DECLARE_DYNAMIC_CLASS(wxPrintPaperDatabase)
+ wxStringToPrintPaperTypeHashMap* m_map;
+ wxPrintPaperTypeList* m_list;
+ // DECLARE_DYNAMIC_CLASS(wxPrintPaperDatabase)
};
WXDLLEXPORT_DATA(extern wxPrintPaperDatabase*) wxThePrintPaperDatabase;
wxPendingEventsLocker = new wxCriticalSection;
#endif
- wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
+ wxTheColourDatabase = new wxColourDatabase;
wxTheColourDatabase->Initialize();
wxInitializeStockLists();
void wxAppBase::DeletePendingObjects()
{
- wxNode *node = wxPendingDelete.GetFirst();
+ wxList::compatibility_iterator node = wxPendingDelete.GetFirst();
while (node)
{
wxObject *obj = node->GetData();
delete obj;
if (wxPendingDelete.Member(obj))
- delete node;
+ wxPendingDelete.Erase(node);
// Deleting one object may have deleted other pending
// objects, so start from beginning of list again.
// Returns TRUE if more time is needed.
bool wxAppBase::ProcessIdle()
{
- wxWindowList::Node* node = wxTopLevelWindows.GetFirst();
+ wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
node = wxTopLevelWindows.GetFirst();
while (node)
{
{
bool needMore = FALSE;
- wxWindowList::Node* node = wxTopLevelWindows.GetFirst();
+ wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
while (node)
{
wxWindow* win = node->GetData();
needMore = event.MoreRequested();
}
- wxWindowList::Node *node = win->GetChildren().GetFirst();
+ wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst();
while ( node )
{
wxWindow *win = node->GetData();
if ( !sm_providers )
{
sm_providers = new wxArtProvidersList;
- sm_providers->DeleteContents(TRUE);
sm_cache = new wxArtProviderCache;
}
wxCHECK_MSG( sm_providers, FALSE, _T("no wxArtProvider exists") );
wxCHECK_MSG( sm_providers->GetCount() > 0, FALSE, _T("wxArtProviders stack is empty") );
- sm_providers->DeleteNode(sm_providers->GetFirst());
+ delete sm_providers->GetFirst()->GetData();
+ sm_providers->Erase(sm_providers->GetFirst());
sm_cache->Clear();
return TRUE;
}
if ( sm_providers->DeleteObject(provider) )
{
+ delete provider;
sm_cache->Clear();
return TRUE;
}
wxBitmap bmp;
if ( !sm_cache->GetBitmap(hashId, &bmp) )
{
- for (wxArtProvidersList::Node *node = sm_providers->GetFirst();
+ for (wxArtProvidersList::compatibility_iterator node = sm_providers->GetFirst();
node; node = node->GetNext())
{
bmp = node->GetData()->CreateBitmap(id, client, size);
wxCommandProcessor::wxCommandProcessor(int maxCommands)
{
m_maxNoCommands = maxCommands;
- m_currentCommand = (wxNode *) NULL;
#if wxUSE_MENUS
m_commandEditMenu = (wxMenu *) NULL;
#endif // wxUSE_MENUS
if ( (int)m_commands.GetCount() == m_maxNoCommands )
{
- wxNode *firstNode = m_commands.GetFirst();
+ wxList::compatibility_iterator firstNode = m_commands.GetFirst();
wxCommand *firstCommand = (wxCommand *)firstNode->GetData();
delete firstCommand;
- delete firstNode;
+ m_commands.Erase(firstNode);
}
// Correct a bug: we must chop off the current 'branch'
ClearCommands();
else
{
- wxNode *node = m_currentCommand->GetNext();
+ wxList::compatibility_iterator node = m_currentCommand->GetNext();
while (node)
{
- wxNode *next = node->GetNext();
+ wxList::compatibility_iterator next = node->GetNext();
delete (wxCommand *)node->GetData();
- delete node;
+ m_commands.Erase(node);
node = next;
}
}
bool wxCommandProcessor::Redo()
{
wxCommand *redoCommand = (wxCommand *) NULL;
- wxNode *redoNode = (wxNode *) NULL;
+ wxList::compatibility_iterator redoNode;
if ( m_currentCommand )
{
bool wxCommandProcessor::CanRedo() const
{
- if ((m_currentCommand != (wxNode*) NULL) && (m_currentCommand->GetNext() == (wxNode*) NULL))
+ if (m_currentCommand && !m_currentCommand->GetNext())
return FALSE;
- if ((m_currentCommand != (wxNode*) NULL) && (m_currentCommand->GetNext() != (wxNode*) NULL))
+ if (m_currentCommand && m_currentCommand->GetNext())
return TRUE;
- if ((m_currentCommand == (wxNode*) NULL) && (m_commands.GetCount() > 0))
+ if (!m_currentCommand && (m_commands.GetCount() > 0))
return TRUE;
return FALSE;
void wxCommandProcessor::ClearCommands()
{
- wxNode *node = m_commands.GetFirst();
+ wxList::compatibility_iterator node = m_commands.GetFirst();
while (node)
{
wxCommand *command = (wxCommand *)node->GetData();
delete command;
- delete node;
+ m_commands.Erase(node);
node = m_commands.GetFirst();
}
- m_currentCommand = (wxNode *) NULL;
+ m_currentCommand = wxList::compatibility_iterator();
}
// otherwise we can accept focus either if we have no children at all
// (in this case we're probably not used as a container) or only when
// at least one child will accept focus
- wxWindowList::Node *node = m_winParent->GetChildren().GetFirst();
+ wxWindowList::compatibility_iterator node = m_winParent->GetChildren().GetFirst();
if ( !node )
return TRUE;
// the node of the children list from which we should start looking for the
// next acceptable child
- wxWindowList::Node *node, *start_node;
+ wxWindowList::compatibility_iterator node, start_node;
// we should start from the first/last control and not from the one which
// had focus the last time if we're propagating the event downwards because
node = forward ? children.GetFirst() : children.GetLast();
// we want to cycle over all nodes
- start_node = (wxWindowList::Node *)NULL;
+ start_node = wxWindowList::compatibility_iterator();
}
else
{
}
else
{
- start_node = (wxWindowList::Node *)NULL;
+ start_node = wxWindowList::compatibility_iterator();
}
if ( !start_node && m_winLastFocused )
}
// set the focus to the first child who wants it
- wxWindowList::Node *node = win->GetChildren().GetFirst();
+ wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst();
while ( node )
{
wxWindow *child = node->GetData();
wxPoint *points = new wxPoint[n];
int i = 0;
- for ( wxNode *node = list->GetFirst(); node; node = node->GetNext(), i++ )
+ for ( wxList::compatibility_iterator node = list->GetFirst(); node; node = node->GetNext(), i++ )
{
wxPoint *point = (wxPoint *)node->GetData();
points[i].x = point->x;
wxPoint *points = new wxPoint[n];
int i = 0;
- for ( wxNode *node = list->GetFirst(); node; node = node->GetNext(), i++ )
+ for ( wxList::compatibility_iterator node = list->GetFirst(); node; node = node->GetNext(), i++ )
{
wxPoint *point = (wxPoint *)node->GetData();
points[i].x = point->x;
DrawSpline(&point_list);
- for( wxNode *node = point_list.GetFirst(); node; node = node->GetNext() )
+ for( wxList::compatibility_iterator node = point_list.GetFirst(); node; node = node->GetNext() )
{
wxPoint *p = (wxPoint *)node->GetData();
delete p;
static void wx_spline_draw_point_array(wxDCBase *dc)
{
dc->DrawLines(&wx_spline_point_list, 0, 0 );
- wxNode *node = wx_spline_point_list.GetFirst();
+ wxList::compatibility_iterator node = wx_spline_point_list.GetFirst();
while (node)
{
wxPoint *point = (wxPoint *)node->GetData();
delete point;
- delete node;
+ wx_spline_point_list.Erase(node);
node = wx_spline_point_list.GetFirst();
}
}
double cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;
double x1, y1, x2, y2;
- wxNode *node = points->GetFirst();
+ wxList::compatibility_iterator node = points->GetFirst();
p = (wxPoint *)node->GetData();
x1 = p->x;
wx_spline_add_point(x1, y1);
- while ((node = node->GetNext()) != NULL)
+ while ((node = node->GetNext()))
{
p = (wxPoint *)node->GetData();
x1 = x2;
wxDataObjectComposite::wxDataObjectComposite()
{
m_preferred = 0;
+}
- m_dataObjects.DeleteContents(TRUE);
+wxDataObjectComposite::~wxDataObjectComposite()
+{
+ WX_CLEAR_LIST(wxSimpleDataObjectList, m_dataObjects);
}
wxDataObjectSimple *
wxDataObjectComposite::GetObject(const wxDataFormat& format) const
{
- wxSimpleDataObjectList::Node *node = m_dataObjects.GetFirst();
+ wxSimpleDataObjectList::compatibility_iterator node = m_dataObjects.GetFirst();
while ( node )
{
wxDataObjectSimple *dataObj = node->GetData();
wxDataFormat
wxDataObjectComposite::GetPreferredFormat(Direction WXUNUSED(dir)) const
{
- wxSimpleDataObjectList::Node *node = m_dataObjects.Item( m_preferred );
+ wxSimpleDataObjectList::compatibility_iterator node = m_dataObjects.Item( m_preferred );
wxCHECK_MSG( node, wxFormatInvalid, wxT("no preferred format") );
Direction WXUNUSED(dir)) const
{
size_t n = 0;
- wxSimpleDataObjectList::Node *node;
+ wxSimpleDataObjectList::compatibility_iterator node;
for ( node = m_dataObjects.GetFirst(); node; node = node->GetNext() )
{
// TODO if ( !outputOnlyToo ) && this one counts ...
{
wxDocManager* manager = GetDocumentManager();
- wxNode *node = m_documentViews.GetFirst();
+ wxList::compatibility_iterator node = m_documentViews.GetFirst();
while (node)
{
wxView *view = (wxView *)node->GetData();
if (!view->Close())
return FALSE;
- wxNode *next = node->GetNext();
+ wxList::compatibility_iterator next = node->GetNext();
delete view; // Deletes node implicitly
node = next;
SetTitle(wxFileNameFromPath(fileName));
// Notify the views that the filename has changed
- wxNode *node = m_documentViews.GetFirst();
+ wxList::compatibility_iterator node = m_documentViews.GetFirst();
while (node)
{
wxView *view = (wxView *)node->GetData();
void wxDocument::UpdateAllViews(wxView *sender, wxObject *hint)
{
- wxNode *node = m_documentViews.GetFirst();
+ wxList::compatibility_iterator node = m_documentViews.GetFirst();
while (node)
{
wxView *view = (wxView *)node->GetData();
void wxDocument::NotifyClosing()
{
- wxNode *node = m_documentViews.GetFirst();
+ wxList::compatibility_iterator node = m_documentViews.GetFirst();
while (node)
{
wxView *view = (wxView *)node->GetData();
if ( notifyViews )
{
// Notify the views that the filename has changed
- wxNode *node = m_documentViews.GetFirst();
+ wxList::compatibility_iterator node = m_documentViews.GetFirst();
while (node)
{
wxView *view = (wxView *)node->GetData();
bool wxDocManager::CloseDocuments(bool force)
{
- wxNode *node = m_docs.GetFirst();
+ wxList::compatibility_iterator node = m_docs.GetFirst();
while (node)
{
wxDocument *doc = (wxDocument *)node->GetData();
- wxNode *next = node->GetNext();
-
+ wxList::compatibility_iterator next = node->GetNext();
+
if (!CloseDocument(doc, force))
return FALSE;
if (!CloseDocuments(force))
return FALSE;
- wxNode *node = m_templates.GetFirst();
+ wxList::compatibility_iterator node = m_templates.GetFirst();
while (node)
{
wxDocTemplate *templ = (wxDocTemplate*) node->GetData();
- wxNode* next = node->GetNext();
+ wxList::compatibility_iterator next = node->GetNext();
delete templ;
node = next;
}
wxDocTemplate *wxDocManager::SelectDocumentType(wxDocTemplate **templates,
int noTemplates, bool sort)
{
- wxArrayString strings(sort);
+ wxArrayString strings;
wxDocTemplate **data = new wxDocTemplate *[noTemplates];
int i;
int n = 0;
if (sort)
{
+ strings.Sort(wxStringSortAscending);
// Yes, this will be slow, but template lists
// are typically short.
int j;
wxDocTemplate *wxDocManager::SelectViewType(wxDocTemplate **templates,
int noTemplates, bool sort)
{
- wxArrayString strings(sort);
+ wxArrayString strings;
wxDocTemplate **data = new wxDocTemplate *[noTemplates];
int i;
int n = 0;
if (sort)
{
+ strings.Sort(wxStringSortAscending);
// Yes, this will be slow, but template lists
// are typically short.
int j;
// Move existing files (if any) down so we can insert file at beginning.
if (m_fileHistoryN < m_fileMaxFiles)
{
- wxNode* node = m_fileMenus.GetFirst();
+ wxList::compatibility_iterator node = m_fileMenus.GetFirst();
while (node)
{
wxMenu* menu = (wxMenu*) node->GetData();
wxString buf;
buf.Printf(s_MRUEntryFormat, i + 1, pathInMenu.c_str());
- wxNode* node = m_fileMenus.GetFirst();
+ wxList::compatibility_iterator node = m_fileMenus.GetFirst();
while (node)
{
wxMenu* menu = (wxMenu*) node->GetData();
m_fileHistory[j] = m_fileHistory[j + 1];
}
- wxNode* node = m_fileMenus.GetFirst();
+ wxList::compatibility_iterator node = m_fileMenus.GetFirst();
while ( node )
{
wxMenu* menu = (wxMenu*) node->GetData();
// delete the last separator too if no more files are left
if ( m_fileHistoryN == 1 )
{
- wxMenuItemList::Node *node = menu->GetMenuItems().GetLast();
+ wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetLast();
if ( node )
{
wxMenuItem *menuItem = node->GetData();
{
if (m_fileHistoryN > 0)
{
- wxNode* node = m_fileMenus.GetFirst();
+ wxList::compatibility_iterator node = m_fileMenus.GetFirst();
while (node)
{
wxMenu* menu = (wxMenu*) node->GetData();
#include "wx/dc.h"
#include "wx/utils.h"
#include "wx/settings.h"
+#include "wx/hashmap.h"
#include "wx/log.h"
#include <string.h>
#include "wx/mac/private.h"
#include "wx/mac/uma.h"
#endif
-IMPLEMENT_CLASS(wxColourDatabase, wxList)
-IMPLEMENT_DYNAMIC_CLASS(wxFontList, wxList)
-IMPLEMENT_DYNAMIC_CLASS(wxPenList, wxList)
-IMPLEMENT_DYNAMIC_CLASS(wxBrushList, wxList)
-IMPLEMENT_DYNAMIC_CLASS(wxBitmapList, wxList)
-IMPLEMENT_DYNAMIC_CLASS(wxResourceCache, wxList)
+//IMPLEMENT_CLASS(wxColourDatabase, wxList)
+//IMPLEMENT_DYNAMIC_CLASS(wxFontList, wxList)
+//IMPLEMENT_DYNAMIC_CLASS(wxPenList, wxList)
+//IMPLEMENT_DYNAMIC_CLASS(wxBrushList, wxList)
+//IMPLEMENT_DYNAMIC_CLASS(wxBitmapList, wxList)
+//IMPLEMENT_DYNAMIC_CLASS(wxResourceCache, wxList)
IMPLEMENT_ABSTRACT_CLASS(wxDCBase, wxObject)
return r.width != 0;
}
-wxColourDatabase::wxColourDatabase (int type) : wxList (type)
+WX_DECLARE_STRING_HASH_MAP( wxColour*, wxStringToColourHashMap );
+
+wxColourDatabase::wxColourDatabase ()
{
+ m_map = new wxStringToColourHashMap;
}
wxColourDatabase::~wxColourDatabase ()
{
- // Cleanup Colour allocated in Initialize()
- wxNode *node = GetFirst ();
- while (node)
- {
- wxColour *col = (wxColour *) node->GetData ();
- wxNode *next = node->GetNext ();
- delete col;
- node = next;
- }
+ typedef wxStringToColourHashMap::iterator iterator;
+
+ for( iterator it = m_map->begin(), en = m_map->end(); it != en; ++it )
+ delete it->second;
+
+ delete m_map;
+ m_map = NULL;
#ifdef __WXPM__
delete [] m_palTable;
#endif
for ( n = 0; n < WXSIZEOF(wxColourTable); n++ )
{
const wxColourDesc& cc = wxColourTable[n];
- Append(cc.name, new wxColour(cc.r,cc.g,cc.b));
+ (*m_map)[cc.name] = new wxColour(cc.r,cc.g,cc.b);
}
#ifdef __WXPM__
m_palTable = new long[n];
*/
wxColour *wxColourDatabase::FindColour(const wxString& colour)
+{
+ return FindColour(colour, true);
+}
+
+wxColour *wxColourDatabase::FindColourNoAdd(const wxString& colour) const
+{
+ return ((wxColourDatabase*)this)->FindColour(colour, false);
+}
+
+wxColour *wxColourDatabase::FindColour(const wxString& colour, bool add)
{
// VZ: make the comparaison case insensitive and also match both grey and
// gray
if ( !colName2.Replace(_T("GRAY"), _T("GREY")) )
colName2.clear();
- wxNode *node = GetFirst();
- while ( node )
- {
- const wxChar *key = node->GetKeyString();
- if ( colName == key || colName2 == key )
- {
- return (wxColour *)node->GetData();
- }
+ wxStringToColourHashMap::iterator it = m_map->find(colName);
+ if ( it == m_map->end() )
+ it = m_map->find(colName2);
+ if ( it != m_map->end() )
+ return it->second;
- node = node->GetNext();
- }
+ if ( !add )
+ return NULL;
#ifdef __WXMSW__
return NULL;
delete col;
return (wxColour *) NULL;
}
- Append( colour, col );
+ (*m_map)[colour] = col;
return col;
#endif
#endif
wxColour *col = new wxColour(r, g, b);
- Append(colour, col);
+ (*m_map)[colour] = col;
return col;
#endif // __X__
wxString wxColourDatabase::FindName (const wxColour& colour) const
{
- wxString name;
-
unsigned char red = colour.Red ();
unsigned char green = colour.Green ();
unsigned char blue = colour.Blue ();
- for (wxNode * node = GetFirst (); node; node = node->GetNext ())
+ typedef wxStringToColourHashMap::iterator iterator;
+
+ for (iterator it = m_map->begin(), en = m_map->end(); it != en; ++it )
{
- wxColour *col = (wxColour *) node->GetData ();
+ wxColour *col = it->second;
if (col->Red () == red && col->Green () == green && col->Blue () == blue)
- {
- const wxChar *found = node->GetKeyString();
- if ( found )
- {
- name = found;
-
- break;
- }
- }
+ return it->first;
}
- return name;
+ return wxEmptyString;
}
void wxInitializeStockLists()
wxBitmapList::~wxBitmapList ()
{
- wxNode *node = GetFirst ();
+ wxList::compatibility_iterator node = GetFirst ();
while (node)
{
wxBitmap *bitmap = (wxBitmap *) node->GetData ();
- wxNode *next = node->GetNext ();
+ wxList::compatibility_iterator next = node->GetNext ();
if (bitmap->GetVisible())
delete bitmap;
node = next;
// Pen and Brush lists
wxPenList::~wxPenList ()
{
- wxNode *node = GetFirst ();
+ wxList::compatibility_iterator node = GetFirst ();
while (node)
{
wxPen *pen = (wxPen *) node->GetData ();
- wxNode *next = node->GetNext ();
+ wxList::compatibility_iterator next = node->GetNext ();
if (pen->GetVisible())
delete pen;
node = next;
wxPen *wxPenList::FindOrCreatePen (const wxColour& colour, int width, int style)
{
- for (wxNode * node = GetFirst (); node; node = node->GetNext ())
+ for (wxList::compatibility_iterator node = GetFirst (); node; node = node->GetNext ())
{
wxPen *each_pen = (wxPen *) node->GetData ();
if (each_pen &&
wxBrushList::~wxBrushList ()
{
- wxNode *node = GetFirst ();
+ wxList::compatibility_iterator node = GetFirst ();
while (node)
{
wxBrush *brush = (wxBrush *) node->GetData ();
- wxNode *next = node->GetNext ();
+ wxList::compatibility_iterator next = node->GetNext ();
if (brush && brush->GetVisible())
delete brush;
node = next;
wxBrush *wxBrushList::FindOrCreateBrush (const wxColour& colour, int style)
{
- for (wxNode * node = GetFirst (); node; node = node->GetNext ())
+ for (wxList::compatibility_iterator node = GetFirst (); node; node = node->GetNext ())
{
wxBrush *each_brush = (wxBrush *) node->GetData ();
if (each_brush &&
wxFontList::~wxFontList ()
{
- wxNode *node = GetFirst ();
+ wxList::compatibility_iterator node = GetFirst ();
while (node)
{
// Only delete objects that are 'visible', i.e.
// where the pointers are expected to be shared
// (and therefore not deleted by any one part of an app).
wxFont *font = (wxFont *) node->GetData ();
- wxNode *next = node->GetNext ();
+ wxList::compatibility_iterator next = node->GetNext ();
if (font->GetVisible())
delete font;
node = next;
wxFontEncoding encoding)
{
wxFont *font = (wxFont *)NULL;
- wxNode *node;
+ wxList::compatibility_iterator node;
for ( node = GetFirst(); node; node = node->GetNext() )
{
font = (wxFont *)node->GetData();
wxResourceCache::~wxResourceCache ()
{
- wxNode *node = GetFirst ();
+ wxList::compatibility_iterator node = GetFirst ();
while (node) {
wxObject *item = (wxObject *)node->GetData();
delete item;
{
const wxList& list = GetHandlers();
- for ( wxList::Node *node = list.GetFirst(); node; node = node->GetNext() )
+ for ( wxList::compatibility_iterator node = list.GetFirst(); node; node = node->GetNext() )
{
wxImageHandler *handler=(wxImageHandler*)node->GetData();
if (handler->CanRead( stream ))
{
wxList &list=GetHandlers();
- for (wxList::Node *node = list.GetFirst(); node; node = node->GetNext())
+ for (wxList::compatibility_iterator node = list.GetFirst(); node; node = node->GetNext())
{
handler=(wxImageHandler*)node->GetData();
if ( handler->CanRead(stream) )
{
wxList &list=GetHandlers();
- for ( wxList::Node *node = list.GetFirst(); node; node = node->GetNext() )
+ for ( wxList::compatibility_iterator node = list.GetFirst(); node; node = node->GetNext() )
{
handler=(wxImageHandler*)node->GetData();
if ( handler->CanRead(stream) )
void wxImage::AddHandler( wxImageHandler *handler )
{
- // make sure that the memory will be freed at the program end
- sm_handlers.DeleteContents(true);
-
// Check for an existing handler of the type being added.
if (FindHandler( handler->GetType() ) == 0)
{
void wxImage::InsertHandler( wxImageHandler *handler )
{
- // make sure that the memory will be freed at the program end
- sm_handlers.DeleteContents(true);
-
// Check for an existing handler of the type being added.
if (FindHandler( handler->GetType() ) == 0)
{
if (handler)
{
sm_handlers.DeleteObject(handler);
+ delete handler;
return true;
}
else
wxImageHandler *wxImage::FindHandler( const wxString& name )
{
- wxNode *node = sm_handlers.GetFirst();
+ wxList::compatibility_iterator node = sm_handlers.GetFirst();
while (node)
{
wxImageHandler *handler = (wxImageHandler*)node->GetData();
wxImageHandler *wxImage::FindHandler( const wxString& extension, long bitmapType )
{
- wxNode *node = sm_handlers.GetFirst();
+ wxList::compatibility_iterator node = sm_handlers.GetFirst();
while (node)
{
wxImageHandler *handler = (wxImageHandler*)node->GetData();
wxImageHandler *wxImage::FindHandler( long bitmapType )
{
- wxNode *node = sm_handlers.GetFirst();
+ wxList::compatibility_iterator node = sm_handlers.GetFirst();
while (node)
{
wxImageHandler *handler = (wxImageHandler *)node->GetData();
wxImageHandler *wxImage::FindHandlerMime( const wxString& mimetype )
{
- wxNode *node = sm_handlers.GetFirst();
+ wxList::compatibility_iterator node = sm_handlers.GetFirst();
while (node)
{
wxImageHandler *handler = (wxImageHandler *)node->GetData();
void wxImage::CleanUpHandlers()
{
- wxNode *node = sm_handlers.GetFirst();
+ wxList::compatibility_iterator node = sm_handlers.GetFirst();
while (node)
{
wxImageHandler *handler = (wxImageHandler *)node->GetData();
- wxNode *next = node->GetNext();
+ wxList::compatibility_iterator next = node->GetNext();
delete handler;
- delete node;
node = next;
}
-}
+ sm_handlers.Clear();
+}
wxString wxImage::GetImageExtWildcard()
{
wxString fmts;
wxList& Handlers = wxImage::GetHandlers();
- wxNode* Node = Handlers.GetFirst();
+ wxList::compatibility_iterator Node = Handlers.GetFirst();
while ( Node )
{
wxImageHandler* Handler = (wxImageHandler*)Node->GetData();
return wxT("(") + fmts + wxT(")|") + fmts;
}
-
//-----------------------------------------------------------------------------
// wxImageHandler
//-----------------------------------------------------------------------------
// If the edge or dimension belongs to the parent, then we know the
// dimension is obtainable immediately. E.g. a wxExpandSizer may contain a
// button (but the button's true parent is a panel, not the sizer)
- if (other->GetChildren().Find(thisWin))
+ if (other->GetChildren().Find((wxWindow*)thisWin))
{
switch (which)
{
void wxMenuBase::Init(long style)
{
- m_items.DeleteContents(TRUE);
-
m_menuBar = (wxMenuBar *)NULL;
m_menuParent = (wxMenu *)NULL;
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.
}
{
wxCHECK_MSG( item, FALSE, wxT("invalid item in wxMenu::Insert()") );
- wxMenuItemList::Node *node = m_items.Item(pos);
+ wxMenuItemList::compatibility_iterator node = m_items.Item(pos);
wxCHECK_MSG( node, FALSE, wxT("invalid index in wxMenu::Insert()") );
m_items.Insert(node, item);
wxMenuItem *wxMenuBase::DoRemove(wxMenuItem *item)
{
- wxMenuItemList::Node *node = m_items.Find(item);
+ wxMenuItemList::compatibility_iterator node = m_items.Find(item);
// if we get here, the item is valid or one of Remove() functions is broken
wxCHECK_MSG( node, NULL, wxT("bug in wxMenu::Remove logic") );
// we detach the item, but we do delete the list node (i.e. don't call
// DetachNode() here!)
- node->SetData((wxMenuItem *)NULL); // to prevent it from deleting the item
- m_items.DeleteNode(node);
+ m_items.Erase(node);
// item isn't attached to anything any more
item->SetMenu((wxMenu *)NULL);
int wxMenuBase::FindItem(const wxString& text) const
{
wxString label = wxMenuItem::GetLabelFromText(text);
- for ( wxMenuItemList::Node *node = m_items.GetFirst();
+ for ( wxMenuItemList::compatibility_iterator node = m_items.GetFirst();
node;
node = node->GetNext() )
{
*itemMenu = NULL;
wxMenuItem *item = NULL;
- for ( wxMenuItemList::Node *node = m_items.GetFirst();
+ for ( wxMenuItemList::compatibility_iterator node = m_items.GetFirst();
node && !item;
node = node->GetNext() )
{
wxMenuItem *wxMenuBase::FindChildItem(int id, size_t *ppos) const
{
wxMenuItem *item = (wxMenuItem *)NULL;
- wxMenuItemList::Node *node = GetMenuItems().GetFirst();
+ wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
size_t pos;
for ( pos = 0; node; pos++ )
if ( !source )
source = this;
- wxMenuItemList::Node* node = GetMenuItems().GetFirst();
+ wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
while ( node )
{
wxMenuItem* item = node->GetData();
wxMenuBarBase::wxMenuBarBase()
{
- // we own the menus when we get them
- m_menus.DeleteContents(TRUE);
-
// not attached yet
m_menuBarFrame = NULL;
}
wxMenuBarBase::~wxMenuBarBase()
{
- // nothing to do, the list will delete the menus because of the call to
- // DeleteContents() above
+ WX_CLEAR_LIST(wxMenuList, m_menus);
}
// ----------------------------------------------------------------------------
wxMenu *wxMenuBarBase::GetMenu(size_t pos) const
{
- wxMenuList::Node *node = m_menus.Item(pos);
+ wxMenuList::compatibility_iterator node = m_menus.Item(pos);
wxCHECK_MSG( node, NULL, wxT("bad index in wxMenuBar::GetMenu()") );
return node->GetData();
{
wxCHECK_MSG( menu, FALSE, wxT("can't insert NULL menu") );
- wxMenuList::Node *node = m_menus.Item(pos);
+ wxMenuList::compatibility_iterator node = m_menus.Item(pos);
wxCHECK_MSG( node, FALSE, wxT("bad index in wxMenuBar::Insert()") );
m_menus.Insert(node, menu);
{
wxCHECK_MSG( menu, NULL, wxT("can't insert NULL menu") );
- wxMenuList::Node *node = m_menus.Item(pos);
+ wxMenuList::compatibility_iterator node = m_menus.Item(pos);
wxCHECK_MSG( node, NULL, wxT("bad index in wxMenuBar::Replace()") );
wxMenu *menuOld = node->GetData();
wxMenu *wxMenuBarBase::Remove(size_t pos)
{
- wxMenuList::Node *node = m_menus.Item(pos);
+ wxMenuList::compatibility_iterator node = m_menus.Item(pos);
wxCHECK_MSG( node, NULL, wxT("bad index in wxMenuBar::Remove()") );
- node = m_menus.DetachNode(node);
- wxCHECK( node, NULL ); // unexpected
wxMenu *menu = node->GetData();
+ wxCHECK( node, NULL ); // unexpected
+ m_menus.Erase(node);
menu->Detach();
- delete node;
-
return menu;
}
*menu = NULL;
wxMenuItem *item = NULL;
- size_t count = GetMenuCount();
- for ( size_t i = 0; !item && (i < count); i++ )
+ size_t count = GetMenuCount(), i;
+ wxMenuList::const_iterator it;
+ for ( i = 0, it = m_menus.begin(); !item && (i < count); i++, it++ )
{
- item = m_menus[i]->FindItem(id, menu);
+ item = (*it)->FindItem(id, menu);
}
return item;
wxString label = wxMenuItem::GetLabelFromText(menu);
int i = 0;
- wxMenuList::Node *node;
+ wxMenuList::compatibility_iterator node;
for ( node = m_menus.GetFirst(); node; node = node->GetNext(), i++ )
{
if ( label == wxMenuItem::GetLabelFromText(GetLabelTop(i)) )
#include "wx/paper.h"
#include "wx/module.h"
+#include "wx/hashmap.h"
#include <stdlib.h>
#include <string.h>
// End __WXMSW__
IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperType, wxObject)
-IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperDatabase, wxList)
+// IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperDatabase, wxList)
/*
* Paper size database for all platforms
* Print paper database for PostScript
*/
+WX_DECLARE_STRING_HASH_MAP(wxPrintPaperType*, wxStringToPrintPaperTypeHashMap);
+WX_DECLARE_LIST(wxPrintPaperType, wxPrintPaperTypeList);
+#include <wx/listimpl.cpp>
+WX_DEFINE_LIST(wxPrintPaperTypeList);
+
wxPrintPaperDatabase* wxThePrintPaperDatabase = (wxPrintPaperDatabase*) NULL;
-wxPrintPaperDatabase::wxPrintPaperDatabase():wxList(wxKEY_STRING)
+wxPrintPaperDatabase::wxPrintPaperDatabase()
+{
+ m_map = new wxStringToPrintPaperTypeHashMap;
+ m_list = new wxPrintPaperTypeList;
+}
+
+wxPrintPaperDatabase::~wxPrintPaperDatabase()
{
- DeleteContents(TRUE);
+ ClearDatabase();
}
void wxPrintPaperDatabase::CreateDatabase()
void wxPrintPaperDatabase::ClearDatabase()
{
- Clear();
+ delete m_list;
+ WX_CLEAR_HASH_MAP(wxStringToPrintPaperTypeHashMap, *m_map);
+ delete m_map;
}
void wxPrintPaperDatabase::AddPaperType(wxPaperSize paperId, const wxString& name, int w, int h)
{
- Append(name, new wxPrintPaperType(paperId, 0, name, w, h));
+ wxPrintPaperType* tmp = new wxPrintPaperType(paperId, 0, name, w, h);
+ (*m_map)[name] = tmp;
+ m_list->push_back(tmp);
}
void wxPrintPaperDatabase::AddPaperType(wxPaperSize paperId, int platformId, const wxString& name, int w, int h)
{
- Append(name, new wxPrintPaperType(paperId, platformId, name, w, h));
+ wxPrintPaperType* tmp = new wxPrintPaperType(paperId, platformId, name, w, h);
+ (*m_map)[name] = tmp;
+ m_list->push_back(tmp);
}
wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(const wxString& name)
{
- wxNode *node = Find(name);
- if (node)
- return (wxPrintPaperType *)node->GetData();
+ wxStringToPrintPaperTypeHashMap::iterator it = m_map->find(name);
+ if (it != m_map->end())
+ return it->second;
else
- return (wxPrintPaperType *) NULL;
+ return NULL;
}
wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(wxPaperSize id)
{
- wxNode *node = GetFirst();
- while (node)
+ typedef wxStringToPrintPaperTypeHashMap::iterator iterator;
+
+ for (iterator it = m_map->begin(), en = m_map->end(); it != en; ++it)
{
- wxPrintPaperType* paperType = (wxPrintPaperType*) node->GetData();
+ wxPrintPaperType* paperType = it->second;
if (paperType->GetId() == id)
return paperType;
- node = node->GetNext();
}
- return (wxPrintPaperType *) NULL;
+
+ return NULL;
}
wxPrintPaperType *wxPrintPaperDatabase::FindPaperTypeByPlatformId(int id)
{
- wxNode *node = GetFirst();
- while (node)
+ typedef wxStringToPrintPaperTypeHashMap::iterator iterator;
+
+ for (iterator it = m_map->begin(), en = m_map->end(); it != en; ++it)
{
- wxPrintPaperType* paperType = (wxPrintPaperType*) node->GetData();
+ wxPrintPaperType* paperType = it->second;
if (paperType->GetPlatformId() == id)
return paperType;
- node = node->GetNext();
}
- return (wxPrintPaperType *) NULL;
+
+ return NULL;
}
wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(const wxSize& sz)
{
- wxNode *node = GetFirst();
- while (node)
+ typedef wxStringToPrintPaperTypeHashMap::iterator iterator;
+
+ for (iterator it = m_map->begin(), en = m_map->end(); it != en; ++it)
{
- wxPrintPaperType* paperType = (wxPrintPaperType*) node->GetData();
+ wxPrintPaperType* paperType = it->second;
wxSize paperSize = paperType->GetSize() ;
if ( abs( paperSize.x - sz.x ) < 10 && abs( paperSize.y - sz.y ) < 10 )
return paperType;
- node = node->GetNext();
}
- return (wxPrintPaperType *) NULL;
+
+ return NULL;
}
// Convert name to size id
return wxPAPER_NONE;
}
+// QUICK and DIRTY
+size_t wxPrintPaperDatabase::GetCount() const
+{
+ return m_list->GetCount();
+}
+
+wxPrintPaperType* wxPrintPaperDatabase::Item(size_t index) const
+{
+ return m_list->Item(index)->GetData();
+}
+
// A module to allow initialization/cleanup of print paper
// things without calling these functions from app.cpp.
wxSizer::wxSizer()
: m_minSize( wxSize( 0, 0 ) )
{
- m_children.DeleteContents( true );
}
wxSizer::~wxSizer()
{
- Clear();
+ WX_CLEAR_LIST(wxSizerItemList, m_children);
}
void wxSizer::Add( wxWindow *window, int proportion, int flag, int border, wxObject* userData )
{
wxASSERT_MSG( sizer, _T("Removing NULL sizer") );
- wxSizerItemList::Node *node = m_children.GetFirst();
+ wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node)
{
wxSizerItem *item = node->GetData();
if (item->GetSizer() == sizer)
- return m_children.DeleteNode( node );
+ {
+ delete item;
+ m_children.Erase( node );
+ return true;
+ }
node = node->GetNext();
}
false,
_T("Remove index is out of range") );
- wxSizerItemList::Node *node = m_children.Item( index );
+ wxSizerItemList::compatibility_iterator node = m_children.Item( index );
wxCHECK_MSG( node, false, _T("Failed to find child node") );
if( item->IsWindow() )
item->GetWindow()->SetContainingSizer( NULL );
- return m_children.DeleteNode( node );
+ delete item;
+ m_children.Erase( node );
+ return true;
}
bool wxSizer::Detach( wxSizer *sizer )
{
wxASSERT_MSG( sizer, _T("Detaching NULL sizer") );
- wxSizerItemList::Node *node = m_children.GetFirst();
+ wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node)
{
wxSizerItem *item = node->GetData();
if (item->GetSizer() == sizer)
{
item->DetachSizer();
- return m_children.DeleteNode( node );
+ m_children.Erase( node );
+ return true;
}
node = node->GetNext();
}
{
wxASSERT_MSG( window, _T("Detaching NULL window") );
- wxSizerItemList::Node *node = m_children.GetFirst();
+ wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node)
{
wxSizerItem *item = node->GetData();
if (item->GetWindow() == window)
{
item->GetWindow()->SetContainingSizer( NULL );
- return m_children.DeleteNode( node );
+ m_children.Erase( node );
+ return true;
}
node = node->GetNext();
}
false,
_T("Detach index is out of range") );
- wxSizerItemList::Node *node = m_children.Item( index );
+ wxSizerItemList::compatibility_iterator node = m_children.Item( index );
wxCHECK_MSG( node, false, _T("Failed to find child node") );
else if( item->IsWindow() )
item->GetWindow()->SetContainingSizer( NULL );
- return m_children.DeleteNode( node );
+ m_children.Erase( node );
+ return true;
}
void wxSizer::Clear( bool delete_windows )
{
// First clear the ContainingSizer pointers
- wxSizerItemList::Node *node = m_children.GetFirst();
+ wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node)
{
wxSizerItem *item = node->GetData();
DeleteWindows();
// Now empty the list
- m_children.Clear();
+ WX_CLEAR_LIST(wxSizerItemList, m_children);
}
void wxSizer::DeleteWindows()
{
- wxSizerItemList::Node *node = m_children.GetFirst();
+ wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node)
{
wxSizerItem *item = node->GetData();
// Is it our immediate child?
- wxSizerItemList::Node *node = m_children.GetFirst();
+ wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node)
{
wxSizerItem *item = node->GetData();
// Is it our immediate child?
- wxSizerItemList::Node *node = m_children.GetFirst();
+ wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node)
{
wxSizerItem *item = node->GetData();
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") );
{
wxASSERT_MSG( window, _T("Show for NULL window") );
- wxSizerItemList::Node *node = m_children.GetFirst();
+ wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node)
{
wxSizerItem *item = node->GetData();
{
wxASSERT_MSG( sizer, _T("Show for NULL sizer") );
- wxSizerItemList::Node *node = m_children.GetFirst();
+ wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node)
{
wxSizerItem *item = node->GetData();
void wxSizer::ShowItems( bool show )
{
- wxSizerItemList::Node *node = m_children.GetFirst();
+ wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node)
{
node->GetData()->Show( show );
bool wxSizer::IsShown( wxWindow *window ) const
{
- wxSizerItemList::Node *node = m_children.GetFirst();
+ wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node)
{
wxSizerItem *item = node->GetData();
bool wxSizer::IsShown( wxSizer *sizer ) const
{
- wxSizerItemList::Node *node = m_children.GetFirst();
+ wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node)
{
wxSizerItem *item = node->GetData();
int i = r * ncols + c;
if (i < nitems)
{
- wxSizerItemList::Node *node = m_children.Item( i );
+ wxSizerItemList::compatibility_iterator node = m_children.Item( i );
wxASSERT_MSG( node, _T("Failed to find SizerItemList node") );
int w = 0;
int h = 0;
- wxSizerItemList::Node *node = m_children.GetFirst();
+ wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node)
{
wxSizerItem *item = node->GetData();
int i = r * ncols + c;
if (i < nitems)
{
- wxSizerItemList::Node *node = m_children.Item( i );
+ wxSizerItemList::compatibility_iterator node = m_children.Item( i );
wxASSERT_MSG( node, _T("Failed to find node") );
for( s = m_colWidths.GetCount(), i = 0; i < s; ++i )
m_colWidths[ i ] = -1;
- wxSizerItemList::Node *node = m_children.GetFirst();
+ wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
i = 0;
while (node)
wxPoint pt( m_position );
- wxSizerItemList::Node *node = m_children.GetFirst();
+ wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node)
{
wxSizerItem *item = node->GetData();
// Find how long each stretch unit needs to be
int stretchSize = 1;
- wxSizerItemList::Node *node = m_children.GetFirst();
+ wxSizerItemList::compatibility_iterator node = m_children.GetFirst();
while (node)
{
int maxX = 0;
int maxY = 0;
- wxWindowList::Node *node = m_notebook->GetChildren().GetFirst();
+ wxWindowList::compatibility_iterator node = m_notebook->GetChildren().GetFirst();
while (node)
{
wxWindow *item = node->GetData();
{
if(m_statusTextStacks[i])
{
- m_statusTextStacks[i]->Clear();
+ wxListString& t = *m_statusTextStacks[i];
+ WX_CLEAR_LIST(wxListString, t);
delete m_statusTextStacks[i];
}
}
{
wxListString *st = GetStatusStack(number);
wxCHECK_RET( st, _T("Unbalanced PushStatusText/PopStatusText") );
- wxListString::Node *top = st->GetFirst();
+ wxListString::compatibility_iterator top = st->GetFirst();
SetStatusText(*top->GetData(), number);
- st->DeleteNode(top);
+ delete top->GetData();
+ st->Erase(top);
if(st->GetCount() == 0)
{
delete st;
if(!m_statusTextStacks[i])
{
m_statusTextStacks[i] = new wxListString();
- m_statusTextStacks[i]->DeleteContents(TRUE);
}
return m_statusTextStacks[i];
wxToolBarBase::wxToolBarBase()
{
// the list owns the pointers
- m_tools.DeleteContents(TRUE);
-
m_xMargin = m_yMargin = 0;
m_maxRows = m_maxCols = 0;
wxControl *wxToolBarBase::FindControl( int id )
{
- for ( wxToolBarToolsList::Node* node = m_tools.GetFirst();
+ for ( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
node;
node = node->GetNext() )
{
wxToolBarToolBase *wxToolBarBase::RemoveTool(int id)
{
size_t pos = 0;
- wxToolBarToolsList::Node *node;
+ wxToolBarToolsList::compatibility_iterator node;
for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
{
if ( node->GetData()->GetId() == id )
return (wxToolBarToolBase *)NULL;
}
- // the node would delete the data, so set it to NULL to avoid this
- node->SetData(NULL);
-
- m_tools.DeleteNode(node);
+ m_tools.Erase(node);
return tool;
}
wxCHECK_MSG( pos < GetToolsCount(), FALSE,
_T("invalid position in wxToolBar::DeleteToolByPos()") );
- wxToolBarToolsList::Node *node = m_tools.Item(pos);
+ wxToolBarToolsList::compatibility_iterator node = m_tools.Item(pos);
if ( !DoDeleteTool(pos, node->GetData()) )
{
return FALSE;
}
- m_tools.DeleteNode(node);
+ delete node->GetData();
+ m_tools.Erase(node);
return TRUE;
}
bool wxToolBarBase::DeleteTool(int id)
{
size_t pos = 0;
- wxToolBarToolsList::Node *node;
+ wxToolBarToolsList::compatibility_iterator node;
for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
{
if ( node->GetData()->GetId() == id )
return FALSE;
}
- m_tools.DeleteNode(node);
+ delete node->GetData();
+ m_tools.Erase(node);
return TRUE;
}
{
wxToolBarToolBase *tool = (wxToolBarToolBase *)NULL;
- for ( wxToolBarToolsList::Node *node = m_tools.GetFirst();
+ for ( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
node;
node = node->GetNext() )
{
void wxToolBarBase::ClearTools()
{
- m_tools.Clear();
+ WX_CLEAR_LIST(wxToolBarToolsList, m_tools);
}
bool wxToolBarBase::Realize()
wxToolBarBase::~wxToolBarBase()
{
+ WX_CLEAR_LIST(wxToolBarToolsList, m_tools);
}
// ----------------------------------------------------------------------------
int wxToolBarBase::GetToolPos(int id) const
{
size_t pos = 0;
- wxToolBarToolsList::Node *node;
+ wxToolBarToolsList::compatibility_iterator node;
for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
{
wxEvtHandler* evtHandler = GetEventHandler() ;
- for ( wxToolBarToolsList::Node* node = m_tools.GetFirst();
+ for ( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
node;
node = node->GetNext() )
{
{
// do we have _exactly_ one child?
wxWindow *child = (wxWindow *)NULL;
- for ( wxWindowList::Node *node = GetChildren().GetFirst();
+ for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
node;
node = node->GetNext() )
{
m_validatorStyle = val.m_validatorStyle ;
m_stringValue = val.m_stringValue ;
- wxStringList::Node *node = val.m_includeList.GetFirst() ;
- while ( node )
- {
- wxChar *s = node->GetData();
- m_includeList.Add(s);
- node = node->GetNext();
- }
- node = val.m_excludeList.GetFirst() ;
- while ( node )
- {
- wxChar *s = node->GetData();
- m_excludeList.Add(s);
- node = node->GetNext();
- }
+ m_includeList = val.m_includeList;
+ m_excludeList = val.m_excludeList;
+
return TRUE;
}
void wxTextValidator::SetIncludeList(const wxStringList& list)
{
-/*
- if ( !M_VTEXTDATA )
- return;
-*/
-
- m_includeList.Clear();
- // TODO: replace with =
- wxStringList::Node *node = list.GetFirst();
- while ( node )
- {
- wxChar *s = node->GetData();
- m_includeList.Add(s);
- node = node->GetNext();
- }
+ m_includeList = list;
}
void wxTextValidator::SetExcludeList(const wxStringList& list)
{
-/*
- if ( !M_VTEXTDATA )
- return;
-*/
-
- m_excludeList.Clear();
- // TODO: replace with =
- wxStringList::Node *node = list.GetFirst() ;
- while ( node )
- {
- wxChar *s = node->GetData();
- m_excludeList.Add(s);
- node = node->GetNext();
- }
+ m_excludeList = list;
}
void wxTextValidator::OnChar(wxKeyEvent& event)
// no window yet, no parent nor children
m_parent = (wxWindow *)NULL;
m_windowId = -1;
- m_children.DeleteContents( FALSE ); // don't auto delete node data
// no constraints on the minimal window size
m_minWidth =
// Just in case we've loaded a top-level window via LoadNativeDialog but
// we weren't a dialog class
- wxTopLevelWindows.DeleteObject(this);
+ wxTopLevelWindows.DeleteObject((wxWindow*)this);
wxASSERT_MSG( GetChildren().GetCount() == 0, wxT("children not destroyed") );
bool wxWindowBase::DestroyChildren()
{
- wxWindowList::Node *node;
+ wxWindowList::compatibility_iterator node;
for ( ;; )
{
// we iterate until the list becomes empty
int maxX = 0,
maxY = 0;
- for ( wxWindowList::Node *node = GetChildren().GetFirst();
+ for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
node;
node = node->GetNext() )
{
int maxX = 0,
maxY = 0;
- for ( wxWindowList::Node *node = GetChildren().GetFirst();
+ for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
node;
node = node->GetNext() )
{
// this should never happen and it will lead to a crash later if it does
// because RemoveChild() will remove only one node from the children list
// and the other(s) one(s) will be left with dangling pointers in them
- wxASSERT_MSG( !GetChildren().Find(child), _T("AddChild() called twice") );
+ wxASSERT_MSG( !GetChildren().Find((wxWindow*)child), _T("AddChild() called twice") );
- GetChildren().Append(child);
+ GetChildren().Append((wxWindow*)child);
child->SetParent(this);
}
{
wxCHECK_RET( child, wxT("can't remove a NULL child") );
- GetChildren().DeleteObject(child);
- child->SetParent((wxWindow *)NULL);
+ GetChildren().DeleteObject((wxWindow *)child);
+ child->SetParent(NULL);
}
bool wxWindowBase::Reparent(wxWindowBase *newParent)
}
else
{
- wxTopLevelWindows.DeleteObject(this);
+ wxTopLevelWindows.DeleteObject((wxWindow *)this);
}
// add it to the new one
}
else
{
- wxTopLevelWindows.Append(this);
+ wxTopLevelWindows.Append((wxWindow *)this);
}
return TRUE;
return (wxWindow *)this;
wxWindowBase *res = (wxWindow *)NULL;
- wxWindowList::Node *node;
+ wxWindowList::compatibility_iterator node;
for ( node = m_children.GetFirst(); node && !res; node = node->GetNext() )
{
wxWindowBase *child = node->GetData();
return (wxWindow *)this;
wxWindowBase *res = (wxWindow *)NULL;
- wxWindowList::Node *node;
+ wxWindowList::compatibility_iterator node;
for ( node = m_children.GetFirst(); node && !res; node = node->GetNext() )
{
wxWindow *child = node->GetData();
return (wxWindow *)parent;
// It wasn't, so check all its children
- for ( wxWindowList::Node * node = parent->GetChildren().GetFirst();
+ for ( wxWindowList::compatibility_iterator node = parent->GetChildren().GetFirst();
node;
node = node->GetNext() )
{
}
// start at very top of wx's windows
- for ( wxWindowList::Node * node = wxTopLevelWindows.GetFirst();
+ for ( wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
node;
node = node->GetNext() )
{
// Disable all other windows
if ( IsTopLevel() )
{
- wxWindowList::Node *node = wxTopLevelWindows.GetFirst();
+ wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
while (node)
{
wxWindow *win = node->GetData();
#if wxUSE_VALIDATORS
bool recurse = (GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY) != 0;
- wxWindowList::Node *node;
+ wxWindowList::compatibility_iterator node;
for ( node = m_children.GetFirst(); node; node = node->GetNext() )
{
wxWindowBase *child = node->GetData();
#if wxUSE_VALIDATORS
bool recurse = (GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY) != 0;
- wxWindowList::Node *node;
+ wxWindowList::compatibility_iterator node;
for ( node = m_children.GetFirst(); node; node = node->GetNext() )
{
wxWindowBase *child = node->GetData();
#if wxUSE_VALIDATORS
bool recurse = (GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY) != 0;
- wxWindowList::Node *node;
+ wxWindowList::compatibility_iterator node;
for ( node = m_children.GetFirst(); node; node = node->GetNext() )
{
wxWindow *child = node->GetData();
{
if ( !m_constraintsInvolvedIn )
m_constraintsInvolvedIn = new wxWindowList;
- if ( !m_constraintsInvolvedIn->Find(otherWin) )
- m_constraintsInvolvedIn->Append(otherWin);
+ if ( !m_constraintsInvolvedIn->Find((wxWindow *)otherWin) )
+ m_constraintsInvolvedIn->Append((wxWindow *)otherWin);
}
// REMOVE back-pointer to other windows we're involved with.
void wxWindowBase::RemoveConstraintReference(wxWindowBase *otherWin)
{
if ( m_constraintsInvolvedIn )
- m_constraintsInvolvedIn->DeleteObject(otherWin);
+ m_constraintsInvolvedIn->DeleteObject((wxWindow *)otherWin);
}
// Reset any constraints that mention this window
{
if ( m_constraintsInvolvedIn )
{
- wxWindowList::Node *node = m_constraintsInvolvedIn->GetFirst();
+ wxWindowList::compatibility_iterator node = m_constraintsInvolvedIn->GetFirst();
while (node)
{
wxWindow *win = node->GetData();
constr->centreY.ResetIfWin(this);
}
- wxWindowList::Node *next = node->GetNext();
- delete node;
+ wxWindowList::compatibility_iterator next = node->GetNext();
+ m_constraintsInvolvedIn->Erase(node);
node = next;
}
int noChanges = 0;
// loop over all children setting their constraints
- for ( wxWindowList::Node *node = GetChildren().GetFirst();
+ for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
node;
node = node->GetNext() )
{
constr->centreY.SetDone(FALSE);
}
- wxWindowList::Node *node = GetChildren().GetFirst();
+ wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
while (node)
{
wxWindow *win = node->GetData();
if ( recurse )
{
- wxWindowList::Node *node = GetChildren().GetFirst();
+ wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
while (node)
{
wxWindow *win = node->GetData();
if (flags & wxUPDATE_UI_RECURSE)
{
- wxWindowList::Node* node = GetChildren().GetFirst();
+ wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
while (node)
{
wxWindow* child = (wxWindow*) node->GetData();
{
OnInternalIdle();
- wxWindowList::Node *node = GetChildren().GetFirst();
+ wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
while (node)
{
wxWindow *child = node->GetData();
// propagate the colour change event to the subwindows
void wxWindowBase::OnSysColourChanged(wxSysColourChangedEvent& event)
{
- wxWindowList::Node *node = GetChildren().GetFirst();
+ wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
while ( node )
{
// Only propagate to non-top-level windows
#endif
+#if !wxUSE_STL
// ----------------------------------------------------------------------------
// list classes implementation
// ----------------------------------------------------------------------------
{
delete (wxWindow *)GetData();
}
+#endif
// ----------------------------------------------------------------------------
// borders
case wxNAVDIR_DOWN:
case wxNAVDIR_NEXT:
{
- wxWindowList::Node *node = NULL;
+ wxWindowList::compatibility_iterator node = NULL;
if (fromId == 0)
{
// Can't navigate to sibling of this window
else
{
if (fromId <= (int) GetWindow()->GetChildren().GetCount())
- node = (wxWindowList::Node*) GetWindow()->GetChildren().Nth(fromId-1);
+ node = GetWindow()->GetChildren().Nth(fromId-1);
}
if (node && node->GetNext())
case wxNAVDIR_UP:
case wxNAVDIR_PREVIOUS:
{
- wxWindowList::Node *node = NULL;
+ wxWindowList::compatibility_iterator node = NULL;
if (fromId == 0)
{
// Can't navigate to sibling of this window
else
{
if (fromId <= (int) GetWindow()->GetChildren().GetCount())
- node = (wxWindowList::Node*) GetWindow()->GetChildren().Nth(fromId-1);
+ node = GetWindow()->GetChildren().Nth(fromId-1);
}
if (node && node->GetPrevious())
public:
wxAccelRefData()
{
- m_accels.DeleteContents(TRUE);
}
wxAccelRefData(const wxAccelRefData& data)
: wxObjectRefData()
{
- m_accels.DeleteContents(TRUE);
m_accels = data.m_accels;
}
+ virtual ~wxAccelRefData()
+ {
+ WX_CLEAR_LIST(wxAccelList, m_accels);
+ }
+
wxAccelList m_accels;
};
{
AllocExclusive();
- wxAccelList::Node *node = M_ACCELDATA->m_accels.GetFirst();
+ wxAccelList::compatibility_iterator node = M_ACCELDATA->m_accels.GetFirst();
while ( node )
{
const wxAcceleratorEntry *entryCur = node->GetData();
if ( *entryCur == entry )
{
- M_ACCELDATA->m_accels.DeleteNode(node);
+ delete node->GetData();
+ M_ACCELDATA->m_accels.Erase(node);
return;
}
return NULL;
}
- wxAccelList::Node *node = M_ACCELDATA->m_accels.GetFirst();
+ wxAccelList::compatibility_iterator node = M_ACCELDATA->m_accels.GetFirst();
while ( node )
{
const wxAcceleratorEntry *entry = node->GetData();
double a, b, c, d, x1, y1, x2, y2, x3, y3;
wxPoint *p, *q;
- wxNode *node = points->GetFirst();
+ wxList::compatibility_iterator node = points->GetFirst();
p = (wxPoint *)node->GetData();
x1 = p->x;
y1 = p->y;
CalcBoundingBox( (wxCoord)x1, (wxCoord)y1 );
CalcBoundingBox( (wxCoord)x3, (wxCoord)y3 );
- while ((node = node->GetNext()) != NULL)
+ while ((node = node->GetNext()))
{
q = (wxPoint *)node->GetData();
// Function which is called by quick sort. We want to override the default wxArrayString behaviour,
// and sort regardless of case.
-static int LINKAGEMODE wxDirCtrlStringCompareFunction(const void *first, const void *second)
+static int LINKAGEMODE wxDirCtrlStringCompareFunction(wxString* strFirst, wxString* strSecond)
{
- wxString *strFirst = (wxString *)first;
- wxString *strSecond = (wxString *)second;
-
return strFirst->CmpNoCase(*strSecond);
}
while (d.GetNext(& eachFilename));
}
}
- dirs.Sort((wxArrayString::CompareFunction) wxDirCtrlStringCompareFunction);
+ dirs.Sort(wxDirCtrlStringCompareFunction);
// Now do the filenames -- but only if we're allowed to
if ((GetWindowStyle() & wxDIRCTRL_DIR_ONLY) == 0)
while (d.GetNext(& eachFilename));
}
}
- filenames.Sort((wxArrayString::CompareFunction) wxDirCtrlStringCompareFunction);
+ filenames.Sort(wxDirCtrlStringCompareFunction);
}
// Add the sorted dirs
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;
}
m_HashTable = new wxHashTable(wxKEY_STRING);
m_smallImageList = new wxImageList(16, 16);
- m_HashTable->DeleteContents(TRUE);
// folder:
m_smallImageList->Add(wxArtProvider::GetBitmap(wxART_FOLDER, wxART_CMN_DIALOG));
// folder_open
if (GetIconID(wxEmptyString, _T("application/x-executable")) == file)
{
m_smallImageList->Add(wxArtProvider::GetBitmap(wxART_EXECUTABLE_FILE, wxART_CMN_DIALOG));
+ delete m_HashTable->Get(_T("exe"));
m_HashTable->Delete(_T("exe"));
m_HashTable->Put(_T("exe"), new wxFileIconEntry(executable));
}
bool wxGenericImageList::Create()
{
- m_images.DeleteContents( TRUE );
return TRUE;
}
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") );
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") );
if (index == (int) m_images.GetCount() - 1)
{
- m_images.DeleteNode( node );
+ delete node->GetData();
+ m_images.Erase( node );
m_images.Append( newBitmap );
}
else
{
- wxNode *next = node->GetNext();
- m_images.DeleteNode( node );
+ wxList::compatibility_iterator next = node->GetNext();
+ delete node->GetData();
+ m_images.Erase( node );
m_images.Insert( next, newBitmap );
}
bool wxGenericImageList::Remove( int index )
{
- wxNode *node = m_images.Item( index );
+ wxList::compatibility_iterator node = m_images.Item( index );
wxCHECK_MSG( node, FALSE, wxT("wrong index in image list") );
- m_images.DeleteNode( node );
+ delete node->GetData();
+ m_images.Erase( node );
return TRUE;
}
bool wxGenericImageList::RemoveAll()
{
+ WX_CLEAR_LIST(wxList, m_images);
m_images.Clear();
return TRUE;
width = 0;
height = 0;
- wxNode *node = m_images.Item( index );
+ wxList::compatibility_iterator node = m_images.Item( index );
wxCHECK_MSG( node, FALSE, wxT("wrong index in image list") );
bool wxGenericImageList::Draw( int index, wxDC &dc, int x, int y,
int flags, bool WXUNUSED(solidBackground) )
{
- wxNode *node = m_images.Item( index );
+ wxList::compatibility_iterator node = m_images.Item( index );
wxCHECK_MSG( node, FALSE, wxT("wrong index in image list") );
wxCalculateLayoutEvent event;
event.SetRect(rect);
- wxWindowList::Node *node = frame->GetChildren().GetFirst();
+ wxWindowList::compatibility_iterator node = frame->GetChildren().GetFirst();
while (node)
{
wxWindow* win = node->GetData();
// Find the last layout-aware window, so we can make it fill all remaining
// space.
wxWindow *lastAwareWindow = NULL;
- wxWindowList::Node *node = parent->GetChildren().GetFirst();
+ wxWindowList::compatibility_iterator node = parent->GetChildren().GetFirst();
while (node)
{
public:
wxListLineData(wxListMainWindow *owner);
- ~wxListLineData() { delete m_gi; }
+ ~wxListLineData()
+ {
+ WX_CLEAR_LIST(wxListItemDataList, m_items);
+ delete m_gi;
+ }
// are we in report mode?
inline bool InReportView() const;
wxListLineData::wxListLineData( wxListMainWindow *owner )
{
m_owner = owner;
- m_items.DeleteContents( TRUE );
if ( InReportView() )
{
void wxListLineData::CalculateSize( wxDC *dc, int spacing )
{
- wxListItemDataList::Node *node = m_items.GetFirst();
+ wxListItemDataList::compatibility_iterator node = m_items.GetFirst();
wxCHECK_RET( node, _T("no subitems at all??") );
wxListItemData *item = node->GetData();
int window_width,
int spacing )
{
- wxListItemDataList::Node *node = m_items.GetFirst();
+ wxListItemDataList::compatibility_iterator node = m_items.GetFirst();
wxCHECK_RET( node, _T("no subitems at all??") );
wxListItemData *item = node->GetData();
void wxListLineData::SetItem( int index, const wxListItem &info )
{
- wxListItemDataList::Node *node = m_items.Item( index );
+ wxListItemDataList::compatibility_iterator node = m_items.Item( index );
wxCHECK_RET( node, _T("invalid column index in SetItem") );
wxListItemData *item = node->GetData();
void wxListLineData::GetItem( int index, wxListItem &info )
{
- wxListItemDataList::Node *node = m_items.Item( index );
+ wxListItemDataList::compatibility_iterator node = m_items.Item( index );
if (node)
{
wxListItemData *item = node->GetData();
{
wxString s;
- wxListItemDataList::Node *node = m_items.Item( index );
+ wxListItemDataList::compatibility_iterator node = m_items.Item( index );
if (node)
{
wxListItemData *item = node->GetData();
void wxListLineData::SetText( int index, const wxString s )
{
- wxListItemDataList::Node *node = m_items.Item( index );
+ wxListItemDataList::compatibility_iterator node = m_items.Item( index );
if (node)
{
wxListItemData *item = node->GetData();
void wxListLineData::SetImage( int index, int image )
{
- wxListItemDataList::Node *node = m_items.Item( index );
+ wxListItemDataList::compatibility_iterator node = m_items.Item( index );
wxCHECK_RET( node, _T("invalid column index in SetImage()") );
wxListItemData *item = node->GetData();
int wxListLineData::GetImage( int index ) const
{
- wxListItemDataList::Node *node = m_items.Item( index );
+ wxListItemDataList::compatibility_iterator node = m_items.Item( index );
wxCHECK_MSG( node, -1, _T("invalid column index in GetImage()") );
wxListItemData *item = node->GetData();
wxListItemAttr *wxListLineData::GetAttr() const
{
- wxListItemDataList::Node *node = m_items.GetFirst();
+ wxListItemDataList::compatibility_iterator node = m_items.GetFirst();
wxCHECK_MSG( node, NULL, _T("invalid column index in GetAttr()") );
wxListItemData *item = node->GetData();
void wxListLineData::SetAttr(wxListItemAttr *attr)
{
- wxListItemDataList::Node *node = m_items.GetFirst();
+ wxListItemDataList::compatibility_iterator node = m_items.GetFirst();
wxCHECK_RET( node, _T("invalid column index in SetAttr()") );
wxListItemData *item = node->GetData();
void wxListLineData::Draw( wxDC *dc )
{
- wxListItemDataList::Node *node = m_items.GetFirst();
+ wxListItemDataList::compatibility_iterator node = m_items.GetFirst();
wxCHECK_RET( node, _T("no subitems at all??") );
bool highlighted = IsHighlighted();
y = rect.y + (LINE_SPACING + EXTRA_HEIGHT) / 2;
size_t col = 0;
- for ( wxListItemDataList::Node *node = m_items.GetFirst();
+ for ( wxListItemDataList::compatibility_iterator node = m_items.GetFirst();
node;
node = node->GetNext(), col++ )
{
void wxListMainWindow::Init()
{
- m_columns.DeleteContents( TRUE );
m_dirty = TRUE;
m_countVirt = 0;
m_lineFrom =
wxListMainWindow::~wxListMainWindow()
{
DoDeleteAllItems();
+ WX_CLEAR_LIST(wxListHeaderDataList, m_columns);
delete m_highlightBrush;
delete m_highlightUnfocusedBrush;
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") );
if ( headerWin )
headerWin->m_dirty = TRUE;
- wxListHeaderDataList::Node *node = m_columns.Item( col );
+ wxListHeaderDataList::compatibility_iterator node = m_columns.Item( col );
wxCHECK_RET( node, _T("no column?") );
wxListHeaderData *column = node->GetData();
for ( size_t i = 0; i < count; i++ )
{
wxListLineData *line = GetLine(i);
- wxListItemDataList::Node *n = line->m_items.Item( col );
+ wxListItemDataList::compatibility_iterator n = line->m_items.Item( col );
wxCHECK_RET( n, _T("no subitem?") );
void wxListMainWindow::GetColumn( int col, wxListItem &item ) const
{
- wxListHeaderDataList::Node *node = m_columns.Item( col );
+ wxListHeaderDataList::compatibility_iterator node = m_columns.Item( col );
wxCHECK_RET( node, _T("invalid column index in GetColumn") );
wxListHeaderData *column = node->GetData();
int wxListMainWindow::GetColumnWidth( int col ) const
{
- wxListHeaderDataList::Node *node = m_columns.Item( col );
+ wxListHeaderDataList::compatibility_iterator node = m_columns.Item( col );
wxCHECK_MSG( node, 0, _T("invalid column index") );
wxListHeaderData *column = node->GetData();
void wxListMainWindow::DeleteColumn( int col )
{
- wxListHeaderDataList::Node *node = m_columns.Item( col );
+ wxListHeaderDataList::compatibility_iterator node = m_columns.Item( col );
wxCHECK_RET( node, wxT("invalid column index in DeleteColumn()") );
m_dirty = TRUE;
- m_columns.DeleteNode( node );
+ delete node->GetData();
+ m_columns.Erase( node );
if ( !IsVirtual() )
{
for ( size_t i = 0; i < m_lines.GetCount(); i++ )
{
wxListLineData * const line = GetLine(i);
- wxListItemDataList::Node *n = line->m_items.Item( col );
- line->m_items.DeleteNode(n);
+ wxListItemDataList::compatibility_iterator n = line->m_items.Item( col );
+ delete n->GetData();
+ line->m_items.Erase(n);
}
}
void wxListMainWindow::DeleteEverything()
{
- m_columns.Clear();
+ WX_CLEAR_LIST(wxListHeaderDataList, m_columns);
DeleteAllItems();
}
bool insert = (col >= 0) && ((size_t)col < m_columns.GetCount());
if ( insert )
{
- wxListHeaderDataList::Node *node = m_columns.Item( col );
+ wxListHeaderDataList::compatibility_iterator node = m_columns.Item( col );
m_columns.Insert( node, column );
}
else
int selectedItem = m_paperTypeChoice->GetSelection();
if (selectedItem != -1)
{
- wxPrintPaperType *paper = (wxPrintPaperType*)wxThePrintPaperDatabase->Item(selectedItem)->GetData();
+ wxPrintPaperType *paper = wxThePrintPaperDatabase->Item(selectedItem);
if (paper != NULL)
m_printData.SetPaperId( paper->GetId());
}
for (size_t i = 0; i < n; i++)
{
- wxPrintPaperType *paper = (wxPrintPaperType *)wxThePrintPaperDatabase->Item(i)->GetData();
+ wxPrintPaperType *paper = wxThePrintPaperDatabase->Item(i);
choices[i] = paper->GetName();
if (m_printData.GetPaperId() == paper->GetId())
sel = i;
for (size_t i = 0; i < n; i++)
{
- wxPrintPaperType *paper = (wxPrintPaperType *)wxThePrintPaperDatabase->Item(i)->GetData();
+ wxPrintPaperType *paper = wxThePrintPaperDatabase->Item(i);
choices[i] = paper->GetName();
}
int selectedItem = m_paperTypeChoice->GetSelection();
if (selectedItem != -1)
{
- wxPrintPaperType *paper = (wxPrintPaperType*)wxThePrintPaperDatabase->Item(selectedItem)->GetData();
+ wxPrintPaperType *paper = wxThePrintPaperDatabase->Item(selectedItem);
if ( paper )
{
m_pageData.SetPaperSize(wxSize(paper->GetWidth()/10, paper->GetHeight()/10));
for (size_t i = 0; i < n; i++)
{
- wxPrintPaperType *paper = (wxPrintPaperType *)wxThePrintPaperDatabase->Item(i)->GetData();
+ wxPrintPaperType *paper = wxThePrintPaperDatabase->Item(i);
choices[i] = paper->GetName();
}
int maxToolHeight = 0;
// Find the maximum tool width and height
- wxToolBarToolsList::Node *node = m_tools.GetFirst();
+ wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
while ( node )
{
wxToolBarToolSimple *tool = (wxToolBarToolSimple *)node->GetData();
return;
count++;
- for ( wxToolBarToolsList::Node *node = m_tools.GetFirst();
+ for ( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
node;
node = node->GetNext() )
{
wxToolBarToolBase *wxToolBarSimple::FindToolForPosition(wxCoord x,
wxCoord y) const
{
- wxToolBarToolsList::Node *node = m_tools.GetFirst();
+ wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
while (node)
{
wxToolBarToolSimple *tool = (wxToolBarToolSimple *)node->GetData();
{
wxCHECK_RET( m_widget != NULL, wxT("invalid choice control") );
- wxNode *node = m_clientList.Item( n );
+ wxList::compatibility_iterator node = m_clientList.Item( n );
wxCHECK_RET( node, wxT("invalid index in wxChoice::DoSetItemClientData") );
node->SetData( (wxObject*) clientData );
{
wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid choice control") );
- wxNode *node = m_clientList.Item( n );
+ wxList::compatibility_iterator node = m_clientList.Item( n );
wxCHECK_MSG( node, NULL, wxT("invalid index in wxChoice::DoGetItemClientData") );
return node->GetData();
{
wxCHECK_RET( m_widget != NULL, wxT("invalid choice control") );
- wxNode *node = m_clientList.Item( n );
+ wxList::compatibility_iterator node = m_clientList.Item( n );
wxCHECK_RET( node, wxT("invalid index in wxChoice::DoSetItemClientObject") );
// wxItemContainer already deletes data for us
{
wxCHECK_MSG( m_widget != NULL, (wxClientData*) NULL, wxT("invalid choice control") );
- wxNode *node = m_clientList.Item( n );
+ wxList::compatibility_iterator node = m_clientList.Item( n );
wxCHECK_MSG( node, (wxClientData *)NULL,
wxT("invalid index in wxChoice::DoGetItemClientObject") );
// destroy the data (due to Robert's idea of using wxList<wxObject>
// and not wxList<wxClientData> we can't just say
// m_clientList.DeleteContents(TRUE) - this would crash!
- wxNode *node = m_clientList.GetFirst();
+ wxList::compatibility_iterator node = m_clientList.GetFirst();
while ( node )
{
delete (wxClientData *)node->GetData();
M_COLDATA->m_color.pixel = 0;
}
+
+
void wxColour::InitFromName( const wxString &colourName )
{
- wxNode *node = (wxNode *) NULL;
- if ( (wxTheColourDatabase) && (node = wxTheColourDatabase->Find(colourName)) )
+ wxColour* col = NULL;
+ if ( (wxTheColourDatabase) && (col = wxTheColourDatabase->FindColourNoAdd(colourName)) )
{
- wxColour *col = (wxColour*)node->GetData();
UnRef();
if (col) Ref( *col );
}
wxComboBox::~wxComboBox()
{
- wxNode *node = m_clientObjectList.GetFirst();
+ wxList::compatibility_iterator node = m_clientObjectList.GetFirst();
while (node)
{
wxClientData *cd = (wxClientData*)node->GetData();
{
wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
- wxNode *node = m_clientDataList.Item( n );
+ wxList::compatibility_iterator node = m_clientDataList.Item( n );
if (!node) return;
node->SetData( (wxObject*) clientData );
{
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;
}
{
wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
- wxNode *node = m_clientObjectList.Item( n );
+ wxList::compatibility_iterator node = m_clientObjectList.Item( n );
if (!node) return;
wxClientData *cd = (wxClientData*) node->GetData();
{
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;
}
GtkWidget *list = GTK_COMBO(m_widget)->list;
gtk_list_clear_items( GTK_LIST(list), 0, Number() );
- wxNode *node = m_clientObjectList.GetFirst();
+ wxList::compatibility_iterator node = m_clientObjectList.GetFirst();
while (node)
{
wxClientData *cd = (wxClientData*)node->GetData();
gtk_list_remove_items( listbox, list );
g_list_free( list );
- wxNode *node = m_clientObjectList.Item( n );
+ wxList::compatibility_iterator node = m_clientObjectList.Item( n );
if (node)
{
wxClientData *cd = (wxClientData*)node->GetData();
if (cd) delete cd;
- m_clientObjectList.DeleteNode( node );
+ m_clientObjectList.Erase( node );
}
node = m_clientDataList.Item( n );
if (node)
- m_clientDataList.DeleteNode( node );
-
+ m_clientDataList.Erase( node );
+
EnableEvents();
}
if (index != GetCount())
{
GtkAddItem( items[n], index );
- wxNode *node = m_clientList.Item( index );
+ wxList::compatibility_iterator node = m_clientList.Item( index );
m_clientList.Insert( node, (wxObject*) NULL );
}
else
}
else
{
- wxNode *node = m_clientList.Item( pos );
+ wxList::compatibility_iterator node = m_clientList.Item( pos );
for ( size_t n = 0; n < nItems; n++ )
{
GtkAddItem( items[n], pos+n );
{
GtkAddItem( item, index );
- wxNode *node = m_clientList.Item( index );
+ wxList::compatibility_iterator node = m_clientList.Item( index );
m_clientList.Insert( node, (wxObject *)NULL );
return index;
// destroy the data (due to Robert's idea of using wxList<wxObject>
// and not wxList<wxClientData> we can't just say
// m_clientList.DeleteContents(TRUE) - this would crash!
- wxNode *node = m_clientList.GetFirst();
+ wxList::compatibility_iterator node = m_clientList.GetFirst();
while ( node )
{
delete (wxClientData *)node->GetData();
gtk_list_remove_items( m_list, list );
g_list_free( list );
- wxNode *node = m_clientList.Item( n );
+ wxList::compatibility_iterator node = m_clientList.Item( n );
if ( node )
{
if ( m_clientDataItemsType == wxClientData_Object )
delete cd;
}
- m_clientList.DeleteNode( node );
+ m_clientList.Erase( node );
}
if ( m_strings )
{
wxCHECK_RET( m_widget != NULL, wxT("invalid listbox control") );
- wxNode *node = m_clientList.Item( n );
+ wxList::compatibility_iterator node = m_clientList.Item( n );
wxCHECK_RET( node, wxT("invalid index in wxListBox::DoSetItemClientData") );
node->SetData( (wxObject*) clientData );
{
wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid listbox control") );
- wxNode *node = m_clientList.Item( n );
+ wxList::compatibility_iterator node = m_clientList.Item( n );
wxCHECK_MSG( node, NULL, wxT("invalid index in wxListBox::DoGetItemClientData") );
return node->GetData();
{
wxCHECK_RET( m_widget != NULL, wxT("invalid listbox control") );
- wxNode *node = m_clientList.Item( n );
+ wxList::compatibility_iterator node = m_clientList.Item( n );
wxCHECK_RET( node, wxT("invalid index in wxListBox::DoSetItemClientObject") );
// wxItemContainer already deletes data for us
{
wxCHECK_MSG( m_widget != NULL, (wxClientData*) NULL, wxT("invalid listbox control") );
- wxNode *node = m_clientList.Item( n );
+ wxList::compatibility_iterator node = m_clientList.Item( n );
wxCHECK_MSG( node, (wxClientData *)NULL,
wxT("invalid index in wxListBox::DoGetItemClientObject") );
child = (wxMDIChildFrame*) NULL;
- wxWindowList::Node *node = client_window->GetChildren().GetFirst();
+ wxWindowList::compatibility_iterator node = client_window->GetChildren().GetFirst();
while (node)
{
wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame );
wxMDIChildFrame *active_child_frame = GetActiveChild();
bool visible_child_menu = false;
- wxWindowList::Node *node = m_clientWindow->GetChildren().GetFirst();
+ wxWindowList::compatibility_iterator node = m_clientWindow->GetChildren().GetFirst();
while (node)
{
wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame );
GtkNotebookPage* page = (GtkNotebookPage*) (g_list_nth(notebook->children,i)->data);
if (!page) return (wxMDIChildFrame*) NULL;
- wxWindowList::Node *node = m_clientWindow->GetChildren().GetFirst();
+ wxWindowList::compatibility_iterator node = m_clientWindow->GetChildren().GetFirst();
while (node)
{
wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame );
return;
}
- m_menus.DeleteContents( TRUE );
-
/* GTK 1.2.0 doesn't have gtk_item_factory_get_item(), but GTK 1.2.1 has. */
#if GTK_CHECK_VERSION(1, 2, 1)
m_accel = gtk_accel_group_new();
return;
}
- m_menus.DeleteContents( TRUE );
-
/* GTK 1.2.0 doesn't have gtk_item_factory_get_item(), but GTK 1.2.1 has. */
#if GTK_CHECK_VERSION(1, 2, 1)
m_accel = gtk_accel_group_new();
/* support for native hot keys */
gtk_accel_group_detach( menu->m_accel, ACCEL_OBJ_CAST(top_frame->m_widget) );
- wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
+ wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
while (node)
{
wxMenuItem *menuitem = node->GetData();
gtk_accel_group_attach( menu->m_accel, obj );
#endif // GTK+ 1.2.1+
- wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
+ wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
while (node)
{
wxMenuItem *menuitem = node->GetData();
gtk_accel_group_attach( m_accel, obj );
#endif // GTK+ 1.2.1+
- wxMenuList::Node *node = m_menus.GetFirst();
+ wxMenuList::compatibility_iterator node = m_menus.GetFirst();
while (node)
{
wxMenu *menu = node->GetData();
gtk_accel_group_detach( m_accel, ACCEL_OBJ_CAST(top_frame->m_widget) );
#endif // GTK+ 1.2.1+
- wxMenuList::Node *node = m_menus.GetFirst();
+ wxMenuList::compatibility_iterator node = m_menus.GetFirst();
while (node)
{
wxMenu *menu = node->GetData();
static wxMenu *CopyMenu (wxMenu *menu)
{
wxMenu *menucopy = new wxMenu ();
- wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
+ wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
while (node)
{
wxMenuItem *item = node->GetData();
return res;
}
- wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
+ wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
while (node)
{
wxMenuItem *item = node->GetData();
int wxMenuBar::FindMenuItem( const wxString &menuString, const wxString &itemString ) const
{
- wxMenuList::Node *node = m_menus.GetFirst();
+ wxMenuList::compatibility_iterator node = m_menus.GetFirst();
while (node)
{
wxMenu *menu = node->GetData();
{
wxMenuItem* result = menu->FindChildItem(id);
- wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
+ wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
while ( node && result == NULL )
{
wxMenuItem *item = node->GetData();
wxMenuItem* wxMenuBar::FindItem( int id, wxMenu **menuForItem ) const
{
wxMenuItem* result = 0;
- wxMenuList::Node *node = m_menus.GetFirst();
+ wxMenuList::compatibility_iterator node = m_menus.GetFirst();
while (node && result == 0)
{
wxMenu *menu = node->GetData();
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") );
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") );
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") );
wxMenu::~wxMenu()
{
- m_items.Clear();
+ WX_CLEAR_LIST(wxMenuItemList, m_items);
if ( GTK_IS_WIDGET( m_menu ))
gtk_widget_destroy( m_menu );
int wxMenu::FindMenuIdByMenuItem( GtkWidget *menuItem ) const
{
- wxMenuItemList::Node *node = m_items.GetFirst();
+ wxMenuItemList::compatibility_iterator node = m_items.GetFirst();
while (node)
{
wxMenuItem *item = node->GetData();
m_inSwitchPage = FALSE;
m_imageList = (wxImageList *) NULL;
- m_pagesData.DeleteContents( TRUE );
m_selection = -1;
m_themeEnabled = TRUE;
}
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 FALSE;
}
- wxNode *node = rb->m_boxes.Find( (wxObject*) widget );
+ wxList::compatibility_iterator node = rb->m_boxes.Find( (wxObject*) widget );
if (!node)
{
return FALSE;
wxRadioBox::~wxRadioBox()
{
- wxNode *node = m_boxes.GetFirst();
+ wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node)
{
GtkWidget *button = GTK_WIDGET( node->GetData() );
y = 15;
int max_len = 0;
- wxNode *node = m_boxes.Item( j*num_of_rows );
+ wxList::compatibility_iterator node = m_boxes.Item( j*num_of_rows );
for (int i1 = 0; i1< num_of_rows; i1++)
{
GtkWidget *button = GTK_WIDGET( node->GetData() );
{
int max = 0;
- wxNode *node = m_boxes.GetFirst();
+ wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node)
{
GtkWidget *button = GTK_WIDGET( node->GetData() );
if ((m_windowStyle & wxNO_BORDER) != 0)
gtk_widget_hide( m_widget );
- wxNode *node = m_boxes.GetFirst();
+ wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node)
{
GtkWidget *button = GTK_WIDGET( node->GetData() );
int count = 0;
- wxNode *node = m_boxes.GetFirst();
+ wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node)
{
GtkLabel *label = GTK_LABEL( BUTTON_CHILD(node->GetData()) );
if (m_boxes.GetCount() == 0) return;
- wxNode *node = m_boxes.GetFirst();
+ wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node)
{
GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->GetData() );
{
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") );
int count = 0;
- wxNode *node = m_boxes.GetFirst();
+ wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node)
{
GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->GetData() );
{
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_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") );
if ( !wxControl::Enable( enable ) )
return FALSE;
- wxNode *node = m_boxes.GetFirst();
+ wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node)
{
GtkButton *button = GTK_BUTTON( node->GetData() );
{
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( 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_MSG( m_widget != NULL, wxT(""), wxT("invalid radiobox") );
- wxNode *node = m_boxes.GetFirst();
+ wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node)
{
GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->GetData() );
void wxRadioBox::GtkDisableEvents()
{
- wxNode *node = m_boxes.GetFirst();
+ wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node)
{
gtk_signal_disconnect_by_func( GTK_OBJECT(node->GetData()),
void wxRadioBox::GtkEnableEvents()
{
- wxNode *node = m_boxes.GetFirst();
+ wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node)
{
gtk_signal_connect( GTK_OBJECT(node->GetData()), "clicked",
gtk_widget_set_style( m_widget, m_widgetStyle );
- wxNode *node = m_boxes.GetFirst();
+ wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node)
{
GtkWidget *widget = GTK_WIDGET( node->GetData() );
#if wxUSE_TOOLTIPS
void wxRadioBox::ApplyToolTip( GtkTooltips *tips, const wxChar *tip )
{
- wxNode *node = m_boxes.GetFirst();
+ wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node)
{
GtkWidget *widget = GTK_WIDGET( node->GetData() );
{
if (window == m_widget->window) return TRUE;
- wxNode *node = m_boxes.GetFirst();
+ wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node)
{
GtkWidget *button = GTK_WIDGET( node->GetData() );
{
// search backward for last group start
wxRadioButton *chief = (wxRadioButton*) NULL;
- wxWindowList::Node *node = parent->GetChildren().GetLast();
+ wxWindowList::compatibility_iterator node = parent->GetChildren().GetLast();
while (node)
{
wxWindow *child = node->GetData();
if ( tool->IsRadio() )
{
- wxToolBarToolsList::Node *node = pos ? m_tools.Item(pos - 1)
- : NULL;
+ wxToolBarToolsList::compatibility_iterator node;
+ if ( pos ) node = m_tools.Item(pos - 1);
+
while ( node )
{
wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
gdk_window_set_cursor( m_widget->window, cursor.GetCursor() );
}
- wxToolBarToolsList::Node *node = m_tools.GetFirst();
+ wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
while ( node )
{
wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
if ( winFocus == win )
return (wxWindow *)win;
- for ( wxWindowList::Node *node = win->GetChildren().GetFirst();
+ for ( wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst();
node;
node = node->GetNext() )
{
yy += pizza->yoffset;
}
- wxWindowList::Node *node = win->GetChildren().GetFirst();
+ wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst();
while (node)
{
wxWindowGTK *child = node->GetData();
// Recurse, so that children have the opportunity to Do The Right Thing
// and reset colours that have been messed up by a parent's (really ancestor's)
// Enable call
- for ( wxWindowList::Node *node = win->GetChildren().GetFirst();
+ for ( wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst();
node;
node = node->GetNext() )
{
static void SetInvokingWindow( wxMenu *menu, wxWindowGTK *win )
{
menu->SetInvokingWindow( win );
- wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
+ wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
while (node)
{
wxMenuItem *menuitem = node->GetData();
{
wxCHECK_RET( m_widget != NULL, wxT("invalid choice control") );
- wxNode *node = m_clientList.Item( n );
+ wxList::compatibility_iterator node = m_clientList.Item( n );
wxCHECK_RET( node, wxT("invalid index in wxChoice::DoSetItemClientData") );
node->SetData( (wxObject*) clientData );
{
wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid choice control") );
- wxNode *node = m_clientList.Item( n );
+ wxList::compatibility_iterator node = m_clientList.Item( n );
wxCHECK_MSG( node, NULL, wxT("invalid index in wxChoice::DoGetItemClientData") );
return node->GetData();
{
wxCHECK_RET( m_widget != NULL, wxT("invalid choice control") );
- wxNode *node = m_clientList.Item( n );
+ wxList::compatibility_iterator node = m_clientList.Item( n );
wxCHECK_RET( node, wxT("invalid index in wxChoice::DoSetItemClientObject") );
// wxItemContainer already deletes data for us
{
wxCHECK_MSG( m_widget != NULL, (wxClientData*) NULL, wxT("invalid choice control") );
- wxNode *node = m_clientList.Item( n );
+ wxList::compatibility_iterator node = m_clientList.Item( n );
wxCHECK_MSG( node, (wxClientData *)NULL,
wxT("invalid index in wxChoice::DoGetItemClientObject") );
// destroy the data (due to Robert's idea of using wxList<wxObject>
// and not wxList<wxClientData> we can't just say
// m_clientList.DeleteContents(TRUE) - this would crash!
- wxNode *node = m_clientList.GetFirst();
+ wxList::compatibility_iterator node = m_clientList.GetFirst();
while ( node )
{
delete (wxClientData *)node->GetData();
M_COLDATA->m_color.pixel = 0;
}
+
+
void wxColour::InitFromName( const wxString &colourName )
{
- wxNode *node = (wxNode *) NULL;
- if ( (wxTheColourDatabase) && (node = wxTheColourDatabase->Find(colourName)) )
+ wxColour* col = NULL;
+ if ( (wxTheColourDatabase) && (col = wxTheColourDatabase->FindColourNoAdd(colourName)) )
{
- wxColour *col = (wxColour*)node->GetData();
UnRef();
if (col) Ref( *col );
}
wxComboBox::~wxComboBox()
{
- wxNode *node = m_clientObjectList.GetFirst();
+ wxList::compatibility_iterator node = m_clientObjectList.GetFirst();
while (node)
{
wxClientData *cd = (wxClientData*)node->GetData();
{
wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
- wxNode *node = m_clientDataList.Item( n );
+ wxList::compatibility_iterator node = m_clientDataList.Item( n );
if (!node) return;
node->SetData( (wxObject*) clientData );
{
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;
}
{
wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
- wxNode *node = m_clientObjectList.Item( n );
+ wxList::compatibility_iterator node = m_clientObjectList.Item( n );
if (!node) return;
wxClientData *cd = (wxClientData*) node->GetData();
{
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;
}
GtkWidget *list = GTK_COMBO(m_widget)->list;
gtk_list_clear_items( GTK_LIST(list), 0, Number() );
- wxNode *node = m_clientObjectList.GetFirst();
+ wxList::compatibility_iterator node = m_clientObjectList.GetFirst();
while (node)
{
wxClientData *cd = (wxClientData*)node->GetData();
gtk_list_remove_items( listbox, list );
g_list_free( list );
- wxNode *node = m_clientObjectList.Item( n );
+ wxList::compatibility_iterator node = m_clientObjectList.Item( n );
if (node)
{
wxClientData *cd = (wxClientData*)node->GetData();
if (cd) delete cd;
- m_clientObjectList.DeleteNode( node );
+ m_clientObjectList.Erase( node );
}
node = m_clientDataList.Item( n );
if (node)
- m_clientDataList.DeleteNode( node );
-
+ m_clientDataList.Erase( node );
+
EnableEvents();
}
if (index != GetCount())
{
GtkAddItem( items[n], index );
- wxNode *node = m_clientList.Item( index );
+ wxList::compatibility_iterator node = m_clientList.Item( index );
m_clientList.Insert( node, (wxObject*) NULL );
}
else
}
else
{
- wxNode *node = m_clientList.Item( pos );
+ wxList::compatibility_iterator node = m_clientList.Item( pos );
for ( size_t n = 0; n < nItems; n++ )
{
GtkAddItem( items[n], pos+n );
{
GtkAddItem( item, index );
- wxNode *node = m_clientList.Item( index );
+ wxList::compatibility_iterator node = m_clientList.Item( index );
m_clientList.Insert( node, (wxObject *)NULL );
return index;
// destroy the data (due to Robert's idea of using wxList<wxObject>
// and not wxList<wxClientData> we can't just say
// m_clientList.DeleteContents(TRUE) - this would crash!
- wxNode *node = m_clientList.GetFirst();
+ wxList::compatibility_iterator node = m_clientList.GetFirst();
while ( node )
{
delete (wxClientData *)node->GetData();
gtk_list_remove_items( m_list, list );
g_list_free( list );
- wxNode *node = m_clientList.Item( n );
+ wxList::compatibility_iterator node = m_clientList.Item( n );
if ( node )
{
if ( m_clientDataItemsType == wxClientData_Object )
delete cd;
}
- m_clientList.DeleteNode( node );
+ m_clientList.Erase( node );
}
if ( m_strings )
{
wxCHECK_RET( m_widget != NULL, wxT("invalid listbox control") );
- wxNode *node = m_clientList.Item( n );
+ wxList::compatibility_iterator node = m_clientList.Item( n );
wxCHECK_RET( node, wxT("invalid index in wxListBox::DoSetItemClientData") );
node->SetData( (wxObject*) clientData );
{
wxCHECK_MSG( m_widget != NULL, NULL, wxT("invalid listbox control") );
- wxNode *node = m_clientList.Item( n );
+ wxList::compatibility_iterator node = m_clientList.Item( n );
wxCHECK_MSG( node, NULL, wxT("invalid index in wxListBox::DoGetItemClientData") );
return node->GetData();
{
wxCHECK_RET( m_widget != NULL, wxT("invalid listbox control") );
- wxNode *node = m_clientList.Item( n );
+ wxList::compatibility_iterator node = m_clientList.Item( n );
wxCHECK_RET( node, wxT("invalid index in wxListBox::DoSetItemClientObject") );
// wxItemContainer already deletes data for us
{
wxCHECK_MSG( m_widget != NULL, (wxClientData*) NULL, wxT("invalid listbox control") );
- wxNode *node = m_clientList.Item( n );
+ wxList::compatibility_iterator node = m_clientList.Item( n );
wxCHECK_MSG( node, (wxClientData *)NULL,
wxT("invalid index in wxListBox::DoGetItemClientObject") );
child = (wxMDIChildFrame*) NULL;
- wxWindowList::Node *node = client_window->GetChildren().GetFirst();
+ wxWindowList::compatibility_iterator node = client_window->GetChildren().GetFirst();
while (node)
{
wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame );
wxMDIChildFrame *active_child_frame = GetActiveChild();
bool visible_child_menu = false;
- wxWindowList::Node *node = m_clientWindow->GetChildren().GetFirst();
+ wxWindowList::compatibility_iterator node = m_clientWindow->GetChildren().GetFirst();
while (node)
{
wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame );
GtkNotebookPage* page = (GtkNotebookPage*) (g_list_nth(notebook->children,i)->data);
if (!page) return (wxMDIChildFrame*) NULL;
- wxWindowList::Node *node = m_clientWindow->GetChildren().GetFirst();
+ wxWindowList::compatibility_iterator node = m_clientWindow->GetChildren().GetFirst();
while (node)
{
wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame );
return;
}
- m_menus.DeleteContents( TRUE );
-
/* GTK 1.2.0 doesn't have gtk_item_factory_get_item(), but GTK 1.2.1 has. */
#if GTK_CHECK_VERSION(1, 2, 1)
m_accel = gtk_accel_group_new();
return;
}
- m_menus.DeleteContents( TRUE );
-
/* GTK 1.2.0 doesn't have gtk_item_factory_get_item(), but GTK 1.2.1 has. */
#if GTK_CHECK_VERSION(1, 2, 1)
m_accel = gtk_accel_group_new();
/* support for native hot keys */
gtk_accel_group_detach( menu->m_accel, ACCEL_OBJ_CAST(top_frame->m_widget) );
- wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
+ wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
while (node)
{
wxMenuItem *menuitem = node->GetData();
gtk_accel_group_attach( menu->m_accel, obj );
#endif // GTK+ 1.2.1+
- wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
+ wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
while (node)
{
wxMenuItem *menuitem = node->GetData();
gtk_accel_group_attach( m_accel, obj );
#endif // GTK+ 1.2.1+
- wxMenuList::Node *node = m_menus.GetFirst();
+ wxMenuList::compatibility_iterator node = m_menus.GetFirst();
while (node)
{
wxMenu *menu = node->GetData();
gtk_accel_group_detach( m_accel, ACCEL_OBJ_CAST(top_frame->m_widget) );
#endif // GTK+ 1.2.1+
- wxMenuList::Node *node = m_menus.GetFirst();
+ wxMenuList::compatibility_iterator node = m_menus.GetFirst();
while (node)
{
wxMenu *menu = node->GetData();
static wxMenu *CopyMenu (wxMenu *menu)
{
wxMenu *menucopy = new wxMenu ();
- wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
+ wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
while (node)
{
wxMenuItem *item = node->GetData();
return res;
}
- wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
+ wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
while (node)
{
wxMenuItem *item = node->GetData();
int wxMenuBar::FindMenuItem( const wxString &menuString, const wxString &itemString ) const
{
- wxMenuList::Node *node = m_menus.GetFirst();
+ wxMenuList::compatibility_iterator node = m_menus.GetFirst();
while (node)
{
wxMenu *menu = node->GetData();
{
wxMenuItem* result = menu->FindChildItem(id);
- wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
+ wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
while ( node && result == NULL )
{
wxMenuItem *item = node->GetData();
wxMenuItem* wxMenuBar::FindItem( int id, wxMenu **menuForItem ) const
{
wxMenuItem* result = 0;
- wxMenuList::Node *node = m_menus.GetFirst();
+ wxMenuList::compatibility_iterator node = m_menus.GetFirst();
while (node && result == 0)
{
wxMenu *menu = node->GetData();
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") );
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") );
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") );
wxMenu::~wxMenu()
{
- m_items.Clear();
+ WX_CLEAR_LIST(wxMenuItemList, m_items);
if ( GTK_IS_WIDGET( m_menu ))
gtk_widget_destroy( m_menu );
int wxMenu::FindMenuIdByMenuItem( GtkWidget *menuItem ) const
{
- wxMenuItemList::Node *node = m_items.GetFirst();
+ wxMenuItemList::compatibility_iterator node = m_items.GetFirst();
while (node)
{
wxMenuItem *item = node->GetData();
m_inSwitchPage = FALSE;
m_imageList = (wxImageList *) NULL;
- m_pagesData.DeleteContents( TRUE );
m_selection = -1;
m_themeEnabled = TRUE;
}
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 FALSE;
}
- wxNode *node = rb->m_boxes.Find( (wxObject*) widget );
+ wxList::compatibility_iterator node = rb->m_boxes.Find( (wxObject*) widget );
if (!node)
{
return FALSE;
wxRadioBox::~wxRadioBox()
{
- wxNode *node = m_boxes.GetFirst();
+ wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node)
{
GtkWidget *button = GTK_WIDGET( node->GetData() );
y = 15;
int max_len = 0;
- wxNode *node = m_boxes.Item( j*num_of_rows );
+ wxList::compatibility_iterator node = m_boxes.Item( j*num_of_rows );
for (int i1 = 0; i1< num_of_rows; i1++)
{
GtkWidget *button = GTK_WIDGET( node->GetData() );
{
int max = 0;
- wxNode *node = m_boxes.GetFirst();
+ wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node)
{
GtkWidget *button = GTK_WIDGET( node->GetData() );
if ((m_windowStyle & wxNO_BORDER) != 0)
gtk_widget_hide( m_widget );
- wxNode *node = m_boxes.GetFirst();
+ wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node)
{
GtkWidget *button = GTK_WIDGET( node->GetData() );
int count = 0;
- wxNode *node = m_boxes.GetFirst();
+ wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node)
{
GtkLabel *label = GTK_LABEL( BUTTON_CHILD(node->GetData()) );
if (m_boxes.GetCount() == 0) return;
- wxNode *node = m_boxes.GetFirst();
+ wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node)
{
GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->GetData() );
{
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") );
int count = 0;
- wxNode *node = m_boxes.GetFirst();
+ wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node)
{
GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->GetData() );
{
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_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") );
if ( !wxControl::Enable( enable ) )
return FALSE;
- wxNode *node = m_boxes.GetFirst();
+ wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node)
{
GtkButton *button = GTK_BUTTON( node->GetData() );
{
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( 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_MSG( m_widget != NULL, wxT(""), wxT("invalid radiobox") );
- wxNode *node = m_boxes.GetFirst();
+ wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node)
{
GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->GetData() );
void wxRadioBox::GtkDisableEvents()
{
- wxNode *node = m_boxes.GetFirst();
+ wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node)
{
gtk_signal_disconnect_by_func( GTK_OBJECT(node->GetData()),
void wxRadioBox::GtkEnableEvents()
{
- wxNode *node = m_boxes.GetFirst();
+ wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node)
{
gtk_signal_connect( GTK_OBJECT(node->GetData()), "clicked",
gtk_widget_set_style( m_widget, m_widgetStyle );
- wxNode *node = m_boxes.GetFirst();
+ wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node)
{
GtkWidget *widget = GTK_WIDGET( node->GetData() );
#if wxUSE_TOOLTIPS
void wxRadioBox::ApplyToolTip( GtkTooltips *tips, const wxChar *tip )
{
- wxNode *node = m_boxes.GetFirst();
+ wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node)
{
GtkWidget *widget = GTK_WIDGET( node->GetData() );
{
if (window == m_widget->window) return TRUE;
- wxNode *node = m_boxes.GetFirst();
+ wxList::compatibility_iterator node = m_boxes.GetFirst();
while (node)
{
GtkWidget *button = GTK_WIDGET( node->GetData() );
{
// search backward for last group start
wxRadioButton *chief = (wxRadioButton*) NULL;
- wxWindowList::Node *node = parent->GetChildren().GetLast();
+ wxWindowList::compatibility_iterator node = parent->GetChildren().GetLast();
while (node)
{
wxWindow *child = node->GetData();
if ( tool->IsRadio() )
{
- wxToolBarToolsList::Node *node = pos ? m_tools.Item(pos - 1)
- : NULL;
+ wxToolBarToolsList::compatibility_iterator node;
+ if ( pos ) node = m_tools.Item(pos - 1);
+
while ( node )
{
wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
gdk_window_set_cursor( m_widget->window, cursor.GetCursor() );
}
- wxToolBarToolsList::Node *node = m_tools.GetFirst();
+ wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
while ( node )
{
wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
if ( winFocus == win )
return (wxWindow *)win;
- for ( wxWindowList::Node *node = win->GetChildren().GetFirst();
+ for ( wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst();
node;
node = node->GetNext() )
{
yy += pizza->yoffset;
}
- wxWindowList::Node *node = win->GetChildren().GetFirst();
+ wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst();
while (node)
{
wxWindowGTK *child = node->GetData();
// Recurse, so that children have the opportunity to Do The Right Thing
// and reset colours that have been messed up by a parent's (really ancestor's)
// Enable call
- for ( wxWindowList::Node *node = win->GetChildren().GetFirst();
+ for ( wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst();
node;
node = node->GetNext() )
{
static void SetInvokingWindow( wxMenu *menu, wxWindowGTK *win )
{
menu->SetInvokingWindow( win );
- wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
+ wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst();
while (node)
{
wxMenuItem *menuitem = node->GetData();
// Check if there are any modal windows present,
// in which case we need to add a grab.
- for ( wxWindowList::Node * node = wxTopLevelWindows.GetFirst();
+ for ( wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
node;
node = node->GetNext() )
{
EVT_SPINCTRL(-1, wxHtmlHelpFrameOptionsDialog::OnUpdateSpin)
END_EVENT_TABLE()
-
void wxHtmlHelpFrame::OptionsDialog()
{
wxHtmlHelpFrameOptionsDialog dlg(this);
enu.EnumerateFacenames();
m_NormalFonts = new wxArrayString;
*m_NormalFonts = *enu.GetFacenames();
- m_NormalFonts->Sort();
+ m_NormalFonts->Sort(wxStringSortAscending);
}
if (m_FixedFonts == NULL)
{
enu.EnumerateFacenames(wxFONTENCODING_SYSTEM, TRUE);
m_FixedFonts = new wxArrayString;
*m_FixedFonts = *enu.GetFacenames();
- m_FixedFonts->Sort();
+ m_FixedFonts->Sort(wxStringSortAscending);
}
// VS: We want to show the font that is actually used by wxHtmlWindow.
{
while (RestoreState()) {}
DestroyDOMTree();
-
+
+ if (m_HandlersStack)
+ {
+ wxList& tmp = *m_HandlersStack;
+ wxList::iterator it, en;
+ for( it = tmp.begin(), en = tmp.end(); it != en; ++it )
+ delete (wxHashTable*)*it;
+ tmp.clear();
+ }
delete m_HandlersStack;
m_HandlersHash.Clear();
- m_HandlersList.DeleteContents(TRUE);
- m_HandlersList.Clear();
+ WX_CLEAR_LIST(wxList, m_HandlersList);
delete m_entitiesParser;
}
if (m_HandlersStack == NULL)
{
m_HandlersStack = new wxList;
- m_HandlersStack->DeleteContents(TRUE);
}
- m_HandlersStack->Insert(new wxHashTable(m_HandlersHash));
+ m_HandlersStack->Insert((wxObject*)new wxHashTable(m_HandlersHash));
while (tokenizer.HasMoreTokens())
{
void wxHtmlParser::PopTagHandler()
{
- wxNode *first;
+ wxList::compatibility_iterator first;
if (m_HandlersStack == NULL ||
- (first = m_HandlersStack->GetFirst()) == NULL)
+ !(first = m_HandlersStack->GetFirst()))
{
wxLogWarning(_("Warning: attempt to remove HTML tag handler from empty stack."));
return;
}
m_HandlersHash = *((wxHashTable*) first->GetData());
- m_HandlersStack->DeleteNode(first);
+ delete (wxHashTable*) first->GetData();
+ m_HandlersStack->Erase(first);
}
void wxHtmlParser::SetSourceAndSaveState(const wxString& src)
if (m_Cell) delete m_Cell;
+ WX_CLEAR_LIST(wxHtmlProcessorList, *m_Processors);
+
delete m_Parser;
delete m_FS;
delete m_History;
// pass HTML through registered processors:
if (m_Processors || m_GlobalProcessors)
{
- wxHtmlProcessorList::Node *nodeL, *nodeG;
+ wxHtmlProcessorList::compatibility_iterator nodeL, nodeG;
int prL, prG;
- nodeL = (m_Processors) ? m_Processors->GetFirst() : NULL;
- nodeG = (m_GlobalProcessors) ? m_GlobalProcessors->GetFirst() : NULL;
+ nodeL = (m_Processors) ? m_Processors->GetFirst() : wxHtmlProcessorList::compatibility_iterator();
+ nodeG = (m_GlobalProcessors) ? m_GlobalProcessors->GetFirst() : wxHtmlProcessorList::compatibility_iterator();
// VS: there are two lists, global and local, both of them sorted by
// priority. Since we have to go through _both_ lists with
else
{
- wxNode *node;
+ wxList::compatibility_iterator node;
wxString src = wxEmptyString;
if (m_RelatedStatusBar != -1)
if (!m_Processors)
{
m_Processors = new wxHtmlProcessorList;
- m_Processors->DeleteContents(TRUE);
}
- wxHtmlProcessorList::Node *node;
+ wxHtmlProcessorList::compatibility_iterator node;
for (node = m_Processors->GetFirst(); node; node = node->GetNext())
{
if (!m_GlobalProcessors)
{
m_GlobalProcessors = new wxHtmlProcessorList;
- m_GlobalProcessors->DeleteContents(TRUE);
}
- wxHtmlProcessorList::Node *node;
+ wxHtmlProcessorList::compatibility_iterator node;
for (node = m_GlobalProcessors->GetFirst(); node; node = node->GetNext())
{
void wxHtmlWindow::CleanUpStatics()
{
wxDELETE(m_DefaultFilter);
- m_Filters.DeleteContents(TRUE);
- m_Filters.Clear();
+ WX_CLEAR_LIST(wxList, m_Filters);
+ if (m_GlobalProcessors)
+ WX_CLEAR_LIST(wxHtmlProcessorList, *m_GlobalProcessors);
wxDELETE(m_GlobalProcessors);
}
void wxHtmlPrintout::CleanUpStatics()
{
- m_Filters.DeleteContents(TRUE);
- m_Filters.Clear();
+ WX_CLEAR_LIST(wxList, m_Filters);
}
// Adds input filter
wxHtmlFilterHTML defaultFilter;
wxString doc;
- wxNode* node = m_Filters.GetFirst();
+ wxList::compatibility_iterator node = m_Filters.GetFirst();
while (node)
{
wxHtmlFilter *h = (wxHtmlFilter*) node->GetData();
}
// fill in wxHtmlParser's tables:
- wxNode *node = m_Modules.GetFirst();
+ wxList::compatibility_iterator node = m_Modules.GetFirst();
while (node)
{
wxHtmlTagsModule *mod = (wxHtmlTagsModule*) node->GetData();
bool wxDialog::IsModalShowing() const
{
- return wxModalDialogs.Find((wxDialog *)this) != NULL; // const_cast
+ return wxModalDialogs.Find((wxDialog *)this); // const_cast
}
wxWindow *wxDialog::FindSuitableParent() const
if ( m_dir.Last() != _T('\\') )
dir += _T('\\');
- m_fileNames.Sort();
+ m_fileNames.Sort(wxStringSortAscending);
m_path = dir + m_fileName;
}
else
// on the desktop, but are iconized/restored with it
void wxFrame::IconizeChildFrames(bool bIconize)
{
- for ( wxWindowList::Node *node = GetChildren().GetFirst();
+ for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
node;
node = node->GetNext() )
{
wxGDIImageHandler *wxGDIImage::FindHandler(const wxString& name)
{
- wxGDIImageHandlerList::Node *node = ms_handlers.GetFirst();
+ wxGDIImageHandlerList::compatibility_iterator node = ms_handlers.GetFirst();
while ( node )
{
wxGDIImageHandler *handler = node->GetData();
wxGDIImageHandler *wxGDIImage::FindHandler(const wxString& extension,
long type)
{
- wxGDIImageHandlerList::Node *node = ms_handlers.GetFirst();
+ wxGDIImageHandlerList::compatibility_iterator node = ms_handlers.GetFirst();
while ( node )
{
wxGDIImageHandler *handler = node->GetData();
wxGDIImageHandler *wxGDIImage::FindHandler(long type)
{
- wxGDIImageHandlerList::Node *node = ms_handlers.GetFirst();
+ wxGDIImageHandlerList::compatibility_iterator node = ms_handlers.GetFirst();
while ( node )
{
wxGDIImageHandler *handler = node->GetData();
void wxGDIImage::CleanUpHandlers()
{
- wxGDIImageHandlerList::Node *node = ms_handlers.GetFirst();
+ wxGDIImageHandlerList::compatibility_iterator node = ms_handlers.GetFirst();
while ( node )
{
wxGDIImageHandler *handler = node->GetData();
- wxGDIImageHandlerList::Node *next = node->GetNext();
+ wxGDIImageHandlerList::compatibility_iterator next = node->GetNext();
delete handler;
- delete node;
+ ms_handlers.Erase( node );
node = next;
}
}
if ( IsMdiCommandId(id) )
{
- wxWindowList::Node *node = GetChildren().GetFirst();
+ wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
while ( node )
{
wxWindow *child = node->GetData();
{
if (GetParent())
{
- wxWindowList::Node *node = GetParent()->GetChildren().GetFirst();
+ wxWindowList::compatibility_iterator node = GetParent()->GetChildren().GetFirst();
while (node)
{
wxWindow *child = node->GetData();
if ( item->IsSubMenu() )
{
wxMenu *submenu = item->GetSubMenu();
- wxMenuItemList::Node *node = submenu->GetMenuItems().GetFirst();
+ wxMenuItemList::compatibility_iterator node = submenu->GetMenuItems().GetFirst();
while ( node )
{
UpdateAccel(node->GetData());
{
// we need to update its end item
item->SetRadioGroupStart(m_startRadioGroup);
- wxMenuItemList::Node *node = GetMenuItems().Item(m_startRadioGroup);
+ wxMenuItemList::compatibility_iterator node = GetMenuItems().Item(m_startRadioGroup);
if ( node )
{
{
// we need to find the items position in the child list
size_t pos;
- wxMenuItemList::Node *node = GetMenuItems().GetFirst();
+ wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst();
for ( pos = 0; node; pos++ )
{
if ( node->GetData() == item )
}
else
{
- size_t count = GetMenuCount();
- for ( size_t i = 0; i < count; i++ )
+ size_t count = GetMenuCount(), i;
+ wxMenuList::iterator it;
+ for ( i = 0, it = m_menus.begin(); i < count; i++, it++ )
{
if ( !::AppendMenu((HMENU)m_hMenu, MF_POPUP | MF_STRING,
- (UINT)m_menus[i]->GetHMenu(),
+ (UINT)(*it)->GetHMenu(),
m_titles[i]) )
{
wxLogLastError(wxT("AppendMenu"));
// merge the accelerators of all menus into one accel table
size_t nAccelCount = 0;
size_t i, count = GetMenuCount();
- for ( i = 0; i < count; i++ )
+ wxMenuList::iterator it;
+ for ( i = 0, it = m_menus.begin(); i < count; i++, it++ )
{
- nAccelCount += m_menus[i]->GetAccelCount();
+ nAccelCount += (*it)->GetAccelCount();
}
if ( nAccelCount )
wxAcceleratorEntry *accelEntries = new wxAcceleratorEntry[nAccelCount];
nAccelCount = 0;
- for ( i = 0; i < count; i++ )
+ for ( i = 0, it = m_menus.begin(); i < count; i++, it++ )
{
- nAccelCount += m_menus[i]->CopyAccels(&accelEntries[nAccelCount]);
+ nAccelCount += (*it)->CopyAccels(&accelEntries[nAccelCount]);
}
m_accelTable = wxAcceleratorTable(nAccelCount, accelEntries);
#endif // __WIN32__
// also uncheck all the other items in this radio group
- wxMenuItemList::Node *node = items.Item(start);
+ wxMenuItemList::compatibility_iterator node = items.Item(start);
for ( int n = start; n <= end && node; n++ )
{
if ( n != pos )
if ( m_windowId == id )
return this;
- wxWindowList::Node *node = GetChildren().GetFirst();
+ wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
while ( node )
{
wxWindow* child = node->GetData();
if ( value )
{
const wxWindowList& siblings = GetParent()->GetChildren();
- wxWindowList::Node *nodeThis = siblings.Find(this);
+ wxWindowList::compatibility_iterator nodeThis = siblings.Find(this);
wxCHECK_RET( nodeThis, _T("radio button not a child of its parent?") );
// if it's not the first item of the group ...
if ( !HasFlag(wxRB_GROUP) )
{
// ... turn off all radio buttons before it
- for ( wxWindowList::Node *nodeBefore = nodeThis->GetPrevious();
+ for ( wxWindowList::compatibility_iterator nodeBefore = nodeThis->GetPrevious();
nodeBefore;
nodeBefore = nodeBefore->GetPrevious() )
{
}
// ... and also turn off all buttons after this one
- for ( wxWindowList::Node *nodeAfter = nodeThis->GetNext();
+ for ( wxWindowList::compatibility_iterator nodeAfter = nodeThis->GetNext();
nodeAfter;
nodeAfter = nodeAfter->GetNext() )
{
wxTaskBarIcon* wxTaskBarIcon::FindObjectForHWND(WXHWND hWnd)
{
- wxTaskBarIconList::Node *node = sm_taskBarIcons.GetFirst();
+ wxTaskBarIconList::compatibility_iterator node = sm_taskBarIcons.GetFirst();
while (node)
{
wxTaskBarIcon *obj = node->GetData();
}
// reparent all our children under the new toolbar
- for ( wxWindowList::Node *node = m_children.GetFirst();
+ for ( wxWindowList::compatibility_iterator node = m_children.GetFirst();
node;
node = node->GetNext() )
{
// first determine the position of the first button to delete: it may be
// different from pos if we use several separators to cover the space used
// by a control
- wxToolBarToolsList::Node *node;
+ wxToolBarToolsList::compatibility_iterator node;
for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
{
wxToolBarToolBase *tool2 = node->GetData();
// First, add the bitmap: we use one bitmap for all toolbar buttons
// ----------------------------------------------------------------
- wxToolBarToolsList::Node *node;
+ wxToolBarToolsList::compatibility_iterator node;
int bitmapId = 0;
wxSize sizeBmp;
wxToolBarToolBase *GetItemSkippingDummySpacers(const wxToolBarToolsList& tools,
size_t index )
{
- wxToolBarToolsList::Node* current = tools.GetFirst();
+ wxToolBarToolsList::compatibility_iterator current = tools.GetFirst();
for ( ; current != 0; current = current->GetNext() )
{
// any here
// first of all, do we have any controls at all?
- wxToolBarToolsList::Node *node;
+ wxToolBarToolsList::compatibility_iterator node;
for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
{
if ( node->GetData()->IsControl() )
#if wxUSE_TIMER
#ifndef WX_PRECOMP
+ #include "wx/hashmap.h"
#include "wx/setup.h"
#include "wx/window.h"
#include "wx/list.h"
// private functions
// ----------------------------------------------------------------------------
-wxList wxTimerList(wxKEY_INTEGER);
+WX_DECLARE_HASH_MAP( long,
+ wxTimer*,
+ wxIntegerHash,
+ wxIntegerEqual,
+ wxTimerMap );
+
+wxTimerMap wxTimerList;
UINT WINAPI _EXPORT wxTimerProc(HWND hwnd, WORD, int idTimer, DWORD);
// ----------------------------------------------------------------------------
wxTimer::~wxTimer()
{
+ long id = m_id;
+
wxTimer::Stop();
- wxTimerList.DeleteObject(this);
+ wxTimerList.erase(id);
}
bool wxTimer::Start(int milliseconds, bool oneShot)
if ( m_id > 0 )
{
- wxTimerList.Append(m_id, this);
+ wxTimerList[m_id] = this;
return true;
}
{
::KillTimer(NULL, (UINT)m_id);
- wxTimerList.DeleteObject(this);
+ wxTimerList.erase(m_id);
}
m_id = 0;
UINT WINAPI _EXPORT wxTimerProc(HWND WXUNUSED(hwnd), WORD, int idTimer, DWORD)
{
- wxNode *node = wxTimerList.Find((long)idTimer);
+
+ wxTimerMap::iterator node = wxTimerList.find((long)idTimer);
- wxCHECK_MSG( node, 0, wxT("bogus timer id in wxTimerProc") );
+ wxCHECK_MSG( node != wxTimerList.end(), 0,
+ wxT("bogus timer id in wxTimerProc") );
- wxProcessTimer(*(wxTimer *)node->GetData());
+ wxProcessTimer(*(node->second));
return 0;
}
// delete any attributes
if ( m_hasAnyAttr )
{
- for ( wxNode *node = m_attrs.Next(); node; node = m_attrs.Next() )
+ for ( wxHashTable::compatibility_iterator node = m_attrs.Next();
+ node; node = m_attrs.Next() )
{
delete (wxTreeItemAttr *)node->GetData();
}
}
#endif // wxUSE_CONTROLS
- wxWindowList::Node *current = GetChildren().GetFirst();
+ wxWindowList::compatibility_iterator current = GetChildren().GetFirst();
while (current)
{
wxWindow *childWin = current->GetData();
// Find an item given the MS Windows handle
wxWindow *wxWindowMSW::FindItemByHWND(WXHWND hWnd, bool controlOnly) const
{
- wxWindowList::Node *current = GetChildren().GetFirst();
+ wxWindowList::compatibility_iterator current = GetChildren().GetFirst();
while (current)
{
wxWindow *parent = current->GetData();
// well but when it is enabled back, only those of the children which
// hadn't been already disabled in the beginning should be enabled again,
// so we have to keep the list of those children
- for ( wxWindowList::Node *node = GetChildren().GetFirst();
+ for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
node;
node = node->GetNext() )
{
{
// passimistic by default
canSafelyCallIsDlgMsg = FALSE;
- for ( wxWindowList::Node *node = GetChildren().GetFirst();
+ for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
node;
node = node->GetNext() )
{
// correct button tooltips
#if 0
// try all our children
- wxWindowList::Node *node = GetChildren().GetFirst();
+ wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
while ( node )
{
wxWindow *child = node->GetData();
// FIXME-MT
gs_hasStdCmap = FALSE;
}
- wxWindowList::Node *node = GetChildren().GetFirst();
+ wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
while ( node )
{
// Only propagate to non-top-level windows because Windows already
void wxColour::InitFromName( const wxString &colourName )
{
wxNode *node = (wxNode *) NULL;
- if ( (wxTheColourDatabase) && (node = wxTheColourDatabase->Find(colourName)) )
+ wxColour* col;
+ if ( (wxTheColourDatabase) && (col = wxTheColourDatabase->FindColourNoAdd(colourName)) )
{
- wxColour *col = (wxColour*)node->GetData();
UnRef();
if (col) Ref( *col );
}