// Copyright 2008 Simon Edwards <simon@simonzone.com>

//                 Generated by twine

// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU Library General Public License as
// published by the Free Software Foundation; either version 2, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details

// You should have received a copy of the GNU Library General Public
// License along with this program; if not, write to the
// Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.


namespace Plasma
{

class PlotColor
{
%TypeHeaderCode
#include <plasma/widgets/signalplotter.h>
%End

public:
    QColor color;
    QColor darkColor;
};   // PlotColor


class SignalPlotter : QGraphicsWidget
{
%TypeHeaderCode
#include <plasma/widgets/signalplotter.h>
%End

public:
                            SignalPlotter (QGraphicsItem* parent = 0);
    void                    addPlot (const QColor& color);
    void                    addSample (const QList<double>& samples);
    void                    reorderPlots (const QList<uint>& newOrder);
    void                    removePlot (uint pos);
    QList<Plasma::PlotColor>&  plotColors ();
    void                    setTitle (const QString& title);
    QString                 title () const;
    void                    setUnit (const QString& unit);
    QString                 unit () const;
    void                    scale (qreal delta);
    qreal                   scaledBy () const;
    void                    setUseAutoRange (bool value);
    bool                    useAutoRange () const;
    void                    setVerticalRange (double min, double max);
    double                  verticalMinValue () const;
    double                  verticalMaxValue () const;
    void                    setHorizontalScale (uint scale);
    uint                    horizontalScale () const;
    void                    setShowVerticalLines (bool value);
    bool                    showVerticalLines () const;
    void                    setVerticalLinesColor (const QColor& color);
    QColor                  verticalLinesColor () const;
    void                    setVerticalLinesDistance (uint distance);
    uint                    verticalLinesDistance () const;
    void                    setVerticalLinesScroll (bool value);
    bool                    verticalLinesScroll () const;
    void                    setShowHorizontalLines (bool value);
    bool                    showHorizontalLines () const;
    void                    setHorizontalLinesColor (const QColor& color);
    QColor                  horizontalLinesColor () const;
    void                    setFontColor (const QColor& color);
    QColor                  fontColor () const;
    void                    setFont (const QFont& font);
    QFont                   font () const;
    void                    setHorizontalLinesCount (uint count);
    uint                    horizontalLinesCount () const;
    void                    setShowLabels (bool value);
    bool                    showLabels () const;
    void                    setShowTopBar (bool value);
    bool                    showTopBar () const;
    void                    setBackgroundColor (const QColor& color);
    QColor                  backgroundColor () const;
    void                    setSvgBackground (const QString& filename);
    QString                 svgBackground ();
    double                  lastValue (uint i) const;
    QString                 lastValueAsString (uint i) const;
    void                    setThinFrame (bool set);
    bool                    thinFrame () const;
    void                    setStackPlots (bool stack);
    bool                    stackPlots () const;
    QPixmap                 getSnapshotImage (uint width, uint height);
    virtual void            setGeometry (const QRectF& geometry);

protected:
    void                    updateDataBuffers ();
    void                    calculateNiceRange ();
    void                    paint (QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
    void                    drawWidget (QPainter* p, uint w, uint height, int horizontalScale);
    void                    drawBackground (QPainter* p, int w, int h);
    void                    drawThinFrame (QPainter* p, int w, int h);
    void                    drawTopBarFrame (QPainter* p, int separatorX, int height);
    void                    drawTopBarContents (QPainter* p, int x, int width, int height);
    void                    drawVerticalLines (QPainter* p, int top, int w, int h);
    void                    drawPlots (QPainter* p, int top, int w, int h, int horizontalScale);
    void                    drawAxisText (QPainter* p, int top, int h);
    void                    drawHorizontalLines (QPainter* p, int top, int w, int h);
};   // SignalPlotter

};   // Plasma


