void FXToolBarShell::drawRaisedRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h){ dc.setForeground(shadowColor); dc.fillRectangle(x,y+h-1,w,1); dc.fillRectangle(x+w-1,y,1,h); dc.setForeground(hiliteColor); dc.fillRectangle(x,y,w,1); dc.fillRectangle(x,y,1,h); }
// Draw vertical ticks void FXSlider::drawVertTicks(FXDCWindow& dc,FXint x,FXint,FXint,FXint){ register FXint interval=range[1]-range[0]; register FXint travel,offset,v,d,p; if(0<interval){ d=delta; if(d<=0) d=incr; dc.setForeground(FXRGB(0,0,0)); travel=height-(border<<1)-padtop-padbottom-headSize-4; offset=height-border-padbottom-2-headSize/2; for(v=range[0]; v<=range[1]; v+=d){ p=offset-(travel*(v-range[0]))/interval; dc.fillRectangle(x,p,TICKSIZE,1); } } }
// Draw horizontal ticks void FXSlider::drawHorzTicks(FXDCWindow& dc,FXint,FXint y,FXint,FXint){ register FXint interval=range[1]-range[0]; register FXint travel,offset,v,d,p; if(0<interval){ d=delta; if(d<=0) d=incr; dc.setForeground(FXRGB(0,0,0)); travel=width-(border<<1)-padleft-padright-headSize-4; offset=border+padleft+2+headSize/2; for(v=range[0]; v<=range[1]; v+=d){ p=offset+(travel*(v-range[0]))/interval; dc.fillRectangle(p,y,1,TICKSIZE); } } }
// Draw down arrow, with point at x,y void FXRuler::drawDownArrow(FXDCWindow& dc,FXint x,FXint y){ FXPoint points[3]; points[0].x=x-ARROWLENGTH+1; points[0].y=y-ARROWLENGTH+1; points[1].x=x+ARROWLENGTH; points[1].y=y-ARROWLENGTH+1; points[2].x=x; points[2].y=y+1; dc.fillPolygon(points,3); }
void plot_canvas::draw_plot(FXEvent* event) { int ww = getWidth(), hh = getHeight(); ensure_canvas_size(ww, hh); if (m_canvas) { m_canvas->clear(); m_plots.draw(m_canvas, ww, hh); m_img->render(); FXDCWindow *dc = (event ? new FXDCWindow(this, event) : new FXDCWindow(this)); dc->drawImage(m_img, 0, 0); delete dc; } m_dirty_flag = false; }
// Draw multi-line label, with underline for hotkey void FXLabel::drawLabel(FXDCWindow& dc,const FXString& text,FXint hot,FXint tx,FXint ty,FXint tw,FXint){ register FXint beg,end; register FXint xx,yy; yy=ty+font->getFontAscent(); beg=0; do{ end=beg; while(end<text.length() && text[end]!='\n') end++; if(options&JUSTIFY_LEFT) xx=tx; else if(options&JUSTIFY_RIGHT) xx=tx+tw-font->getTextWidth(&text[beg],end-beg); else xx=tx+(tw-font->getTextWidth(&text[beg],end-beg))/2; dc.drawText(xx,yy,&text[beg],end-beg); if(beg<=hot && hot<end){ dc.fillRectangle(xx+font->getTextWidth(&text[beg],hot-beg),yy+1,font->getTextWidth(&text[hot],wclen(&text[hot])),1); } yy+=font->getFontHeight(); beg=end+1; } while(end<text.length()); }
// Draw triangle void FXMenuCascade::drawTriangle(FXDCWindow& dc,FXint l,FXint t,FXint,FXint b){ FXPoint points[3]; int m=(t+b)/2; points[0].x=l; points[0].y=t; points[1].x=l; points[1].y=b; points[2].x=l+(b-t)/2; points[2].y=m; dc.fillPolygon(points,3); }
void FXToolBarShell::drawDoubleSunkenRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h){ dc.setForeground(shadowColor); dc.fillRectangle(x,y,w-1,1); dc.fillRectangle(x,y,1,h-1); dc.setForeground(borderColor); dc.fillRectangle(x+1,y+1,w-3,1); dc.fillRectangle(x+1,y+1,1,h-3); dc.setForeground(hiliteColor); dc.fillRectangle(x,y+h-1,w,1); dc.fillRectangle(x+w-1,y,1,h); dc.setForeground(baseColor); dc.fillRectangle(x+1,y+h-2,w-2,1); dc.fillRectangle(x+w-2,y+1,1,h-2); }
// Draw document background void FXRulerView::drawBackground(FXDCWindow& dc) { FXint docx,docy,docw,doch; // Background dc.setForeground(backColor); docx=getDocumentX(); docy=getDocumentY(); docw=getDocumentWidth(); doch=getDocumentHeight(); dc.fillRectangle(0,0,docx,height); dc.fillRectangle(docx+docw,0,width-docx-docw,height); dc.fillRectangle(docx,0,docw,docy); dc.fillRectangle(docx,docy+doch,docw,height-docy-doch); // Document insides dc.setForeground(docColor); dc.fillRectangle(docx,docy,docw,doch); dc.setForeground(FXRGB(0,0,0)); dc.drawRectangle(docx-1,docy-1,docw+1,doch+1); dc.fillRectangle(docx+1,docy+doch+1,docw+2,2); dc.fillRectangle(docx+docw+1,docy+1,2,doch+2); }
// Draw down marker void FXRuler::drawDownMarker(FXDCWindow& dc,FXint x,FXint y){ FXPoint points[6]; points[0].x=x; points[0].y=y; points[1].x=x-MARKERLENGTH; points[1].y=y-MARKERLENGTH; points[2].x=x-MARKERLENGTH; points[2].y=y-MARKERLENGTH-MARKERLENGTH+1; points[3].x=x+MARKERLENGTH; points[3].y=y-MARKERLENGTH-MARKERLENGTH+1; points[4].x=x+MARKERLENGTH; points[4].y=y-MARKERLENGTH; points[5].x=x; points[5].y=y; dc.setForeground(baseColor); dc.fillPolygon(points,5); dc.setForeground(textColor); dc.drawLines(points,6); points[0].x=x; points[0].y=y-1; points[1].x=x+MARKERLENGTH-1; points[1].y=y-MARKERLENGTH; points[2].x=x+MARKERLENGTH-1; points[2].y=y-MARKERLENGTH-MARKERLENGTH+3; dc.setForeground(shadowColor); dc.drawLines(points,3); points[0].x=x; points[0].y=y-1; points[1].x=x-MARKERLENGTH+1; points[1].y=y-MARKERLENGTH; points[2].x=x-MARKERLENGTH+1; points[2].y=y-MARKERLENGTH-MARKERLENGTH+2; points[3].x=x+MARKERLENGTH-1; points[3].y=y-MARKERLENGTH-MARKERLENGTH+2; dc.setForeground(hiliteColor); dc.drawLines(points,4); }
// Draw slider head void FXRealSlider::drawSliderHead(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h){ FXint m; dc.setForeground(baseColor); dc.fillRectangle(x,y,w,h); if(options&REALSLIDER_VERTICAL){ m=(h>>1); if(options&REALSLIDER_ARROW_LEFT){ dc.setForeground(hiliteColor); dc.drawLine(x+m,y,x+w-1,y); dc.drawLine(x,y+m,x+m,y); dc.setForeground(shadowColor); dc.drawLine(x+1,y+h-m-1,x+m+1,y+h-1); dc.drawLine(x+m,y+h-2,x+w-1,y+h-2); dc.drawLine(x+w-2,y+1,x+w-2,y+h-1); dc.setForeground(borderColor); dc.drawLine(x,y+h-m-1,x+m,y+h-1); dc.drawLine(x+w-1,y+h-1,x+w-1,y); dc.fillRectangle(x+m,y+h-1,w-m,1); } else if(options&REALSLIDER_ARROW_RIGHT){ dc.setForeground(hiliteColor); dc.drawLine(x,y,x+w-m-1,y); dc.drawLine(x,y+1,x,y+h-1); dc.drawLine(x+w-1,y+m,x+w-m-1,y); #ifndef WIN32 dc.setForeground(shadowColor); dc.drawLine(x+w-2,y+h-m-1,x+w-m-2,y+h-1); dc.drawLine(x+1,y+h-2,x+w-m-1,y+h-2); dc.setForeground(borderColor); dc.drawLine(x+w-1,y+h-m-1,x+w-m-1,y+h-1); dc.drawLine(x,y+h-1,x+w-m-1,y+h-1); #else dc.setForeground(shadowColor); dc.drawLine(x+w-1,y+h-m-2,x+w-m-2,y+h-1); dc.drawLine(x+1,y+h-2,x+w-m-1,y+h-2); dc.setForeground(borderColor); dc.drawLine(x+w,y+h-m-2,x+w-m-1,y+h-1); dc.drawLine(x,y+h-1,x+w-m-1,y+h-1); #endif } else if(options&REALSLIDER_INSIDE_BAR){ drawDoubleRaisedRectangle(dc,x,y,w,h); dc.setForeground(shadowColor); dc.drawLine(x+1,y+m-1,x+w-2,y+m-1); dc.setForeground(hiliteColor); dc.drawLine(x+1,y+m,x+w-2,y+m); } else{ drawDoubleRaisedRectangle(dc,x,y,w,h); } }
void FXToolBarShell::drawBorderRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h){ dc.setForeground(borderColor); dc.drawRectangle(x,y,w-1,h-1); }
// Draw fragment of text in given style void FXConsole::drawTextFragment(FXDCWindow& dc,FXint x,FXint y,FXint,FXint,const FXchar *text,FXint n,FXuint sty) const { register FXColor color=FXRGB(255,255,255); dc.setForeground(color); y+=font->getFontAscent(); dc.drawText(x,y,text,n); }