Esempio n. 1
0
void PHILinkItem::html( const PHIRequest *req, QByteArray &out, QByteArray &script, const QByteArray &indent ) const
{
    PHILabelItem::html( req, out, script, indent );
    QByteArray arr=data( DUrl ).toByteArray();
    script+=BL( "$$link('" )+id()+BL( "'," );
    if ( arr.isEmpty() ) {
        script+=BL( "undefined" );
    } else {
        script+=BL( "function(){" );
        if ( arr.startsWith( "javascript:" ) ) {
            arr.remove( 0, 11 );
            script+=arr;
        } else {
            arr.replace( '\'', BL( "\\'" ) );
            script+=BL( "phi.href('" )+arr+BL( "');" );
        }
        script+='}';
    }
    script+=BL( ",'" )+cssColor( realColor() )+BL( "','" );
    if ( realBackgroundColor()!=QColor( Qt::transparent ) ) script+=cssColor( realBackgroundColor() );
    script+=BL( "','" )+cssColor( realHoverColor() )+BL( "','" );
    if ( realHoverBgColor()!=QColor( Qt::transparent ) ) script+=cssColor( realHoverBgColor() );
    script+=BL( "')" );
    if ( arr.isEmpty() ) script+=BL( ";\n" );
    else script+=BL( ".cursor('pointer');\n" );
}
Esempio n. 2
0
void PHILabelItem::cssGraphicEffect( const PHIRequest *req, QByteArray &out, QByteArray &script ) const
{
    if ( effect()->graphicsType()==PHIEffect::GTShadow && !(req->agentFeatures() & PHIRequest::IE678) ) {
        QColor c;
        qreal radius, xoff, yoff;
        effect()->shadow( c, xoff, yoff, radius );
        QByteArray col=cssColor( c );
        if ( !(req->agentFeatures() & PHIRequest::RGBA) ) col=c.name().toLatin1();
        if ( colorRole( PHIPalette::WidgetBase )==PHIPalette::Window ) {
            out+=BL( "text-shadow:" )+QByteArray::number( qRound(xoff) )
                +BL( "px " )+QByteArray::number( qRound(yoff) )+BL( "px " )
                +QByteArray::number( qRound(radius) )+BL( "px " )+col+';';
        } else {
            QByteArray prefix=req->agentPrefix();
            if ( req->agentEngine()==PHIRequest::Trident ) prefix=QByteArray();
            else if ( req->agentEngine()==PHIRequest::Gecko && req->engineMajorVersion()>1 ) prefix=QByteArray();
            else if ( req->agentEngine()==PHIRequest::WebKit && req->engineMajorVersion()>534 ) prefix=QByteArray();
            else if ( req->agentEngine()==PHIRequest::Presto ) prefix=QByteArray();
            out+=prefix+BL( "box-shadow:" )+QByteArray::number( qRound(xoff) )+"px ";
            out+=QByteArray::number( qRound(yoff) )+"px ";
            out+=QByteArray::number( qRound(radius) )+"px "+col+';';
        }
    } else {
        if ( realBackgroundColor()!=QColor( Qt::transparent ) )
            PHIAbstractTextItem::cssGraphicEffect( req, out, script );
    }
}
Esempio n. 3
0
void PHILabelItem::html( const PHIRequest *req, QByteArray &out, QByteArray &script, const QByteArray &indent ) const
{
    htmlInitItem( script, false );
    if ( Q_UNLIKELY( colorRole( PHIPalette::WidgetText )==PHIPalette::Custom ) )
        script+=BL( ".color('" )+cssColor( realColor() )+BL( "')" );
    if ( Q_UNLIKELY( colorRole( PHIPalette::WidgetBase )==PHIPalette::Custom ) )
        script+=BL( ".bgColor('" )+cssColor( realBackgroundColor() )+BL( "')" );
    script+=BL( ";\n" );
    out+=indent+BL( "<div" );
    htmlBase( req, out, script );
    out+=BL( "\"><table class=\"phi\"><tr><td id=\"" )+id()+BL( "_phit\" style=\"" );
    Qt::Alignment a=static_cast<Qt::Alignment>(realAlignment());
    if ( data( DFont ).isValid() ) {
        QFont f=data( DFont ).value<QFont>();
        if ( f.underline() ) {
            out+=BL( "text-decoration:underline;" );
        }
    }
    if ( a & Qt::AlignJustify ) out+=BL( "vertical-align:top;" );
    else out+=BL( "vertical-align:middle;" );
    if ( a & Qt::AlignHCenter ) out+=BL( "text-align:center;" );
    else if ( a & Qt::AlignRight ) out+=BL( "text-align:right;" );
    out+=BL( "\">" )+data( DText ).toByteArray()+BL( "</td></tr></table></div>\n" );
}
Esempio n. 4
0
EdgeCell::EdgeCell(VAC * vac) :
    Cell(vac)
{
    QColor edgeColor = global()->edgeColor();
    color_[0] = edgeColor.redF();
    color_[1] = edgeColor.greenF();
    color_[2] = edgeColor.blueF();
    color_[3] = edgeColor.alphaF();
    CssColor cssColor(edgeColor.red(),edgeColor.green(),edgeColor.blue(),edgeColor.alphaF());
    style_.set("color",cssColor.toString());

    // highlighted/selected color
    colorSelected_[0] = 1;
    colorSelected_[1] = 0;
    colorSelected_[2] = 0;
    colorSelected_[3] = 1;
}