#include <wx/power.h>
Helper RAII class ensuring that power resources are released.
A wxPowerResourceBlocker object acquires a power resource in the constructor and releases it in the destructor making it impossible to to forget to release the power resource (which would prevent suspending or screen power off until the application ends).
Example:
Public Member Functions | |
wxPowerResourceBlocker (wxPowerResourceKind kind, const wxString &reason=wxString()) | |
Acquires the power resource. More... | |
bool | IsInEffect () const |
Returns whether the power resource could be acquired. More... | |
~wxPowerResourceBlocker () | |
Releases the power resource. More... | |
|
explicit |
Acquires the power resource.
Uses the same parameters as wxPowerResource::Acquire().
wxPowerResourceBlocker::~wxPowerResourceBlocker | ( | ) |
Releases the power resource.
bool wxPowerResourceBlocker::IsInEffect | ( | ) | const |
Returns whether the power resource could be acquired.
This can be used to inform the user that the application will not prevent automatic suspending.