src/msw/dir.cpp \
src/msw/dlmsw.cpp \
src/msw/mimetype.cpp \
+ src/msw/power.cpp \
src/msw/regconf.cpp \
src/msw/registry.cpp \
src/msw/snglinst.cpp \
monodll_dir.o \
monodll_dlmsw.o \
monodll_mimetype.o \
+ monodll_power.o \
monodll_regconf.o \
monodll_registry.o \
monodll_snglinst.o \
monolib_dir.o \
monolib_dlmsw.o \
monolib_mimetype.o \
+ monolib_power.o \
monolib_regconf.o \
monolib_registry.o \
monolib_snglinst.o \
basedll_dir.o \
basedll_dlmsw.o \
basedll_mimetype.o \
+ basedll_power.o \
basedll_regconf.o \
basedll_registry.o \
basedll_snglinst.o \
baselib_dir.o \
baselib_dlmsw.o \
baselib_mimetype.o \
+ baselib_power.o \
baselib_regconf.o \
baselib_registry.o \
baselib_snglinst.o \
monodll_dlmsw.o: $(srcdir)/src/msw/dlmsw.cpp $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/dlmsw.cpp
+monodll_power.o: $(srcdir)/src/msw/power.cpp $(MONODLL_ODEP)
+ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/power.cpp
+
monodll_regconf.o: $(srcdir)/src/msw/regconf.cpp $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/regconf.cpp
monolib_dlmsw.o: $(srcdir)/src/msw/dlmsw.cpp $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/dlmsw.cpp
+monolib_power.o: $(srcdir)/src/msw/power.cpp $(MONOLIB_ODEP)
+ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/power.cpp
+
monolib_regconf.o: $(srcdir)/src/msw/regconf.cpp $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/regconf.cpp
basedll_dlmsw.o: $(srcdir)/src/msw/dlmsw.cpp $(BASEDLL_ODEP)
$(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/msw/dlmsw.cpp
+basedll_power.o: $(srcdir)/src/msw/power.cpp $(BASEDLL_ODEP)
+ $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/msw/power.cpp
+
basedll_regconf.o: $(srcdir)/src/msw/regconf.cpp $(BASEDLL_ODEP)
$(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/msw/regconf.cpp
baselib_dlmsw.o: $(srcdir)/src/msw/dlmsw.cpp $(BASELIB_ODEP)
$(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/msw/dlmsw.cpp
+baselib_power.o: $(srcdir)/src/msw/power.cpp $(BASELIB_ODEP)
+ $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/msw/power.cpp
+
baselib_regconf.o: $(srcdir)/src/msw/regconf.cpp $(BASELIB_ODEP)
$(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/msw/regconf.cpp
src/msw/dir.cpp
src/msw/dlmsw.cpp
src/msw/mimetype.cpp
+ src/msw/power.cpp
src/msw/regconf.cpp
src/msw/registry.cpp
src/msw/snglinst.cpp
$(OBJS)\monodll_dir.obj \
$(OBJS)\monodll_dlmsw.obj \
$(OBJS)\monodll_mimetype.obj \
+ $(OBJS)\monodll_power.obj \
$(OBJS)\monodll_regconf.obj \
$(OBJS)\monodll_registry.obj \
$(OBJS)\monodll_snglinst.obj \
$(OBJS)\monolib_dir.obj \
$(OBJS)\monolib_dlmsw.obj \
$(OBJS)\monolib_mimetype.obj \
+ $(OBJS)\monolib_power.obj \
$(OBJS)\monolib_regconf.obj \
$(OBJS)\monolib_registry.obj \
$(OBJS)\monolib_snglinst.obj \
$(OBJS)\basedll_dir.obj \
$(OBJS)\basedll_dlmsw.obj \
$(OBJS)\basedll_mimetype.obj \
+ $(OBJS)\basedll_power.obj \
$(OBJS)\basedll_regconf.obj \
$(OBJS)\basedll_registry.obj \
$(OBJS)\basedll_snglinst.obj \
$(OBJS)\baselib_dir.obj \
$(OBJS)\baselib_dlmsw.obj \
$(OBJS)\baselib_mimetype.obj \
+ $(OBJS)\baselib_power.obj \
$(OBJS)\baselib_regconf.obj \
$(OBJS)\baselib_registry.obj \
$(OBJS)\baselib_snglinst.obj \
$(OBJS)\monodll_mimetype.obj: ..\..\src\msw\mimetype.cpp
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $**
+$(OBJS)\monodll_power.obj: ..\..\src\msw\power.cpp
+ $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $**
+
$(OBJS)\monodll_regconf.obj: ..\..\src\msw\regconf.cpp
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $**
$(OBJS)\monolib_mimetype.obj: ..\..\src\msw\mimetype.cpp
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $**
+$(OBJS)\monolib_power.obj: ..\..\src\msw\power.cpp
+ $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $**
+
$(OBJS)\monolib_regconf.obj: ..\..\src\msw\regconf.cpp
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $**
$(OBJS)\basedll_mimetype.obj: ..\..\src\msw\mimetype.cpp
$(CXX) -q -c -P -o$@ $(BASEDLL_CXXFLAGS) $**
+$(OBJS)\basedll_power.obj: ..\..\src\msw\power.cpp
+ $(CXX) -q -c -P -o$@ $(BASEDLL_CXXFLAGS) $**
+
$(OBJS)\basedll_regconf.obj: ..\..\src\msw\regconf.cpp
$(CXX) -q -c -P -o$@ $(BASEDLL_CXXFLAGS) $**
$(OBJS)\baselib_mimetype.obj: ..\..\src\msw\mimetype.cpp
$(CXX) -q -c -P -o$@ $(BASELIB_CXXFLAGS) $**
+$(OBJS)\baselib_power.obj: ..\..\src\msw\power.cpp
+ $(CXX) -q -c -P -o$@ $(BASELIB_CXXFLAGS) $**
+
$(OBJS)\baselib_regconf.obj: ..\..\src\msw\regconf.cpp
$(CXX) -q -c -P -o$@ $(BASELIB_CXXFLAGS) $**
$(OBJS)\monodll_dir.o \
$(OBJS)\monodll_dlmsw.o \
$(OBJS)\monodll_mimetype.o \
+ $(OBJS)\monodll_power.o \
$(OBJS)\monodll_regconf.o \
$(OBJS)\monodll_registry.o \
$(OBJS)\monodll_snglinst.o \
$(OBJS)\monolib_dir.o \
$(OBJS)\monolib_dlmsw.o \
$(OBJS)\monolib_mimetype.o \
+ $(OBJS)\monolib_power.o \
$(OBJS)\monolib_regconf.o \
$(OBJS)\monolib_registry.o \
$(OBJS)\monolib_snglinst.o \
$(OBJS)\basedll_dir.o \
$(OBJS)\basedll_dlmsw.o \
$(OBJS)\basedll_mimetype.o \
+ $(OBJS)\basedll_power.o \
$(OBJS)\basedll_regconf.o \
$(OBJS)\basedll_registry.o \
$(OBJS)\basedll_snglinst.o \
$(OBJS)\baselib_dir.o \
$(OBJS)\baselib_dlmsw.o \
$(OBJS)\baselib_mimetype.o \
+ $(OBJS)\baselib_power.o \
$(OBJS)\baselib_regconf.o \
$(OBJS)\baselib_registry.o \
$(OBJS)\baselib_snglinst.o \
$(OBJS)\monodll_mimetype.o: ../../src/msw/mimetype.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
+$(OBJS)\monodll_power.o: ../../src/msw/power.cpp
+ $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
+
$(OBJS)\monodll_regconf.o: ../../src/msw/regconf.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\monolib_mimetype.o: ../../src/msw/mimetype.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
+$(OBJS)\monolib_power.o: ../../src/msw/power.cpp
+ $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
+
$(OBJS)\monolib_regconf.o: ../../src/msw/regconf.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\basedll_mimetype.o: ../../src/msw/mimetype.cpp
$(CXX) -c -o $@ $(BASEDLL_CXXFLAGS) $(CPPDEPS) $<
+$(OBJS)\basedll_power.o: ../../src/msw/power.cpp
+ $(CXX) -c -o $@ $(BASEDLL_CXXFLAGS) $(CPPDEPS) $<
+
$(OBJS)\basedll_regconf.o: ../../src/msw/regconf.cpp
$(CXX) -c -o $@ $(BASEDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\baselib_mimetype.o: ../../src/msw/mimetype.cpp
$(CXX) -c -o $@ $(BASELIB_CXXFLAGS) $(CPPDEPS) $<
+$(OBJS)\baselib_power.o: ../../src/msw/power.cpp
+ $(CXX) -c -o $@ $(BASELIB_CXXFLAGS) $(CPPDEPS) $<
+
$(OBJS)\baselib_regconf.o: ../../src/msw/regconf.cpp
$(CXX) -c -o $@ $(BASELIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\monodll_dir.obj \
$(OBJS)\monodll_dlmsw.obj \
$(OBJS)\monodll_mimetype.obj \
+ $(OBJS)\monodll_power.obj \
$(OBJS)\monodll_regconf.obj \
$(OBJS)\monodll_registry.obj \
$(OBJS)\monodll_snglinst.obj \
$(OBJS)\monolib_dir.obj \
$(OBJS)\monolib_dlmsw.obj \
$(OBJS)\monolib_mimetype.obj \
+ $(OBJS)\monolib_power.obj \
$(OBJS)\monolib_regconf.obj \
$(OBJS)\monolib_registry.obj \
$(OBJS)\monolib_snglinst.obj \
$(OBJS)\basedll_dir.obj \
$(OBJS)\basedll_dlmsw.obj \
$(OBJS)\basedll_mimetype.obj \
+ $(OBJS)\basedll_power.obj \
$(OBJS)\basedll_regconf.obj \
$(OBJS)\basedll_registry.obj \
$(OBJS)\basedll_snglinst.obj \
$(OBJS)\baselib_dir.obj \
$(OBJS)\baselib_dlmsw.obj \
$(OBJS)\baselib_mimetype.obj \
+ $(OBJS)\baselib_power.obj \
$(OBJS)\baselib_regconf.obj \
$(OBJS)\baselib_registry.obj \
$(OBJS)\baselib_snglinst.obj \
$(OBJS)\monodll_mimetype.obj: ..\..\src\msw\mimetype.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $**
+$(OBJS)\monodll_power.obj: ..\..\src\msw\power.cpp
+ $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $**
+
$(OBJS)\monodll_regconf.obj: ..\..\src\msw\regconf.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $**
$(OBJS)\monolib_mimetype.obj: ..\..\src\msw\mimetype.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $**
+$(OBJS)\monolib_power.obj: ..\..\src\msw\power.cpp
+ $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $**
+
$(OBJS)\monolib_regconf.obj: ..\..\src\msw\regconf.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $**
$(OBJS)\basedll_mimetype.obj: ..\..\src\msw\mimetype.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BASEDLL_CXXFLAGS) $**
+$(OBJS)\basedll_power.obj: ..\..\src\msw\power.cpp
+ $(CXX) /c /nologo /TP /Fo$@ $(BASEDLL_CXXFLAGS) $**
+
$(OBJS)\basedll_regconf.obj: ..\..\src\msw\regconf.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BASEDLL_CXXFLAGS) $**
$(OBJS)\baselib_mimetype.obj: ..\..\src\msw\mimetype.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BASELIB_CXXFLAGS) $**
+$(OBJS)\baselib_power.obj: ..\..\src\msw\power.cpp
+ $(CXX) /c /nologo /TP /Fo$@ $(BASELIB_CXXFLAGS) $**
+
$(OBJS)\baselib_regconf.obj: ..\..\src\msw\regconf.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BASELIB_CXXFLAGS) $**
$(OBJS)\monodll_dir.obj &
$(OBJS)\monodll_dlmsw.obj &
$(OBJS)\monodll_mimetype.obj &
+ $(OBJS)\monodll_power.obj &
$(OBJS)\monodll_regconf.obj &
$(OBJS)\monodll_registry.obj &
$(OBJS)\monodll_snglinst.obj &
$(OBJS)\monolib_dir.obj &
$(OBJS)\monolib_dlmsw.obj &
$(OBJS)\monolib_mimetype.obj &
+ $(OBJS)\monolib_power.obj &
$(OBJS)\monolib_regconf.obj &
$(OBJS)\monolib_registry.obj &
$(OBJS)\monolib_snglinst.obj &
$(OBJS)\basedll_dir.obj &
$(OBJS)\basedll_dlmsw.obj &
$(OBJS)\basedll_mimetype.obj &
+ $(OBJS)\basedll_power.obj &
$(OBJS)\basedll_regconf.obj &
$(OBJS)\basedll_registry.obj &
$(OBJS)\basedll_snglinst.obj &
$(OBJS)\baselib_dir.obj &
$(OBJS)\baselib_dlmsw.obj &
$(OBJS)\baselib_mimetype.obj &
+ $(OBJS)\baselib_power.obj &
$(OBJS)\baselib_regconf.obj &
$(OBJS)\baselib_registry.obj &
$(OBJS)\baselib_snglinst.obj &
$(OBJS)\monodll_mimetype.obj : .AUTODEPEND ..\..\src\msw\mimetype.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
+$(OBJS)\monodll_power.obj : .AUTODEPEND ..\..\src\msw\power.cpp
+ $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
+
$(OBJS)\monodll_regconf.obj : .AUTODEPEND ..\..\src\msw\regconf.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<
$(OBJS)\monolib_mimetype.obj : .AUTODEPEND ..\..\src\msw\mimetype.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
+$(OBJS)\monolib_power.obj : .AUTODEPEND ..\..\src\msw\power.cpp
+ $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
+
$(OBJS)\monolib_regconf.obj : .AUTODEPEND ..\..\src\msw\regconf.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $<
$(OBJS)\basedll_mimetype.obj : .AUTODEPEND ..\..\src\msw\mimetype.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(BASEDLL_CXXFLAGS) $<
+$(OBJS)\basedll_power.obj : .AUTODEPEND ..\..\src\msw\power.cpp
+ $(CXX) -bt=nt -zq -fo=$^@ $(BASEDLL_CXXFLAGS) $<
+
$(OBJS)\basedll_regconf.obj : .AUTODEPEND ..\..\src\msw\regconf.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(BASEDLL_CXXFLAGS) $<
$(OBJS)\baselib_mimetype.obj : .AUTODEPEND ..\..\src\msw\mimetype.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(BASELIB_CXXFLAGS) $<
+$(OBJS)\baselib_power.obj : .AUTODEPEND ..\..\src\msw\power.cpp
+ $(CXX) -bt=nt -zq -fo=$^@ $(BASELIB_CXXFLAGS) $<
+
$(OBJS)\baselib_regconf.obj : .AUTODEPEND ..\..\src\msw\regconf.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(BASELIB_CXXFLAGS) $<
# End Source File
# Begin Source File
+SOURCE=..\..\src\msw\power.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\src\msw\regconf.cpp
# End Source File
# Begin Source File
\texttt{wxBATTERY\_LOW\_STATE}, \texttt{wxBATTERY\_CRITICAL\_STATE},
\texttt{wxBATTERY\_SHUTDOWN\_STATE} or \texttt{wxBATTERY\_UNKNOWN\_STATE}.
\texttt{wxBATTERY\_UNKNOWN\_STATE} is also the default on platforms where
-this feature is not implemented.
+this feature is not implemented (currently everywhere but MS Windows).
\wxheading{Include files}
Returns the type of power source as one of \texttt{wxPOWER\_SOCKET},
\texttt{wxPOWER\_BATTERY} or \texttt{wxPOWER\_UNKNOWN}.
\texttt{wxPOWER\_UNKNOWN} is also the default on platforms where this
-feature is not implemented.
+feature is not implemented (currently everywhere but MS Windows).
\wxheading{Include files}
wxTE_MULTILINE | wxTE_READONLY);
m_logOld = wxLog::SetActiveTarget(new wxLogTextCtrl(text));
+ CreateStatusBar();
+
SetIcon(wxICON(sample));
+ UpdatePowerSettings(wxPOWER_UNKNOWN, wxBATTERY_UNKNOWN_STATE);
+
Show();
}
}
private:
+ void OnIdle(wxIdleEvent& WXUNUSED(event))
+ {
+ const wxPowerType powerType = wxGetPowerType();
+ const wxBatteryState batteryState = wxGetBatteryState();
+ if ( powerType != m_powerType || batteryState != m_batteryState )
+ {
+ UpdatePowerSettings(powerType, batteryState);
+ }
+ }
+
+#ifdef wxHAS_POWER_EVENTS
void OnSuspending(wxPowerEvent& event)
{
wxLogMessage(_T("System suspend starting..."));
{
wxLogMessage(_T("System resumed from suspend."));
}
+#endif // wxHAS_POWER_EVENTS
+
+
+ void UpdatePowerSettings(wxPowerType powerType, wxBatteryState batteryState)
+ {
+ wxString powerStr;
+ switch ( m_powerType = powerType )
+ {
+ case wxPOWER_SOCKET:
+ powerStr = _T("wall");
+ break;
+
+ case wxPOWER_BATTERY:
+ powerStr = _T("battery");
+ break;
+
+ default:
+ wxFAIL_MSG(_T("unknown wxPowerType value"));
+ // fall through
+
+ case wxPOWER_UNKNOWN:
+ powerStr = _T("psychic");
+ break;
+ }
+
+ wxString batteryStr;
+ switch ( m_batteryState = batteryState )
+ {
+ case wxBATTERY_NORMAL_STATE:
+ batteryStr = _T("charged");
+ break;
+
+ case wxBATTERY_LOW_STATE:
+ batteryStr = _T("low");
+ break;
+
+ case wxBATTERY_CRITICAL_STATE:
+ batteryStr = _T("critical");
+ break;
+
+ case wxBATTERY_SHUTDOWN_STATE:
+ batteryStr = _T("empty");
+ break;
+
+ default:
+ wxFAIL_MSG(_T("unknown wxBatteryState value"));
+ // fall through
+
+ case wxBATTERY_UNKNOWN_STATE:
+ batteryStr = _T("unknown");
+ break;
+ }
+
+ SetStatusText(wxString::Format(
+ _T("System is on %s power, battery state is %s"),
+ powerStr.c_str(),
+ batteryStr.c_str()));
+ }
+ wxPowerType m_powerType;
+ wxBatteryState m_batteryState;
wxLog *m_logOld;
};
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
+ EVT_IDLE(MyFrame::OnIdle)
+
+#ifdef wxHAS_POWER_EVENTS
EVT_POWER_SUSPENDING(MyFrame::OnSuspending)
EVT_POWER_SUSPENDED(MyFrame::OnSuspended)
EVT_POWER_SUSPEND_CANCEL(MyFrame::OnSuspendCancel)
EVT_POWER_RESUME(MyFrame::OnResume)
+#endif // wxHAS_POWER_EVENTS
END_EVENT_TABLE()
// ----------------------------------------------------------------------------
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: src/msw/power.cpp
+// Purpose: power management functions for MSW
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 2006-05-27
+// RCS-ID: $Id$
+// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+// for compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#endif //WX_PRECOMP
+
+#include "wx/power.h"
+
+// ----------------------------------------------------------------------------
+// helper functions
+// ----------------------------------------------------------------------------
+
+static inline bool wxGetPowerStatus(SYSTEM_POWER_STATUS *sps)
+{
+ if ( !::GetSystemPowerStatus(sps) )
+ {
+ wxLogLastError(_T("GetSystemPowerStatus()"));
+ return false;
+ }
+
+ return true;
+}
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+wxPowerType wxGetPowerType()
+{
+ SYSTEM_POWER_STATUS sps;
+ if ( wxGetPowerStatus(&sps) )
+ {
+ switch ( sps.ACLineStatus )
+ {
+ case 0:
+ return wxPOWER_BATTERY;
+
+ case 1:
+ return wxPOWER_SOCKET;
+
+ default:
+ wxLogDebug(_T("Unknown ACLineStatus=%u"), sps.ACLineStatus);
+ case 255:
+ break;
+ }
+ }
+
+ return wxPOWER_UNKNOWN;
+}
+
+wxBatteryState wxGetBatteryState()
+{
+ SYSTEM_POWER_STATUS sps;
+ if ( wxGetPowerStatus(&sps) )
+ {
+ // there can be other bits set in the flag field ("charging" and "no
+ // battery"), extract only those which we need here
+ switch ( sps.BatteryFlag & 7 )
+ {
+ case 1:
+ return wxBATTERY_NORMAL_STATE;
+
+ case 2:
+ return wxBATTERY_LOW_STATE;
+
+ case 3:
+ return wxBATTERY_CRITICAL_STATE;
+ }
+ }
+
+ return wxBATTERY_UNKNOWN_STATE;
+}
+
+
#include "wx/dynlib.h"
#include "wx/dynload.h"
#include "wx/scopeguard.h"
-#include "wx/power.h"
#include "wx/confbase.h" // for wxExpandEnvVars()
#endif // Win32/16
}
-wxPowerType wxGetPowerType()
-{
- // TODO
- return wxPOWER_UNKNOWN;
-}
-
-wxBatteryState wxGetBatteryState()
-{
- // TODO
- return wxBATTERY_UNKNOWN_STATE;
-}
-
// ----------------------------------------------------------------------------
// misc
// ----------------------------------------------------------------------------
# End Source File
# Begin Source File
+SOURCE=.\msw\power.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\msw\printdlg.cpp
# End Source File
# Begin Source File