CtrlLib: Chameleon improvement

git-svn-id: svn://ultimatepp.org/upp/trunk@14146 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2020-03-09 22:43:29 +00:00
parent 40ebfca46e
commit 1d531b13e2
3 changed files with 10 additions and 5 deletions

View file

@ -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:

View file

@ -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);

View file

@ -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)