Back to index

scribus-ng  1.3.4.dfsg+svn20071115
curvewidget.h
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 #ifndef CURVEWIDGET_H
00008 #define CURVEWIDGET_H
00009 
00010 #include <qvariant.h>
00011 #include <qpixmap.h>
00012 #include <qwidget.h>
00013 #include "fpointarray.h"
00014 #include "scribusapi.h"
00015 
00016 class QVBoxLayout;
00017 class QHBoxLayout;
00018 class QGridLayout;
00019 class QSpacerItem;
00020 class QPushButton;
00021 class QToolButton;
00022 class QLabel;
00023 
00024 class SCRIBUS_API KCurve : public QWidget
00025 {
00026        Q_OBJECT
00027 
00028 public:
00029        KCurve(QWidget *parent);
00030        virtual ~KCurve();
00031        void setPixmap(QPixmap pix);
00032 
00033 protected:
00034        void paintEvent(QPaintEvent *);
00035        void keyPressEvent(QKeyEvent *);
00036        void mousePressEvent (QMouseEvent * e);
00037        void mouseReleaseEvent ( QMouseEvent * e );
00038        void mouseMoveEvent ( QMouseEvent * e );
00039        void leaveEvent ( QEvent * );
00040 
00041 public:
00042        double getCurveValue(double x);
00043        FPointArray getCurve();
00044        void setCurve(FPointArray inlist);
00045        void resetCurve();
00046        void setLinear(bool setter);
00047        bool isLinear();
00048 
00049 signals:
00050        void modified();
00051 
00052 private:
00053        double m_leftmost;
00054        double m_rightmost;
00055        FPoint m_grab_point;
00056        int m_pos;
00057        bool m_dragging;
00058        bool m_linear;
00059        double m_grabOffsetX;
00060        double m_grabOffsetY;
00061        FPointArray m_points;
00062        FPointArray m_points_back;
00063        QPixmap *m_pix;
00064 };
00065 
00066 class SCRIBUS_API CurveWidget : public QWidget
00067 {
00068        Q_OBJECT
00069 
00070 public:
00071        CurveWidget(QWidget* parent);
00072        ~CurveWidget() {};
00073        void setLinear(bool setter);
00074        QPushButton* invertButton;
00075        QPushButton* resetButton;
00076        QToolButton *linearButton;
00077        QPushButton* loadButton;
00078        QPushButton* saveButton;
00079        KCurve* cDisplay;
00080 
00081 private slots:
00082        void doInvert();
00083        void doReset();
00084        void doLinear();
00085        void doLoad();
00086        void doSave();
00087 
00088 protected:
00089        QHBoxLayout* CurveWidgetLayout;
00090        QVBoxLayout* layout1;
00091        QSpacerItem* spacer1;
00092 
00093 protected slots:
00094        virtual void languageChange();
00095 };
00096 
00097 #endif // CURVEWIDGET_H