/[pcsx2_0.9.7]/branch/r3113_0.9.7_beta/3rdparty/wxWidgets/include/wx/power.h
ViewVC logotype

Contents of /branch/r3113_0.9.7_beta/3rdparty/wxWidgets/include/wx/power.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 32 - (show annotations) (download)
Tue Sep 7 03:29:01 2010 UTC (9 years, 5 months ago) by william
File MIME type: text/plain
File size: 3752 byte(s)
branching from upstream revision (http://pcsx2.googlecode.com/svn/trunk
): r3113 to
https://svn.netsolutions.dnsalias.com/websvn/ps2/pcsx2/pcsx2_0.9.7/branch/r3113_0.9.7_beta
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/power.h
3 // Purpose: functions and classes for system power management
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 2006-05-27
7 // RCS-ID: $Id: power.h 48811 2007-09-19 23:11:28Z RD $
8 // Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_POWER_H_
13 #define _WX_POWER_H_
14
15 #include "wx/event.h"
16
17 // ----------------------------------------------------------------------------
18 // power management constants
19 // ----------------------------------------------------------------------------
20
21 enum wxPowerType
22 {
23 wxPOWER_SOCKET,
24 wxPOWER_BATTERY,
25 wxPOWER_UNKNOWN
26 };
27
28 enum wxBatteryState
29 {
30 wxBATTERY_NORMAL_STATE, // system is fully usable
31 wxBATTERY_LOW_STATE, // start to worry
32 wxBATTERY_CRITICAL_STATE, // save quickly
33 wxBATTERY_SHUTDOWN_STATE, // too late
34 wxBATTERY_UNKNOWN_STATE
35 };
36
37 // ----------------------------------------------------------------------------
38 // wxPowerEvent is generated when the system online status changes
39 // ----------------------------------------------------------------------------
40
41 // currently the power events are only available under Windows, to avoid
42 // compiling in the code for handling them which is never going to be invoked
43 // under the other platforms, we define wxHAS_POWER_EVENTS symbol if this event
44 // is available, it should be used to guard all code using wxPowerEvent
45 #ifdef __WXMSW__
46
47 #define wxHAS_POWER_EVENTS
48
49 class WXDLLIMPEXP_BASE wxPowerEvent : public wxEvent
50 {
51 public:
52 wxPowerEvent(wxEventType evtType) : wxEvent(wxID_NONE, evtType)
53 {
54 m_veto = false;
55 }
56
57 // Veto the operation (only makes sense with EVT_POWER_SUSPENDING)
58 void Veto() { m_veto = true; }
59
60 bool IsVetoed() const { return m_veto; }
61
62
63 // default copy ctor, assignment operator and dtor are ok
64
65 virtual wxEvent *Clone() const { return new wxPowerEvent(*this); }
66
67 private:
68 bool m_veto;
69
70 #if wxABI_VERSION >= 20806
71 DECLARE_ABSTRACT_CLASS(wxPowerEvent)
72 #endif
73 };
74
75 BEGIN_DECLARE_EVENT_TYPES()
76 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_POWER_SUSPENDING, 406)
77 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_POWER_SUSPENDED, 407)
78 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_POWER_SUSPEND_CANCEL, 408)
79 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_POWER_RESUME, 444)
80 END_DECLARE_EVENT_TYPES()
81
82 typedef void (wxEvtHandler::*wxPowerEventFunction)(wxPowerEvent&);
83
84 #define wxPowerEventHandler(func) \
85 (wxObjectEventFunction)(wxEventFunction) \
86 wxStaticCastEvent(wxPowerEventFunction, &func)
87
88 #define EVT_POWER_SUSPENDING(func) \
89 wx__DECLARE_EVT0(wxEVT_POWER_SUSPENDING, wxPowerEventHandler(func))
90 #define EVT_POWER_SUSPENDED(func) \
91 wx__DECLARE_EVT0(wxEVT_POWER_SUSPENDED, wxPowerEventHandler(func))
92 #define EVT_POWER_SUSPEND_CANCEL(func) \
93 wx__DECLARE_EVT0(wxEVT_POWER_SUSPEND_CANCEL, wxPowerEventHandler(func))
94 #define EVT_POWER_RESUME(func) \
95 wx__DECLARE_EVT0(wxEVT_POWER_RESUME, wxPowerEventHandler(func))
96
97 #else // no support for power events
98 #undef wxHAS_POWER_EVENTS
99 #endif // support for power events/no support
100
101 // ----------------------------------------------------------------------------
102 // power management functions
103 // ----------------------------------------------------------------------------
104
105 // return the current system power state: online or offline
106 WXDLLIMPEXP_BASE wxPowerType wxGetPowerType();
107
108 // return approximate battery state
109 WXDLLIMPEXP_BASE wxBatteryState wxGetBatteryState();
110
111 #endif // _WX_POWER_H_

  ViewVC Help
Powered by ViewVC 1.1.22