// Name: src/common/evtloopcmn.cpp
// Purpose: common wxEventLoop-related stuff
// Author: Vadim Zeitlin
-// Modified by:
// Created: 2006-01-12
// RCS-ID: $Id$
-// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
+// Copyright: (c) 2006, 2013 Vadim Zeitlin <vadim@wxwindows.org>
+// (c) 2013 Rob Bresalier
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
wxEventLoopSourceHandler *handler,
int flags)
{
- // Ensure that we have some valid traits.
- wxConsoleAppTraits traitsConsole;
- wxAppTraits *traits = wxTheApp ? wxTheApp->GetTraits() : NULL;
- if ( !traits )
- traits = &traitsConsole;
-
- // And delegate to the event loop sources manager defined by it.
+#if wxUSE_CONSOLE_EVENTLOOP
+ // Delegate to the event loop sources manager defined by it.
wxEventLoopSourcesManagerBase* const
- manager = traits->GetEventLoopSourcesManager();
+ manager = wxApp::GetValidTraits().GetEventLoopSourcesManager();
wxCHECK_MSG( manager, NULL, wxS("Must have wxEventLoopSourcesManager") );
return manager->AddSourceForFD(fd, handler, flags);
+#else // !wxUSE_CONSOLE_EVENTLOOP
+ return NULL;
+#endif // wxUSE_CONSOLE_EVENTLOOP/!wxUSE_CONSOLE_EVENTLOOP
}
#endif // wxUSE_EVENTLOOP_SOURCE