krita

kis_gradient_slider_widget.h

00001 /*
00002  *  Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
00003  *                2004 Sven Langkamp <longamp@reallygood.de>
00004  *
00005  *  This program is free software; you can redistribute it and/or modify
00006  *  it under the terms of the GNU General Public License as published by
00007  *  the Free Software Foundation; either version 2 of the License, or
00008  *  (at your option) any later version.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00018  */
00019 
00020 #ifndef _KIS_WDG_GRADIENT_SLIDER_H_
00021 #define _KIS_WDG_GRADIENT_SLIDER_H_
00022 
00023 #include <kpixmapio.h>
00024 #include <qwidget.h>
00025 
00026 class KPopupMenu;
00027 class KisAutogradientResource;
00028 class KisGradientSegment;
00029 
00030 class KisGradientSliderWidget : public QWidget
00031 {
00032     Q_OBJECT
00033 
00034 public:
00035     KisGradientSliderWidget(QWidget *parent = 0, const char* name = 0, WFlags f = 0);
00036 
00037 public:
00038     virtual void paintEvent ( QPaintEvent * );
00039     void setGradientResource( KisAutogradientResource* agr);
00040     KisGradientSegment* selectedSegment() { return m_selectedSegment; };
00041 
00042 signals:
00043     void sigSelectedSegment(KisGradientSegment*);
00044     void sigChangedSegment(KisGradientSegment*);
00045 
00046 protected:
00047     virtual void mousePressEvent( QMouseEvent * e );
00048     virtual void mouseReleaseEvent ( QMouseEvent * e );
00049     virtual void mouseMoveEvent( QMouseEvent * e );
00050     virtual void contextMenuEvent( QContextMenuEvent * e );
00051 
00052 private slots:
00053     void slotMenuAction(int id);
00054 
00055 private:
00056 
00057     enum {
00058         NO_DRAG,
00059         LEFT_DRAG,
00060         RIGHT_DRAG,
00061         MIDDLE_DRAG
00062     };
00063 
00064     enum {
00065         SPLIT_SEGMENT,
00066         DUPLICATE_SEGMENT,
00067         MIRROR_SEGMENT,
00068         REMOVE_SEGMENT
00069     };
00070 
00071     KPixmapIO m_pixmapIO;
00072     KisAutogradientResource* m_autogradientResource;
00073     KisGradientSegment* m_currentSegment;
00074     KisGradientSegment* m_selectedSegment;
00075     KPopupMenu* m_segmentMenu;
00076     int m_drag;
00077 };
00078 
00079 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys