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 PopUpInfo::Paint(Draw& w) { Size sz = GetSize(); if(!IsTransparent()) w.DrawRect(0, 0, sz.cx, sz.cy, color); PaintLabel(w, 0, 0, sz.cx, sz.cy, !IsShowEnabled(), false, false, VisibleAccessKeys()); }
NAMESPACE_UPP void StaticText::Paint(Draw& w) { Size sz = GetSize(); if(!IsTransparent()) w.DrawRect(0, 0, sz.cx, sz.cy, SColorFace); PaintLabel(this, w, 0, 0, sz.cx, sz.cy, !IsShowEnabled(), false, false, VisibleAccessKeys()); }
Size LabelBase::PaintLabel(Draw& w, int x, int y, int cx, int cy, bool disabled, bool push, bool focus, bool vak) { return PaintLabel(w, RectC(x, y, cx, cy), disabled, push, focus, vak); }
Size LabelBase::PaintLabel(Draw& w, const Rect& r, bool disabled, bool push, bool focus, bool vak) { return PaintLabel(NULL, w, r, disabled, push, focus, vak); }
void LabelBox::Paint(Draw& w) { Size sz = GetSize(); if(!IsTransparent()) w.DrawRect(sz, SColorFace); Size lsz = GetLabelSize(); int d = lsz.cy >> 1; bool hline = sz.cy < 2 * Draw::GetStdFontCy(); bool vline = sz.cx < 2 * Draw::GetStdFontCy(); int ty = hline ? (sz.cy - lsz.cy) / 2 : 0; Size ts = PaintLabel(w, d + 2, ty, sz.cx, lsz.cy, !IsShowEnabled(), false, false, VisibleAccessKeys()); w.Begin(); w.ExcludeClip(d, ty, ts.cx + 4, ts.cy); if(GUI_GlobalStyle() >= GUISTYLE_XP || !IsNull(color)) { if(hline) { d = sz.cy / 2; w.DrawRect(0, d - 1, sz.cx, 1, SColorLight); w.DrawRect(0, d, sz.cx, 1, SColorShadow); w.DrawRect(0, d + 1, sz.cx, 1, SColorLight); } else if(vline) { d = sz.cx / 2; w.DrawRect(d - 1, 0, 1, sz.cy, SColorLight); w.DrawRect(d, 0, 1, sz.cy, SColorShadow); w.DrawRect(d + 1, 0, 1, sz.cy, SColorLight); } else { Color c = Nvl(color, LabelBoxColor); w.DrawRect(0, d + 2, 1, sz.cy - d - 4, c); w.DrawRect(sz.cx - 1, d + 2, 1, sz.cy - d - 4, c); w.DrawRect(2, sz.cy - 1, sz.cx - 4, 1, c); w.DrawRect(2, d, sz.cx - 4, 1, c); w.DrawRect(1, d + 1, 2, 1, c); w.DrawRect(1, d + 2, 1, 1, c); w.DrawRect(sz.cx - 3, d + 1, 2, 1, c); w.DrawRect(sz.cx - 2, d + 2, 1, 1, c); w.DrawRect(1, sz.cy - 2, 2, 1, c); w.DrawRect(1, sz.cy - 3, 1, 1, c); w.DrawRect(sz.cx - 3, sz.cy - 2, 2, 1, c); w.DrawRect(sz.cx - 2, sz.cy - 3, 1, 1, c); } } else { if(hline) { d = sz.cy / 2; w.DrawRect(0, d, sz.cx, 1, SColorShadow); w.DrawRect(0, d + 1, sz.cx, 1, SColorLight); } else if(vline) { d = sz.cx / 2; w.DrawRect(d, 0, 1, sz.cy, SColorShadow); w.DrawRect(d - 1, 1, 0, sz.cy, SColorLight); } else { w.DrawRect(1, d, sz.cx - 2, 1, SColorShadow); w.DrawRect(1, d + 1, sz.cx - 2, 1, SColorLight); w.DrawRect(0, d, 1, sz.cy - d - 1, SColorShadow); w.DrawRect(1, d + 1, 1, sz.cy - d - 2, SColorLight); w.DrawRect(sz.cx - 2, d, 1, sz.cy - d, SColorShadow); w.DrawRect(sz.cx - 1, d, 1, sz.cy - d, SColorLight); w.DrawRect(1, sz.cy - 2, sz.cx - 2, 1, SColorShadow); w.DrawRect(1, sz.cy - 1, sz.cx - 2, 1, SColorLight); } } w.End(); }