void gcHyperlinkCtrl::onPaint(wxPaintEvent& WXUNUSED(event)) { wxRect rect = GetLabelRect(); rect.Offset(1,0); wxPaintDC dc(this); wxFont font = GetFont(); font.SetUnderlined(m_bUnderlined); dc.SetFont(font); dc.SetTextForeground(GetForegroundColour()); dc.SetTextBackground(GetBackgroundColour()); dc.DrawText(GetLabel(), rect.GetTopLeft()); if (HasFocus()) { wxColor rectColor(GetGCThemeManager()->getColor("checkbox", "focus-fg")); wxRect rect = GetRect(); rect.SetPosition(wxPoint(0,0)); dc.SetBrush(wxBrush(*wxRED, wxTRANSPARENT)); dc.SetPen(wxPen(rectColor)); dc.DrawRectangle(rect); } }
virtual void paintEvent(QPaintEvent *event) { Q_UNUSED(event); QStylePainter p(this); QStyleOptionButton opt; initStyleOption(&opt); p.drawControl(QStyle::CE_PushButtonLabel, opt); QRect rectColor(6, opt.iconSize.height() - 4, opt.iconSize.width() - 12, 4); //p.setBrush(QBrush(m_color)); p.fillRect(QRect(rectColor), m_color); }
bool RenderThemeApollo::paintMenuList(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) { ASSERT(o); ASSERT(o->style()); Color fillColor( 0xff, 0xff, 0xee ); fillColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor); Color rectColor( 0x18, 0x52, 0x84 ); if ( o->node() && !isEnabled(o)) { rectColor = Color( 0xce, 0xce, 0xdb ); } i.context->save(); i.context->setStrokeThickness(1); i.context->setStrokeColor(rectColor.rgb(), DeviceColorSpace); i.context->setFillColor(fillColor, DeviceColorSpace); i.context->drawRect(r); i.context->restore(); return false; }
Box::Box(float width, float height) { conv = 3.141592 / 180.0; gravity = 9.8; displayx = width; displayy = height; rectW = 50.0; rectL = 50.0; sf::Vector2f rectSize( rectW, rectL ); sf::Color rectColor( sf::Color::Green ); rect.setSize( rectSize ); rect.setOrigin( rectW/2.0, rectL/2.0 ); rect.setFillColor( rectColor ); // Some Initial Conditions sf::Vector2f boxPosition(0,0); speed = 1.f; rect.setPosition( displayx/2.0, 3*rectL ); collision = false; bounceNumber = 0; }
virtual void paintEvent(QPaintEvent *event) { Q_UNUSED(event); QStyleOptionToolButton opt; initStyleOption(&opt); QStylePainter p(this); p.setClipRect(opt.rect); drawCommonPrimitive(&p, &opt); QIcon::Mode mode = opt.state & QStyle::State_Enabled ? QIcon::Normal : QIcon::Disabled; if (mode == QIcon::Normal && (opt.state & QStyle::State_HasFocus || opt.state & QStyle::State_Sunken)) mode = QIcon::Active; QIcon::State state = QIcon::Off; if (opt.state & QStyle::State_On) state = QIcon::On; opt.icon.paint(&p, opt.rect, Qt::AlignCenter, mode, state); QRect rectColor(opt.rect.x() + 4, opt.iconSize.height() + 1, opt.iconSize.width() - 4, 4); p.fillRect(QRect(rectColor), m_color); }
void RenderRadio::paintObject(PaintInfo& i, int _tx, int _ty) { ASSERT(node()); Element* element = static_cast<Element*>(node()); InputElement* inputElement = toInputElement(element); bool isEnabled = element->isEnabledFormControl(); bool isChecked = inputElement->isChecked(); i.context->save(); RefPtr<Image> image = Image::loadPlatformResource( "radioButtonStates" ).get(); IntPoint destPt( _tx, _ty ); IntRect srcRect( 0, 0, 14, 16 ); if (isEnabled) { if (node()->active()) { if (isChecked) { srcRect.move( 75, 0 ); } else { srcRect.move( 60, 0 ); } } else if (node()->hovered()) { if (isChecked) { srcRect.move( 45, 0 ); } else { srcRect.move( 30, 0 ); } } else { if (isChecked) { srcRect.move( 15, 0 ); } else { } } } else { if (isChecked) { srcRect.move( 105, 0 ); } else { srcRect.move( 90, 0 ); } } i.context->drawImage( image.get(), DeviceColorSpace, destPt, srcRect ); // draw the focus ring. // if (node()->focused()) { IntRect focusRingSrcRect( 120, 0, 15, 17 ); i.context->drawImage( image.get(), DeviceColorSpace, destPt, focusRingSrcRect ); } #if 0 // this is the old "moveto - lineto" drawing code IntRect checkRect(_tx + borderLeft() , _ty + borderTop() , width() - borderLeft() - borderRight() , height() - borderBottom() - borderTop()); Color fillColor(0xff, 0xff, 0xff, 0x00); Color rectColor(0x18, 0x52, 0x84); Color checkColor(0x21, 0xa5, 0x21); if (!node()->isEnabled()) { rectColor = Color(0xce, 0xce, 0xdb); checkColor = Color(0xce, 0xce, 0xdb); } i.context->setStrokeThickness(1); i.context->setStrokeStyle(SolidStroke); i.context->setStrokeColor(rectColor); i.context->setFillColor(fillColor); i.context->drawEllipse(checkRect); if(node()->isEnabled() && node()->hovered()) { i.context->setStrokeColor(Color(0xff, 0xb5, 0x31)); IntRect hoverRect = checkRect; hoverRect.inflateX(-1); hoverRect.inflateY(-1); i.context->drawEllipse( hoverRect ); hoverRect.inflateX(-1); hoverRect.inflateY(-1); i.context->drawEllipse( hoverRect ); } if (isChecked) { i.context->setStrokeThickness(2); i.context->setStrokeColor(checkColor); i.context->setFillColor(checkColor); IntRect fillRect = checkRect; fillRect.inflateX(-2); fillRect.inflateY(-2); i.context->drawEllipse(fillRect); } #endif i.context->restore(); }