]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_power.i
Source cleaning, wxW headers, whitespaces and improved PCH support.
[wxWidgets.git] / wxPython / src / _power.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: _power.i
3 // Purpose: SWIG interface for wx poser events and functions
4 //
5 // Author: Robin Dunn
6 //
7 // Created: 28-May-2006
8 // RCS-ID: $Id$
9 // Copyright: (c) 2006 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13 // Not a %module
14
15 //---------------------------------------------------------------------------
16 %newgroup
17
18 %{
19 #ifndef wxHAS_POWER_EVENTS
20 // Dummy class and other definitions for platforms that don't have them
21
22 class wxPowerEvent : public wxEvent
23 {
24 public:
25 wxPowerEvent(wxEventType evtType) : wxEvent(wxID_NONE, evtType) {}
26 void Veto() {}
27 bool IsVetoed() const { return false; }
28
29 virtual wxEvent *Clone() const { return new wxPowerEvent(*this); }
30 };
31
32 enum {
33 wxEVT_POWER_SUSPENDING,
34 wxEVT_POWER_SUSPENDED,
35 wxEVT_POWER_SUSPEND_CANCEL,
36 wxEVT_POWER_RESUME,
37 };
38
39 wxPowerType wxGetPowerType() { return wxPOWER_UNKNOWN; }
40 wxBatteryState wxGetBatteryState() { return wxBATTERY_UNKNOWN_STATE; }
41
42 #endif
43 %}
44
45
46
47 enum wxPowerType
48 {
49 wxPOWER_SOCKET,
50 wxPOWER_BATTERY,
51 wxPOWER_UNKNOWN
52 };
53
54 enum wxBatteryState
55 {
56 wxBATTERY_NORMAL_STATE, // system is fully usable
57 wxBATTERY_LOW_STATE, // start to worry
58 wxBATTERY_CRITICAL_STATE, // save quickly
59 wxBATTERY_SHUTDOWN_STATE, // too late
60 wxBATTERY_UNKNOWN_STATE
61 };
62
63
64 DocStr(wxPowerEvent,
65 "wx.PowerEvent is generated when the system online status changes.
66 Currently this is only implemented for Windows.",
67 "");
68 class wxPowerEvent : public wxEvent
69 {
70 public:
71 wxPowerEvent(wxEventType evtType);
72
73 // Veto the operation (only makes sense with EVT_POWER_SUSPENDING)
74 void Veto();
75 bool IsVetoed() const;
76 };
77
78
79 %constant wxEventType wxEVT_POWER_SUSPENDING;
80 %constant wxEventType wxEVT_POWER_SUSPENDED;
81 %constant wxEventType wxEVT_POWER_SUSPEND_CANCEL;
82 %constant wxEventType wxEVT_POWER_RESUME;
83
84 %pythoncode {
85 EVT_POWER_SUSPENDING = wx.PyEventBinder( wxEVT_POWER_SUSPENDING , 1 )
86 EVT_POWER_SUSPENDED = wx.PyEventBinder( wxEVT_POWER_SUSPENDED , 1 )
87 EVT_POWER_SUSPEND_CANCEL = wx.PyEventBinder( wxEVT_POWER_SUSPEND_CANCEL , 1 )
88 EVT_POWER_RESUME = wx.PyEventBinder( wxEVT_POWER_RESUME , 1 )
89 }
90
91
92 DocDeclStr(
93 wxPowerType , wxGetPowerType(),
94 "return the current system power state: online or offline", "");
95
96
97 DocDeclStr(
98 wxBatteryState , wxGetBatteryState(),
99 "return approximate battery state", "");
100
101
102 //---------------------------------------------------------------------------