*
*/
+#ifdef __VISUALC__
+ // 'this' : used in base member initializer list (for m_commandString)
+ #pragma warning(disable:4355)
+#endif
+
wxCommandEvent::wxCommandEvent(wxEventType commandType, int theId)
: wxEvent(theId, commandType)
#if WXWIN_COMPATIBILITY_2_4
m_propagationLevel = wxEVENT_PROPAGATE_MAX;
}
+#ifdef __VISUALC__
+ #pragma warning(default:4355)
+#endif
+
wxString wxCommandEvent::GetString() const
{
if(m_eventType != wxEVT_COMMAND_TEXT_UPDATED || !m_eventObject)
return m_cmdString;
else
{
+#if wxUSE_TEXTCTRL
wxTextCtrl *txt = wxDynamicCast(m_eventObject, wxTextCtrl);
if(txt)
return txt->GetValue();
else
+#endif // wxUSE_TEXTCTRL
return m_cmdString;
}
}
wxCHECK_RET( eventCopy,
_T("events of this type aren't supposed to be posted") );
-#if defined(__VISAGECPP__)
- wxENTER_CRIT_SECT( m_eventsLocker);
-#else
- wxENTER_CRIT_SECT( *m_eventsLocker);
-#endif
+ wxENTER_CRIT_SECT( Lock() );
if ( !m_pendingEvents )
m_pendingEvents = new wxList;
m_pendingEvents->Append(eventCopy);
-#if defined(__VISAGECPP__)
- wxLEAVE_CRIT_SECT( m_eventsLocker);
-#else
- wxLEAVE_CRIT_SECT( *m_eventsLocker);
-#endif
+ wxLEAVE_CRIT_SECT( Lock() );
// 2) Add this event handler to list of event handlers that
// have pending events.
wxCHECK_RET( m_pendingEvents,
wxT("Please call wxApp::ProcessPendingEvents() instead") );
-#if defined(__VISAGECPP__)
- wxENTER_CRIT_SECT( m_eventsLocker);
-#else
- wxENTER_CRIT_SECT( *m_eventsLocker);
-#endif
-
- // remember last event to process during this iteration
- wxList::compatibility_iterator lastPendingNode = m_pendingEvents->GetLast();
+ wxENTER_CRIT_SECT( Lock() );
- wxList::compatibility_iterator node = m_pendingEvents->GetFirst();
- while ( node )
+ // we leave the loop once we have processed all events that were present at
+ // the start of ProcessPendingEvents because otherwise we could get into
+ // infinite loop if the pending event handler execution resulted in another
+ // event being posted
+ size_t n = m_pendingEvents->size();
+ for ( wxList::compatibility_iterator node = m_pendingEvents->GetFirst();
+ node;
+ node = m_pendingEvents->GetFirst() )
{
wxEvent *event = (wxEvent *)node->GetData();
+
m_pendingEvents->Erase(node);
- // In ProcessEvent, new events might get added and
- // we can safely leave the crtical section here.
-#if defined(__VISAGECPP__)
- wxLEAVE_CRIT_SECT( m_eventsLocker);
-#else
- wxLEAVE_CRIT_SECT( *m_eventsLocker);
-#endif
+ wxLEAVE_CRIT_SECT( Lock() );
+
ProcessEvent(*event);
delete event;
-#if defined(__VISAGECPP__)
- wxENTER_CRIT_SECT( m_eventsLocker);
-#else
- wxENTER_CRIT_SECT( *m_eventsLocker);
-#endif
- // leave the loop once we have processed all events that were present
- // at the start of ProcessPendingEvents because otherwise we could get
- // into infinite loop if the pending event handler execution resulted
- // in another event being posted
- if ( node == lastPendingNode )
- break;
+ wxENTER_CRIT_SECT( Lock() );
- node = m_pendingEvents->GetFirst();
+ if ( !--n )
+ break;
}
-#if defined(__VISAGECPP__)
- wxLEAVE_CRIT_SECT( m_eventsLocker);
-#else
- wxLEAVE_CRIT_SECT( *m_eventsLocker);
-#endif
+ wxLEAVE_CRIT_SECT( Lock() );
}
/*