wxDFB wxUSE_STL compilation fixes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46935 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2007-06-25 13:55:06 +00:00
parent 9ec6078f41
commit 9580fdc3b1
3 changed files with 21 additions and 14 deletions

View File

@@ -24,9 +24,15 @@
WX_DECLARE_LIST(wxFontInstance, wxFontInstanceList); WX_DECLARE_LIST(wxFontInstance, wxFontInstanceList);
WX_DEFINE_LIST(wxFontInstanceList) WX_DEFINE_LIST(wxFontInstanceList)
WX_DEFINE_LIST(wxFontBundleList) WX_DEFINE_LIST(wxFontBundleList)
WX_DECLARE_HASH_MAP(wxString, wxFontBundle*, WX_DECLARE_HASH_MAP(wxString, wxFontBundle*,
wxStringHash, wxStringEqual, 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 // implementation
@@ -65,17 +71,14 @@ wxFontInstance *wxFontFaceBase::GetFontInstance(float ptSize, bool aa)
{ {
wxASSERT_MSG( m_refCnt > 0, _T("font library not loaded!") ); wxASSERT_MSG( m_refCnt > 0, _T("font library not loaded!") );
wxFontInstance *i; for ( wxFontInstanceList::const_iterator i = m_instances->begin();
wxFontInstanceList::Node *node; i != m_instances->end(); ++i )
for ( node = m_instances->GetFirst(); node; node = node->GetNext() )
{ {
i = node->GetData(); if ( (*i)->GetPointSize() == ptSize && (*i)->IsAntiAliased() == aa )
if ( i->GetPointSize() == ptSize && i->IsAntiAliased() == aa ) return *i;
return i;
} }
i = CreateFontInstance(ptSize, aa); wxFontInstance *i = CreateFontInstance(ptSize, aa);
m_instances->Append(i); m_instances->Append(i);
return i; return i;
} }

View File

@@ -757,7 +757,9 @@ void wxWindowDFB::PaintOverlays(const wxRect& rect)
for ( wxDfbOverlaysList::const_iterator i = m_overlays->begin(); for ( wxDfbOverlaysList::const_iterator i = m_overlays->begin();
i != m_overlays->end(); ++i ) 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 orectOrig(overlay->GetRect());
wxRect orect(orectOrig); wxRect orect(orectOrig);

View File

@@ -93,17 +93,19 @@ int wxControl::FindAccelIndex(const wxString& label, wxString *labelOnly)
} }
int indexAccel = -1; 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 ) if ( *pc == MNEMONIC_PREFIX )
{ {
pc++; // skip it ++pc; // skip it
if ( *pc != MNEMONIC_PREFIX ) if ( pc == label.end() )
break;
else if ( *pc != MNEMONIC_PREFIX )
{ {
if ( indexAccel == -1 ) if ( indexAccel == -1 )
{ {
// remember it (-1 is for MNEMONIC_PREFIX itself // remember it (-1 is for MNEMONIC_PREFIX itself
indexAccel = pc - label.c_str() - 1; indexAccel = pc - label.begin() - 1;
} }
else else
{ {