/* ============================================================ * * Copyright 2004-2005 by Gilles Caulier (original work as digikam curveswidget) * Copyright 2005 by Casper Boemann (reworked to be generic) * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU 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. * * ============================================================ */ #ifndef KCURVE_H #define KCURVE_H // TQt includes. #include #include #include #include #include class KRITAUI_EXPORT KCurve : public TQWidget { Q_OBJECT TQ_OBJECT public: KCurve(TQWidget *tqparent = 0, const char *name = 0, WFlags f = 0); virtual ~KCurve(); void reset(void); void setCurveGuide(TQColor color); void setPixmap(TQPixmap pix); signals: void modified(void); protected: void keyPressEvent(TQKeyEvent *); void paintEvent(TQPaintEvent *); void mousePressEvent (TQMouseEvent * e); void mouseReleaseEvent ( TQMouseEvent * e ); void mouseMoveEvent ( TQMouseEvent * e ); void leaveEvent ( TQEvent * ); public: static double getCurveValue(TQPtrList > &curve, double x); double getCurveValue(double x); TQPtrList > getCurve(); void setCurve(TQPtrList >inlist); private: double m_leftmost; double m_rightmost; TQPair *m_grab_point; bool m_dragging; double m_grabOffsetX; double m_grabOffsetY; bool m_readOnlyMode; bool m_guideVisible; TQColor m_colorGuide; TQPtrList > m_points; TQPixmap *m_pix; }; #endif /* KCURVE_H */