/****************************************************************************
**
** Copyright (C) 1992-2004 Trolltech AS. All rights reserved.
**
** This file is part of the demonstration applications of the Qt Toolkit.
**
** Licensees holding valid Qt Preview licenses may use this file in
** accordance with the Qt Preview License Agreement provided with the
** Software.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
****************************************************************************/

#ifndef ROADS_H
#define ROADS_H

#include "demowidget.h"

#include <qpainterpath.h>
#include <qpolygon.h>

class Roads : public DemoWidget
{
public:
    Roads(QWidget *parent=0);

    void paintEvent(QPaintEvent *e);
    void mousePressEvent(QMouseEvent *) { stopAnimation(); }
    void mouseReleaseEvent(QMouseEvent *) { startAnimation(); }

    void hideEvent(QHideEvent *) { resetState(); }

    void resetState() { backBuffer = QPixmap(); }

private:
    QPainterPath yellowLine;
    QList<QPolygon> carVectors;
    QPixmap pixmap;
    QPixmap backBuffer;

};

#endif // PATHS_H
