Exemple #1
0
// 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());
  }
Exemple #2
0
// 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);
  }