]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/power.h
Add a more convenient wxColour::MakeDisabled() overload.
[wxWidgets.git] / interface / wx / power.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: power.h
e54c96f1 3// Purpose: interface of wxPowerEvent
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
526954c5 6// Licence: wxWindows licence
23324ae1
FM
7/////////////////////////////////////////////////////////////////////////////
8
05b0355a
RD
9enum wxPowerType
10{
11 wxPOWER_SOCKET,
12 wxPOWER_BATTERY,
13 wxPOWER_UNKNOWN
14};
15
16enum 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
23324ae1
FM
26/**
27 @class wxPowerEvent
7c913512 28
23324ae1
FM
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
3051a44a 31 and so on. wxPowerEvents are emitted by wxWindows.
7c913512 32
23324ae1
FM
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
b1b95a65
FM
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
23324ae1
FM
37 the platform in your code: this symbol will be defined for all platforms
38 supporting the power events.
7c913512 39
b1b95a65 40 @beginEventTable{wxPowerEvent}
3051a44a 41 @event{EVT_POWER_SUSPENDING(func)}
b1b95a65
FM
42 System is about to be suspended, this event can be vetoed to prevent
43 suspend from taking place.
3051a44a 44 @event{EVT_POWER_SUSPENDED(func)}
b1b95a65
FM
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.
3051a44a 49 @event{EVT_POWER_SUSPEND_CANCEL(func)}
b1b95a65 50 System suspension was cancelled because some application vetoed it.
3051a44a 51 @event{EVT_POWER_RESUME(func)}
b1b95a65
FM
52 System resumed from suspend: normally the application should restore
53 the state in which it had been before the suspension.
54 @endEventTable
55
23324ae1 56 @library{wxbase}
b1b95a65 57 @category{events}
7c913512 58
b1b95a65 59 @see ::wxGetPowerType(), ::wxGetBatteryState()
23324ae1
FM
60*/
61class wxPowerEvent : public wxEvent
62{
63public:
2de2a468
RD
64 wxPowerEvent();
65 wxPowerEvent(wxEventType evtType);
66
23324ae1 67 /**
b1b95a65
FM
68 Call this to prevent suspend from taking place in @c wxEVT_POWER_SUSPENDING
69 handler (it is ignored for all the others).
23324ae1
FM
70 */
71 void Veto();
2de2a468
RD
72
73 /**
74 Returns whether Veto has been called.
75 */
76 bool IsVetoed() const;
23324ae1 77};
e54c96f1 78
2de2a468
RD
79wxEventType wxEVT_POWER_SUSPENDING;
80wxEventType wxEVT_POWER_SUSPENDED;
81wxEventType wxEVT_POWER_SUSPEND_CANCEL;
82wxEventType wxEVT_POWER_RESUME;
83
84