int ScrollBar::GetMousePart() { int q = -1; for(int i = 2; i >= 0; i--) if(HasMouseIn(GetPartRect(i))) { q = i; break; } return q; }
void SlimButton::Paint(Draw &w) { SystemDraw& sw = (SystemDraw&) w; float a = sw.alpha; sw.alpha = alpha; Size sz = GetSize(); if(HasMouseIn(sz)) w.DrawRect(sz, bg); sw.alpha = a; Size tsz = GetTextSize(label, StdFont()); w.DrawText((sz.cx - tsz.cx) / 2, (sz.cy - tsz.cy) / 2, label, StdFont(), fg); }
void HeaderCtrl::Paint(Draw& w) { RefreshDistribution(); Size sz = GetSize(); w.DrawRect(sz, SColorFace()); bool ds = !IsShowEnabled(); double rs = Denominator(); double rr = 0; int x = -sb; light = -1; bool first = true; int dx = Null; for(int i = 0; i < col.GetCount(); i++) { if(col[i].visible) { Rect r; if(mode == SCROLL) { int cx = (int)col[i].ratio; r = RectC(x, 0, cx, sz.cy); x += cx; } else { rr += rs ? col[i].ratio : 1; int xx = int(rr * sz.cx / (rs ? rs : col.GetCount())); r = RectC(x, 0, i == col.GetCount() - 1 ? sz.cx - x : xx - x, sz.cy); x = xx; } bool mousein = HasMouseIn(r.Deflated(1, 0)) && col[i].WhenAction && pushi < 0 && !isdrag; if(mousein) light = i; col[i].Paint(first, w, r.left, r.top, r.Width(), r.Height(), ds, push && i == pushi, mousein); if(isdrag && ti == i) dx = r.left; } if(x >= sz.cx) break; } Column h; h.header = this; h.Paint(first, w, x, 0, 999, sz.cy, false, false, false); if(isdrag) { w.DrawImage(dragx + dragd, 0, dragtab); DrawVertDrop(w, IsNull(dx) ? sz.cx - 2 : dx - (dx > 0), 0, sz.cy); } }