Version: 3.3.4
Loading...
Searching...
No Matches
wxEventLoopActivator Class Reference

#include <wx/evtloop.h>

Detailed Description

Makes an event loop temporarily active.

You normally don't need to use this class before calling wxEventLoopBase::Run(), as Run() already uses it. Use this class only when an event loop must be temporarily active without entering Run(), or from a custom Run() implementation which doesn't call the base class version.

This class is used to make the event loop active during its life-time, e.g.:

class MyEventLoop : public wxEventLoopBase { ... };
void RunMyLoop()
{
MyEventLoop loop;
wxEventLoopActivator activate(&loop);
...
} // the previously active event loop restored here
Makes an event loop temporarily active.
Definition evtloop.h:355
Base class for all event loop implementations.
Definition evtloop.h:67

Library:  wxBase
Category:  Application and Process Management
See also
wxEventLoopBase

Public Member Functions

 wxEventLoopActivator (wxEventLoopBase *loop)
 Makes the loop passed as the parameter currently active.
 ~wxEventLoopActivator ()
 Restores the previously active event loop stored by the constructor.

Constructor & Destructor Documentation

◆ wxEventLoopActivator()

wxEventLoopActivator::wxEventLoopActivator ( wxEventLoopBase * loop)

Makes the loop passed as the parameter currently active.

This saves the current return value of wxEventLoopBase::GetActive() and then calls wxEventLoopBase::SetActive() with the given loop.

◆ ~wxEventLoopActivator()

wxEventLoopActivator::~wxEventLoopActivator ( )

Restores the previously active event loop stored by the constructor.