PowerComponentWin.h 590 B

12345678910111213141516171819202122232425262728293031
  1. #ifndef POWERCOMPONENTWIN_H
  2. #define POWERCOMPONENTWIN_H
  3. #include "PowerComponent.h"
  4. class PowerComponentWin : public PowerComponent
  5. {
  6. public:
  7. PowerComponentWin();
  8. virtual void doDisableScreensaver();
  9. virtual void doEnableScreensaver();
  10. virtual int getPowerCapabilities() override
  11. {
  12. int flags = CAP_SUSPEND;
  13. if (m_hasPrivileges)
  14. flags |= CAP_POWER_OFF | CAP_REBOOT;
  15. return flags;
  16. }
  17. virtual bool PowerOff() override;
  18. virtual bool Reboot() override;
  19. virtual bool Suspend() override;
  20. private:
  21. bool m_hasPrivileges;
  22. };
  23. #endif // POWERCOMPONENTWIN_H