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