]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/power.h
Move code removing "-psn_xxx" command line arguments to common code.
[wxWidgets.git] / interface / wx / power.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: power.h
e54c96f1 3// Purpose: interface of wxPowerEvent
23324ae1 4// Author: wxWidgets team
526954c5 5// Licence: wxWindows licence
23324ae1
FM
6/////////////////////////////////////////////////////////////////////////////
7
05b0355a
RD
8enum wxPowerType
9{
10 wxPOWER_SOCKET,
11 wxPOWER_BATTERY,
12 wxPOWER_UNKNOWN
13};
14
15enum wxBatteryState
16{
17 wxBATTERY_NORMAL_STATE, // system is fully usable
18 wxBATTERY_LOW_STATE, // start to worry
19 wxBATTERY_CRITICAL_STATE, // save quickly
20 wxBATTERY_SHUTDOWN_STATE, // too late
21 wxBATTERY_UNKNOWN_STATE
22};
23
24
23324ae1
FM
25/**
26 @class wxPowerEvent
7c913512 27
23324ae1
FM
28 The power events are generated when the system power state changes, e.g. the
29 system is suspended, hibernated, plugged into or unplugged from the wall socket
3051a44a 30 and so on. wxPowerEvents are emitted by wxWindows.
7c913512 31
23324ae1
FM
32 Notice that currently only suspend and resume events are generated and only
33 under MS Windows platform. To avoid the need to change the code using this
b1b95a65
FM
34 event later when these events are implemented on the other platforms please
35 use the test <tt>ifdef wxHAS_POWER_EVENTS</tt> instead of directly testing for
23324ae1
FM
36 the platform in your code: this symbol will be defined for all platforms
37 supporting the power events.
7c913512 38
b1b95a65 39 @beginEventTable{wxPowerEvent}
3051a44a 40 @event{EVT_POWER_SUSPENDING(func)}
b1b95a65
FM
41 System is about to be suspended, this event can be vetoed to prevent
42 suspend from taking place.
3051a44a 43 @event{EVT_POWER_SUSPENDED(func)}
b1b95a65
FM
44 System is about to suspend: normally the application should quickly
45 (i.e. without user intervention) close all the open files and network
46 connections here, possibly remembering them to reopen them later when
47 the system is resumed.
3051a44a 48 @event{EVT_POWER_SUSPEND_CANCEL(func)}
b1b95a65 49 System suspension was cancelled because some application vetoed it.
3051a44a 50 @event{EVT_POWER_RESUME(func)}
b1b95a65
FM
51 System resumed from suspend: normally the application should restore
52 the state in which it had been before the suspension.
53 @endEventTable
54
23324ae1 55 @library{wxbase}
b1b95a65 56 @category{events}
7c913512 57
b1b95a65 58 @see ::wxGetPowerType(), ::wxGetBatteryState()
23324ae1
FM
59*/
60class wxPowerEvent : public wxEvent
61{
62public:
2de2a468
RD
63 wxPowerEvent();
64 wxPowerEvent(wxEventType evtType);
65
23324ae1 66 /**
b1b95a65
FM
67 Call this to prevent suspend from taking place in @c wxEVT_POWER_SUSPENDING
68 handler (it is ignored for all the others).
23324ae1
FM
69 */
70 void Veto();
2de2a468
RD
71
72 /**
73 Returns whether Veto has been called.
74 */
75 bool IsVetoed() const;
23324ae1 76};
e54c96f1 77
2de2a468
RD
78wxEventType wxEVT_POWER_SUSPENDING;
79wxEventType wxEVT_POWER_SUSPENDED;
80wxEventType wxEVT_POWER_SUSPEND_CANCEL;
81wxEventType wxEVT_POWER_RESUME;
82
83