class WXDLLIMPEXP_BASE wxAppConsole;
class WXDLLIMPEXP_BASE wxAppTraits;
class WXDLLIMPEXP_BASE wxCmdLineParser;
-class WXDLLIMPEXP_BASE wxEventLoop;
+class WXDLLIMPEXP_BASE wxEventLoopBase;
class WXDLLIMPEXP_BASE wxLog;
class WXDLLIMPEXP_BASE wxMessageOutput;
#if wxUSE_GUI
- class WXDLLEXPORT wxEventLoop;
struct WXDLLIMPEXP_CORE wxVideoMode;
#endif
// create main loop from AppTraits or return NULL if
// there is no main loop implementation
- wxEventLoop *CreateMainLoop();
+ wxEventLoopBase *CreateMainLoop();
// application info (must be set from the user code)
wxString m_vendorName, // vendor name (ACME Inc)
// the main event loop of the application (may be NULL if the loop hasn't
// been started yet or has already terminated)
- wxEventLoop *m_mainLoop;
+ wxEventLoopBase *m_mainLoop;
// the application object is a singleton anyhow, there is no sense in
// copying it
class WXDLLIMPEXP_BASE wxArrayString;
class WXDLLIMPEXP_BASE wxObject;
class WXDLLEXPORT wxAppTraits;
-class WXDLLIMPEXP_BASE wxEventLoop;
+class WXDLLIMPEXP_BASE wxEventLoopBase;
#if wxUSE_FONTMAP
class WXDLLEXPORT wxFontMapper;
#endif // wxUSE_FONTMAP
#endif
// create a new, port specific, instance of the event loop used by wxApp
- virtual wxEventLoop *CreateEventLoop() = 0;
+ virtual wxEventLoopBase *CreateEventLoop() = 0;
#if wxUSE_TIMER
// return platform and toolkit dependent wxTimer implementation
#include "wx/utils.h"
-class WXDLLEXPORT wxEventLoop;
-
// ----------------------------------------------------------------------------
// wxEventLoopBase: interface for wxEventLoop
// ----------------------------------------------------------------------------
virtual bool Dispatch() = 0;
// return currently active (running) event loop, may be NULL
- static wxEventLoop *GetActive() { return ms_activeLoop; }
+ static wxEventLoopBase *GetActive() { return ms_activeLoop; }
// set currently active (running) event loop
- static void SetActive(wxEventLoop* loop) { ms_activeLoop = loop; }
+ static void SetActive(wxEventLoopBase* loop) { ms_activeLoop = loop; }
// is this event loop running now?
//
// the pointer to currently active loop
- static wxEventLoop *ms_activeLoop;
+ static wxEventLoopBase *ms_activeLoop;
DECLARE_NO_COPY_CLASS(wxEventLoopBase)
};
#include "wx/unix/evtloop.h"
#endif
-// cannot use typedef because wxEventLoop is forward-declared in many places
+// we use a class rather than a typedef because wxEventLoop is forward-declared
+// in many places
#if wxUSE_GUI
-class wxEventLoop : public wxGUIEventLoop { };
-#elif defined(__WXMSW__) || defined(__UNIX__)
-class wxEventLoop : public wxConsoleEventLoop { };
-#else // we still must define it somehow for the code below...
-class wxEventLoop : public wxEventLoopBase { };
+ class wxEventLoop : public wxGUIEventLoop { };
+#else // !GUI
+ // we can't define wxEventLoop differently in GUI and base libraries so use
+ // a #define to still allow writing wxEventLoop in the user code
+ #if defined(__WXMSW__) || defined(__UNIX__)
+ #define wxEventLoop wxConsoleEventLoop
+ #else // we still must define it somehow for the code below...
+ #define wxEventLoop wxEventLoopBase
+ #endif
#endif
inline bool wxEventLoopBase::IsRunning() const { return GetActive() == this; }
wxEventLoopActivator(wxEventLoopBase *evtLoop)
{
m_evtLoopOld = wxEventLoopBase::GetActive();
- wxEventLoopBase::SetActive(wx_static_cast(wxEventLoop *, evtLoop));
+ wxEventLoopBase::SetActive(evtLoop);
}
~wxEventLoopActivator()
}
private:
- wxEventLoop *m_evtLoopOld;
+ wxEventLoopBase *m_evtLoopOld;
};
#endif // _WX_EVTLOOP_H_
class wxConsoleAppTraits : public wxConsoleAppTraitsBase
{
public:
- virtual wxEventLoop *CreateEventLoop() { return NULL; }
+ virtual wxEventLoopBase *CreateEventLoop() { return NULL; }
#if wxUSE_TIMER
virtual wxTimerImpl *CreateTimerImpl(wxTimer *) { return NULL; }
#endif // wxUSE_TIMER
class wxGUIAppTraits : public wxGUIAppTraitsBase
{
public:
- virtual wxEventLoop *CreateEventLoop();
+ virtual wxEventLoopBase *CreateEventLoop();
virtual wxPortId GetToolkitVersion(int *majVer, int *minVer) const;
#if wxUSE_TIMER
class WXDLLIMPEXP_BASE wxConsoleAppTraits : public wxConsoleAppTraitsBase
{
public:
- virtual wxEventLoop *CreateEventLoop();
+ virtual wxEventLoopBase *CreateEventLoop();
virtual void *BeforeChildWaitLoop();
virtual void AlwaysYield();
virtual void AfterChildWaitLoop(void *data);
class WXDLLIMPEXP_CORE wxGUIAppTraits : public wxGUIAppTraitsBase
{
public:
- virtual wxEventLoop *CreateEventLoop();
+ virtual wxEventLoopBase *CreateEventLoop();
virtual void *BeforeChildWaitLoop();
virtual void AlwaysYield();
virtual void AfterChildWaitLoop(void *data);
class WXDLLEXPORT wxConsoleAppTraits : public wxConsoleAppTraitsBase
{
public:
- virtual wxEventLoop *CreateEventLoop();
+ virtual wxEventLoopBase *CreateEventLoop();
virtual bool CreateEndProcessPipe(wxExecuteData& execData);
virtual bool IsWriteFDOfEndProcessPipe(wxExecuteData& execData, int fd);
virtual void DetachWriteFDOfEndProcessPipe(wxExecuteData& execData);
class WXDLLEXPORT wxGUIAppTraits : public wxGUIAppTraitsBase
{
public:
- virtual wxEventLoop *CreateEventLoop();
+ virtual wxEventLoopBase *CreateEventLoop();
virtual bool CreateEndProcessPipe(wxExecuteData& execData);
virtual bool IsWriteFDOfEndProcessPipe(wxExecuteData& execData, int fd);
virtual void DetachWriteFDOfEndProcessPipe(wxExecuteData& execData);
return new wxCocoaTimerImpl(timer);
}
-wxEventLoop* wxGUIAppTraits::CreateEventLoop()
+wxEventLoopBase* wxGUIAppTraits::CreateEventLoop()
{
- // MAJOR HACK: wxEventLoop is implemented in both core and base libraries.
- // Fortunately, it has an empty implementation so an instance of the
- // wxGUIEventLoop parent class will be fine until this issue is fixed.
- return static_cast<wxEventLoop*>(new wxGUIEventLoop);
+ return new wxGUIEventLoop;
}
wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
// ----------------------------------------------------------------------------
// this defines wxEventLoopPtr
-wxDEFINE_TIED_SCOPED_PTR_TYPE(wxEventLoop)
+wxDEFINE_TIED_SCOPED_PTR_TYPE(wxEventLoopBase)
// ============================================================================
// wxAppConsole implementation
return true;
}
-wxEventLoop *wxAppConsole::CreateMainLoop()
+wxEventLoopBase *wxAppConsole::CreateMainLoop()
{
return GetTraits()->CreateEventLoop();
}
int wxAppConsole::MainLoop()
{
- wxEventLoopTiedPtr mainLoop(&m_mainLoop, CreateMainLoop());
+ wxEventLoopBaseTiedPtr mainLoop(&m_mainLoop, CreateMainLoop());
return m_mainLoop ? m_mainLoop->Run() : -1;
}
// use the currently active message loop here, not m_mainLoop, because if
// we're showing a modal dialog (with its own event loop) currently the
// main event loop is not running anyhow
- wxEventLoop * const loop = wxEventLoopBase::GetActive();
+ wxEventLoopBase * const loop = wxEventLoopBase::GetActive();
return loop && loop->Pending();
}
bool wxAppConsole::Dispatch()
{
// see comment in Pending()
- wxEventLoop * const loop = wxEventLoopBase::GetActive();
+ wxEventLoopBase * const loop = wxEventLoopBase::GetActive();
return loop && loop->Dispatch();
}
// globals
// ----------------------------------------------------------------------------
-wxEventLoop *wxEventLoopBase::ms_activeLoop = NULL;
+wxEventLoopBase *wxEventLoopBase::ms_activeLoop = NULL;
// wxEventLoopManual is unused in the other ports
#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXDFB__) || (defined(__UNIX__) && !wxUSE_GUI)
wxMutexGuiEnter();
#endif
- wxEventLoop * const loop = wxEventLoop::GetActive();
+ wxEventLoopBase * const loop = wxEventLoop::GetActive();
if ( loop )
loop->WakeUp();
wxLog::Suspend();
- wxEventLoop * const loop = wxEventLoop::GetActive();
+ wxEventLoop * const
+ loop = wx_static_cast(wxEventLoop *, wxEventLoop::GetActive());
if ( loop )
loop->Yield();
}
-wxEventLoop* wxGUIAppTraits::CreateEventLoop()
+wxEventLoopBase* wxGUIAppTraits::CreateEventLoop()
{
return new wxEventLoop;
-};
+}
+
// ----------------------------------------------------------------------------
// display characteristics
// ----------------------------------------------------------------------------
// wxGUIAppTraits
//-----------------------------------------------------------------------------
-wxEventLoop *wxGUIAppTraits::CreateEventLoop()
+wxEventLoopBase *wxGUIAppTraits::CreateEventLoop()
{
return new wxEventLoop();
}
return wxPORT_GTK;
}
-wxEventLoop* wxGUIAppTraits::CreateEventLoop()
+wxEventLoopBase* wxGUIAppTraits::CreateEventLoop()
{
return new wxEventLoop;
}
return wxPORT_MAC;
}
-wxEventLoop* wxGUIAppTraits::CreateEventLoop()
+wxEventLoopBase* wxGUIAppTraits::CreateEventLoop()
{
return new wxEventLoop;
}
wxLog::Suspend();
- if ( wxEventLoop::GetActive() )
+ wxEventLoopBase * const eventLoop = wxEventLoop::GetActive();
+ if ( eventLoop )
{
- while (wxEventLoop::GetActive()->Pending())
- wxEventLoop::GetActive()->Dispatch();
+ while (eventLoop->Pending())
+ eventLoop->Dispatch();
}
/* it's necessary to call ProcessIdle() to update the frames sizes which
return wxPORT_MGL;
}
-wxEventLoop* wxGUIAppTraits::CreateEventLoop()
+wxEventLoopBase* wxGUIAppTraits::CreateEventLoop()
{
return new wxEventLoop;
}
return wxPORT_MOTIF;
}
-wxEventLoop* wxGUIAppTraits::CreateEventLoop()
+wxEventLoopBase* wxGUIAppTraits::CreateEventLoop()
{
return new wxEventLoop;
}
{
// we should return false only if the app should exit, i.e. only if
// Dispatch() determines that the main event loop should terminate
- wxEventLoop *evtLoop = wxEventLoop::GetActive();
+ wxEventLoopBase * const evtLoop = wxEventLoop::GetActive();
if ( !evtLoop || !evtLoop->Pending() )
{
// no events means no quit event
return new wxMSWTimerImpl(timer);
}
-wxEventLoop* wxGUIAppTraits::CreateEventLoop()
+wxEventLoopBase* wxGUIAppTraits::CreateEventLoop()
{
return new wxEventLoop;
}
return new wxMSWTimerImpl(timer);
}
-wxEventLoop *wxConsoleAppTraits::CreateEventLoop()
+wxEventLoopBase *wxConsoleAppTraits::CreateEventLoop()
{
return new wxEventLoop();
}
return new wxOS2TimerImpl(timer);
}
-wxEventLoop* wxGUIAppTraits::CreateEventLoop()
+wxEventLoopBase* wxGUIAppTraits::CreateEventLoop()
{
return new wxEventLoop;
}
return new wxPalmOSTimerImpl(timer);
};
-wxEventLoop* wxGUIAppTraits::CreateEventLoop()
+wxEventLoopBase* wxGUIAppTraits::CreateEventLoop()
{
return new wxEventLoop;
}
return new wxUnixTimerImpl(timer);
}
-wxEventLoop *wxConsoleAppTraits::CreateEventLoop()
+wxEventLoopBase *wxConsoleAppTraits::CreateEventLoop()
{
return new wxEventLoop();
}
// Make sure we have an event loop object,
// or Pending/Dispatch will fail
- wxEventLoop* eventLoop = wxEventLoop::GetActive();
+ wxEventLoopBase * const eventLoop = wxEventLoop::GetActive();
wxEventLoop* newEventLoop = NULL;
if (!eventLoop)
{
return wxPORT_X11;
}
-wxEventLoop* wxGUIAppTraits::CreateEventLoop()
+wxEventLoopBase* wxGUIAppTraits::CreateEventLoop()
{
return new wxEventLoop;
}