chalk

kis_gradient_slider_widget.h
1/*
2 * Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
3 * 2004 Sven Langkamp <longamp@reallygood.de>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20#ifndef _KIS_WDG_GRADIENT_SLIDER_H_
21#define _KIS_WDG_GRADIENT_SLIDER_H_
22
23#include <kpixmapio.h>
24#include <tqwidget.h>
25
26class TDEPopupMenu;
27class KisAutogradientResource;
28class KisGradientSegment;
29
30class KisGradientSliderWidget : public TQWidget
31{
32 TQ_OBJECT
33
34
35public:
36 KisGradientSliderWidget(TQWidget *parent = 0, const char* name = 0, WFlags f = 0);
37
38public:
39 virtual void paintEvent ( TQPaintEvent * );
40 void setGradientResource( KisAutogradientResource* agr);
41 KisGradientSegment* selectedSegment() { return m_selectedSegment; };
42
43signals:
44 void sigSelectedSegment(KisGradientSegment*);
45 void sigChangedSegment(KisGradientSegment*);
46
47protected:
48 virtual void mousePressEvent( TQMouseEvent * e );
49 virtual void mouseReleaseEvent ( TQMouseEvent * e );
50 virtual void mouseMoveEvent( TQMouseEvent * e );
51 virtual void contextMenuEvent( TQContextMenuEvent * e );
52
53private slots:
54 void slotMenuAction(int id);
55
56private:
57
58 enum {
59 NO_DRAG,
60 LEFT_DRAG,
61 RIGHT_DRAG,
62 MIDDLE_DRAG
63 };
64
65 enum {
66 SPLIT_SEGMENT,
67 DUPLICATE_SEGMENT,
68 MIRROR_SEGMENT,
69 REMOVE_SEGMENT
70 };
71
72 KPixmapIO m_pixmapIO;
73 KisAutogradientResource* m_autogradientResource;
74 KisGradientSegment* m_currentSegment;
75 KisGradientSegment* m_selectedSegment;
76 TDEPopupMenu* m_segmentMenu;
77 int m_drag;
78};
79
80#endif