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