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); }
void FXToolBarShell::drawGrooveRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h){ dc.setForeground(shadowColor); dc.fillRectangle(x,y,w,1); dc.fillRectangle(x,y,1,h); dc.fillRectangle(x+1,y+h-2,w-2,1); dc.fillRectangle(x+w-2,y+1,1,h-2); dc.setForeground(hiliteColor); dc.fillRectangle(x+1,y+1,w-3,1); dc.fillRectangle(x+1,y+1,1,h-3); dc.fillRectangle(x,y+h-1,w,1); dc.fillRectangle(x+w-1,y,1,h); }
// 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::drawDoubleRaisedRectangle(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h){ dc.setForeground(baseColor); dc.fillRectangle(x,y,w-1,1); dc.fillRectangle(x,y,1,h-1); dc.setForeground(hiliteColor); dc.fillRectangle(x+1,y+1,w-2,1); dc.fillRectangle(x+1,y+1,1,h-2); dc.setForeground(shadowColor); dc.fillRectangle(x+1,y+h-2,w-2,1); dc.fillRectangle(x+w-2,y+1,1,h-1); dc.setForeground(borderColor); dc.fillRectangle(x,y+h-1,w,1); dc.fillRectangle(x+w-1,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 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 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); }