From 21a64f02e396cb2668db31c7fc0cbefdc377ca95 Mon Sep 17 00:00:00 2001 From: cxl Date: Fri, 18 Dec 2020 09:42:46 +0000 Subject: [PATCH] CtrlLib: Win32 HeaderCtrl appearance changed (now ignoring weird native appearance) git-svn-id: svn://ultimatepp.org/upp/trunk@15607 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/CtrlLib/Ch.h | 2 ++ uppsrc/CtrlLib/ChWin32.cpp | 24 +++++++----------------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/uppsrc/CtrlLib/Ch.h b/uppsrc/CtrlLib/Ch.h index bcb3f2db5..88a62a07a 100644 --- a/uppsrc/CtrlLib/Ch.h +++ b/uppsrc/CtrlLib/Ch.h @@ -38,6 +38,8 @@ Image WithRightLine(const Image& m, Color c, int w = DPI(1)); Image WithTopLine(const Image& m, Color c, int w = DPI(1)); Image WithBottomLine(const Image& m, Color c, int w = DPI(1)); +Color FaceColor(int adj); + // Creates synthetic style based on SColors and basic button face void ChSynthetic(Image *button100x100, Color *text, bool macos = false); diff --git a/uppsrc/CtrlLib/ChWin32.cpp b/uppsrc/CtrlLib/ChWin32.cpp index 88e938a67..45f353f3b 100644 --- a/uppsrc/CtrlLib/ChWin32.cpp +++ b/uppsrc/CtrlLib/ChWin32.cpp @@ -550,26 +550,16 @@ void ChHostSkin() s.border = s.trivialborder = XpInt(XP_COMBOBOX, CP_DROPDOWNBUTTON, CBXS_NORMAL, 2403/*TMT_BORDERSIZE*/); } } + { - HeaderCtrl::Style& s = HeaderCtrl::StyleDefault().Write(); - Win32Look(s.look, 4, XP_HEADER, HP_HEADERITEM); - Image hm = Unmultiply(XpImage(XP_HEADER, HP_HEADERITEM, 1, SColorPaper, Size(20, 10))); - RGBA textc = SColorText(); - int diff = Diff(hm[4][19], textc); - int hdroll = 0; + HeaderCtrl::Style& hs = HeaderCtrl::StyleDefault().Write(); for(int i = 0; i < 4; i++) { - int d = Diff(hm[4][i], textc); - if(d < diff) { - diff = d; - hdroll = i + 1; - } - d = Diff(hm[4][19 - i], textc); - if(d < diff) { - diff = d; - hdroll = -i; - } + Image h = CreateImage(Size(10, 10), FaceColor(decode(i, CTRL_NORMAL, 5, + CTRL_HOT, IsDarkTheme() ? 10 : 0, + CTRL_PRESSED, -5, + -8))); + hs.look[i] = ChHot(WithBottomLine(WithRightLine(h, SColorShadow(), 1), SColorShadow())); } - s.gridadjustment = hdroll; } { ProgressIndicator::Style& s = ProgressIndicator::StyleDefault().Write();