void draw(Engine &painter)
  {
    Label::draw( painter );

    Picture goodIcon = GoodHelper::picture( _type );
    painter.draw( goodIcon, absoluteRect().lefttop() + Point( 15, 0 ), &absoluteClippingRectRef() );
    painter.draw( goodIcon, absoluteRect().lefttop() + Point( 390, 0 ), &absoluteClippingRectRef() );
  }
Beispiel #2
0
//! draws the element and its children
void GroupBox::draw(gfx::Engine& painter )
{
  if (!visible())
      return;

  if( _d->backgroundImage.isValid() )
  {
    painter.draw( _d->backgroundImage, absoluteRect().UpperLeftCorner, &absoluteClippingRectRef() );
  }
  else
  {
    painter.draw( _d->background, absoluteRect().UpperLeftCorner, &absoluteClippingRectRef() );
  }

  Widget::draw( painter );
}
Beispiel #3
0
void TouchEventHandler::drawTapHighlight()
{
    Element* elementUnderFatFinger = m_lastFatFingersResult.nodeAsElementIfApplicable();
    if (!elementUnderFatFinger)
        return;

    Element* element = elementForTapHighlight(elementUnderFatFinger);
    if (!element)
        return;

    // Get the element bounding rect in transformed coordinates so we can extract
    // the focus ring relative position each rect.
    RenderObject* renderer = element->renderer();
    ASSERT(renderer);

    Frame* elementFrame = element->document()->frame();
    ASSERT(elementFrame);

    FrameView* elementFrameView = elementFrame->view();
    if (!elementFrameView)
        return;

    // Tell the client if the element is either in a scrollable container or in a fixed positioned container.
    // On the client side, this info is being used to hide the tap highlight window on scroll.
    RenderLayer* layer = m_webPage->enclosingFixedPositionedAncestorOrSelfIfFixedPositioned(renderer->enclosingLayer());
    bool shouldHideTapHighlightRightAfterScrolling = !layer->renderer()->isRenderView();
    shouldHideTapHighlightRightAfterScrolling |= !!m_webPage->m_inRegionScroller->d->node();

    IntPoint framePos(m_webPage->frameOffset(elementFrame));

    // FIXME: We can get more precise on the <map> case by calculating the rect with HTMLAreaElement::computeRect().
    IntRect absoluteRect(renderer->absoluteClippedOverflowRect());
    absoluteRect.move(framePos.x(), framePos.y());

    IntRect clippingRect;
    if (elementFrame == m_webPage->mainFrame())
        clippingRect = IntRect(IntPoint(0, 0), elementFrameView->contentsSize());
    else
        clippingRect = m_webPage->mainFrame()->view()->windowToContents(m_webPage->getRecursiveVisibleWindowRect(elementFrameView, true /*noClipToMainFrame*/));
    clippingRect = intersection(absoluteRect, clippingRect);

    Vector<FloatQuad> focusRingQuads;
    renderer->absoluteFocusRingQuads(focusRingQuads);

    Platform::IntRectRegion region;
    for (size_t i = 0; i < focusRingQuads.size(); ++i) {
        IntRect rect = focusRingQuads[i].enclosingBoundingBox();
        rect.move(framePos.x(), framePos.y());
        IntRect clippedRect = intersection(clippingRect, rect);
        clippedRect.inflate(2);
        region = unionRegions(region, Platform::IntRect(clippedRect));
    }

    Color highlightColor = element->renderStyle()->tapHighlightColor();

    m_webPage->m_tapHighlight->draw(region,
                                    highlightColor.red(), highlightColor.green(), highlightColor.blue(), highlightColor.alpha(),
                                    shouldHideTapHighlightRightAfterScrolling);
}
void AboutWarehouse::showSpecialOrdersWindow()
{
  Point pos;
  if( top() > (int)parent()->height() / 2 )
  {
    pos = Point( screenLeft(), screenBottom() - WarehouseSpecialOrdersWindow::defaultHeight );
  }
  else
  {
    pos = absoluteRect().UpperLeftCorner;
  }

  new WarehouseSpecialOrdersWindow( parent(), pos, _warehouse );
}
void AboutGranary::showSpecialOrdersWindow()
{
  Point pos;
  if( top() > (int)parent()->height() / 2 )
  {
    pos = Point( screenLeft(), screenBottom() - GranarySpecialOrdersWindow::defaultHeight );
  }
  else
  {
    pos = absoluteRect().UpperLeftCorner;
  }

  new GranarySpecialOrdersWindow( parent(), pos, _granary );
}
  virtual void _updateBackground(gfx::Engine&, bool&)
  {
    _background().destroy();

    Pictures pics;
    Decorator::draw( pics, Rect( Point(), size() ), style );

    Picture emlbPic( gui::rc.panel, config::id.empire.stamp );
    pics.append( emlbPic, Point( 4, 2 ) );
    pics.append( emlbPic, Point( width() - emlbPic.width()-4, 2 ) );

    bool batchOk = _background().load( pics, absoluteRect().lefttop() );
    if( !batchOk )
    {
      _background().destroy();
      Decorator::reverseYoffset( pics );
      _backgroundNb() = pics;
    }
  }
Beispiel #7
0
IntPoint BackingStoreClient::absoluteLocation() const
{
    return absoluteRect().location();
}
Beispiel #8
0
IntRect BackingStoreClient::transformedAbsoluteRect() const
{
    return m_webPage->d->mapToTransformed(absoluteRect());
}
Beispiel #9
0
void Console::draw( gfx::Engine& painter )
{
  if( !font().isValid() )
  {
    Widget::draw( painter );
    return;
  }

  if( visible() )															// render only if the console is visible
  {
    if( toggle_visible_ != NONE )
    {
      if( toggle_visible_ == DOWNLIGTH )
      {
        if (_opacity > 5) _opacity -= 9;
        else setVisible(false);
        _d->dirty = true;
      }
      else
      {
        if (_opacity < 0xff)	_opacity += 3;
        else toggle_visible_ = NONE;
        _d->dirty = true;
      }
    }

    Rect textRect, shellRect;										//we calculate where the message log shall be printed and where the prompt shall be printed
    calculatePrintRects(textRect,shellRect);

    if(_d->dirty)
    {
      Decorator::drawLines(_d->bg, ColorList::red, relativeRect().lines());
      _d->bg.fill(ColorList::blue);

      unsigned int maxLines, lineHeight;											//now, render the messages
      int fontHeight=0;
      if (!calculateLimits(maxLines,lineHeight,fontHeight))
      {
        return;
      }

      Rect lineRect( textRect.left(),						//calculate the line rectangle
                     textRect.top(),
                     textRect.right(),
                     textRect.bottom() + lineHeight);

      for (unsigned int index = 0; index < console_messages_.size(); index++)
      {
        unsigned int rindex = (_d->curIndex + index) % console_messages_.size();
        const std::string& line = console_messages_[rindex];
        font().draw(_d->bg, line, lineRect.lefttop(), false, false);
        lineRect += Point(0, lineHeight);						//update line rectangle
      }

      std::string shellText = "$>" + currentCommand_;

      font().draw( _d->bg, shellText, shellRect.lefttop(), false, false);	//draw the prompt string

      _d->dirty = false;
      _d->bg.update();
      _d->bg.setAlpha(_opacity/3*2);
    }

    painter.draw( _d->bg, absoluteRect().lefttop() );

    if( DateTime::elapsedTime() % 700 < 350 )
    {
      NColor color = ColorList::white;
      color.setAlpha(_opacity/2);
      painter.fillRect( color, Rect(0, 0, _d->commandCursorWidth,shellRect.height()*0.8)
                        +absoluteRect().leftbottom() + Point(_d->commandTextSize.width(), -shellRect.height()) );
    }
  }

  Widget::draw( painter );
}