コード例 #1
0
void FOX16_HtmlCtx::paint(FXDC *dc, int xOffset, int yOffset) {
  HTML_OBJECT *o;

  o=HtmlCtx_GetRootObject(_context);
  if (o)
    _paint(dc, o, xOffset, yOffset);
}
コード例 #2
0
InfoBoxHouse::InfoBoxHouse( Widget* parent, const Tile& tile )
    : GuiInfoBox( parent, Rect( 0, 0, 510, 360 ), -1 ),
      _ed( new Impl )
{
  _ed->house = tile.getTerrain().getOverlay().as<House>();
  setTitle( _ed->house->getName() );
  _paint();
}
コード例 #3
0
void FOX16_HtmlCtx::_paint(FXDC *dc, HTML_OBJECT *o, int xOffset, int yOffset) {
  HTML_OBJECT *c;

  xOffset+=HtmlObject_GetX(o);
  yOffset+=HtmlObject_GetY(o);

  switch(HtmlObject_GetObjectType(o)) {
  case HtmlObjectType_Word: {
    HTML_PROPS *pr;
    HTML_FONT *fnt;
    FXFont *xfnt;
    int ascent=0;
    uint32_t col;

    pr=HtmlObject_GetProperties(o);

    /* select font */
    fnt=HtmlProps_GetFont(pr);
    xfnt=_getFoxFont(fnt);
    if (xfnt) {
      dc->setFont(xfnt);
      ascent=xfnt->getFontAscent();
    }

    /* select foreground color */
    col=HtmlProps_GetForegroundColor(pr);
    if (col==HTML_PROPS_NOCOLOR)
      dc->setForeground(_fgColor);
    else
      dc->setForeground(col);

    /* select background color */
    col=HtmlProps_GetBackgroundColor(pr);
    if (col==HTML_PROPS_NOCOLOR)
      dc->setBackground(_bgColor);
    else
      dc->setBackground(col);

    dc->drawText(xOffset, yOffset+ascent, HtmlObject_GetText(o));
    break;
  }

  case HtmlObjectType_Image: {
    HTML_IMAGE *img;

    img=HtmlObject_Image_GetImage(o);
    if (img) {
      FXImage *ximg;

      ximg=GWEN_INHERIT_GETDATA(HTML_IMAGE, FXImage, img);
      if (ximg) {
        HTML_PROPS *pr;
        uint32_t col;

        pr=HtmlObject_GetProperties(o);

        /* select background color */
        col=HtmlProps_GetBackgroundColor(pr);
        if (col==HTML_PROPS_NOCOLOR) {
          dc->setBackground(_bgColor);
          dc->setForeground(_bgColor);
        }
        else {
          dc->setBackground(col);
          dc->setForeground(col);
        }

        dc->fillRectangle(xOffset, yOffset, ximg->getWidth(), ximg->getHeight());

        dc->drawImage(ximg, xOffset, yOffset);
      }
    }
    break;
  }
  default:
    break;
  }

  c=HtmlObject_Tree_GetFirstChild(o);
  while(c) {
    _paint(dc, c, xOffset, yOffset);
    c=HtmlObject_Tree_GetNext(c);
  }
}