CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
Path: blob/master/Windows/W32Util/DarkMode.h
Views: 1401
#pragma once12#include "Common/CommonWindows.h"3#include <commctrl.h>4#include <Uxtheme.h>5#include <WindowsX.h>6#include <Vssym32.h>78#include "IatHook.h"910enum IMMERSIVE_HC_CACHE_MODE11{12IHCM_USE_CACHED_VALUE,13IHCM_REFRESH14};1516// 1903 1836217enum PreferredAppMode18{19Default,20AllowDark,21ForceDark,22ForceLight,23Max24};2526enum WINDOWCOMPOSITIONATTRIB27{28WCA_UNDEFINED = 0,29WCA_NCRENDERING_ENABLED = 1,30WCA_NCRENDERING_POLICY = 2,31WCA_TRANSITIONS_FORCEDISABLED = 3,32WCA_ALLOW_NCPAINT = 4,33WCA_CAPTION_BUTTON_BOUNDS = 5,34WCA_NONCLIENT_RTL_LAYOUT = 6,35WCA_FORCE_ICONIC_REPRESENTATION = 7,36WCA_EXTENDED_FRAME_BOUNDS = 8,37WCA_HAS_ICONIC_BITMAP = 9,38WCA_THEME_ATTRIBUTES = 10,39WCA_NCRENDERING_EXILED = 11,40WCA_NCADORNMENTINFO = 12,41WCA_EXCLUDED_FROM_LIVEPREVIEW = 13,42WCA_VIDEO_OVERLAY_ACTIVE = 14,43WCA_FORCE_ACTIVEWINDOW_APPEARANCE = 15,44WCA_DISALLOW_PEEK = 16,45WCA_CLOAK = 17,46WCA_CLOAKED = 18,47WCA_ACCENT_POLICY = 19,48WCA_FREEZE_REPRESENTATION = 20,49WCA_EVER_UNCLOAKED = 21,50WCA_VISUAL_OWNER = 22,51WCA_HOLOGRAPHIC = 23,52WCA_EXCLUDED_FROM_DDA = 24,53WCA_PASSIVEUPDATEMODE = 25,54WCA_USEDARKMODECOLORS = 26,55WCA_LAST = 2756};5758struct WINDOWCOMPOSITIONATTRIBDATA59{60WINDOWCOMPOSITIONATTRIB Attrib;61PVOID pvData;62SIZE_T cbData;63};6465using fnRtlGetNtVersionNumbers = void (WINAPI *)(LPDWORD major, LPDWORD minor, LPDWORD build);66using fnSetWindowCompositionAttribute = BOOL (WINAPI *)(HWND hWnd, WINDOWCOMPOSITIONATTRIBDATA*);67// 1809 1776368using fnShouldAppsUseDarkMode = bool (WINAPI *)(); // ordinal 13269using fnAllowDarkModeForWindow = bool (WINAPI *)(HWND hWnd, bool allow); // ordinal 13370using fnAllowDarkModeForApp = bool (WINAPI *)(bool allow); // ordinal 135, in 180971using fnFlushMenuThemes = void (WINAPI *)(); // ordinal 13672using fnRefreshImmersiveColorPolicyState = void (WINAPI *)(); // ordinal 10473using fnIsDarkModeAllowedForWindow = bool (WINAPI *)(HWND hWnd); // ordinal 13774using fnGetIsImmersiveColorUsingHighContrast = bool (WINAPI *)(IMMERSIVE_HC_CACHE_MODE mode); // ordinal 10675using fnOpenNcThemeData = HTHEME(WINAPI *)(HWND hWnd, LPCWSTR pszClassList); // ordinal 4976// 1903 1836277using fnShouldSystemUseDarkMode = bool (WINAPI *)(); // ordinal 13878using fnSetPreferredAppMode = PreferredAppMode (WINAPI *)(PreferredAppMode appMode); // ordinal 135, in 190379using fnIsDarkModeAllowedForApp = bool (WINAPI *)(); // ordinal 13980using fnSetWindowTheme = void (WINAPI*)(HWND, LPCWSTR, LPCWSTR);81//---------------------------------------------------------------------------8283extern fnSetWindowCompositionAttribute _SetWindowCompositionAttribute;84extern fnShouldAppsUseDarkMode _ShouldAppsUseDarkMode;85extern fnAllowDarkModeForWindow _AllowDarkModeForWindow;86extern fnAllowDarkModeForApp _AllowDarkModeForApp;87extern fnFlushMenuThemes _FlushMenuThemes;88extern fnRefreshImmersiveColorPolicyState _RefreshImmersiveColorPolicyState;89extern fnIsDarkModeAllowedForWindow _IsDarkModeAllowedForWindow;90extern fnGetIsImmersiveColorUsingHighContrast _GetIsImmersiveColorUsingHighContrast;91extern fnOpenNcThemeData _OpenNcThemeData;92// 1903 1836293extern fnShouldSystemUseDarkMode _ShouldSystemUseDarkMode;94extern fnSetPreferredAppMode _SetPreferredAppMode;95extern fnSetWindowTheme _SetWindowTheme;9697extern bool g_darkModeSupported;98extern bool g_darkModeEnabled;99100void InitDarkMode();101bool AllowDarkModeForWindow(HWND hWnd, bool allow);102void RefreshTitleBarThemeColor(HWND hWnd);103bool IsColorSchemeChangeMessage(LPARAM lParam);104bool IsDarkModeEnabled();105106void DarkModeInitDialog(HWND hDlg);107LRESULT DarkModeDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);108109110