| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: power.h |
| 3 | // Purpose: interface of wxPowerEvent |
| 4 | // Author: wxWidgets team |
| 5 | // RCS-ID: $Id$ |
| 6 | // Licence: wxWindows license |
| 7 | ///////////////////////////////////////////////////////////////////////////// |
| 8 | |
| 9 | /** |
| 10 | @class wxPowerEvent |
| 11 | |
| 12 | The power events are generated when the system power state changes, e.g. the |
| 13 | system is suspended, hibernated, plugged into or unplugged from the wall socket |
| 14 | and so on. wxPowerEvents are emitted by wxWindows. |
| 15 | |
| 16 | Notice that currently only suspend and resume events are generated and only |
| 17 | under MS Windows platform. To avoid the need to change the code using this |
| 18 | event later when these events are implemented on the other platforms please |
| 19 | use the test <tt>ifdef wxHAS_POWER_EVENTS</tt> instead of directly testing for |
| 20 | the platform in your code: this symbol will be defined for all platforms |
| 21 | supporting the power events. |
| 22 | |
| 23 | @beginEventTable{wxPowerEvent} |
| 24 | @event{EVT_POWER_SUSPENDING(func)} |
| 25 | System is about to be suspended, this event can be vetoed to prevent |
| 26 | suspend from taking place. |
| 27 | @event{EVT_POWER_SUSPENDED(func)} |
| 28 | System is about to suspend: normally the application should quickly |
| 29 | (i.e. without user intervention) close all the open files and network |
| 30 | connections here, possibly remembering them to reopen them later when |
| 31 | the system is resumed. |
| 32 | @event{EVT_POWER_SUSPEND_CANCEL(func)} |
| 33 | System suspension was cancelled because some application vetoed it. |
| 34 | @event{EVT_POWER_RESUME(func)} |
| 35 | System resumed from suspend: normally the application should restore |
| 36 | the state in which it had been before the suspension. |
| 37 | @endEventTable |
| 38 | |
| 39 | @library{wxbase} |
| 40 | @category{events} |
| 41 | |
| 42 | @see ::wxGetPowerType(), ::wxGetBatteryState() |
| 43 | */ |
| 44 | class wxPowerEvent : public wxEvent |
| 45 | { |
| 46 | public: |
| 47 | /** |
| 48 | Call this to prevent suspend from taking place in @c wxEVT_POWER_SUSPENDING |
| 49 | handler (it is ignored for all the others). |
| 50 | */ |
| 51 | void Veto(); |
| 52 | }; |
| 53 | |