void MyList::Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const { if(style & CURSOR) w.DrawRect(r,SLtGray()); else w.DrawRect(r,SWhite()); w.DrawText(r.left,r.top,q.ToString()); }
void MyApp::Paint(Draw& w) { w.DrawRect(GetSize(), SColorPaper()); w.DrawText(pos.x, pos.y, data.text, StdFont(), data.color); if(!IsNull(dragpos)) w.DrawRect(RectC(dragpos.x - 1, dragpos.y - 1, 3, 3), LtBlue); }
void RGBACtrl::Paint(Draw& w) { w.DrawRect(GetSize(), SColorFace); if(alpha.IsMask()) return; for(int x = 0; x <= 18; x++) w.DrawRect(x * cbox.cx + cs.x, cs.y, 1, cbox.cy * 14, SColorText()); int i = 0; int my = cs.y + 1; w.DrawRect(cs.x, cs.y + 14 * cbox.cy, cbox.cx * 18 + 1, 1, SColorText()); Point pp = Null; for(int y = 0; y < 14; y++) { w.DrawRect(cs.x, my - 1, cbox.cx * 18 + 1, 1, SColorText()); int mx = cs.x + 1; for(int x = 0; x < 18; x++) { Color c = GetColor(i++); w.DrawRect(mx, my, cbox.cx - 1, cbox.cy - 1, c); if(c == color) pp = Point(mx, my); mx += cbox.cx; } my += cbox.cy; } if(!IsNull(pp)) { Size isz = CtrlImg::wheel_cursor().GetSize(); pp = pp + (cbox - isz) / 2; w.DrawImage(pp.x, pp.y, CtrlImg::wheel_cursor(), Grayscale(color) < 120 ? White() : Black()); } }
virtual void Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const { w.DrawRect(r, paper); w.DrawText(r.left, r.top, AsString(q), StdFont(), ink); Font fnt; fnt.FaceName("Bitstream Vera Sans Mono"); // fnt.Face(Font::ARIAL); fnt.Height(20); WString txt((int)q, 1); w.DrawText(r.left + 40, r.top, txt, Courier(20), ink); GlyphInfo gi = GetGlyphMetrics(fnt, q); w.DrawRect(r.left + 60, r.top, gi.width, r.GetHeight(), LtCyan()); gi = GetGlyphInfo(fnt, q); if(!gi.IsMissing()) { if(gi.IsNormal()) w.DrawText(r.left + 60, r.top, txt, fnt); else if(gi.IsReplaced()) w.DrawText(r.left + 60, r.top, txt, fnt().Face(gi.lspc), Magenta()); else if(gi.IsComposed()) { ComposedGlyph g; if(Compose(fnt, q, g)) { w.DrawText(r.left + 60, r.top, WString(g.basic_char, 1), fnt, LtBlue()); w.DrawText(r.left + 60 + g.mark_pos.x, r.top + g.mark_pos.y, WString(g.mark_char, 1), g.mark_font, LtRed()); } } } else w.DrawText(r.left + 60, r.top, txt, fnt, ink); w.DrawRect(r.left, r.bottom - 1, r.Width(), 1, Black()); }
void ValueSlider::Paint(Draw &w) { Size sz = GetSize(); /*w.DrawRect(0, 0, sz.cx, 1, Black); w.DrawRect(0, sz.cy - 1, sz.cx, 1, Black); w.DrawRect(0, 0, 1, sz.cy, Black); w.DrawRect(sz.cx - 1, 0, 1, sz.cy, Black);*/ int t = (int) (((pos - minValue) * sz.cx) / (maxValue - minValue)); if(t < 1) t = 1; if(t > sz.cx - 1) t = sz.cx - 1; if(shaded) { for(int i = 1; i < t; i++) w.DrawRect(i, 1, 1, sz.cy - 2, Blend(src, dst, 256 * i / (sz.cx - 1))); } else { w.DrawRect(Rect(1, 1, t, sz.cy - 1), dst); } if(t < sz.cx - 1) w.DrawRect(Rect(t, 1, sz.cx - 1, sz.cy - 1), Color(245, 245, 255)); String s = Format("%s : %.2f", text, pos); Size tsz = GetTextSize(s, StdFont()); w.DrawText((sz.cx - tsz.cx) / 2, (sz.cy - tsz.cy) / 2, s); }
void DrawHorzDrop(Draw& w, int x, int y, int cx) { w.DrawRect(x, y, cx, 2, SColorHighlight); w.DrawRect(x, y - 2, 1, 6, SColorHighlight); w.DrawRect(x + cx - 1, y - 2, 1, 6, SColorHighlight); w.DrawRect(x + 1, y - 1, 1, 4, SColorHighlight); w.DrawRect(x + cx - 2, y - 1, 1, 4, SColorHighlight); }
void DrawVertDrop(Draw& w, int x, int y, int cy) { w.DrawRect(x, y, 2, cy, SColorHighlight); w.DrawRect(x - 2, y, 6, 1, SColorHighlight); w.DrawRect(x - 2, y + cy - 1, 6, 1, SColorHighlight); w.DrawRect(x - 1, y + 1, 4, 1, SColorHighlight); w.DrawRect(x - 1, y + cy - 2, 4, 1, SColorHighlight); }
void ItemProperty::Paint(Draw& w) { Size sz = GetSize(); w.DrawRect(sz, SColorLtFace); w.DrawRect(0, GetHeight() - 1, sz.cx, 1, SColorText); w.DrawText(2, (EditField::GetStdHeight() + 6 - GetTextSize(name, StdFont()).cy) / 2, name, GetData() == defval ? StdFont()() : StdFont().Bold()); }
void DocEdit::Paint(Draw& w) { Size sz = GetSize(); Color bg = color[IsShowEnabled() && !IsReadOnly() ? PAPER_NORMAL : PAPER_READONLY]; if(nobg) bg = Null; int y = -sb + 1; int pos = 0; int sell, selh; GetSelection(sell, selh); for(int i = 0; i < para.GetCount() && y < sz.cy; i++) { int h = GetHeight(i); if(y + h >= 0) { WString text = line[i]; Fmt fmt = Format(text); int p = pos; for(int i = 0; i < fmt.line.GetCount(); i++) { int n = fmt.LineEnd(i) - fmt.line[i]; int a = minmax(sell - p, 0, n); int b = minmax(selh - p, 0, n) - a; int c = n - a - b; int *wa = fmt.width + fmt.line[i]; int *wb = fmt.width + fmt.line[i] + a; int *wc = fmt.width + fmt.line[i] + a + b; int acx = sSum(wa, a); int bcx = sSum(wb, b); int ccx = sSum(wc, c); w.DrawRect(1, y, acx, fmt.fi.GetHeight(), bg); w.DrawText(1, y, ~fmt.text + fmt.line[i], font, IsShowEnabled() ? color[INK_NORMAL] : color[INK_DISABLED], a, wa); w.DrawRect(1 + acx, y, bcx, fmt.fi.GetHeight(), color[PAPER_SELECTED]); w.DrawText(1 + acx, y, ~fmt.text + fmt.line[i] + a, font, color[INK_SELECTED], b, wb); w.DrawRect(1 + acx + bcx, y, ccx, fmt.fi.GetHeight(), bg); w.DrawText(1 + acx + bcx, y, ~fmt.text + fmt.line[i] + a + b, font, color[INK_NORMAL], c, wc); p += n; w.DrawRect(1 + acx + bcx + ccx, y, cx - (acx + bcx + ccx), fmt.fi.GetHeight(), p >= sell && p < selh ? color[PAPER_SELECTED] : bg); y += fmt.fi.GetHeight(); } w.DrawRect(1, y, cx, after, color[PAPER_NORMAL]); y += after; } else y += h; pos += line[i].GetLength() + 1; } w.DrawRect(0, -sb, sz.cx, 1, bg); w.DrawRect(0, 0, 1, sz.cy, bg); w.DrawRect(sz.cx - 1, 0, 1, sz.cy, bg); if(eofline) w.DrawRect(1, y++, cx, 1, SColorShadow); if(y < sz.cy) w.DrawRect(1, y, cx, sz.cy - y, bg); DrawTiles(w, DropCaret(), CtrlImg::checkers()); }
void Navigator::NavigatorDisplay::PaintBackground(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const { int ii = q; if(ii < 0 || ii >= item.GetCount()) return; const NavItem& m = *item[ii]; bool focuscursor = (style & (FOCUS|CURSOR)) == (FOCUS|CURSOR) || (style & SELECT); if(findarg(m.kind, KIND_FILE, KIND_NEST) >= 0) w.DrawRect(r, focuscursor ? paper : m.kind == KIND_NEST ? Blend(SColorMark, SColorPaper, 220) : SColorFace); else w.DrawRect(r, paper); }
void cyclic_space::Paint(Draw& w) { int i, j; Size sz = GetSize(); w.DrawRect(sz, White); for(i=0; i<640; i++) { for(j=0; j<480; j++) { w.DrawRect(i,j,1,1,col[fd[i][j]]); } } }
void InfoPanel::Paint(Draw& w) { Size sz = GetSize(); Size wsz = screenRect.GetSize(); Color frameColor = Color(183, 183, 183); Color bgColor = Color(102, 102, 102); w.DrawRect(sz, bgColor); w.DrawRect(0, 0, 1, sz.cy, frameColor); w.DrawRect(0, 0, sz.cx, 1, frameColor); w.DrawRect(sz.cx - 1, 0, 1, sz.cy, frameColor); String info = Format("FPS: %.2f, Textures: %d (%d), Size: %d, %d", GetFps(), resources.textures.GetCount(), resources.bindedTextures, wsz.cx, wsz.cy); w.DrawText(5, sz.cy - 18, info, StdFont(), White); }
int Navigator::NavigatorDisplay::DoPaint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const { int ii = q; if(ii < 0 || ii >= item.GetCount()) return 0; const NavItem& m = *item[ii]; bool focuscursor = (style & (FOCUS|CURSOR)) == (FOCUS|CURSOR) || (style & SELECT); int x = r.left; int ry = r.top + r.GetHeight() / 2; int y = ry - Draw::GetStdFontCy() / 2; if(findarg(m.kind, KIND_FILE, KIND_NEST) >= 0) { w.DrawRect(r, focuscursor ? paper : m.kind == KIND_NEST ? Blend(SColorMark, SColorPaper, 220) : SColorFace); if(m.kind == KIND_FILE) return PaintFileName(w, r, m.type, ink); String h = FormatNest(m.type); w.DrawText(x, y, h, StdFont().Bold(), ink); return GetTextSize(h, StdFont().Bold()).cx; } w.DrawRect(r, paper); if(m.kind == KIND_LINE) { w.DrawText(x, y, m.type, StdFont().Bold(), ink); return GetTextSize(m.type, StdFont().Bold()).cx; } PaintCppItemImage(w, x, ry, m.access, m.kind, focuscursor); x += Zx(15); Vector<ItemTextPart> n = ParseItemNatural(m.name, m.natural, m.ptype, m.pname, m.type, m.tname, m.ctname, ~m.natural + m.at); int starti = 0; for(int i = 0; i < n.GetCount(); i++) if(n[i].type == ITEM_NAME) { starti = i; break; } PaintText(w, x, y, m.natural, n, starti, n.GetCount(), focuscursor, ink, false); if(starti) { const char *h = " : "; w.DrawText(x, y, h, BrowserFont(), SColorText); x += GetTextSize(h, BrowserFont()).cx; } PaintText(w, x, y, m.natural, n, 0, starti, focuscursor, ink, false); return x; }
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()); }
// frame painting void XMLDragFrame::FramePaint(Draw& w, const Rect& r) { w.DrawRect(r, SColorFace()); int x1 = r.left + 1; int x2 = r.right - 1; int y1 = r.top + 1; int y2 = r.bottom -1; w.DrawLine(x1, y1, x2, y1, 1, SColorLight()); w.DrawLine(x2, y1, x2, y2, 1, SColorShadow()); w.DrawLine(x2, y2, x1, y2, 1, SColorShadow()); w.DrawLine(x1, y2, x1, y1, 1, SColorLight()); if(align == ToolBar::BAR_LEFT || align == ToolBar::BAR_RIGHT) { x1 = r.left + 5; x2 = r.right - 5; y1 = r.top + 4; y2 = r.top + 9; w.DrawLine(x1, y1, x2, y1, 2, SColorShadow()); w.DrawLine(x1, y2, x2, y2, 2, SColorShadow()); } else { x1 = r.left + 4; x2 = r.left + 9; y1 = r.top + 5; y2 = r.bottom - 5; w.DrawLine(x1, y1, x1, y2, 2, SColorShadow()); w.DrawLine(x2, y1, x2, y2, 2, SColorShadow()); } }
/////////////////////////////////////////////////////////////////////////////////////////////// // paint routine void PixRasterBaseCtrl::Paint(Draw &d) { // clears background d.DrawRect(GetSize(), SColorFace()); // if no associated PixRaster, does nothing if(!pixRasterCtrl->GetPixBase()) return; // paints image inside cache, if needed PaintCache(); // paints image cache inside control if(imageCache.GetWidth() >= GetSize().cx) imageCache.Paint(d, Point(0, 0)); else imageCache.Paint(d, Point((GetSize().cx - imageCache.GetWidth()) / 2, 0)); // paints markers inside control PaintMarkers(d); // if dragging, paints rubber banded polygon if(selectedMarker && dragPolygon.GetCount()) { d.DrawPolygon(dragPolygon, dragPolygon.GetCount(), selectedMarker->GetFillColor(), selectedMarker->GetBorderThickness(), selectedMarker->GetBorderColor(), PEN_DOT, White); } } // END LeptonicaBaseCtrl::Paint()
void DrawImageBandRLE(Draw& w, int x, int y, const Image& m, int minp) { int xi = 0; int cx = m.GetWidth(); int ccy = m.GetHeight(); Buffer<bool> todo(cx, true); #ifdef BENCHMARK_RLE sTotal += cx; #endif while(xi < cx) { int xi0 = xi; while(w.Dots() && IsWhiteColumn(m, xi) && xi < cx) xi++; if(xi - xi0 >= 16) { #ifdef BENCHMARK_RLE sRle += xi - xi0; #endif w.DrawRect(x + xi0, y, xi - xi0, ccy, White); Fill(~todo + xi0, ~todo + xi, false); } xi++; } xi = 0; while(xi < cx) if(todo[xi]) { int xi0 = xi; while(xi < cx && todo[xi] && xi - xi0 < 2000) xi++; w.DrawImage(x + xi0, y, m, RectC(xi0, 0, xi - xi0, ccy)); } else xi++; }
virtual void Paint(Draw& w) { Size sz = GetSize(); w.DrawRect(sz, LtGray); w.DrawRect(sz / 2, LtBlue); w.DrawText(10, 10, "Hello", Arial(12)); w.DrawImage(50, 50, CtrlImg::exclamation()); w.DrawImage(100, 50, CtrlImg::exclamation(), Blue); w.DrawImage(50, 150, CtrlsImg::O1h()); w.DrawImage(150, 150, CtrlsImg::O1h()); w.Clipoff(50, 180, 40, 40); w.DrawImage(0, 0, 50, 50, CtrlsImg::O1h()); w.End(); w.DrawImage(100, 100, ball); w.DrawImage(200, 200, 40, 40, ball); }
void Picture::Paint(Draw& w) { Size sz = GetSize(); w.DrawRect(0, 0, sz.cx, sz.cy, background); if(!picture) return; int dx = 0; int dy = 0; Size rz = sz; if(ratio) { Size sr = picture.GetSize(); if(sr.cy * sz.cx < sz.cy * sr.cx) { if(sr.cx) { rz.cy = sr.cy * sz.cx / sr.cx; dy = (sz.cy - rz.cy) / 2; } } else { if(sr.cy) { rz.cx = sr.cx * sz.cy / sr.cy; dx = (sz.cx - rz.cx) / 2; } } } w.Clipoff(dx, dy, rz.cx, rz.cy); w.DrawDrawing(0, 0, rz.cx, rz.cy, picture); w.End(); }
void DropGrid::Paint(Draw& w) { Size sz = GetSize(); Size isz = clear.GetStdSize(); if(clear_button && !notnull && IsEnabled() && IsSelected()) { clear.Show(); clear.RightPos(3, isz.cx).TopPos((sz.cy - isz.cy) / 2, isz.cy); } else clear.Hide(); GridDisplay &disp = display ? *display : list.GetDisplay(); bool hf = HasFocus(); bool isnull = rowid < 0; Color fg = hf ? SColorHighlightText() : IsEnabled() ? SColorText() : SColorDisabled(); Color bg = !IsEnabled() || !IsEditable() ? EditField::StyleDefault().disabled : notnull && isnull ? Blend(SColorPaper, Color(255, 0, 0), 32) : hf ? SColorHighlight() : SColorPaper(); const int d = 0; if(isnull) w.DrawRect(d, d, sz.cx - d * 2, sz.cy - d * 2, bg); else { Font fnt(StdFont()); Paint0(w, 1, 1, d, d, sz.cx - d * 2, sz.cy - d * 2, Format0(Null, rowid), 0, fg, bg, fnt); } if(hf) DrawFocus(w, d - 0, d - 0, sz.cx - (d - 0) * 2, sz.cy - (d - 0) * 2); }
virtual void Paint(Draw& w) { Rect r = w.GetPaintRect(); w.DrawRect(r, LtGray()); Point p = r.TopLeft(); if(p.x < 256 && p.y < 256) SetSurface(w, r, pixels, Size(256, 256), p); }
void DropGrid::Paint0(Draw &w, int lm, int rm, int x, int y, int cx, int cy, const Value &val, dword style, Color &fg, Color &bg, Font &fnt, bool found, int fs, int fe) { real_size.Clear(); w.DrawRect(x, y, cx, cy, bg); int nx = x + lm; int ny = y + tm; int ncx = cx - lm - rm; if(IsType< Vector<String> >(val)) { const Vector<String> &v = ValueTo< Vector<String> >(val); const char * SPACE = " "; int tcx = 0; int scx = GetTextSize(SPACE, fnt).cx; int cnt = v.GetCount(); Size isz = GridImg::Dots2().GetSize(); for(int i = 0; i < cnt; i++) { bool iscol = (i + 1) & 1; if(!display_columns && iscol) continue; fnt.Bold(iscol); Size tsz = GetTextSize(v[i], fnt); DrawText(w, nx, x + lm + tcx, ny, tcx + tsz.cx > ncx - isz.cx ? ncx - tcx: tsz.cx + isz.cx, cy, GD::VCENTER, WString(v[i]), fnt, fg, bg, found, fs, fe, false); tcx += tsz.cx + scx; } } else DrawText(w, nx, nx, ny, ncx, cy, GD::VCENTER, GetStdConvertedValue(val), fnt, fg, bg, found, fs, fe, false); }
void RichTextView::Paint(Draw& w) { Size sz = GetSize(); w.DrawRect(sz, background); sz.cx -= margin.left + margin.right; sz.cy -= margin.top + margin.bottom; w.Clipoff(margin.left, margin.top, sz.cx, sz.cy); PaintInfo pi; if(!hldec) pi.hyperlink = Null; if(sell < selh) { pi.sell = sell; pi.selh = selh; } pi.indexentry = Null; pi.highlightpara = highlight; pi.zoom = GetZoom(); int q = sb * pi.zoom; scroller.Set(q); w.Offset(0, -q); SimplePageDraw pw(w); pi.top = PageY(0, sb); pi.bottom = PageY(0, sb + sz.cy / pi.zoom); pi.usecache = true; pi.sizetracking = sizetracking; pi.shrink_oversized_objects = shrink_oversized_objects; Color c = SColorPaper(); if(Grayscale(c) < 100) pi.coloroverride = true; text.Paint(pw, GetPage(), pi); w.End(); w.End(); }
//============================================================================================== /*virtual*/ void TightFontDisplayForArrayCtrl::Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const { Font fnt(FontZ(Font::COURIER, 9)); String txt = q; w.DrawRect(r, paper); w.DrawText(r.left + 2, r.top + (r.Height() - GetTextSize(txt, fnt).cy) / 2, txt, fnt, ink); // <- Change is here - "w." no more needed }
virtual void Paint(Draw& w) { w.DrawRect(GetSize(), White); w.DrawText(10, 10, "ultimate++是一个性能优良的C++GUI库"); w.DrawText(10, 100, "X\357\274\214X"); WString h("x\357\274\214X"); w.DrawText(10, 150, h); DDUMP(h.GetLength()); }
virtual void Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const { ValueArray va = q; String txt = va[0]; Image icon = va[1]; w.DrawRect(r, paper); w.DrawImage(r.left, r.top + (r.Height() - 16) / 2, IsNull(icon) ? IdeImg::Package() : icon); w.DrawText(r.left + 20, r.top + (r.Height() - Draw::GetStdFontCy()) / 2, txt, fnt, ink); }
virtual void Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const { Font fnt = Font(q, r.Height() - 2); String txt = Font::GetFaceName(q); w.DrawRect(r, paper); w.DrawText(r.left + 2, r.top + (r.Height() - GetTextSize(txt, fnt).cy) / 2, txt, fnt, ink); }
void IdeImgView::Paint(Draw& w) { Size sz = GetSize(); String t = (img_sz != img.GetSize() ? "Resized from: " : "Image size: "); t << Format("%d x %d", img_sz.cx, img_sz.cy); int tcy = Draw::GetStdFontCy(); w.DrawRect(0, 0, sz.cx, tcy, SColorFace()); w.DrawText(5, 0, t, StdFont(), SColorText()); int ii = 0; for(int x = 0; x < sz.cx; x += 16) { int jj = ii; for(int y = tcy; y < sz.cy; y += 16) w.DrawRect(x, y, 16, 16, jj++ & 1 ? LtGray() : WhiteGray()); ii++; } w.DrawImage(5, 5 + tcy, img); }
virtual void Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const { w.DrawRect(r, paper); Image m = q; if(!IsNull(m)) w.DrawImage(r.left, r.top, Rescale(m, r.GetSize())); }
void ColorDisplayNull::Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const { if(IsNull(q)) StdDisplay().Paint(w, r, nulltext, ink, paper, style); else w.DrawRect(r, Color(q)); }