+bool wxWindowMSW::HandlePower(WXWPARAM WXUNUSED_IN_WINCE(wParam),
+ WXLPARAM WXUNUSED(lParam),
+ bool *WXUNUSED_IN_WINCE(vetoed))
+{
+#ifdef __WXWINCE__
+ // FIXME
+ return false;
+#else
+ wxEventType evtType;
+ switch ( wParam )
+ {
+ case PBT_APMQUERYSUSPEND:
+ evtType = wxEVT_POWER_SUSPENDING;
+ break;
+
+ case PBT_APMQUERYSUSPENDFAILED:
+ evtType = wxEVT_POWER_SUSPEND_CANCEL;
+ break;
+
+ case PBT_APMSUSPEND:
+ evtType = wxEVT_POWER_SUSPENDED;
+ break;
+
+ case PBT_APMRESUMESUSPEND:
+#ifdef PBT_APMRESUMEAUTOMATIC
+ case PBT_APMRESUMEAUTOMATIC:
+#endif
+ evtType = wxEVT_POWER_RESUME;
+ break;
+
+ default:
+ wxLogDebug(_T("Unknown WM_POWERBROADCAST(%d) event"), wParam);
+ // fall through
+
+ // these messages are currently not mapped to wx events
+ case PBT_APMQUERYSTANDBY:
+ case PBT_APMQUERYSTANDBYFAILED:
+ case PBT_APMSTANDBY:
+ case PBT_APMRESUMESTANDBY:
+ case PBT_APMBATTERYLOW:
+ case PBT_APMPOWERSTATUSCHANGE:
+ case PBT_APMOEMEVENT:
+ case PBT_APMRESUMECRITICAL:
+ evtType = wxEVT_NULL;
+ break;
+ }
+
+ // don't handle unknown messages
+ if ( evtType == wxEVT_NULL )
+ return false;
+
+ // TODO: notify about PBTF_APMRESUMEFROMFAILURE in case of resume events?
+
+ wxPowerEvent event(evtType);
+ if ( !GetEventHandler()->ProcessEvent(event) )
+ return false;
+
+ *vetoed = event.IsVetoed();
+
+ return true;
+#endif
+}
+