contents up previous next

wxpowerevent

the power events are generated when the system power state changes, e.g. the system is suspended, hibernated, plugged into or unplugged from the wall socket and so on.

notice that currently only suspend and resume events are generated and only under ms windows platform. to avoid the need to change the code using this event later when these events are implemented on the other platforms please use the test ifdef wxhas_power_events instead of directly testing for the platform in your code: this symbol will be defined for all platforms supporting the power events.

event table macros

to process power events, use these macros to handle them in member functions that take a wxpowerevent argument.

evt_power_suspending(func) system is about to be suspended, this event can be vetoed to prevent suspend from taking place.
evt_power_suspended(func) system is about to suspend: normally the application should quickly (i.e. without user intervention) close all the open files and network connections here, possibly remembering them to reopen them later when the system is resumed.
evt_power_suspend_cancel(func) system suspension was cancelled because some application vetoed it.
evt_power_resume(func) system resumed from suspend: normally the application should restore the state in which it had been before the suspension.
derived from

wxevent
wxobject

include files

<wx/power.h>

see also

wxgetpowertype, wxgetbatterystate

members

wxpowerevent::veto


wxpowerevent::veto

void veto()

call this to prevent suspend from taking place in wxevt_power_suspending handler (it is ignored for all the others).