comparison foosdk/sdk/libPPUI/CPowerRequest.h @ 1:20d02a178406 default tip

*: check in everything else yay
author Paper <paper@tflc.us>
date Mon, 05 Jan 2026 02:15:46 -0500
parents
children
comparison
equal deleted inserted replaced
0:e9bb126753e7 1:20d02a178406
1 #pragma once
2
3 #ifdef _WIN32
4
5 #ifdef WINAPI_FAMILY_PARTITION
6 #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
7 #define CPowerRequestAPI_Avail
8 #endif
9 #else // no WINAPI_FAMILY_PARTITION, desktop SDK
10 #define CPowerRequestAPI_Avail
11 #endif
12
13 #endif // _WIN32
14
15 #ifdef CPowerRequestAPI_Avail
16
17 class CPowerRequest {
18 public:
19 CPowerRequest(const wchar_t * Reason);
20 void SetSystem(bool bSystem);
21 void SetExecution(bool bExecution);
22 void SetDisplay(bool bDisplay);
23 ~CPowerRequest();
24
25 CPowerRequest(const CPowerRequest&) = delete;
26 void operator=(const CPowerRequest&) = delete;
27 private:
28 HANDLE m_Request = INVALID_HANDLE_VALUE;
29 bool m_bSystem = false, m_bDisplay = false;
30 };
31 #else
32
33 class CPowerRequest {
34 public:
35 CPowerRequest(const wchar_t * Reason) {}
36 void SetSystem(bool bSystem) {}
37 void SetExecution(bool bExecution) {}
38 void SetDisplay(bool bDisplay) {}
39 CPowerRequest(const CPowerRequest&) = delete;
40 void operator=(const CPowerRequest&) = delete;
41 };
42
43 #endif // CPowerRequestAPI_Avail