void SeparatorCtrl::Paint(Draw& w) { Size sz = GetSize(); if(sz.cx > sz.cy) { int q = sz.cy / 2; ChPaint(w, lmargin, q - 1, sz.cx - (lmargin + rmargin), 1, style->l1); ChPaint(w, lmargin, q, sz.cx - (lmargin + rmargin), 1, style->l2); } else { int q = sz.cx / 2; ChPaint(w, q - 1, lmargin, 1, sz.cy - (lmargin + rmargin), style->l1); ChPaint(w, q, lmargin, 1, sz.cy - (lmargin + rmargin), style->l2); } };
void TopWindow::Paint(Draw& w) { if(!IsNull(st->background)) ChPaint(w, GetSize(), st->background); else background.Paint(w, GetSize(), SColorText, SColorShadow); }
void HeaderCtrl::Column::Paint(bool& first, Draw& w, int x, int y, int cx, int cy, bool disabled, bool push, bool hl) { const HeaderCtrl::Style *style = header ? header->style : &HeaderCtrl::StyleDefault();; if(first) { if(cx >= -style->gridadjustment) { cx -= style->gridadjustment; if(cx < 0) cx = 0; first = false; } } else x -= style->gridadjustment; bool p = push && style->pressoffset; int q = CTRL_NORMAL; if(hl) q = CTRL_HOT; if(push) q = CTRL_PRESSED; if(disabled) q = CTRL_DISABLED; ChPaint(w, x, y, cx, cy, IsNull(paper) ? style->look[q] : paper.operator Value()); x += margin; cx -= 2 * margin; w.Clip(x + 2, y, cx - 4, cy); PaintLabel(w, x + 2, y + 1, cx - 4, cy - 4, disabled, p); w.End(); }
void StaticBarArea::Paint(Draw& w) { if(IsNull(ToolBar().StyleDefault().arealook)) ChPaint(w, GetSize(), ToolBar().StyleDefault().look); else PaintBarArea(w, this, ToolBar().StyleDefault().arealook, upperframe ? Null : GetScreenRect().bottom); }
void PaintBarArea(Draw& w, Ctrl *x, const Value& look, int bottom) { Ctrl *tc = x->GetTopCtrl(); Rect sr = tc->GetScreenRect(); sr.bottom = Nvl(bottom, tc->GetScreenView().top); sr.Offset(-x->GetScreenRect().TopLeft()); ChPaint(w, sr, look); }
void DockCont::Handle::Paint(Draw& w) { if (IsShown() && dc) { const DockableCtrl::Style &s = dc->GetStyle(); Rect r = GetSize(); const Rect &m = s.handle_margins; Point p; if (s.handle_vert) p = Point(r.left-1 + m.left, r.bottom - m.bottom); else p = Point(r.left + m.left, r.top + m.top); ChPaint(w, r, s.handle[focus]); Image img = dc->GetIcon(); if (!img.IsEmpty()) { if (s.handle_vert) { int isz = r.GetWidth(); p.y -= isz; isz -= (m.left + m.right); ChPaint(w, max(p.x+m.left, r.left), p.y, isz, isz, img); p.y -= 2; } else { int isz = r.GetHeight(); isz -= (m.top + m.bottom); ChPaint(w, p.x, max(p.y, r.top), isz, isz, img); p.x += isz + 2; } } if (!s.title_font.IsNull()) { Ctrl *c = GetLastChild(); while (c && !c->IsShown() && c->GetParent()) c = c->GetNext(); if (s.handle_vert) r.top = c ? c->GetRect().bottom + m.top : m.top; else r.right = c ? c->GetRect().left + m.right : m.right; w.Clip(r); WString text = IsNull(dc->GetGroup()) ? dc->GetTitle() : (WString)Format("%s (%s)", dc->GetTitle(), dc->GetGroup()); w.DrawText(p.x, p.y, s.handle_vert ? 900 : 0, text, s.title_font, s.title_ink[focus]); w.End(); } } }
void DockWindow::HighlightCtrl::Paint(Draw &w) { if (!img.IsEmpty()) w.DrawImage(0, 0, img); bool nest = (GetMouseFlags() & nestedkey) ? !isnested : isnested; if (nest) { Rect r = GetSize(); Rect t = r; const TabCtrl::Style &s = TabCtrl::StyleDefault(); t.bottom -= s.tabheight + s.sel.top + 1; // Nasty bodge! See TabBar::GetStyleHeight r.top = t.bottom-1; r.right = max(min(150, r.GetWidth()/3), 20); r.left += 10; ChPaint(w, r, *highlight); ChPaint(w, t, *highlight); } else ChPaint(w, GetSize(), *highlight); }
// ImgButton void ImgButton::Paint(Draw &w) { Size sz = GetSize(); if (look) ChPaint(w, sz, look[Pusher::GetVisualState()]); int dx = IsPush() * -1; int dy = IsPush(); if (!img.IsEmpty()) { Size isz = img.GetSize(); w.DrawImage((sz.cx - isz.cx) / 2 + dx, (sz.cy - isz.cy) / 2 + dy, img); } }
void BarPane::PaintBar(Draw& w, const SeparatorCtrl::Style& ss, const Value& pane, const Value& iconbar, int iconsz) { Size sz = GetSize(); Rect r = GetSize(); for(int i = 0; i < breakpos.GetCount(); i++) if(horz) { int y = breakpos[i]; Rect rr = r; rr.bottom = y; ChPaint(w, rr, pane); if(!IsNull(ss.l1)) ChPaint(w, 0, y++, sz.cx, 1, ss.l1); if(!IsNull(ss.l2)) ChPaint(w, 0, y++, sz.cx, 1, ss.l2); r.top = y; } else { int x = breakpos[i]; Rect rr = r; rr.right = x; if(!IsNull(iconbar)) { Rect r2 = rr; r2.right = r2.left + iconsz; ChPaint(w, r2, iconbar); rr.left = r2.right; } ChPaint(w, rr, pane); if(!IsNull(ss.l1)) ChPaint(w, x++, 0, 1, sz.cy, ss.l1); if(!IsNull(ss.l2)) ChPaint(w, x++, 0, 1, sz.cy, ss.l2); r.left = x; } if(!horz && !IsNull(iconbar)) { Rect r2 = r; r2.right = r2.left + iconsz; ChPaint(w, r2, iconbar); r.left = r2.right; } ChPaint(w, r, pane); }
void MenuItemBase::PaintTopItem(Draw& w, int state) { Size sz = GetSize(); if(GUI_GlobalStyle() >= GUISTYLE_XP) { bool opaque = InOpaqueBar(); bool opaque2 = opaque || state; Color bg = SColorFace(); if(opaque2) ChPaint(w, 0, 0, sz.cx, sz.cy, style->topitem[state]); else if(opaque) w.DrawRect(0, 0, sz.cx, sz.cy, bg); String text = GetText(); Size isz = GetTextSize(text, StdFont()); Color txt = opaque ? style->topitemtext[0] : GetLabelTextColor(this); Color hltxt = opaque2 ? style->topitemtext[state] : GetLabelTextColor(this); if(!opaque && state != 2) { // Fix issues when text color is not compatible with transparent background (e.g. Ubuntu Ambience)] Color c = state == 1 ? SColorHighlight() : bg; int g = Grayscale(c); bool dark = IsDark(c); if(abs(g - Grayscale(txt)) < 70) txt = dark ? White() : Black(); if(abs(g - Grayscale(hltxt)) < 70) hltxt = dark ? White() : Black(); } DrawMenuText(w, 6, (sz.cy - isz.cy) / 2, text, GetFont(), IsItemEnabled(), state, txt, hltxt); } else { w.DrawRect(sz, SColorFace); static const ColorF b0[] = { (ColorF)1, SColorLight, SColorLight, SColorShadow, SColorShadow, }; static const ColorF b1[] = { (ColorF)1, SColorShadow, SColorShadow, SColorLight, SColorLight, }; String text = GetText(); Size isz = GetTextSize(text, StdFont()); DrawMenuText(w, 6, (sz.cy - isz.cy) / 2, text, GetFont(), IsItemEnabled(), false, SColorMenuText, SColorHighlightText); if(state) DrawBorder(w, 0, 0, sz.cx, sz.cy, state == 2 ? b1 : b0); } }
void ColorButton::Paint(Draw& w) { Size sz = GetSize(); Size isz = image.GetSize(); Point center = (sz - isz) / 2; if(GUI_GlobalStyle() >= GUISTYLE_XP) ChPaint(w, sz, style->look[!IsEnabled() ? CTRL_DISABLED : push ? CTRL_PRESSED : HasMouse() ? CTRL_HOT : CTRL_NORMAL]); else { w.DrawRect(sz, SColorFace); if(push) DrawFrame(w, sz, SColorShadow, SColorLight); else if(HasMouse()) DrawFrame(w, sz, SColorLight, SColorShadow); } if(IsNull(color)) w.DrawImage(center.x + push, center.y + push, nullimage); else w.DrawImage(center.x + push, center.y + push, image, color); w.DrawImage(center.x + push, center.y + push, staticimage); }
void ToolButton::Paint(Draw& w) { LTIMING("ToolButton::Paint"); paint_checked = checked; Size sz = GetSize(); UPP::Image image = GetImage(); Size isz = image.GetSize(); // Ctrl *q = GetParent()->GetParent(); // if(!q || !q->IsTransparent()) // w.DrawRect(sz, checked && !HasMouse() ? Blend(SColorFace, SColorLight) : SColorFace); int li = IsEnabled() ? HasMouse() ? GetMouseLeft() ? CTRL_PRESSED : checked ? CTRL_HOTCHECKED : CTRL_HOT : checked ? CTRL_CHECKED : CTRL_NORMAL : CTRL_DISABLED; ChPaint(w, sz, style->look[li]); Point off = style->offset[li]; Point ip = (sz - isz) / 2 + off; Size tsz(0, 0); if(kind != NOLABEL) tsz = GetTextSize(text, style->font); if(kind == BOTTOMLABEL) { ip.y -= tsz.cy / 2 + 1; w.DrawText((sz.cx - tsz.cx) / 2 + off.x, ip.y + isz.cy + 2 + off.y, text, style->font, style->textcolor[li]); } if(kind == RIGHTLABEL) { ip.x -= tsz.cx / 2 + 2; w.DrawText(ip.x + isz.cx + 3 + off.x, (sz.cy - tsz.cy) / 2 + off.y, text, style->font, style->textcolor[li]); } UPP::Image img = CachedContrast(image, style->contrast[li]); if(!IsEnabled()) img = DisabledImage(img); if(IsEnabled() && style->light[li]) DrawHighlightImage(w, ip.x, ip.y, img, true); else w.DrawImage(ip.x, ip.y, img); }
void ScrollBar::Paint(Draw& w) { w.DrawRect(GetSize(), SColorPaper()); int cc; Size sz = style->through ? GetSize() : Slider(cc).GetSize(); light = GetMousePart(); int p = push; if(!HasCapture()) p = -1; const Value *hl[] = { style->hlower, style->hupper, style->hthumb }; const Value *vl[] = { style->vupper, style->vlower, style->vthumb }; const Value **l = IsHorz() ? hl : vl; if(prev.IsShowEnabled()) { for(int i = 0; i < 3; i++) { Rect pr = GetPartRect(i); if(i != 2) { w.Clip(pr); pr = style->through ? GetSize() : Slider(); } if(i != 2 || thumbsize >= style->thumbmin) ChPaint(w, pr, l[i][p == i ? CTRL_PRESSED : light == i ? CTRL_HOT : CTRL_NORMAL]); if(i != 2) w.End(); } } else if(style->through) ChPaint(w, sz, l[0][CTRL_DISABLED]); else if(IsHorz()) { ChPaint(w, cc, 0, sz.cx / 2, sz.cy, l[0][CTRL_DISABLED]); ChPaint(w, cc + sz.cx / 2, 0, sz.cx - sz.cx / 2, sz.cy, l[1][CTRL_DISABLED]); } else { ChPaint(w, 0, cc, sz.cx, sz.cy / 2, l[0][CTRL_DISABLED]); ChPaint(w, 0, cc + sz.cy / 2, sz.cx, sz.cy - sz.cy / 2, l[1][CTRL_DISABLED]); // w.DrawRect(0, cc, sz.cx, sz.cy / 2, Red()); _DBG_ // w.DrawRect(0, cc + sz.cy / 2, sz.cx, sz.cy - sz.cy / 2, Green()); _DBG_ } }
void GridDisplay::PaintFixed(Draw &w, bool firstx, bool firsty, int x, int y, int cx, int cy, const Value &val, dword style, Font &fnt, bool indicator, bool moved, int sortmode, int sortcol, int sortcnt, bool horizontal) { real_size.cx = 0; real_size.cy = 0; bool chameleon = style & GD::CHAMELEON; bool highlight = style & GD::HIGHLIGHT; bool readonly = style & GD::READONLY; if(chameleon) { int ncx = cx; int nx = x; int ht = HeaderCtrl::StyleDefault().gridadjustment; if(firstx) { if(ncx >= -ht) { ncx -= ht; if(ncx < 0) ncx = 0; } } else nx -= ht; int q = CTRL_NORMAL; if(highlight) q = CTRL_HOT; if(readonly) q = CTRL_DISABLED; ChPaint(w, nx, y, ncx, cy, HeaderCtrl::StyleDefault().look[q]); } else { if(theme < 0) w.DrawRect(x, y, cx, cy, highlight ? Blend(SColorFace(), White, 128) : SColorFace()); else { int sx = cx > 1 ? cx : 1; int sy = cy - 1; if(sx > 0 && sy > 0) w.DrawImage(x, y, sx, sy, highlight ? hdrhigh : vhdr[theme]()); } //Color dark(76, 83, 92); Color dark(155, 154, 153); //Color dark(155, 154, 153); Color bright(White); if(!firstx) w.DrawRect(x, y, 1, cy, bright); if(!firsty) w.DrawRect(x, y, cx, 1, bright); if(firstx) w.DrawRect(x, y, 1, cy, dark); if(firsty) w.DrawRect(x, y, cx, 1, dark); w.DrawRect(x + cx - 1, y, 1, cy, dark); w.DrawRect(x, y + cy - 1, cx, 1, dark); } int tx = x + lm; if(firsty) { if(!leftImg.IsEmpty()) { Size isz = leftImg.GetSize(); w.DrawImage(tx, y + (cy - isz.cy) / 2, leftImg); tx += isz.cx + 3; } if(!rightImg.IsEmpty()) { Size isz = rightImg.GetSize(); w.DrawImage(x + cx - isz.cx - 3, y + (cy - isz.cy) / 2, rightImg); } if(!centerImg.IsEmpty()) { Size isz = centerImg.GetSize(); w.DrawImage(x + (cx - isz.cx) / 2, y + (cy - isz.cy) / 2, centerImg); } } if(moved) DrawBorder(w, x, y, cx, cy, BlackBorder); Color col = style & GD::READONLY ? Gray : Black; if(sortmode > 0) { Size isz = GridImg::SortAsc().GetSize(); int yf = y + (cy - isz.cy) / 2; int xf = tx + 2; tx = xf + isz.cx + 1; if(sortcol > 0 && sortcnt > 1) { String tcol = AsString(sortcol); Size tsz = GetTextSize(tcol, fnt); w.DrawText(tx, y + (cy - tsz.cy) / 2, tcol, fnt); tx += tsz.cx; } bool asc = sortmode == 1; if(reverse_sort_icon) asc = !asc; w.DrawImage(xf, yf, asc ? GridImg::SortAsc() : GridImg::SortDsc(), col); tx += 3; } if(indicator) { w.Clip(x, y, cx, cy); Image img; if((style & GD::CURSOR) && (style & GD::SELECT)) { img = GridImg::FocSel(); } else if(style & GD::CURSOR) { img = GridImg::Focused(); } else if(style & GD::SELECT) { img = GridImg::Selected(); } if(!img.IsEmpty()) { Size isz = img.GetSize(); int xp = IsNull(val) ? x + (cx - isz.cx) / 2 : tx; w.DrawImage(xp, y + (cy - isz.cy) / 2, img, col); if(!IsNull(val)) tx += isz.cx + 3; } w.End(); } if(cx > lm + rm && cy > tm + bm) { int nx = x + lm; int ny = y + tm; int ncx = cx - lm - rm; int ncy = cy - tm - bm; w.Clip(nx, ny, ncx, ncy); int al = style & GD::ALIGN ? style & GD::ALIGN : align; Color fg = style & GD::READONLY ? SColorDisabled() : SColorText(); DrawText(w, tx, nx, ny, ncx, ncy, al, GetStdConvertedValue(val), fnt, fg, SColorPaper, 0, 0, 0, style & GD::WRAP); w.End(); } }
void DockCont::Highlight() { if (!GetCount() || (!IsOpen() && !IsPopUp() && !GetParent())) return; ViewDraw v(this); ChPaint(v, GetSize(), GetCurrent().GetStyle().highlight); }
void MultiButton::Paint(Draw& w) { Size sz = GetSize(); int border, lx, rx; bool frm = Metrics(border, lx, rx); int mst = ChState(MAIN); if(frm && !nobg) ChPaint(w, sz, style->edge[style->activeedge ? mst : 0]); bool left = false; bool right = false; for(int i = 0; i < button.GetCount(); i++) { SubButton& b = button[i]; int st = ChState(i); int x = 0, cx = 0; GetPos(b, lx, rx, x, cx); bool dopaint = true; Value v = b.left ? left ? style->lmiddle[st] : style->left[st] : right ? style->rmiddle[st] : style->right[st]; if(!nobg) { if(ComplexFrame()) ChPaint(w, x, border, cx, sz.cy - 2 * border, style->simple[st]); else if(frm) { if(IsTrivial() && style->usetrivial) dopaint = false; ChPaint(w, x, border, cx, sz.cy - 2 * border, dopaint ? v : style->trivial[st]); } else { w.Clip(x, 0, cx, sz.cy); ChPaint(w, sz, style->look[Frame() ? mst : st]); if(IsNull(v) || !Frame()) { if((!IsTrivial() || style->trivialsep) && IsEnabled()) { if(b.left) { if(left) ChPaint(w, x, style->sepm, 1, sz.cy - 2 * style->sepm, style->sep1); ChPaint(w, x + cx - 1, style->sepm, 1, sz.cy - 2 * style->sepm, style->sep2); } else { ChPaint(w, x, style->sepm, 1, sz.cy - 2 * style->sepm, style->sep1); if(right) ChPaint(w, x + cx - 1, style->sepm, 1, sz.cy - 2 * style->sepm, style->sep2); } } } else ChPaint(w, x, 0, cx, sz.cy, v); w.End(); } } if(dopaint) { Size tsz = GetTextSize(b.label, StdFont()); Image m = tsz.cx > 0 ? b.img : (Image)Nvl(b.img, CtrlsImg::DA()); Size isz = m.GetSize(); Point p = (st == CTRL_PRESSED) * style->pressoffset; p.x += x + (cx - isz.cx - tsz.cx - (tsz.cx > 0 && isz.cx > 0 ? LB_IMAGE : 0)) / 2; p.y += (sz.cy - isz.cy) / 2; if(b.left) { if(!left) p.x += style->loff; } else if(!right) p.x += style->roff; if(b.monoimg || IsNull(b.img)) w.DrawImage(p.x, p.y, m, frm ? style->fmonocolor[st] : style->monocolor[st]); else w.DrawImage(p.x, p.y, m); if(tsz.cx > 0) { if(isz.cx > 0) p.x += isz.cx + LB_IMAGE; w.DrawText(p.x, (sz.cy - tsz.cy) / 2, b.label); } } (b.left ? left : right) = true; } Rect r, cr; cr = GetSize(); cr.left = lx; cr.right = rx; Color text = SColorLabel(); Color paper = Null; if(!nobg) { if(ComplexFrame()) { r = cr; paper = HasFocus() ? SColorHighlight() : SColorPaper(); if(HasFocus()) text = SColorHighlightText(); w.DrawRect(r, paper); } else if(frm) { Rect m = GetMargin(); r = Rect(max(lx, m.left), m.top, min(rx, sz.cx - m.right), sz.cy - m.bottom); Color paper; if(mst == CTRL_HOT && !IsTrivial()) paper = Blend(SColorHighlight, SColorPaper, 235); else if(mst == CTRL_PRESSED && !IsTrivial()) paper = Blend(SColorHighlight, SColorFace, 235); else if(HasFocus()) { paper = SColorHighlight(); text = SColorHighlightText(); } else paper = SColorPaper(); w.DrawRect(r, paper); cr = r; } else { w.Clip(lx, 0, rx - lx, sz.cy); ChPaint(w, sz, style->look[mst]); Rect m = style->margin; r = Rect(max(lx, m.left), m.top, min(rx, sz.cx - m.right), sz.cy - m.bottom); if(!IsTrivial() || style->trivialsep) { if(left) { r.left++; if(IsEnabled()) ChPaint(w, lx, style->sepm, 1, sz.cy - 2 * style->sepm, style->sep1); } if(right) { if(IsEnabled()) ChPaint(w, rx - 1, style->sepm, 1, sz.cy - 2 * style->sepm, style->sep2); r.right--; } } w.End(); cr = r; } } cr.left++; Rect clr = cr; if(!IsNull(valuecy)) { cr.top += (cr.GetHeight() - valuecy + 1) / 2; cr.bottom = cr.top + valuecy; } Value v = convert->Format(value); bool f = HasFocus() && !push && frm; if(cr.left < cr.right && display) { w.Clip(clr); display->Paint(w, cr, v, IsShowEnabled() ? text : SColorDisabled, paper, f ? Display::CURSOR : Display::FOCUS|Display::CURSOR); w.End(); } if(!frm && HasFocus()) DrawFocus(w, r); }
void SplitterFrame::Paint(Draw& draw) { const Value *ch = type == LEFT || type == RIGHT ? style->vert : style->horz; ChPaint(draw, Ctrl::GetSize(), ch[HasCapture()]); }
void ProgressIndicator::Paint(Draw& w) { Size sz = GetSize(); Size msz = GetMsz(); int p0 = 0; int p = pxp; if(total <= 0) { int l = max(msz.cx, msz.cy) & ~7; p0 = pxp - l / 4; p = min(p - p0, max(msz.cx, msz.cy) - p0); if(style->bound && p0 < 0) { p += p0; p0 = 0; } } if(style->classic || percent || !IsNull(color)) { ChPaintEdge(w, sz, EditFieldEdge()); Rect mg = ChMargins(EditFieldEdge()); sz -= Size(mg.left + mg.right, mg.top + mg.bottom); Rect r1, r2, r3; r1 = r2 = r3 = RectC(mg.left, mg.top, sz.cx, sz.cy); w.Clip(r1); if(sz.cx > sz.cy) { r1.right = r2.left = min(p, sz.cx) + mg.left + p0; r3.right = mg.left + p0; r3.bottom = r1.bottom; } else { r2.bottom = r1.top = sz.cy - min(p, sz.cy) + mg.left + p0; r3.bottom = mg.top + p0; r3.right = r1.right; } w.DrawRect(r1, Nvl(color, SColorHighlight())); w.DrawRect(r2, SColorPaper); w.DrawRect(r3, SColorPaper); if(percent) { String pt = Format("%d %%", 100 * actual / max(total, 1)); Size psz = GetTextSize(pt, StdFont()); int px = (sz.cx - psz.cx) / 2 + 2; int py = (sz.cy - psz.cy) / 2 + 2; w.Clip(r1); w.DrawText(px, py, pt, StdFont(), SColorLight); w.End(); w.Clip(r2); w.DrawText(px, py, pt, StdFont(), SColorText); w.End(); } w.End(); } else { if(sz.cy > sz.cx) { ChPaint(w, sz, style->vlook); Rect r = ChMargins(style->vlook); w.Clip(r.left, r.top, sz.cx - r.left - r.right, sz.cy - r.top - r.bottom); ChPaint(w, r.left, sz.cy - r.bottom - p - p0, sz.cx - r.left - r.right, p, style->vchunk); } else { ChPaint(w, sz, style->hlook); Rect r = ChMargins(style->hlook); w.Clip(r.left, r.top, sz.cx - r.left - r.right, sz.cy - r.top - r.bottom); ChPaint(w, r.left + p0, r.top, p, sz.cy - r.top - r.bottom, style->hchunk); } w.End(); } }
void MenuItem::Paint(Draw& w) { int q = text.Find('\t'); String txt, keydesc; if(accel) keydesc = GetKeyDesc(accel); if(q >= 0) { keydesc = text.Mid(q + 1); txt = text.Mid(0, q); } else txt = text; state = GetVisualState(); bool hl = state != NORMAL; Size sz = GetSize(); if(hl) { if(GUI_GlobalStyle() >= GUISTYLE_XP) ChPaint(w, 0, 0, sz.cx, sz.cy, style->item); else w.DrawRect(sz, SColorHighlight); } UPP::Image li = licon; if(li.IsEmpty()) { switch(type) { case CHECK0: li = CtrlImg::MenuCheck0(); break; case CHECK1: li = CtrlImg::MenuCheck1(); break; case RADIO0: li = CtrlImg::MenuRadio0(); break; case RADIO1: li = CtrlImg::MenuRadio1(); break; } } Size isz = li.GetSize(); // Size isz = min(maxiconsize, imsz); // if(isz != imsz) // li = CachedRescale(li, isz); int iy = (sz.cy - isz.cy) / 2; bool chk = false; int x = Zx(2); if(!licon.IsEmpty() && type) { chk = type == CHECK1 || type == RADIO1; if(GUI_GlobalStyle() >= GUISTYLE_XP) { if(chk && !hl) DrawXPButton(w, RectC(0, iy - Zy(2), isz.cx + Zx(4), isz.cy + Zy(4)), BUTTON_EDGE|BUTTON_CHECKED); } 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); } } if(isenabled) DrawHighlightImage(w, x, iy, li, hl || chk, true); else w.DrawImage(x, iy, DisabledImage(li)); x = max(isz.cx, leftgap) + textgap; isz = GetTextSize(text, StdFont()); DrawMenuText(w, x, (sz.cy - isz.cy) / 2, txt, font, isenabled, hl, style->menutext, style->itemtext); isz = ricon.GetSize(); if(isenabled) w.DrawImage(sz.cx - isz.cx, (sz.cy - isz.cy) / 2, ricon, hl ? style->itemtext : style->menutext); else w.DrawImage(sz.cx - isz.cx, (sz.cy - isz.cy) / 2, DisabledImage(ricon)); x = sz.cx - max(isz.cx, Zx(16)) - Zx(1); if(!IsEmpty(keydesc)) { isz = GetTextSize(keydesc, StdFont()); UPP::DrawMenuText(w, x - isz.cx - Zx(2), (sz.cy - isz.cy) / 2, keydesc, font, isenabled, hl, 0, SColorMenuMark(), style->itemtext, false); } }
void StaticRect::Paint(Draw& w) { ChPaint(w, GetSize(), bg); }
virtual void FramePaint(Draw& w, const Rect& r) { ChPaint(w, r.left, r.top, r.Width(), 1, TopSeparator1()); ChPaint(w, r.left, r.top + 1, r.Width(), 1, TopSeparator2()); }