CtrlCore: IsDarkThemeEnabled flag

git-svn-id: svn://ultimatepp.org/upp/trunk@12913 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2019-03-29 08:53:32 +00:00
parent 25fea8d9da
commit 33df3ece07
4 changed files with 32 additions and 1 deletions

View file

@ -842,6 +842,20 @@ bool Ctrl::IsUHDEnabled()
return ApplicationUHDEnabled;
}
bool ApplicationDarkThemeEnabled;
void Ctrl::SetDarkThemeEnabled(bool set)
{
ApplicationDarkThemeEnabled = set;
ReSkin();
}
bool Ctrl::IsDarkThemeEnabled()
{
return ApplicationDarkThemeEnabled;
}
Font StdFontZ(int height) { return FontZ(Font::STDFONT, height); }
Font SansSerifZ(int height) { return FontZ(Font::SANSSERIF, height); }
Font SerifZ(int height) { return FontZ(Font::SERIF, height); }

View file

@ -1248,6 +1248,9 @@ public:
static void SetUHDEnabled(bool set = true);
static bool IsUHDEnabled();
static void SetDarkThemeEnabled(bool set = true);
static bool IsDarkThemeEnabled();
static bool ClickFocus();
static void ClickFocus(bool cf);

View file

@ -2601,6 +2601,20 @@ is true.&]
[s5;:Upp`:`:Ctrl`:`:IsUHDEnabled`(`):%- [@(0.0.255) bool]_[* IsUHDEnabled]()&]
[s2; Returns the value set by SetUHDEnabled.&]
[s3;%- &]
[s4;%- &]
[s5;:Upp`:`:Ctrl`:`:SetDarkThemeEnabled`(bool`):%- [@(0.0.255) static]
[@(0.0.255) void]_[* SetDarkThemeEnabled]([@(0.0.255) bool]_[*@3 set]_`=_[@(0.0.255) true])
&]
[s2; Hints coloring and skinning algorithms that the application
is ready to work in dark theme mode. Currently this enables dark
theme in Windows (with other platforms dark theme is enabled
by default).&]
[s3; &]
[s4;%- &]
[s5;:Upp`:`:Ctrl`:`:IsDarkThemeEnabled`(`):%- [@(0.0.255) static] [@(0.0.255) bool]_[* IsDa
rkThemeEnabled]()&]
[s2; Returns the value set by SetDarkThemeEnabled.&]
[s3;%- &]
[s4; &]
[s5;K:Ctrl`:`:GetWorkArea`(`):%- [*^`:`:Rect^@(64) Rect][*@(64) _][* GetWorkArea][*@(64) ()]&]
[s2; Returns OS specific working area for the widget `- this is rectangle

View file

@ -665,7 +665,7 @@ void ChSysInit()
}
}
if(IsSystemThemeDark() && !IsDark(Color::FromCR(GetSysColor(COLOR_WINDOW))))
if(Ctrl::IsDarkThemeEnabled() && IsSystemThemeDark() && !IsDark(Color::FromCR(GetSysColor(COLOR_WINDOW))))
sEmulateDarkTheme = true;
NONCLIENTMETRICS ncm;