//-----------
void MetaController::draw() {
    if (!visible)   return;
    ofPushStyle();
    ofSetColor(0, 150);
    ofRect(x-82, y-4, width + 195, height+8);
    sequencer->draw();
    int idx = 0;
    for (int i=0; i<seqParams.size(); i++) {
        if (seqParams[i]->getType() == ParameterBase::FLOAT ||
            seqParams[i]->getType() == ParameterBase::INT) {
            drawLabel(i, idx);
            idx+=1;
        }
        else if (seqParams[i]->getType() == ParameterBase::VEC2F) {
            drawLabel(i, idx,   ".x");
            drawLabel(i, idx+1, ".y");
            idx+=2;
        }
        else if (seqParams[i]->getType() == ParameterBase::VEC3F) {
            drawLabel(i, idx,   ".x");
            drawLabel(i, idx+1, ".y");
            drawLabel(i, idx+2, ".z");
            idx+=3;
        }
        else if (seqParams[i]->getType() == ParameterBase::VEC4F) {
            drawLabel(i, idx,   ".x");
            drawLabel(i, idx+1, ".y");
            drawLabel(i, idx+2, ".z");
            drawLabel(i, idx+3, ".w");
            idx+=4;
        }
    }
    ofPopStyle();
}
Ejemplo n.º 2
0
    virtual void onDraw(SkCanvas* canvas) {
        this->init();
        SkIRect scrollCenterRegion = SkIRect::MakeXYWH(
            quarterWidth, quarterHeight, quarterWidth*2+1, quarterHeight*2+1);
        int x = quarterWidth;
        int y = quarterHeight;
        int xSpacing = quarterWidth * 20;
        int ySpacing = quarterHeight * 16;

        // Draw left-hand text labels.
        drawLabel(canvas, "scroll entire bitmap",
                  x, y, x, y + ySpacing);
        drawLabel(canvas, "scroll part of bitmap",
                  x, y + ySpacing, x, y + ySpacing*2);
        x += 30;

        // Draw various permutations of scrolled bitmaps, scrolling a bit
        // further each time.
        draw9(canvas, x, y, NULL, quarterWidth*1/2, quarterHeight*1/2);
        draw9(canvas, x, y+ySpacing, &scrollCenterRegion,
              quarterWidth*1/2, quarterHeight*1/2);
        x += xSpacing;
        draw9(canvas, x, y, NULL, quarterWidth*3/2, quarterHeight*3/2);
        draw9(canvas, x, y+ySpacing, &scrollCenterRegion,
              quarterWidth*3/2, quarterHeight*3/2);
        x += xSpacing;
        draw9(canvas, x, y, NULL, quarterWidth*5/2, quarterHeight*5/2);
        draw9(canvas, x, y+ySpacing, &scrollCenterRegion,
              quarterWidth*5/2, quarterHeight*5/2);
        x += xSpacing;
        draw9(canvas, x, y, NULL, quarterWidth*9/2, quarterHeight*9/2);
        draw9(canvas, x, y+ySpacing, &scrollCenterRegion,
              quarterWidth*9/2, quarterHeight*9/2);
    }
Ejemplo n.º 3
0
void renderDemo(struct NVGcontext* vg, float mx, float my, float width, float height,
				float t, int blowup, struct DemoData* data)
{
	float x,y,popy;

	drawEyes(vg, width - 250, 50, 150, 100, mx, my, t);
	drawParagraph(vg, width - 450, 50, 150, 100, mx, my);
	drawGraph(vg, 0, height/2, width, height/2, t);
	drawColorwheel(vg, width - 300, height - 300, 250.0f, 250.0f, t);

	// Line joints
	drawLines(vg, 50, height-50, 600, 50, t);

	// Line caps
	drawWidths(vg, 10, 50, 30);

	// Line caps
	drawCaps(vg, 10, 300, 30);

	nvgSave(vg);
	if (blowup) {
		nvgRotate(vg, sinf(t*0.3f)*5.0f/180.0f*NVG_PI);
		nvgScale(vg, 2.0f, 2.0f);
	}

	// Widgets
	drawWindow(vg, "Widgets `n Stuff", 50, 50, 300, 400);
	x = 60; y = 95;
	drawSearchBox(vg, "Search", x,y,280,25);
	y += 40;
	drawDropDown(vg, "Effects", x,y,280,28);
	popy = y + 14;
	y += 45;

	// Form
	drawLabel(vg, "Login", x,y, 280,20);
	y += 25;
	drawEditBox(vg, "Email",  x,y, 280,28);
	y += 35;
	drawEditBox(vg, "Password", x,y, 280,28);
	y += 38;
	drawCheckBox(vg, "Remember me", x,y, 140,28);
	drawButton(vg, ICON_LOGIN, "Sign in", x+138, y, 140, 28, nvgRGBA(0,96,128,255));
	y += 45;

	// Slider
	drawLabel(vg, "Diameter", x,y, 280,20);
	y += 25;
	drawEditBoxNum(vg, "123.00", "px", x+180,y, 100,28);
	drawSlider(vg, 0.4f, x,y, 170,28);
	y += 55;

	drawButton(vg, ICON_TRASH, "Delete", x, y, 160, 28, nvgRGBA(128,16,8,255));
	drawButton(vg, 0, "Cancel", x+170, y, 110, 28, nvgRGBA(0,0,0,0));

	// Thumbnails box
	drawThumbnails(vg, 365, popy-30, 160, 300, data->images, 12, t);

	nvgRestore(vg);
}
Ejemplo n.º 4
0
void DecibelScaleComponent::paint (Graphics& g)
{
    g.setFont (font);
    g.setColour (Colours::lightgrey);

    lastY = 0;

    drawLabel (g, iecLevel (Level0dB),   "0");
    drawLabel (g, iecLevel (Level3dB),   "3");
    drawLabel (g, iecLevel (Level6dB),   "6");
    drawLabel (g, iecLevel (Level10dB), "10");

    for (float dB = -20.0f; dB > -70.0f; dB -= 10.0f)
        drawLabel (g, DecibelScaleComponent::iecScale (dB), String ((int) -dB));
}
Ejemplo n.º 5
0
void drawSlider(entity me)
{
	float controlLeft;
	float save;
	me.focusable = !me.disabled;
	save = draw_alpha;
	if(me.disabled)
		draw_alpha *= me.disabledAlpha;
	draw_ButtonPicture('0 0 0', strcat(me.src, "_s"), eX * (1 - me.textSpace) + eY, me.color2, 1);
	if(almost_in_bounds(me.valueMin, me.value, me.valueMax))
	{
		controlLeft = (me.value - me.valueMin) / (me.valueMax - me.valueMin) * (1 - me.textSpace - me.controlWidth);
		if(me.disabled)
			draw_Picture(eX * controlLeft, strcat(me.src, "_d"), eX * me.controlWidth + eY, me.colorD, 1);
		else if(me.pressed)
			draw_Picture(eX * controlLeft, strcat(me.src, "_c"), eX * me.controlWidth + eY, me.colorC, 1);
		else if(me.focused)
			draw_Picture(eX * controlLeft, strcat(me.src, "_f"), eX * me.controlWidth + eY, me.colorF, 1);
		else
			draw_Picture(eX * controlLeft, strcat(me.src, "_n"), eX * me.controlWidth + eY, me.color, 1);
	}
	me.setText(me, me.valueToText(me, me.value));
	draw_alpha = save;
	drawLabel(me);
	me.text = NULL; // TEMPSTRING!
}
Ejemplo n.º 6
0
void drawWidget(Widget *w, Menu *m, int selected)
{
	int x, y;

	if (w->hidden == TRUE)
	{
		return;
	}

	x = w->x < 0 ? (m->background->w - w->normalState->w) / 2 : w->x;
	y = w->y < 0 ? (m->background->h - w->normalState->h) / 2 : w->y;

	x += m->x;
	y += m->y;

	if (w->disabled == TRUE)
	{
		drawImage(w->disabledState, x, y - m->startY, FALSE, 255);
	}

	else
	{
		drawImage(selected == TRUE ? w->selectedState : w->normalState, x, y - m->startY, FALSE, 255);
	}

	if (w->label != NULL)
	{
		drawLabel(w->label, m);
	}
}
void
ArxDbgDbAdeskLogo::commonDraw(AcGiCommonDraw* drawContext)
{
    if (drawContext->regenAbort())
        return;

    AcGeMatrix3d scaleMat;
    m_scale.getMatrix(scaleMat);

    AcGeMatrix3d mat;
    getEcs(mat);   // push ECS of this Logo
    mat *= scaleMat;

    drawContext->rawGeometry()->pushModelTransform(mat);

    ArxDbgDbAdeskLogoStyle* lStyle = NULL;
    Acad::ErrorStatus es = acdbOpenObject(lStyle, m_logoStyleId, AcDb::kForRead);

    drawLogo(drawContext, lStyle);
    drawLabel(drawContext, lStyle);
    drawBorder(drawContext, lStyle);

    if (es == Acad::eOk)
        lStyle->close();

    drawContext->rawGeometry()->popModelTransform();

	drawRefLine(drawContext);
}
Ejemplo n.º 8
0
/*!
  Draw the marker

  \param painter Painter
  \param xMap x Scale Map
  \param yMap y Scale Map
  \param canvasRect Contents rectangle of the canvas in painter coordinates
*/
void QwtPlotMarker::draw( QPainter *painter,
    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
    const QRectF &canvasRect ) const
{
    const QPointF pos( xMap.transform( d_data->xValue ), 
        yMap.transform( d_data->yValue ) );

    // draw lines

    drawLines( painter, canvasRect, pos );

    // draw symbol
    if ( d_data->symbol &&
        ( d_data->symbol->style() != QwtSymbol::NoSymbol ) )
    {
        const QSizeF sz = d_data->symbol->size();

        const QRectF clipRect = canvasRect.adjusted( 
            -sz.width(), -sz.height(), sz.width(), sz.height() );

        if ( clipRect.contains( pos ) )
            d_data->symbol->drawSymbol( painter, pos );
    }

    drawLabel( painter, canvasRect, pos );
}
Ejemplo n.º 9
0
void
UIButton::drawQuad ( float scale ) { 
    filledQuad();
    drawLabel( scale );
    outlineQuad();
    
}
Ejemplo n.º 10
0
void ModelReader::render( QGLPainter* painter )
{
    painter->modelViewMatrix().push();
    painter->modelViewMatrix().translate( m_translation );
    painter->modelViewMatrix().rotate( m_quaternion );
    if( !m_z_up )
    {
        painter->modelViewMatrix().rotate( 180, 1, 0, 0 );
    }
    if( m_plyLoader )
    {
        m_plyLoader->draw( painter );
    }
    else
    {
        QGLSceneNode* node = m_scene->mainNode();
    //     painter->setStandardEffect( QGL::LitMaterial ); // no effect ?
        node->draw(painter);
    }
    painter->modelViewMatrix().pop();
    if( !m_label.empty() )
    {
        drawLabel( painter, m_translation );
    }
}
Ejemplo n.º 11
0
void InfoLabel::renderOpenGL()
{

	glClear(GL_COLOR_BUFFER_BIT); // clear buffers to preset values
	drawLabel();
	drawScrollBars();

}
Ejemplo n.º 12
0
void GlNode::drawLabel(bool drawSelect,OcclusionTest* test,GlGraphInputData* data,float lod) {
  node n=node(id);
  bool selected=data->getElementSelected()->getNodeValue(n);

  if(drawSelect!=selected)
    return;

  drawLabel(test,data,lod);
}
Ejemplo n.º 13
0
void ofxDatGuiComponent::draw()
{
    ofPushStyle();
        if (mStyle.border.visible) drawBorder();
        drawBackground();
        drawLabel();
        if (mStyle.stripe.visible) drawStripe();
    ofPopStyle();
}
Ejemplo n.º 14
0
void BarChartWidget::paintEvent(QPaintEvent *event) {
    QWidget::paintEvent(event);

    QPainter painter(this);

    drawLabel(painter);
    drawBaseLine(painter);
    drawBars(painter);
}
Ejemplo n.º 15
0
void
PartitionLabelsView::drawLabels( QPainter* painter,
                                 const QRect& rect,
                                 const QModelIndex& parent )
{
    PartitionModel* modl = qobject_cast< PartitionModel* >( model() );
    if ( !modl )
        return;

    QModelIndexList indexesToDraw = getIndexesToDraw( parent );

    int label_x = rect.x();
    int label_y = rect.y();
    foreach ( const QModelIndex& index, indexesToDraw )
    {
        QStringList texts = buildTexts( index );

        QSize labelSize = sizeForLabel( texts );

        QColor labelColor = index.data( Qt::DecorationRole ).value< QColor >();

        if ( label_x + labelSize.width() > rect.width() ) //wrap to new line if overflow
        {
            label_x = rect.x();
            label_y += labelSize.height() + labelSize.height() / 4;
        }

        // Draw hover
        if ( selectionMode() != QAbstractItemView::NoSelection && // no hover without selection
             m_hoveredIndex.isValid() &&
             index == m_hoveredIndex )
        {
            painter->save();
            QRect labelRect( QPoint( label_x, label_y ), labelSize );
            labelRect.adjust( 0, -LAYOUT_MARGIN, 0, -2*LAYOUT_MARGIN );
            painter->translate( 0.5, 0.5 );
            QRect hoverRect = labelRect.adjusted( 0, 0, -1, -1 );
            painter->setBrush( QPalette().background().color().lighter( 102 ) );
            painter->setPen( Qt::NoPen );
            painter->drawRoundedRect( hoverRect, CORNER_RADIUS, CORNER_RADIUS );

            painter->translate( -0.5, -0.5 );
            painter->restore();
        }

        // Is this element the selected one?
        bool sel = selectionMode() != QAbstractItemView::NoSelection &&
                   index.isValid() &&
                   selectionModel() &&
                   !selectionModel()->selectedIndexes().isEmpty() &&
                   selectionModel()->selectedIndexes().first() == index;

        drawLabel( painter, texts, labelColor, QPoint( label_x, label_y ), sel );

        label_x += labelSize.width() + LABELS_MARGIN;
    }
Ejemplo n.º 16
0
	void GUIEdge::draw(CDC& context) const
	{
		context.CreatePen(PS_SOLID, 1, visible ? RGB(0, 0, 0) : RGB(223, 223, 223));
		context.MoveTo(side1->getX(), side1->getY());
		context.LineTo(side2->getX(), side2->getY());
		if (blocked)
			context.Ellipse(getX() - 16, getY() - 16, getX() + 16, getY() + 16);
		drawLabel(context, 0, 16);
		context.CreatePen(PS_SOLID, 1, RGB(0, 0, 0));
	}
void Item::paintEvent(QPaintEvent *e)
{
  QPainter painter(this);

  //draw label
  drawLabel(&painter, ITEM_BOUND_PAD, ITEM_BOUND_PAD, 
	    width()- ITEM_BOUND_PAD - ITEM_BOUND_PAD,
	    height() - ITEM_BOUND_PAD - ITEM_BOUND_PAD);

  QWidget::paintEvent(e);
}
Ejemplo n.º 18
0
void MSToggleButtonBase::redraw(void)
{
  if (owner()->mapped()==MSTrue)
   {
     MSWidgetCommon::drawBackground();
     if(highlighted()==MSTrue) drawHighlight();
     else undrawHighlight();
     drawSymbol();
     if (pixmap()==0) drawLabel();
     else drawPixmap();
   }
}
void OnsetMeterView::drawStaticElements(){
    drawLabel();
    onOffToggle->drawTransparent();
    if (_enabled){
        alphaSlider->drawSimplified();
        silenceThresholdSlider->drawSimplified();
        timeThresholdSlider->drawSimplified();
        armToggle->drawTransparent();
        resetButton->drawTransparent();
    }
    drawBounds();
}
Ejemplo n.º 20
0
void Thermometer::paintEvent(QPaintEvent *)
{
    painter.begin(this);

    drawTitle();
    drawUnit();
    drawLabel();
    drawDisplay();
    drawScale();
    drawMeter();
    drawRange();
    drawPointer();

    painter.end();
}
Ejemplo n.º 21
0
int freshDisplay()
{
        static int i = 0;       

        if (fresh_display) {
                if( i > 6) i = 0;
                SDL_Widget *label = drawLabel(color[i]);
                printf( "freash_display:  %d ", i);
                        
                SDL_Delay(1500);
                SDL_WidgetClose(label);
                label = NULL;
                ++i; 
        }
        return 0;        
}
Ejemplo n.º 22
0
// draw
//---------------------------------------------------------------------------
void CheckBox::draw(Surface &dest)
{
    iRect bounds;

    getBounds(bounds);

    if (state) {
        drawCheckBox(dest);
        drawCheck(dest);
    } else {
        drawCheckBox(dest);
    }

    drawLabel(dest);

} // end CheckBox::draw
Ejemplo n.º 23
0
void ofxJFButton::drawController(){
    
    ofPushStyle();
    ofSetColor(PANEL_COLOR);
    ofRectRounded(location.x, location.y, size.x, size.y,5);
    ofSetColor(255);
    ofRectRounded(location.x, location.y, size.x*value, size.y,5);
    
    ofNoFill();
    ofSetColor(0);
    ofRectRounded(location.x, location.y, size.x, size.y,5);
    
    drawLabel();
    state.drawLabel();
    ofPopStyle();
    
}
Ejemplo n.º 24
0
//------------------------------------------------------------------------------
// Name: GraphNode
// Desc:
//------------------------------------------------------------------------------
GraphNode::GraphNode(GraphWidget *graph, const QString &text, const QColor &color) : color_(color), graph_(graph) {

    setFlag(QGraphicsItem::ItemIsMovable, true);
    setFlag(QGraphicsItem::ItemIsSelectable, true);
    setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
	setAcceptHoverEvents(true);
	setCacheMode(QGraphicsItem::DeviceCoordinateCache);
	setZValue(NodeZValue);

	drawLabel(text);
	
	graph->scene()->addItem(this);

	QString name = QString("Node%1").arg(reinterpret_cast<uintptr_t>(this));
	node_ = _agnode(graph->graph_, name);
		
	_agset(node_, "fixedsize", "0");
	_agset(node_, "width",  QString("%1").arg(boundingRect().width()  / 96.0));
	_agset(node_, "height", QString("%1").arg(boundingRect().height() / 96.0));

}
Ejemplo n.º 25
0
const QIcon Flags::getIconWithText(const LayoutUnit& layoutUnit, const KeyboardConfig& keyboardConfig)
{
    QString keySuffix(getPixmapKey(keyboardConfig));
    QString key(layoutUnit.toString() + keySuffix);
    if( iconOrTextMap.contains(key) ) {
        return iconOrTextMap[ key ];
    }

    if( keyboardConfig.indicatorType == KeyboardConfig::SHOW_FLAG ) {
        QIcon icon = getIcon(layoutUnit.layout);
        if( ! icon.isNull() ) {
            iconOrTextMap[ key ] = icon;
            return icon;
        }
    }

    QString layoutText = Flags::getShortText(layoutUnit, keyboardConfig);

    const QSize TRAY_ICON_SIZE(21, 14);
    QPixmap pixmap = QPixmap(TRAY_ICON_SIZE);
    pixmap.fill(Qt::transparent);

    QPainter painter(&pixmap);
//	p.setRenderHint(QPainter::SmoothPixmapTransform);
//	p.setRenderHint(QPainter::Antialiasing);

    if( keyboardConfig.indicatorType == KeyboardConfig::SHOW_LABEL_ON_FLAG ) {
        QIcon iconf = createIcon(layoutUnit.layout);
        iconf.paint(&painter, painter.window(), Qt::AlignCenter);
    }

    drawLabel(painter, layoutText, keyboardConfig.isFlagShown());

    painter.end();

    QIcon icon(pixmap);
    iconOrTextMap[ key ] = icon;

    return icon;
}
Ejemplo n.º 26
0
void Area3::paintGL()
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glLoadIdentity();	
	glEnable(GL_POLYGON_SMOOTH);
	glEnable(GL_LINE_SMOOTH);
	glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST); // Make round points, not square points
	glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); // Antialias the lines
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

	glTranslatef(DISFONT, DISFONT, -5.0);//move (0 , 0) to (disfont, disfont)
	qglColor(Qt::black);

	initializeAxis();

	//draw labels in x and y axises
	drawLabel();
	//draw data
	drawData();
	glFlush();
}
Ejemplo n.º 27
0
void
MenuItem::drawButton( QPainter* p )
{
	QPen origPen = p->pen();
	p->setPen( Qt::NoPen );
	RasterOp origRasterOp = p->rasterOp();
// 	p->setRasterOp( OrROP );
	if( isDown() && m_mouseOver )
	{
 		p->fillRect( m_offset,
 					 m_offset,
					 geometry().width() - 2 * m_offset,
					 geometry().height() - 2 * m_offset,
					 QBrush( highlightColor().light() ) );
	}
	else if( m_mouseOver )
	{
		// if mouse is over the button, paint the highlight area with highlight color
 		p->fillRect( m_offset,
 					 m_offset,
					 geometry().width() - 2 * m_offset,
					 geometry().height() - 2 * m_offset,
					 QBrush( highlightColor() ) );
	}

	// Check if there's a sub menu, if so draw an arrow-like thing
	if( m_sub )
	{
		QPixmap arrow = KGlobal::iconLoader()->loadIcon( m_arrowIcon, KIcon::Toolbar );
		p->drawPixmap( geometry().width() - arrow.width() - m_offset - m_secOffset,
						( geometry().height() - arrow.height() ) / 2,
						arrow );
	}
	// Restore the settings
	p->setPen( origPen );
	p->setRasterOp( origRasterOp );
	// Draw the pixmap AND the labels
	drawLabel( p );
}
Ejemplo n.º 28
0
void TrackViewDelegate::paintDisk(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index, const Disk *disk) const
{
    QRect paintRect = option.rect;
    paintRect.setLeft(0);

    if (option.state & QStyle::State_Selected)
        QStyledItemDelegate::paint(painter, option, index);
    else
        painter->fillRect(option.rect, mTrackView->palette().base().color());


    //cache = self.cache(index)
    painter->save();
    painter->setClipRect(option.rect);
    QFont titleFont = this->titleFont(painter);
    QFont filesFont = this->filesFont(painter);


    int topPadding = index.row() ? TOP_PADDING : 0;

    painter->translate(option.rect.topLeft());

    QRect windowRect(MARGIN + MARGIN,
                     MARGIN + topPadding,
                     option.rect.right() - 2 * MARGIN,
                     option.rect.height() - 2 * MARGIN - topPadding - BOTTOM_PADDING);

    // Draw cover image ................................
    if (mNoCoverImg.height() != windowRect.height())
    {
        mNoCoverImg = QImage(":noCover").scaledToHeight(windowRect.height(), Qt::SmoothTransformation);
    }

    QRect imgRect(windowRect.topLeft(), mNoCoverImg.size());
    painter->fillRect(imgRect, mTrackView->palette().base().color());
    painter->fillRect(imgRect, Qt::white);
    painter->drawImage(imgRect, mNoCoverImg);


    // Rectangle for text drawing ......................
    QRect textRect(windowRect);
    textRect.setLeft(imgRect.right() + MARGIN);

    // Draw album & artist .............................
    painter->setFont(titleFont);
    QString album =  index.sibling(index.row(), TrackView::ColumnAlbum).data().toString();
    QString artist = index.sibling(index.row(), TrackView::ColumnArtist).data().toString();
    if (!album.isEmpty() || !artist.isEmpty())
        painter->drawText(textRect, Qt::AlignLeft, QString("%1 / %2").arg(artist, album));

    // Draw audio filename .............................
    painter->setFont(filesFont);
    int th = painter->fontMetrics().height();
    int tTop = windowRect.bottom() - 2 * th - 2;
    int aTop = windowRect.bottom() - th + 1;

    // Draw labels ........
    QRect tLabelRect(textRect.left(), tTop, windowRect.width(), th);
    QRect aLabelRect(textRect.left(), aTop, windowRect.width(), th);

    tLabelRect = drawLabel(tr("Tracks:"), tLabelRect, painter);
    aLabelRect = drawLabel(tr("Audio:"),  aLabelRect, painter);

    // Draw filenames .....
    int l = qMax(tLabelRect.right(), aLabelRect.right()) + 6;
    QRect tFileRect(l, tTop, windowRect.width(), th);
    QRect aFileRect(l, aTop, windowRect.width(), th);

    tFileRect = drawFile(disk->tagsTitle(), tFileRect, painter);
    QFileInfo fi(disk->audioFileName());
    aFileRect = drawFile(fi.fileName(), aFileRect, painter);


    // Draw buttons ......
    l = qMax(tLabelRect.right() + 80, qMax(tFileRect.right(), aFileRect.right()) + 8);

    QRect tBtnRect(0, 0, mTrackBtnPix.height(), mTrackBtnPix.width());
    tBtnRect.moveCenter(tLabelRect.center());
    tBtnRect.moveLeft(l);
    painter->drawPixmap(tBtnRect, mTrackBtnPix);

    QRect aBtnRect(0, 0, mAudioBtnPix.height(), mAudioBtnPix.width());
    aBtnRect.moveCenter(aLabelRect.center());
    aBtnRect.moveLeft(l);
    painter->drawPixmap(aBtnRect, mAudioBtnPix);

    TrackViewCacheItem *cache = mCache->item(index);
    QRect tClickRect = tBtnRect.united(tLabelRect).adjusted(0, -3, 4, 1);
    cache->trackBtn = tClickRect;
    //painter->drawRect(tClickRect);

    QRect aClickRect = aBtnRect.united(aLabelRect).adjusted(0, -3, 4, 1);
    cache->audioBtn = aClickRect;
    //painter->drawRect(aClickRect);

    // Draw bottom line ................................
    painter->setPen(mTrackView->palette().dark().color());
    int y = option.rect.height() - BOTTOM_PADDING - 2;
    painter->drawLine(MARGIN, y, windowRect.right(), y);

    // Draw warning mark ...............................
    QRect markRect(imgRect.right() - MARK_HEIGHT, imgRect.bottom() - MARK_HEIGHT, MARK_HEIGHT, MARK_HEIGHT);
    if (!disk->canConvert())
        painter->drawPixmap(markRect, mWarnPix);

    cache->isWaiting = disk->isDownloads();
    if (cache->isWaiting)
    {
        painter->drawPixmap(markRect, mDownloadMovie.currentPixmap());
    }

    cache->markBtn = markRect;

    painter->restore();    
}
Ejemplo n.º 29
0
void drawButton(entity me)
{
	vector bOrigin, bSize;
	float save;

	me.focusable = !me.disabled;

	save = draw_alpha;
	if(me.disabled)
		draw_alpha *= me.disabledAlpha;

	if(me.src)
	{
		if(me.srcMulti)
		{
			bOrigin = '0 0 0';
			bSize = '1 1 0';
			if(me.disabled)
				draw_ButtonPicture(bOrigin, strcat(me.src, "_d", me.srcSuffix), bSize, me.colorD, 1);
			else if(me.forcePressed || me.pressed || me.clickTime > 0)
				draw_ButtonPicture(bOrigin, strcat(me.src, "_c", me.srcSuffix), bSize, me.colorC, 1);
			else if(me.focused)
				draw_ButtonPicture(bOrigin, strcat(me.src, "_f", me.srcSuffix), bSize, me.colorF, 1);
			else
				draw_ButtonPicture(bOrigin, strcat(me.src, "_n", me.srcSuffix), bSize, me.color, 1);
		}
		else
		{
			if(me.realFontSize_y == 0)
			{
				bOrigin = '0 0 0';
				bSize = '1 1 0';
			}
			else
			{
				bOrigin = eY * (0.5 * (1 - me.realFontSize_y)) + eX * (0.5 * (me.keepspaceLeft - me.realFontSize_x));
				bSize = me.realFontSize;
			}
			if(me.disabled)
				draw_Picture(bOrigin, strcat(me.src, "_d", me.srcSuffix), bSize, me.colorD, 1);
			else if(me.forcePressed || me.pressed || me.clickTime > 0)
				draw_Picture(bOrigin, strcat(me.src, "_c", me.srcSuffix), bSize, me.colorC, 1);
			else if(me.focused)
				draw_Picture(bOrigin, strcat(me.src, "_f", me.srcSuffix), bSize, me.colorF, 1);
			else
				draw_Picture(bOrigin, strcat(me.src, "_n", me.srcSuffix), bSize, me.color, 1);
		}
	}
	if(me.src2)
	{
		bOrigin = me.keepspaceLeft * eX;
		bSize = eY + eX * (1 - me.keepspaceLeft);

		bOrigin += bSize * (0.5 - 0.5 * me.src2scale);
		bSize = bSize * me.src2scale;

		draw_Picture(bOrigin, me.src2, bSize, me.color2, me.alpha2);
	}

	draw_alpha = save;

	drawLabel(me);

	if(me.clickTime > 0 && me.clickTime <= frametime)
	{
		// keyboard click timer expired? Fire the event then.
		if not(me.disabled)
			me.onClick(me, me.onClickEntity);
	}
	me.clickTime -= frametime;
}
Ejemplo n.º 30
0
 Vec2i               drawLabel       (const String& str, const Vec2f& pos, U32 abgr) { return drawLabel(str, Vec4f(pos, 0.0f, 1.0f), 0.5f, abgr); }