KbfxSpinxScrollBar::KbfxSpinxScrollBar ( QWidget * parent, const char *name, int type ) : QWidget ( parent, name ) { if (type == 0){ m_normal = ( *KbfxPlasmaPixmapProvider::pixmap ( "scrollnormal" ) ); } else { m_normal = ( *KbfxPlasmaPixmapProvider::pixmap ( "scrollnormalbot" ) ); } QImage _tmp_img = m_normal.convertToImage(); _tmp_img = _tmp_img.smoothScale ( ConfigInit().m_itemView_w, m_normal.height (),QImage::ScaleFree ); m_normal = QPixmap ( _tmp_img ); this->resize ( m_normal.width (), m_normal.height () ); _x = this->x () /40; _y = this->y (); w = this->width () / 40; h = this->height () / 2; _x += ( this->width () - w ) / 2; _y += ( this->height () - h ) / 2; m_triAngle = QPointArray ( 3 ); m_dir = DOWN; m_timer = new QTimer ( this,"ScrollTimer" ); connect ( m_timer,SIGNAL ( timeout() ),this,SLOT ( timeoutslot() ) ); m_pressed = false; }
QPointArray ResizeHandle::areaPoints() const { // QPointArray pa = QCanvasRectangle::areaPoints(); // pa.translate( -7, -7 ); // return pa; return QPointArray( QRect( int(x())-8, int(y())-8, 15, 15 ) ); }
void Number::reconstructPointArrayAndRegion() { Q_ASSERT( d ); d->m_points = rect(); d->m_collisionRegion = QRegion( QPointArray( d->m_points, TRUE ) ); // make text bounding rectangle equal to our rectangle d->m_input_pos = rect(); int w = d->m_pen.width(); // when we are big enough, clip text inside if( d->m_input_pos.width() >( w + 4 ) * 2 && d->m_input_pos.height() >( w + 4 ) * 2 ) { QPoint p( w + 4, w + 4 ); d->m_input_pos.setTopLeft( d->m_input_pos.topLeft() + p ); d->m_input_pos.setBottomRight( d->m_input_pos.bottomRight() - p ); } }
void KDGanttViewTaskLink::initTaskLink() { horLineList = new QPtrList<KDCanvasLine>; verLineList = new QPtrList<KDCanvasLine>; horLineList2 = new QPtrList<KDCanvasLine>; verLineList2 = new QPtrList<KDCanvasLine>; horLineList3 = new QPtrList<KDCanvasLine>; topList = new QPtrList<KDCanvasPolygon>; topLeftList = new QPtrList<KDCanvasPolygon>; topRightList = new QPtrList<KDCanvasPolygon>; horLineList->setAutoDelete( true ); verLineList->setAutoDelete( true ); horLineList2->setAutoDelete( true ); verLineList2->setAutoDelete( true ); horLineList3->setAutoDelete( true ); topList->setAutoDelete( true ); topLeftList->setAutoDelete( true ); topRightList->setAutoDelete( true ); myTimeTable = fromList.getFirst()->myGanttView->myTimeTable; KDCanvasLine* horLine,*verLine; KDCanvasLine* horLine2,*verLine2; KDCanvasLine* horLine3; KDCanvasPolygon* top; KDCanvasPolygon* topLeft; KDCanvasPolygon* topRight; unsigned int i, j; for ( i = 0;i < fromList.count();++i) { for ( j = 0;j < toList.count();++j) { horLine = new KDCanvasLine(myTimeTable,this,Type_is_KDGanttTaskLink); verLine = new KDCanvasLine(myTimeTable,this,Type_is_KDGanttTaskLink); horLine2 = new KDCanvasLine(myTimeTable,this,Type_is_KDGanttTaskLink); verLine2 = new KDCanvasLine(myTimeTable,this,Type_is_KDGanttTaskLink); horLine3 = new KDCanvasLine(myTimeTable,this,Type_is_KDGanttTaskLink); top = new KDCanvasPolygon(myTimeTable,this,Type_is_KDGanttTaskLink); topLeft = new KDCanvasPolygon(myTimeTable,this,Type_is_KDGanttTaskLink); topRight = new KDCanvasPolygon(myTimeTable,this,Type_is_KDGanttTaskLink); QPointArray arr = QPointArray(3); arr.setPoint(0,-4,-5); arr.setPoint(1,4,-5); arr.setPoint(2,0,0); top->setPoints(arr); arr.setPoint(0,5,-5); // need an extra y pixel, canvas bug? arr.setPoint(1,5,5); // need an extra y pixel, canvas bug? arr.setPoint(2,0,0); topLeft->setPoints(arr); arr.setPoint(0,-5,-4); arr.setPoint(1,-5,4); arr.setPoint(2,0,0); topRight->setPoints(arr); horLineList->append(horLine); verLineList->append(verLine); horLineList2->append(horLine2); verLineList2->append(verLine2); horLineList3->append(horLine3); topList->append(top); topLeftList->append(topLeft); topRightList->append(topRight); horLine->setZ(1); verLine->setZ(1); horLine2->setZ(1); verLine2->setZ(1); horLine3->setZ(1); top->setZ(1); topLeft->setZ(1); topRight->setZ(1); } } setTooltipText( "Tasklink" ); setWhatsThisText( "Tasklink" ); myTimeTable->myTaskLinkList.append(this); setHighlight( false); setHighlightColor(Qt::red ); setColor(Qt::black); setVisible(true); }
void RDTransportButton::drawOffCap() { QPainter p; QPointArray triangle=QPointArray(3); int edge; if(height()<width()) { edge=height(); } else { edge=width(); } drawMask(off_cap); p.begin(off_cap); p.setPen(QColor(black)); p.setBrush(QColor(black)); switch(button_type) { case RDTransportButton::Play: triangle.setPoint(0,width()/2-(3*edge)/10,height()/2-(3*edge)/10); triangle.setPoint(1,width()/2+(3*edge)/10,height()/2); triangle.setPoint(2,width()/2-(3*edge)/10,height()/2+(3*edge)/10); p.drawPolygon(triangle); p.setPen(QColor(colorGroup().shadow())); p.moveTo(width()/2-(3*edge)/10,height()/2+(3*edge)/10); p.lineTo(width()/2-(3*edge)/10,height()/2-(3*edge)/10); p.setPen(QColor(colorGroup().dark())); p.lineTo(width()/2+(3*edge)/10,height()/2); p.setPen(QColor(colorGroup().light())); p.lineTo(width()/2-(3*edge)/10,height()/2+(3*edge)/10); break; case RDTransportButton::Stop: p.fillRect(width()/2-edge*3/10,height()/2-edge*3/10, edge*3/5,edge*3/5,QColor(colorGroup().shadow())); p.setPen(QColor(colorGroup().shadow())); p.moveTo(width()/2-edge*3/10,height()/2+edge*3/10); p.lineTo(width()/2-edge*3/10,height()/2-edge*3/10); p.lineTo(width()/2+edge*3/10,height()/2-edge*3/10); p.setPen(QColor(colorGroup().light())); p.lineTo(width()/2+edge*3/10,height()/2+edge*3/10); p.lineTo(width()/2-edge*3/10,height()/2+edge*3/10); break; case RDTransportButton::Record: p.setPen(QColor(darkRed)); p.setBrush(QColor(darkRed)); p.drawEllipse(width()/2-(3*edge)/10,height()/2-(3*edge)/10, (3*edge)/5,(3*edge)/5); break; case RDTransportButton::FastForward: triangle.setPoint(0,width()/2-(3*edge)/10,height()/2-(3*edge)/10); triangle.setPoint(1,width()/2,height()/2); triangle.setPoint(2,width()/2-(3*edge)/10,height()/2+(3*edge)/10); p.drawPolygon(triangle); p.setPen(QColor(colorGroup().shadow())); p.moveTo(width()/2-(3*edge)/10,height()/2+(3*edge)/10); p.lineTo(width()/2-(3*edge)/10,height()/2-(3*edge)/10); p.setPen(QColor(colorGroup().dark())); p.lineTo(width()/2,height()/2); p.setPen(QColor(colorGroup().light())); p.lineTo(width()/2-(3*edge)/10,height()/2+(3*edge)/10); triangle.setPoint(0,width()/2,height()/2-(3*edge)/10); triangle.setPoint(1,width()/2+(3*edge)/10,height()/2); triangle.setPoint(2,width()/2,height()/2+(3*edge)/10); p.drawPolygon(triangle); p.drawPolygon(triangle); p.setPen(QColor(colorGroup().shadow())); p.moveTo(width()/2,height()/2+(3*edge)/10); p.lineTo(width()/2,height()/2-(3*edge)/10); p.setPen(QColor(colorGroup().dark())); p.lineTo(width()/2+(3*edge)/10,height()/2); p.setPen(QColor(colorGroup().light())); p.lineTo(width()/2,height()/2+(3*edge)/10); break; case RDTransportButton::Rewind: triangle.setPoint(0,width()/2+(3*edge)/10,height()/2-(3*edge)/10); triangle.setPoint(1,width()/2,height()/2); triangle.setPoint(2,width()/2+(3*edge)/10,height()/2+(3*edge)/10); p.drawPolygon(triangle); p.setPen(QColor(colorGroup().shadow())); p.moveTo(width()/2+(3*edge)/10,height()/2-(3*edge)/10); p.lineTo(width()/2,height()/2); p.setPen(QColor(colorGroup().dark())); p.lineTo(width()/2+(3*edge)/10,height()/2+(3*edge)/10); p.setPen(QColor(colorGroup().light())); p.lineTo(width()/2+(3*edge)/10,height()/2-(3*edge)/10); triangle.setPoint(0,width()/2,height()/2-(3*edge)/10); triangle.setPoint(1,width()/2-(3*edge)/10,height()/2); triangle.setPoint(2,width()/2,height()/2+(3*edge)/10); p.drawPolygon(triangle); p.setPen(QColor(colorGroup().shadow())); p.moveTo(width()/2,height()/2-(3*edge)/10); p.lineTo(width()/2-(3*edge)/10,height()/2); p.setPen(QColor(colorGroup().dark())); p.lineTo(width()/2,height()/2+(3*edge)/10); p.setPen(QColor(colorGroup().light())); p.lineTo(width()/2,height()/2-(3*edge)/10); break; case RDTransportButton::Eject: triangle.setPoint(0,width()/2,height()/2-(3*edge)/10); triangle.setPoint(1,width()/2+(3*edge)/10,height()/2); triangle.setPoint(2,width()/2-(3*edge)/10,height()/2); p.drawPolygon(triangle); p.fillRect(width()/2-(3*edge)/10,height()/2+edge/10, (3*edge)/5,edge/5,QColor(black)); break; case RDTransportButton::Pause: p.fillRect(width()/2-(3*edge)/10,height()/2-(3*edge)/10, (3*edge)/15,(3*edge)/5,QColor(black)); p.setPen(QColor(colorGroup().shadow())); p.moveTo(width()/2-(3*edge)/10,height()/2+(3*edge)/10); p.lineTo(width()/2-(3*edge)/10,height()/2-(3*edge)/10); p.lineTo(width()/2-(3*edge)/10+(3*edge)/15,height()/2-(3*edge)/10); p.setPen(QColor(colorGroup().light())); p.lineTo(width()/2-(3*edge)/10+(3*edge)/15,height()/2+(3*edge)/10); p.lineTo(width()/2-(3*edge)/10,height()/2+(3*edge)/10); p.fillRect(width()/2+(3*edge)/30,height()/2-(3*edge)/10, (3*edge)/15,(3*edge)/5,QColor(black)); p.setPen(QColor(colorGroup().shadow())); p.moveTo(width()/2+(3*edge)/30,height()/2+(3*edge)/10); p.lineTo(width()/2+(3*edge)/30,height()/2-(3*edge)/10); p.lineTo(width()/2+(3*edge)/10,height()/2-(3*edge)/10); p.setPen(QColor(colorGroup().light())); p.lineTo(width()/2+(3*edge)/10,height()/2+(3*edge)/10); p.lineTo(width()/2+(3*edge)/30,height()/2+(3*edge)/10); break; case RDTransportButton::PlayFrom: p.fillRect(width()/2-(3*edge)/10,height()/2-(3*edge)/10, 3,(3*edge)/5,QBrush(accent_color)); triangle.setPoint(0,width()/2-(2*edge)/10+1,height()/2-(3*edge)/10); triangle.setPoint(1,width()/2+(3*edge)/10+1,height()/2); triangle.setPoint(2,width()/2-(2*edge)/10+1,height()/2+(3*edge)/10); p.drawPolygon(triangle); p.setPen(QColor(colorGroup().shadow())); p.moveTo(width()/2-(2*edge)/10+1,height()/2+(3*edge)/10); p.lineTo(width()/2-(2*edge)/10+1,height()/2-(3*edge)/10); p.setPen(QColor(colorGroup().dark())); p.lineTo(width()/2+(3*edge)/10+1,height()/2); p.setPen(QColor(colorGroup().light())); p.lineTo(width()/2-(2*edge)/10+1,height()/2+(3*edge)/10); break; case RDTransportButton::PlayBetween: p.fillRect(width()/2-(3*edge)/10,height()/2-(3*edge)/10, 3,(3*edge)/5,QBrush(accent_color)); p.fillRect(width()/2+(3*edge)/10,height()/2-(3*edge)/10, 3,(3*edge)/5,QBrush(accent_color)); triangle.setPoint(0,width()/2-(2*edge)/10+1,height()/2-(3*edge)/10); triangle.setPoint(1,width()/2+(2*edge)/10+1,height()/2); triangle.setPoint(2,width()/2-(2*edge)/10+1,height()/2+(3*edge)/10); p.drawPolygon(triangle); p.setPen(QColor(colorGroup().shadow())); p.moveTo(width()/2-(2*edge)/10+1,height()/2+(3*edge)/10); p.lineTo(width()/2-(2*edge)/10+1,height()/2-(3*edge)/10); p.setPen(QColor(colorGroup().dark())); p.lineTo(width()/2+(2*edge)/10+1,height()/2); p.setPen(QColor(colorGroup().light())); p.lineTo(width()/2-(2*edge)/10+1,height()/2+(3*edge)/10); break; case RDTransportButton::Loop: triangle.setPoint(0,width()/2-(2*edge)/10+1,height()/2-(edge)/4); triangle.setPoint(1,width()/2+(edge)/10+1,height()/2-edge/10); triangle.setPoint(2,width()/2-(2*edge)/10+1,height()/2+edge/20); p.drawPolygon(triangle); p.setPen(QColor(colorGroup().shadow())); p.moveTo(width()/2-(2*edge)/10+1,height()/2+(edge)/4); p.lineTo(width()/2+(edge)/10+1,height()/2-edge/10); p.setPen(QColor(colorGroup().dark())); p.setPen(QColor(colorGroup().light())); p.lineTo(width()/2-(2*edge)/10+1,height()/2+(edge)/4); p.setPen(QColor(colorGroup().shadow())); p.drawArc(width()/6,height()/2-edge/9,2*width()/3, height()/3+edge/10,1440,5760); break; case RDTransportButton::Up: triangle.setPoint(0,width()/2,(3*edge)/10); triangle.setPoint(1,width()/2+(3*edge)/10,height()-(3*edge)/10); triangle.setPoint(2,width()/2-(3*edge)/10,height()-(3*edge)/10); p.drawPolygon(triangle); break; case RDTransportButton::Down: triangle.setPoint(0,width()/2,height()-(3*edge)/10); triangle.setPoint(1,width()/2+(3*edge)/10,(3*edge)/10); triangle.setPoint(2,width()/2-(3*edge)/10,(3*edge)/10); p.drawPolygon(triangle); break; case RDTransportButton::PlayTo: p.fillRect(width()/2+(3*edge)/10,height()/2-(3*edge)/10, 3,(3*edge)/5,QBrush(accent_color)); triangle.setPoint(0,width()/2-(3*edge)/10,height()/2-(3*edge)/10); triangle.setPoint(1,width()/2+(2*edge)/10+1,height()/2); triangle.setPoint(2,width()/2-(3*edge)/10,height()/2+(3*edge)/10); p.drawPolygon(triangle); p.setPen(QColor(colorGroup().shadow())); p.moveTo(width()/2-(3*edge)/10,height()/2+(3*edge)/10); p.lineTo(width()/2-(3*edge)/10,height()/2-(3*edge)/10); p.setPen(QColor(colorGroup().dark())); p.lineTo(width()/2+(2*edge)/10+1,height()/2); p.setPen(QColor(colorGroup().light())); p.lineTo(width()/2-(3*edge)/10,height()/2+(3*edge)/10); break; } p.end(); }
void RDTransportButton::drawMask(QPixmap *cap) { QPointArray triangle=QPointArray(3); QPainter b; QBitmap *bitmap=new QBitmap(size()); int edge; if(height()<width()) { edge=height(); } else { edge=width(); } cap->resize(size()); b.begin(bitmap); b.fillRect(0,0,size().width(),size().height(),QColor(color0)); b.setPen(QColor(color1)); b.setBrush(QColor(color1)); switch(button_type) { case RDTransportButton::Play: triangle.setPoint(0,width()/2-(3*edge)/10,height()/2-(3*edge)/10); triangle.setPoint(1,width()/2+(3*edge)/10,height()/2); triangle.setPoint(2,width()/2-(3*edge)/10,height()/2+(3*edge)/10); b.drawPolygon(triangle); break; case RDTransportButton::Stop: b.fillRect(width()/2-edge*3/10,height()/2-edge*3/10, edge*3/5,edge*3/5,QColor(color1)); break; case RDTransportButton::Record: b.drawEllipse(width()/2-(3*edge)/10,height()/2-(3*edge)/10, (3*edge)/5,(3*edge)/5); break; case RDTransportButton::FastForward: triangle.setPoint(0,width()/2-(3*edge)/10,height()/2-(3*edge)/10); triangle.setPoint(1,width()/2,height()/2); triangle.setPoint(2,width()/2-(3*edge)/10,height()/2+(3*edge)/10); b.drawPolygon(triangle); triangle.setPoint(0,width()/2,height()/2-(3*edge)/10); triangle.setPoint(1,width()/2+(3*edge)/10,height()/2); triangle.setPoint(2,width()/2,height()/2+(3*edge)/10); b.drawPolygon(triangle); break; case RDTransportButton::Rewind: triangle.setPoint(0,width()/2+(3*edge)/10,height()/2-(3*edge)/10); triangle.setPoint(1,width()/2,height()/2); triangle.setPoint(2,width()/2+(3*edge)/10,height()/2+(3*edge)/10); b.drawPolygon(triangle); triangle.setPoint(0,width()/2,height()/2-(3*edge)/10); triangle.setPoint(1,width()/2-(3*edge)/10,height()/2); triangle.setPoint(2,width()/2,height()/2+(3*edge)/10); b.drawPolygon(triangle); break; case RDTransportButton::Eject: triangle.setPoint(0,width()/2,height()/2-(3*edge)/10); triangle.setPoint(1,width()/2+(3*edge)/10,height()/2); triangle.setPoint(2,width()/2-(3*edge)/10,height()/2); b.drawPolygon(triangle); b.fillRect(width()/2-(3*edge)/10,height()/2+edge/10, (3*edge)/5,edge/5,QColor(color1)); break; case RDTransportButton::Pause: b.fillRect(width()/2-(3*edge)/10,height()/2-(3*edge)/10, (3*edge)/15,(3*edge)/5,QColor(color1)); b.fillRect(width()/2+(3*edge)/30,height()/2-(3*edge)/10, (3*edge)/15,(3*edge)/5,QColor(color1)); break; case RDTransportButton::PlayFrom: b.fillRect(width()/2-(3*edge)/10,height()/2-(3*edge)/10, 3,(3*edge)/5,QBrush(color1)); triangle.setPoint(0,width()/2-(2*edge)/10+1,height()/2-(3*edge)/10); triangle.setPoint(1,width()/2+(3*edge)/10+1,height()/2); triangle.setPoint(2,width()/2-(2*edge)/10+1,height()/2+(3*edge)/10); b.drawPolygon(triangle); break; case RDTransportButton::PlayBetween: b.fillRect(width()/2-(3*edge)/10,height()/2-(3*edge)/10, 3,(3*edge)/5,QBrush(color1)); b.fillRect(width()/2+(3*edge)/10,height()/2-(3*edge)/10, 3,(3*edge)/5,QBrush(color1)); triangle.setPoint(0,width()/2-(2*edge)/10+1,height()/2-(3*edge)/10); triangle.setPoint(1,width()/2+(2*edge)/10+1,height()/2); triangle.setPoint(2,width()/2-(2*edge)/10+1,height()/2+(3*edge)/10); b.drawPolygon(triangle); break; case RDTransportButton::Loop: b.moveTo(width()/2-(2*edge)/10+1,height()/2+(edge)/4); b.moveTo(width()/2+(edge)/10+1,height()/2-edge/10); b.moveTo(width()/2-(2*edge)/10+1,height()/2+(edge)/4); b.drawArc(width()/6,height()/2-edge/9,2*width()/3, height()/3+edge/10,1440,5760); triangle.setPoint(0,width()/2-(2*edge)/10+1,height()/2-(edge)/4); triangle.setPoint(1,width()/2+(edge)/10+1,height()/2-edge/10); triangle.setPoint(2,width()/2-(2*edge)/10+1,height()/2+edge/20); b.drawPolygon(triangle); break; case RDTransportButton::Up: triangle.setPoint(0,width()/2,(3*edge)/10); triangle.setPoint(1,width()/2+(3*edge)/10,height()-(3*edge)/10); triangle.setPoint(2,width()/2-(3*edge)/10,height()-(3*edge)/10); b.drawPolygon(triangle); break; case RDTransportButton::Down: triangle.setPoint(0,width()/2,height()-(3*edge)/10); triangle.setPoint(1,width()/2+(3*edge)/10,(3*edge)/10); triangle.setPoint(2,width()/2-(3*edge)/10,(3*edge)/10); b.drawPolygon(triangle); break; case RDTransportButton::PlayTo: b.fillRect(width()/2+(3*edge)/10,height()/2-(3*edge)/10, 3,(3*edge)/5,QBrush(color1)); triangle.setPoint(0,width()/2-(3*edge)/10,height()/2-(3*edge)/10); triangle.setPoint(1,width()/2+(2*edge)/10+1,height()/2); triangle.setPoint(2,width()/2-(3*edge)/10,height()/2+(3*edge)/10); b.drawPolygon(triangle); break; default: b.fillRect(0,0,width(),height(),QColor(color1)); } b.end(); cap->setMask(*bitmap); delete bitmap; }
void DPImage::postResize() { setItemPoints( QPointArray(m_sizeRect), false ); m_bSettingsChanged = true; }
QPointArray ossimQtVceShape::areaPoints () const { return QPointArray(boundingRect()); }
/*!\reimp */ void QPlatinumStyle::drawPrimitive( PrimitiveElement pe, QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags, const QStyleOption& opt ) const { switch (pe) { case PE_HeaderSection: { // adjust the sunken flag, otherwise headers are drawn // sunken... if ( flags & Style_Sunken ) flags ^= Style_Sunken; drawPrimitive( PE_ButtonBevel, p, r, cg, flags, opt ); break; } case PE_ButtonTool: { // tool buttons don't change color when pushed in platinum, // so we need to make the mid and button color the same QColorGroup myCG = cg; QBrush fill; // quick trick to make sure toolbuttons drawn sunken // when they are activated... if ( flags & Style_On ) flags |= Style_Sunken; fill = myCG.brush( QColorGroup::Button ); myCG.setBrush( QColorGroup::Mid, fill ); drawPrimitive( PE_ButtonBevel, p, r, myCG, flags, opt ); break; } case PE_ButtonBevel: { int x, y, w, h; r.rect( &x, &y, &w, &h ); QPen oldPen = p->pen(); if ( w * h < 1600 || QABS(w - h) > 10 ) { // small buttons if ( !(flags & (Style_Sunken | Style_Down)) ) { p->fillRect( x + 2, y + 2, w - 4, h - 4, cg.brush(QColorGroup::Button) ); // the bright side p->setPen( cg.dark() ); // the bright side p->setPen( cg.dark() ); p->drawLine( x, y, x + w - 1, y ); p->drawLine( x, y, x, y + h - 1 ); p->setPen( cg.light() ); p->drawLine( x + 1, y + 1, x + w - 2, y + 1 ); p->drawLine( x + 1, y + 1, x + 1, y + h - 2 ); // the dark side p->setPen( cg.mid() ); p->drawLine( x + 2, y + h - 2, x + w - 2, y + h - 2 ); p->drawLine( x + w - 2, y + 2, x + w - 2, y + h - 3 ); p->setPen( cg.dark().dark() ); p->drawLine( x + 1, y + h - 1, x + w - 1, y + h - 1 ); p->drawLine( x + w - 1, y + 1, x + w - 1, y + h - 2 ); } else { p->fillRect(x + 2, y + 2, w - 4, h - 4, cg.brush( QColorGroup::Mid )); // the dark side p->setPen( cg.dark().dark() ); p->drawLine( x, y, x + w - 1, y ); p->drawLine( x, y, x, y + h - 1 ); p->setPen( cg.mid().dark()); p->drawLine( x + 1, y + 1, x + w-2, y + 1); p->drawLine( x + 1, y + 1, x + 1, y + h - 2 ); // the bright side! p->setPen(cg.button()); p->drawLine( x + 1, y + h - 2, x + w - 2, y + h - 2 ); p->drawLine( x + w - 2, y + 1, x + w - 2, y + h - 2 ); p->setPen(cg.dark()); p->drawLine(x, y + h - 1, x + w - 1, y + h - 1 ); p->drawLine(x + w - 1, y, x + w - 1, y + h - 1 ); } } else { // big ones if ( !(flags & (Style_Sunken | Style_Down)) ) { p->fillRect( x + 3, y + 3, w - 6, h - 6, cg.brush(QColorGroup::Button) ); // the bright side p->setPen( cg.button().dark() ); p->drawLine( x, y, x + w - 1, y ); p->drawLine( x, y, x, y + h - 1 ); p->setPen( cg.button() ); p->drawLine( x + 1, y + 1, x + w - 2, y + 1 ); p->drawLine( x + 1, y + 1, x + 1, y + h - 2 ); p->setPen( cg.light() ); p->drawLine( x + 2, y + 2, x + 2, y + h - 2 ); p->drawLine( x + 2, y + 2, x + w - 2, y + 2 ); // the dark side! p->setPen( cg.mid() ); p->drawLine( x + 3, y + h - 3, x + w - 3, y + h - 3 ); p->drawLine( x + w - 3, y + 3, x + w - 3, y + h - 3 ); p->setPen( cg.dark() ); p->drawLine( x + 2, y + h - 2, x + w - 2, y + h - 2 ); p->drawLine( x + w - 2, y + 2, x + w - 2, y + h - 2 ); p->setPen( cg.dark().dark() ); p->drawLine( x + 1, y + h - 1, x + w - 1, y + h - 1 ); p->drawLine( x + w - 1, y + 1, x + w - 1, y + h - 1 ); } else { p->fillRect( x + 3, y + 3, w - 6, h - 6, cg.brush( QColorGroup::Mid ) ); // the dark side p->setPen( cg.dark().dark().dark() ); p->drawLine( x, y, x + w - 1, y ); p->drawLine( x, y, x, y + h - 1 ); p->setPen( cg.dark().dark() ); p->drawLine( x + 1, y + 1, x + w - 2, y + 1 ); p->drawLine( x + 1, y + 1, x + 1, y + h - 2 ); p->setPen( cg.mid().dark() ); p->drawLine( x + 2, y + 2, x + 2, y + w - 2 ); p->drawLine( x + 2, y + 2, x + w - 2, y + 2 ); // the bright side! p->setPen( cg.button() ); p->drawLine( x + 2, y + h - 3, x + w - 3, y + h - 3 ); p->drawLine( x + w - 3, y + 3, x + w - 3, y + h - 3 ); p->setPen( cg.midlight() ); p->drawLine( x + 1, y + h - 2, x + w - 2, y + h - 2 ); p->drawLine( x + w - 2, y + 1, x + w - 2, y + h - 2 ); p->setPen( cg.dark() ); p->drawLine( x, y + h - 1, x + w - 1, y + h - 1 ); p->drawLine( x + w - 1, y, x + w - 1, y + h - 1 ); // corners p->setPen( mixedColor(cg.dark().dark().dark(), cg.dark()) ); p->drawPoint( x, y + h - 1 ); p->drawPoint( x + w - 1, y ); p->setPen( mixedColor(cg.dark().dark(), cg.midlight()) ); p->drawPoint( x + 1, y + h - 2 ); p->drawPoint( x + w - 2, y + 1 ); p->setPen( mixedColor(cg.mid().dark(), cg.button() ) ); p->drawPoint( x + 2, y + h - 3 ); p->drawPoint( x + w - 3, y + 2 ); } } p->setPen( oldPen ); break; } case PE_ButtonCommand: { QPen oldPen = p->pen(); int x, y, w, h; r.rect( &x, &y, &w, &h); if ( !(flags & (Style_Down | Style_On)) ) { p->fillRect( x+3, y+3, w-6, h-6, cg.brush( QColorGroup::Button )); // the bright side p->setPen( cg.shadow() ); p->drawLine( x, y, x+w-1, y ); p->drawLine( x, y, x, y + h - 1 ); p->setPen( cg.button() ); p->drawLine( x + 1, y + 1, x + w - 2, y + 1 ); p->drawLine( x + 1, y + 1, x + 1, y + h - 2 ); p->setPen( cg.light() ); p->drawLine( x + 2, y + 2, x + 2, y + h - 2 ); p->drawLine( x + 2, y + 2, x + w - 2, y + 2 ); // the dark side! p->setPen( cg.mid() ); p->drawLine( x + 3, y + h - 3 ,x + w - 3, y + h - 3 ); p->drawLine( x + w - 3, y + 3, x + w - 3, y + h - 3 ); p->setPen( cg.dark() ); p->drawLine( x + 2, y + h - 2, x + w - 2, y + h - 2 ); p->drawLine( x + w - 2, y + 2, x + w - 2, y + h - 2 ); p->setPen( cg.shadow() ); p->drawLine( x + 1, y + h - 1, x + w - 1, y + h - 1 ); p->drawLine( x + w - 1, y, x + w - 1, y + h - 1 ); // top left corner: p->setPen( cg.background() ); p->drawPoint( x, y ); p->drawPoint( x + 1, y ); p->drawPoint( x, y+1 ); p->setPen( cg.shadow() ); p->drawPoint( x + 1, y + 1 ); p->setPen( cg.button() ); p->drawPoint( x + 2, y + 2 ); p->setPen( white ); p->drawPoint( x + 3, y + 3 ); // bottom left corner: p->setPen( cg.background() ); p->drawPoint( x, y + h - 1 ); p->drawPoint( x + 1, y + h - 1 ); p->drawPoint( x, y + h - 2 ); p->setPen( cg.shadow() ); p->drawPoint( x + 1, y + h - 2 ); p->setPen( cg.dark() ); p->drawPoint( x + 2, y + h - 3 ); // top right corner: p->setPen( cg.background() ); p->drawPoint( x + w -1, y ); p->drawPoint( x + w - 2, y ); p->drawPoint( x + w - 1, y + 1 ); p->setPen( cg.shadow() ); p->drawPoint( x + w - 2, y + 1 ); p->setPen( cg.dark() ); p->drawPoint( x + w - 3, y + 2 ); // bottom right corner: p->setPen( cg.background() ); p->drawPoint( x + w - 1, y + h - 1 ); p->drawPoint( x + w - 2, y + h - 1 ); p->drawPoint( x + w - 1, y + h - 2 ); p->setPen( cg.shadow() ); p->drawPoint( x + w - 2, y + h - 2 ); p->setPen( cg.dark() ); p->drawPoint( x + w - 3, y + h - 3 ); p->setPen( cg.mid() ); p->drawPoint( x + w - 4, y + h - 4 ); } else { p->fillRect( x + 2, y + 2, w - 4, h - 4, cg.brush(QColorGroup::Dark) ); // the dark side p->setPen( cg.shadow() ); p->drawLine( x, y, x + w - 1, y ); p->drawLine( x, y, x, y + h - 1 ); p->setPen( cg.dark().dark() ); p->drawLine( x + 1, y + 1, x + w - 2, y + 1 ); p->drawLine( x + 1, y + 1, x + 1, y + h - 2 ); // the bright side! p->setPen( cg.button() ); p->drawLine( x + 1, y + h - 2, x + w - 2, y + h - 2 ); p->drawLine( x + w - 2, y + 1, x + w - 2, y + h - 2 ); p->setPen( cg.dark() ); p->drawLine( x, y + h - 1, x + w - 1, y + h - 1 ); p->drawLine( x + w - 1, y, x + w - 1, y + h - 1 ); // top left corner: p->setPen( cg.background() ); p->drawPoint( x, y ); p->drawPoint( x + 1, y ); p->drawPoint( x, y + 1 ); p->setPen( cg.shadow() ); p->drawPoint( x + 1, y + 1 ); p->setPen( cg.dark().dark() ); p->drawPoint( x + 3, y + 3 ); // bottom left corner: p->setPen( cg.background() ); p->drawPoint( x, y + h - 1 ); p->drawPoint( x + 1, y + h - 1 ); p->drawPoint( x, y + h - 2 ); p->setPen( cg.shadow() ); p->drawPoint( x + 1, y + h - 2 ); // top right corner: p->setPen( cg.background() ); p->drawPoint( x + w - 1, y ); p->drawPoint( x + w - 2, y ); p->drawPoint( x + w - 1, y + 1 ); p->setPen( cg.shadow() ); p->drawPoint( x + w - 2, y + 1 ); // bottom right corner: p->setPen( cg.background() ); p->drawPoint( x + w - 1, y + h - 1 ); p->drawPoint( x + w - 2, y + h - 1 ); p->drawPoint( x + w - 1, y + h - 2 ); p->setPen( cg.shadow() ); p->drawPoint( x + w - 2, y + h - 2 ); p->setPen( cg.dark() ); p->drawPoint( x + w - 3, y + h - 3 ); p->setPen( cg.mid() ); p->drawPoint( x + w - 4, y + h - 4 ); } p->setPen( oldPen ); break; } case PE_Indicator: { drawPrimitive( PE_ButtonBevel, p, QRect(r.x(), r.y(), r.width() - 2, r.height()), cg, flags ); p->fillRect( r.x() + r.width() - 2, r.y(), 2, r.height(), cg.brush( QColorGroup::Background ) ); p->setPen( cg.shadow() ); p->drawRect( r.x(), r.y(), r.width() - 2, r.height() ); static const QCOORD nochange_mark[] = { 3,5, 9,5, 3,6, 9,6 }; static const QCOORD check_mark[] = { 3,5, 5,5, 4,6, 5,6, 5,7, 6,7, 5,8, 6,8, 6,9, 9,9, 6,10, 8,10, 7,11, 8,11, 7,12, 7,12, 8,8, 9,8, 8,7, 10,7, 9,6, 10,6, 9,5, 11,5, 10,4, 11,4, 10,3, 12,3, 11,2, 12,2, 11,1, 13,1, 12,0, 13,0 }; if ( !(flags & Style_Off) ) { QPen oldPen = p->pen(); int x1 = r.x(); int y1 = r.y(); if ( flags & Style_Down ) { x1++; y1++; } QPointArray amark; if ( flags & Style_On ) { amark = QPointArray( sizeof(check_mark)/(sizeof(QCOORD)*2), check_mark ); // ### KLUDGE!! flags ^= Style_On; flags ^= Style_Down; } else if ( flags & Style_NoChange ) { amark = QPointArray( sizeof(nochange_mark) / (sizeof(QCOORD) * 2), nochange_mark ); } amark.translate( x1 + 1, y1 + 1 ); p->setPen( cg.dark() ); p->drawLineSegments( amark ); amark.translate( -1, -1 ); p->setPen( cg.foreground() ); p->drawLineSegments( amark ); p->setPen( oldPen ); } break; } case PE_IndicatorMask: { int x, y, w, h; r.rect( &x, &y, &w, &h ); p->fillRect( x, y, w - 2, h, color1); if ( flags & Style_Off ) { QPen oldPen = p->pen(); p->setPen ( QPen(color1, 2)); p->drawLine( x + 2, y + h / 2 - 1, x + w / 2 - 1, y + h - 4 ); p->drawLine( x + w / 2 - 1, y + h - 4, x + w, 0); p->setPen( oldPen ); } break; } case PE_ExclusiveIndicator: { #define QCOORDARRLEN(x) sizeof(x) / (sizeof(QCOORD) * 2 ) bool down = flags & Style_Down; bool on = flags & Style_On; static const QCOORD pts1[] = { // normal circle 5,0, 8,0, 9,1, 10,1, 11,2, 12,3, 12,4, 13,5, 13,8, 12,9, 12,10, 11,11, 10,12, 9,12, 8,13, 5,13, 4,12, 3,12, 2,11, 1,10, 1,9, 0,8, 0,5, 1,4, 1,3, 2,2, 3,1, 4,1 }; static const QCOORD pts2[] = { // top left shadow 5,1, 8,1, 3,2, 7,2, 2,3, 5,3, 2,4, 4,4, 1,5, 3,5, 1,6, 1,8, 2,6, 2,7 }; static const QCOORD pts3[] = { // bottom right, dark 5,12, 8,12, 7,11, 10,11, 8,10, 11,10, 9,9, 11,9, 10,8, 12,8, 11,7, 11,7, 12,5, 12,7 }; static const QCOORD pts4[] = { // bottom right, light 5,12, 8,12, 7,11, 10,11, 9,10, 11,10, 10,9, 11,9, 11,7, 11,8, 12,5, 12,8 }; static const QCOORD pts5[] = { // check mark 6,4, 8,4, 10,6, 10,8, 8,10, 6,10, 4,8, 4,6 }; static const QCOORD pts6[] = { // check mark extras 4,5, 5,4, 9,4, 10,5, 10,9, 9,10, 5,10, 4,9 }; int x, y; x = r.x(); y = r.y(); p->eraseRect( r ); p->setBrush( (down||on) ? cg.brush( QColorGroup::Dark ) : cg.brush( QColorGroup::Button) ); p->setPen( NoPen ); p->drawEllipse( x, y, 13, 13 ); p->setPen( cg.shadow() ); QPointArray a( QCOORDARRLEN(pts1), pts1 ); a.translate( x, y ); p->drawPolyline( a ); // draw normal circle QColor tc, bc; const QCOORD *bp; int bl; if ( down || on ) { // pressed down or on tc = cg.dark().dark(); bc = cg.light(); bp = pts4; bl = QCOORDARRLEN(pts4); } else { // released tc = cg.light(); bc = cg.dark(); bp = pts3; bl = QCOORDARRLEN(pts3); } p->setPen( tc ); a.setPoints( QCOORDARRLEN(pts2), pts2 ); a.translate( x, y ); p->drawLineSegments( a ); // draw top shadow p->setPen( bc ); a.setPoints( bl, bp ); a.translate( x, y ); p->drawLineSegments( a ); if ( on ) { // draw check mark int x1 = x, y1 = y; p->setBrush( cg.foreground() ); p->setPen( cg.foreground() ); a.setPoints( QCOORDARRLEN(pts5), pts5 ); a.translate( x1, y1 ); p->drawPolygon( a ); p->setBrush( NoBrush ); p->setPen( cg.dark() ); a.setPoints( QCOORDARRLEN(pts6), pts6 ); a.translate( x1, y1 ); p->drawLineSegments( a ); } break; } case PE_ExclusiveIndicatorMask: { static const QCOORD pts1[] = { // normal circle 5,0, 8,0, 9,1, 10,1, 11,2, 12,3, 12,4, 13,5, 13,8, 12,9, 12,10, 11,11, 10,12, 9,12, 8,13, 5,13, 4,12, 3,12, 2,11, 1,10, 1,9, 0,8, 0,5, 1,4, 1,3, 2,2, 3,1, 4,1 }; QPointArray a(QCOORDARRLEN(pts1), pts1); a.translate(r.x(), r.y()); p->setPen(color1); p->setBrush(color1); p->drawPolygon(a); break; } case PE_ScrollBarAddLine: { drawPrimitive( PE_ButtonBevel, p, r, cg, (flags & Style_Enabled) | ((flags & Style_Down) ? Style_Sunken : Style_Raised) ); p->setPen( cg.shadow() ); p->drawRect( r ); drawPrimitive( ((flags & Style_Horizontal) ? PE_ArrowRight : PE_ArrowDown), p, QRect(r.x() + 2, r.y() + 2, r.width() - 4, r.height() - 4), cg, flags ); break; } case PE_ScrollBarSubLine: { drawPrimitive( PE_ButtonBevel, p, r, cg, (flags & Style_Enabled) | ((flags & Style_Down) ? Style_Sunken : Style_Raised) ); p->setPen( cg.shadow() ); p->drawRect( r ); drawPrimitive( ((flags & Style_Horizontal) ? PE_ArrowLeft : PE_ArrowUp ), p, QRect(r.x() + 2, r.y() + 2, r.width() - 4, r.height() - 4), cg, flags ); break; } case PE_ScrollBarAddPage: case PE_ScrollBarSubPage: { QPen oldPen = p->pen(); if ( r.width() < 3 || r.height() < 3 ) { p->fillRect( r, cg.brush(QColorGroup::Mid) ); p->setPen( cg.shadow() ); p->drawRect( r ); p->setPen( oldPen ); } else { int x, y, w, h; r.rect( &x, &y, &w, &h ); if ( flags & Style_Horizontal ) { p->fillRect( x + 2, y + 2, w - 2, h - 4, cg.brush(QColorGroup::Mid) ); // the dark side p->setPen( cg.dark().dark() ); p->drawLine( x, y, x + w - 1, y ); p->setPen( cg.shadow()); p->drawLine( x, y, x, y + h - 1 ); p->setPen( cg.mid().dark()); p->drawLine( x + 1, y + 1, x + w - 1, y + 1 ); p->drawLine( x + 1, y + 1, x + 1, y + h - 2 ); // the bright side! p->setPen( cg.button()); p->drawLine( x + 1, y + h - 2, x + w - 1, y + h - 2 ); p->setPen( cg.shadow()); p->drawLine( x, y + h - 1, x + w - 1, y + h - 1 ); } else { p->fillRect( x + 2, y + 2, w - 4, h - 2, cg.brush(QColorGroup::Mid) ); // the dark side p->setPen( cg.dark().dark() ); p->drawLine( x, y, x + w - 1, y ); p->setPen( cg.shadow() ); p->drawLine( x, y, x, y + h - 1 ); p->setPen( cg.mid().dark() ); p->drawLine( x + 1, y + 1, x + w - 2, y + 1 ); p->drawLine( x + 1, y + 1, x + 1, y + h - 1 ); // the bright side! p->setPen( cg.button() ); p->drawLine( x + w - 2, y + 1, x + w - 2, y + h - 1 ); p->setPen( cg.shadow() ); p->drawLine( x + w - 1, y, x + w - 1, y + h - 1 ); } } p->setPen( oldPen ); break; } case PE_ScrollBarSlider: { QPoint bo = p->brushOrigin(); p->setBrushOrigin( r.topLeft() ); drawPrimitive( PE_ButtonBevel, p, r, cg, Style_Raised ); p->setBrushOrigin( bo ); drawRiffles( p, r.x(), r.y(), r.width(), r.height(), cg, flags & Style_Horizontal ); p->setPen( cg.shadow() ); p->drawRect( r ); if ( flags & Style_HasFocus ) { drawPrimitive( PE_FocusRect, p, QRect(r.x() + 2, r.y() + 2, r.width() - 5, r.height() - 5 ), cg, flags ); } break; } default: QWindowsStyle::drawPrimitive( pe, p, r, cg, flags, opt ); break; } }