Version: 3.1.0
wxPowerResource Class Reference

#include <wx/power.h>

Detailed Description

Helper functions for acquiring and releasing the given power resource.

If an application performs a long running task without user interaction it is often necessary to prevent the system from automatically suspending or powering off the screen and Acquire() method can be used to do this.

Notice that currently this functionality is only implemented for MSW and OS X.

If possible, use wxPowerResourceBlocker class to ensure that Release() is called instead of calling it manually.

Since
3.1.0

Library:  wxBase
Category:  Miscellaneous
See also
wxPowerResourceBlocker

Static Public Member Functions

static bool Acquire (wxPowerResourceKind kind, const wxString &reason=wxString())
 Acquire a power resource for the application. More...
 
static void Release (wxPowerResourceKind kind)
 Release a previously acquired power resource. More...
 

Member Function Documentation

static bool wxPowerResource::Acquire ( wxPowerResourceKind  kind,
const wxString reason = wxString() 
)
static

Acquire a power resource for the application.

If successful, the system will not automatically power of the screen or suspend until Release() is called.

Every call to Acquire must be matched by a corresponding call to Release() or the system will not suspend until the application ends, use wxPowerResourceBlocker to ensure that this happens.

Parameters
kindPower resource required, either wxPOWER_RESOURCE_SCREEN or wxPOWER_RESOURCE_SYSTEM.
reasonOptional reason may be specified which might be used on some platforms to inform the user what is preventing power saving. It should usually describe the operation requiring the resource and specifying it is strongly recommended.
Returns
Returns true if the acquisition was successful.
See also
Release()
static void wxPowerResource::Release ( wxPowerResourceKind  kind)
static

Release a previously acquired power resource.

Release must be called for every Acquire() call made to restore normal power saving behaviour

Parameters
kindPower resource to be released.
See also
Acquire()