From 1d531b13e2182d282947687d7807f8a6dd39a22d Mon Sep 17 00:00:00 2001 From: cxl Date: Mon, 9 Mar 2020 22:43:29 +0000 Subject: [PATCH] CtrlLib: Chameleon improvement git-svn-id: svn://ultimatepp.org/upp/trunk@14146 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/CtrlLib/Bar.h | 1 + uppsrc/CtrlLib/Ch.cpp | 1 + uppsrc/CtrlLib/MenuItem.cpp | 13 ++++++++----- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/uppsrc/CtrlLib/Bar.h b/uppsrc/CtrlLib/Bar.h index 03b3345ac..0fa0ec112 100644 --- a/uppsrc/CtrlLib/Bar.h +++ b/uppsrc/CtrlLib/Bar.h @@ -326,6 +326,7 @@ public: int rsepm; Point pullshift; // offset of submenu popup bool opaquetest; // If true, topmenu item can change hot text color + Value icheck; // background of Check (or Radio) item with image }; private: diff --git a/uppsrc/CtrlLib/Ch.cpp b/uppsrc/CtrlLib/Ch.cpp index b9ba0dfe2..bb6e86139 100644 --- a/uppsrc/CtrlLib/Ch.cpp +++ b/uppsrc/CtrlLib/Ch.cpp @@ -682,6 +682,7 @@ void ChMakeSkin(int roundness, Color button_face, Color thumb, int *adj) { MenuBar::Style& s = MenuBar::StyleDefault().Write(); s.topitem[1] = Blend(SColorHighlight(), SColorPaper()); + s.icheck = button[CTRL_PRESSED]; } GUI_PopUpEffect_Write(Ctrl::IsCompositedGui() ? GUIEFFECT_NONE : GUIEFFECT_SLIDE); diff --git a/uppsrc/CtrlLib/MenuItem.cpp b/uppsrc/CtrlLib/MenuItem.cpp index 1514f4a57..925d19ec6 100644 --- a/uppsrc/CtrlLib/MenuItem.cpp +++ b/uppsrc/CtrlLib/MenuItem.cpp @@ -309,16 +309,19 @@ void MenuItem::Paint(Draw& w) int x = max(Zx(3), (leftgap + textgap - isz.cx) / 2); if(!licon.IsEmpty() && type) { chk = type == CHECK1 || type == RADIO1; + Rect rr = RectC(x - Zx(2), iy - Zy(2), isz.cx + Zx(4), isz.cy + Zy(4)); if(GUI_GlobalStyle() >= GUISTYLE_XP) { - if(chk && !hl) - DrawXPButton(w, RectC(x - Zx(2), iy - Zy(2), isz.cx + Zx(4), isz.cy + Zy(4)), - BUTTON_EDGE|BUTTON_CHECKED); + if(chk && !hl) { + if(IsNull(style->icheck)) + DrawXPButton(w, rr, BUTTON_EDGE|BUTTON_CHECKED); + else + ChPaint(w, rr, style->icheck); + } } else { w.DrawRect(x - Zx(1), iy - Zy(1), isz.cx + Zx(2), isz.cy + Zy(2), chk ? Blend(SColorFace, SColorLight) : SColorFace); - DrawBorder(w, x - Zx(2), iy - Zy(2), isz.cx + Zx(4), isz.cy + Zy(4), - chk ? ThinInsetBorder : ThinOutsetBorder); + DrawBorder(w, rr, chk ? ThinInsetBorder : ThinOutsetBorder); } } if(isenabled)