]> git.saurik.com Git - wxWidgets.git/commitdiff
moved power functions for MSW from utils.cpp to (new) power.cpp and implemented them
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 27 May 2006 14:29:30 +0000 (14:29 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 27 May 2006 14:29:30 +0000 (14:29 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39360 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

12 files changed:
Makefile.in
build/bakefiles/files.bkl
build/msw/makefile.bcc
build/msw/makefile.gcc
build/msw/makefile.vc
build/msw/makefile.wat
build/msw/wx_base.dsp
docs/latex/wx/function.tex
samples/power/power.cpp
src/msw/power.cpp [new file with mode: 0644]
src/msw/utils.cpp
src/wxWindows.dsp

index a89ba4f8ed8b4f8b60adfb4d25d44ce89912cc4f..25f6c14e5c878a408bb2492a12a0660f7d3c5830 100644 (file)
@@ -585,6 +585,7 @@ ALL_BASE_SOURCES =  \
        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 \
@@ -2952,6 +2953,7 @@ COND_PLATFORM_WIN32_1___BASE_PLATFORM_SRC_OBJECTS =  \
        monodll_dir.o \
        monodll_dlmsw.o \
        monodll_mimetype.o \
+       monodll_power.o \
        monodll_regconf.o \
        monodll_registry.o \
        monodll_snglinst.o \
@@ -4587,6 +4589,7 @@ COND_PLATFORM_WIN32_1___BASE_PLATFORM_SRC_OBJECTS_1 =  \
        monolib_dir.o \
        monolib_dlmsw.o \
        monolib_mimetype.o \
+       monolib_power.o \
        monolib_regconf.o \
        monolib_registry.o \
        monolib_snglinst.o \
@@ -6260,6 +6263,7 @@ COND_PLATFORM_WIN32_1___BASE_PLATFORM_SRC_OBJECTS_2 =  \
        basedll_dir.o \
        basedll_dlmsw.o \
        basedll_mimetype.o \
+       basedll_power.o \
        basedll_regconf.o \
        basedll_registry.o \
        basedll_snglinst.o \
@@ -6419,6 +6423,7 @@ COND_PLATFORM_WIN32_1___BASE_PLATFORM_SRC_OBJECTS_3 =  \
        baselib_dir.o \
        baselib_dlmsw.o \
        baselib_mimetype.o \
+       baselib_power.o \
        baselib_regconf.o \
        baselib_registry.o \
        baselib_snglinst.o \
@@ -11381,6 +11386,9 @@ monodll_dde.o: $(srcdir)/src/msw/dde.cpp $(MONODLL_ODEP)
 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
 
@@ -15194,6 +15202,9 @@ monolib_dde.o: $(srcdir)/src/msw/dde.cpp $(MONOLIB_ODEP)
 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
 
@@ -19010,6 +19021,9 @@ basedll_dde.o: $(srcdir)/src/msw/dde.cpp $(BASEDLL_ODEP)
 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
 
@@ -19568,6 +19582,9 @@ baselib_dde.o: $(srcdir)/src/msw/dde.cpp $(BASELIB_ODEP)
 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
 
index 4c877b7bad94fb941f9403df3e4859376c6b7e83..8a727c9eb56028038fd66d06b7cc541f059786a2 100644 (file)
@@ -88,6 +88,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
     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
index f19d2dc698ed7e86eda9232f7297d4db01bbeb64..33fecbd5ece00cd3b7b78d7c7160d78e5bc45483 100644 (file)
@@ -265,6 +265,7 @@ MONODLL_OBJECTS =  \
        $(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 \
@@ -375,6 +376,7 @@ MONOLIB_OBJECTS =  \
        $(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 \
@@ -486,6 +488,7 @@ BASEDLL_OBJECTS =  \
        $(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 \
@@ -582,6 +585,7 @@ BASELIB_OBJECTS =  \
        $(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 \
@@ -4289,6 +4293,9 @@ $(OBJS)\monodll_dlmsw.obj: ..\..\src\msw\dlmsw.cpp
 $(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) $**
 
@@ -6083,6 +6090,9 @@ $(OBJS)\monolib_dlmsw.obj: ..\..\src\msw\dlmsw.cpp
 $(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) $**
 
@@ -7880,6 +7890,9 @@ $(OBJS)\basedll_dlmsw.obj: ..\..\src\msw\dlmsw.cpp
 $(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) $**
 
@@ -8120,6 +8133,9 @@ $(OBJS)\baselib_dlmsw.obj: ..\..\src\msw\dlmsw.cpp
 $(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) $**
 
index 3a3b4eb8b60727560ff9a46cae752a6bebadabc2..a04df069641b0fe71c8ca01ec3736317a00a462f 100644 (file)
@@ -251,6 +251,7 @@ MONODLL_OBJECTS =  \
        $(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 \
@@ -361,6 +362,7 @@ MONOLIB_OBJECTS =  \
        $(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 \
@@ -473,6 +475,7 @@ BASEDLL_OBJECTS =  \
        $(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 \
@@ -569,6 +572,7 @@ BASELIB_OBJECTS =  \
        $(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 \
@@ -4393,6 +4397,9 @@ $(OBJS)\monodll_dlmsw.o: ../../src/msw/dlmsw.cpp
 $(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) $<
 
@@ -6291,6 +6298,9 @@ $(OBJS)\monolib_dlmsw.o: ../../src/msw/dlmsw.cpp
 $(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) $<
 
@@ -8192,6 +8202,9 @@ $(OBJS)\basedll_dlmsw.o: ../../src/msw/dlmsw.cpp
 $(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) $<
 
@@ -8432,6 +8445,9 @@ $(OBJS)\baselib_dlmsw.o: ../../src/msw/dlmsw.cpp
 $(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) $<
 
index cb46c122d80ff81792f55b56a597e273bda211dd..563782f3bf5895f39532498c2d9e37ec02c12555 100644 (file)
@@ -264,6 +264,7 @@ MONODLL_OBJECTS =  \
        $(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 \
@@ -379,6 +380,7 @@ MONOLIB_OBJECTS =  \
        $(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 \
@@ -497,6 +499,7 @@ BASEDLL_OBJECTS =  \
        $(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 \
@@ -598,6 +601,7 @@ BASELIB_OBJECTS =  \
        $(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 \
@@ -4598,6 +4602,9 @@ $(OBJS)\monodll_dlmsw.obj: ..\..\src\msw\dlmsw.cpp
 $(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) $**
 
@@ -6392,6 +6399,9 @@ $(OBJS)\monolib_dlmsw.obj: ..\..\src\msw\dlmsw.cpp
 $(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) $**
 
@@ -8189,6 +8199,9 @@ $(OBJS)\basedll_dlmsw.obj: ..\..\src\msw\dlmsw.cpp
 $(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) $**
 
@@ -8429,6 +8442,9 @@ $(OBJS)\baselib_dlmsw.obj: ..\..\src\msw\dlmsw.cpp
 $(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) $**
 
index 640f9740cc8ff2d25505b6510b14a01f4fc37d14..edd3525c19d14de57932402e468022d637ef725a 100644 (file)
@@ -2735,6 +2735,7 @@ MONODLL_OBJECTS =  &
        $(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 &
@@ -2846,6 +2847,7 @@ MONOLIB_OBJECTS =  &
        $(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 &
@@ -2957,6 +2959,7 @@ BASEDLL_OBJECTS =  &
        $(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 &
@@ -3053,6 +3056,7 @@ BASELIB_OBJECTS =  &
        $(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 &
@@ -4593,6 +4597,9 @@ $(OBJS)\monodll_dlmsw.obj :  .AUTODEPEND ..\..\src\msw\dlmsw.cpp
 $(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) $<
 
@@ -6491,6 +6498,9 @@ $(OBJS)\monolib_dlmsw.obj :  .AUTODEPEND ..\..\src\msw\dlmsw.cpp
 $(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) $<
 
@@ -8392,6 +8402,9 @@ $(OBJS)\basedll_dlmsw.obj :  .AUTODEPEND ..\..\src\msw\dlmsw.cpp
 $(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) $<
 
@@ -8632,6 +8645,9 @@ $(OBJS)\baselib_dlmsw.obj :  .AUTODEPEND ..\..\src\msw\dlmsw.cpp
 $(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) $<
 
index 294c71bcd70bc9b99720ccdd0fd2ae7804abb69c..025a9b26cc0143c510ab53829cf3318fa51cce4e 100644 (file)
@@ -743,6 +743,10 @@ SOURCE=..\..\src\msw\mslu.cpp
 # 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
index 78ae7251dfd37702c37bc2bde11a2b4f02200b52..4db79cb10ff5b5419c1e383cb5a16d68c07a5a12 100644 (file)
@@ -2975,7 +2975,7 @@ Returns battery state as one of \texttt{wxBATTERY\_NORMAL\_STATE},
 \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}
 
@@ -3000,7 +3000,7 @@ Under X only, returns the current display name. See also \helpref{wxSetDisplayNa
 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}
 
index 04b9ab3c63ce71d6485e21e8deb44635c13b0f4a..5649e29b57e63d4e6d823bd99c2ba10299893e8d 100644 (file)
@@ -52,8 +52,12 @@ public:
                                           wxTE_MULTILINE | wxTE_READONLY);
         m_logOld = wxLog::SetActiveTarget(new wxLogTextCtrl(text));
 
+        CreateStatusBar();
+
         SetIcon(wxICON(sample));
 
+        UpdatePowerSettings(wxPOWER_UNKNOWN, wxBATTERY_UNKNOWN_STATE);
+
         Show();
     }
 
@@ -63,6 +67,17 @@ public:
     }
 
 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..."));
@@ -88,7 +103,67 @@ private:
     {
         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;
 
@@ -96,10 +171,14 @@ private:
 };
 
 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()
 
 // ----------------------------------------------------------------------------
diff --git a/src/msw/power.cpp b/src/msw/power.cpp
new file mode 100644 (file)
index 0000000..022e624
--- /dev/null
@@ -0,0 +1,97 @@
+///////////////////////////////////////////////////////////////////////////////
+// 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;
+}
+
+
index 5b418e2167e132b3e7e60b3854a6f31497635861..d94f52caa2715f61fbe2534feb15430b50eab098 100644 (file)
@@ -37,7 +37,6 @@
 #include "wx/dynlib.h"
 #include "wx/dynload.h"
 #include "wx/scopeguard.h"
-#include "wx/power.h"
 
 #include "wx/confbase.h"        // for wxExpandEnvVars()
 
@@ -1004,18 +1003,6 @@ bool wxShutdown(wxShutdownFlags WXUNUSED_IN_WINCE(wFlags))
 #endif // Win32/16
 }
 
-wxPowerType wxGetPowerType()
-{
-    // TODO
-    return wxPOWER_UNKNOWN;
-}
-
-wxBatteryState wxGetBatteryState()
-{
-    // TODO
-    return wxBATTERY_UNKNOWN_STATE;
-}
-
 // ----------------------------------------------------------------------------
 // misc
 // ----------------------------------------------------------------------------
index 0182d1d720cc2dc26d883cb1576622c4f83c4256..8d1e857e9c3aad2cca94084a352fc4b9aa9dad41 100644 (file)
@@ -1543,6 +1543,10 @@ SOURCE=.\msw\popupwin.cpp
 # 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