]> git.saurik.com Git - wxWidgets.git/commitdiff
wxDFB wxUSE_STL compilation fixes
authorVáclav Slavík <vslavik@fastmail.fm>
Mon, 25 Jun 2007 13:55:06 +0000 (13:55 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Mon, 25 Jun 2007 13:55:06 +0000 (13:55 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46935 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/fontmgrcmn.cpp
src/dfb/window.cpp
src/univ/control.cpp

index ee2fe4915a632a983939130a9dafdfb9ecb016ea..7d7ef9d35d24464cb8dfe70777f1be4afd0fc8ce 100644 (file)
 WX_DECLARE_LIST(wxFontInstance, wxFontInstanceList);
 WX_DEFINE_LIST(wxFontInstanceList)
 WX_DEFINE_LIST(wxFontBundleList)
+
 WX_DECLARE_HASH_MAP(wxString, wxFontBundle*,
                     wxStringHash, wxStringEqual,
-                    wxFontBundleHash);
+                    wxFontBundleHashBase);
+// in STL build, hash class is typedef to a template, so it can't be forward
+// declared, as we do; solve it by having a dummy class:
+class wxFontBundleHash : public wxFontBundleHashBase
+{
+};
 
 // ============================================================================
 // implementation
@@ -65,17 +71,14 @@ wxFontInstance *wxFontFaceBase::GetFontInstance(float ptSize, bool aa)
 {
     wxASSERT_MSG( m_refCnt > 0, _T("font library not loaded!") );
 
-    wxFontInstance *i;
-    wxFontInstanceList::Node *node;
-
-    for ( node = m_instances->GetFirst(); node; node = node->GetNext() )
+    for ( wxFontInstanceList::const_iterator i = m_instances->begin();
+          i != m_instances->end(); ++i )
     {
-        i = node->GetData();
-        if ( i->GetPointSize() == ptSize && i->IsAntiAliased() == aa )
-            return i;
+        if ( (*i)->GetPointSize() == ptSize && (*i)->IsAntiAliased() == aa )
+            return *i;
     }
 
-    i = CreateFontInstance(ptSize, aa);
+    wxFontInstance *i = CreateFontInstance(ptSize, aa);
     m_instances->Append(i);
     return i;
 }
index d07170da05b7f7b99bb69234121d0c7e1ec6e879..b3f8121c5eb4487672ee5ef8bc690b2aaae05b12 100644 (file)
@@ -757,7 +757,9 @@ void wxWindowDFB::PaintOverlays(const wxRect& rect)
     for ( wxDfbOverlaysList::const_iterator i = m_overlays->begin();
           i != m_overlays->end(); ++i )
     {
-        wxOverlayImpl *overlay = *i;
+        // FIXME: the cast is necessary for STL build where the iterator
+        //        (incorrectly) returns void* and not wxOverlayImpl*
+        wxOverlayImpl *overlay = (wxOverlayImpl*) *i;
 
         wxRect orectOrig(overlay->GetRect());
         wxRect orect(orectOrig);
index 8a692bf840cf08682cbd0497e022850f801a58eb..8e2a06e9de8a2f6a1042af3dafb0f60a95cc842d 100644 (file)
@@ -93,17 +93,19 @@ int wxControl::FindAccelIndex(const wxString& label, wxString *labelOnly)
     }
 
     int indexAccel = -1;
-    for ( const wxChar *pc = label; *pc != wxT('\0'); pc++ )
+    for ( wxString::const_iterator pc = label.begin(); pc != label.end(); ++pc )
     {
         if ( *pc == MNEMONIC_PREFIX )
         {
-            pc++; // skip it
-            if ( *pc != MNEMONIC_PREFIX )
+            ++pc; // skip it
+            if ( pc == label.end() )
+                break;
+            else if ( *pc != MNEMONIC_PREFIX )
             {
                 if ( indexAccel == -1 )
                 {
                     // remember it (-1 is for MNEMONIC_PREFIX itself
-                    indexAccel = pc - label.c_str() - 1;
+                    indexAccel = pc - label.begin() - 1;
                 }
                 else
                 {