]>
Commit | Line | Data |
---|---|---|
d0e2ede0 RD |
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 | ||
0fade4f1 | 18 | |
d0e2ede0 RD |
19 | %{ |
20 | #ifndef wxHAS_POWER_EVENTS | |
21 | // Dummy class and other definitions for platforms that don't have them | |
22 | ||
0fade4f1 RD |
23 | // See wxPython_int.h for wxPowerEvent |
24 | ||
d0e2ede0 RD |
25 | enum { |
26 | wxEVT_POWER_SUSPENDING, | |
27 | wxEVT_POWER_SUSPENDED, | |
28 | wxEVT_POWER_SUSPEND_CANCEL, | |
29 | wxEVT_POWER_RESUME, | |
30 | }; | |
31 | ||
32 | wxPowerType wxGetPowerType() { return wxPOWER_UNKNOWN; } | |
33 | wxBatteryState wxGetBatteryState() { return wxBATTERY_UNKNOWN_STATE; } | |
34 | ||
35 | #endif | |
36 | %} | |
37 | ||
38 | ||
39 | ||
40 | enum wxPowerType | |
41 | { | |
42 | wxPOWER_SOCKET, | |
43 | wxPOWER_BATTERY, | |
44 | wxPOWER_UNKNOWN | |
45 | }; | |
46 | ||
47 | enum wxBatteryState | |
48 | { | |
49 | wxBATTERY_NORMAL_STATE, // system is fully usable | |
50 | wxBATTERY_LOW_STATE, // start to worry | |
51 | wxBATTERY_CRITICAL_STATE, // save quickly | |
52 | wxBATTERY_SHUTDOWN_STATE, // too late | |
53 | wxBATTERY_UNKNOWN_STATE | |
54 | }; | |
55 | ||
56 | ||
57 | DocStr(wxPowerEvent, | |
58 | "wx.PowerEvent is generated when the system online status changes. | |
59 | Currently this is only implemented for Windows.", | |
60 | ""); | |
61 | class wxPowerEvent : public wxEvent | |
62 | { | |
63 | public: | |
64 | wxPowerEvent(wxEventType evtType); | |
65 | ||
66 | // Veto the operation (only makes sense with EVT_POWER_SUSPENDING) | |
67 | void Veto(); | |
68 | bool IsVetoed() const; | |
69 | }; | |
70 | ||
71 | ||
72 | %constant wxEventType wxEVT_POWER_SUSPENDING; | |
73 | %constant wxEventType wxEVT_POWER_SUSPENDED; | |
74 | %constant wxEventType wxEVT_POWER_SUSPEND_CANCEL; | |
75 | %constant wxEventType wxEVT_POWER_RESUME; | |
76 | ||
77 | %pythoncode { | |
78 | EVT_POWER_SUSPENDING = wx.PyEventBinder( wxEVT_POWER_SUSPENDING , 1 ) | |
79 | EVT_POWER_SUSPENDED = wx.PyEventBinder( wxEVT_POWER_SUSPENDED , 1 ) | |
80 | EVT_POWER_SUSPEND_CANCEL = wx.PyEventBinder( wxEVT_POWER_SUSPEND_CANCEL , 1 ) | |
81 | EVT_POWER_RESUME = wx.PyEventBinder( wxEVT_POWER_RESUME , 1 ) | |
82 | } | |
83 | ||
84 | ||
85 | DocDeclStr( | |
86 | wxPowerType , wxGetPowerType(), | |
87 | "return the current system power state: online or offline", ""); | |
88 | ||
89 | ||
90 | DocDeclStr( | |
91 | wxBatteryState , wxGetBatteryState(), | |
92 | "return approximate battery state", ""); | |
93 | ||
94 | ||
95 | //--------------------------------------------------------------------------- |