Make wxCocoa work with wxUSE_STL==1:

Use compatibility_iterator instead of Node and Erase instead of DeleteNode


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26350 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Elliott
2004-03-26 03:11:51 +00:00
parent 4263de1e05
commit 7ce8248bc6
2 changed files with 7 additions and 7 deletions

View File

@@ -46,7 +46,7 @@ protected:
bool CocoaUnwindStackAndTakeFocus(); bool CocoaUnwindStackAndTakeFocus();
inline bool CocoaTakeFocus() inline bool CocoaTakeFocus()
{ {
wxCocoaDCStack::Node *node = sm_cocoaDCStack.GetFirst(); wxCocoaDCStack::compatibility_iterator node = sm_cocoaDCStack.GetFirst();
if(node && (node->GetData() == this)) if(node && (node->GetData() == this))
return true; return true;
return CocoaUnwindStackAndTakeFocus(); return CocoaUnwindStackAndTakeFocus();

View File

@@ -98,10 +98,10 @@ void wxDC::CocoaShutdownTextSystem()
void wxDC::CocoaUnwindStackAndLoseFocus() void wxDC::CocoaUnwindStackAndLoseFocus()
{ {
wxCocoaDCStack::Node *ourNode=sm_cocoaDCStack.Find(this); wxCocoaDCStack::compatibility_iterator ourNode=sm_cocoaDCStack.Find(this);
if(ourNode) if(ourNode)
{ {
wxCocoaDCStack::Node *node=sm_cocoaDCStack.GetFirst(); wxCocoaDCStack::compatibility_iterator node=sm_cocoaDCStack.GetFirst();
for(;node!=ourNode; node=sm_cocoaDCStack.GetFirst()) for(;node!=ourNode; node=sm_cocoaDCStack.GetFirst())
{ {
wxDC *dc = node->GetData(); wxDC *dc = node->GetData();
@@ -111,18 +111,18 @@ void wxDC::CocoaUnwindStackAndLoseFocus()
{ {
wxFAIL_MSG(wxT("Unable to unlock focus on higher-level DC!")); wxFAIL_MSG(wxT("Unable to unlock focus on higher-level DC!"));
} }
sm_cocoaDCStack.DeleteNode(node); sm_cocoaDCStack.Erase(node);
} }
wxASSERT(node==ourNode); wxASSERT(node==ourNode);
wxASSERT(ourNode->GetData() == this); wxASSERT(ourNode->GetData() == this);
ourNode->GetData()->CocoaUnlockFocus(); ourNode->GetData()->CocoaUnlockFocus();
sm_cocoaDCStack.DeleteNode(ourNode); sm_cocoaDCStack.Erase(ourNode);
} }
} }
bool wxDC::CocoaUnwindStackAndTakeFocus() bool wxDC::CocoaUnwindStackAndTakeFocus()
{ {
wxCocoaDCStack::Node *node=sm_cocoaDCStack.GetFirst(); wxCocoaDCStack::compatibility_iterator node=sm_cocoaDCStack.GetFirst();
for(;node;node = sm_cocoaDCStack.GetFirst()) for(;node;node = sm_cocoaDCStack.GetFirst())
{ {
wxDC *dc = node->GetData(); wxDC *dc = node->GetData();
@@ -133,7 +133,7 @@ bool wxDC::CocoaUnwindStackAndTakeFocus()
// If unable to unlockFocus (e.g. wxPaintDC) stop here // If unable to unlockFocus (e.g. wxPaintDC) stop here
if(!dc->CocoaUnlockFocus()) if(!dc->CocoaUnlockFocus())
break; break;
sm_cocoaDCStack.DeleteNode(node); sm_cocoaDCStack.Erase(node);
} }
return CocoaLockFocus(); return CocoaLockFocus();
} }