karbon

vgradienttabwidget.h
1/* This file is part of the KDE project
2 Copyright (C) 2001, The Karbon Developers
3 Copyright (C) 2002, The Karbon Developers
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library 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 GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19*/
20
21#ifndef _VGRADIENTTABWIDGET_H_
22#define _VGRADIENTTABWIDGET_H_
23
24#include <tqwidget.h>
25#include <tqtabwidget.h>
26#include <tqlistbox.h>
27#include <koffice_export.h>
28#include "vgradient.h"
29
30class KComboBox;
31class VGradientWidget;
32class TDEListBox;
33class KIntNumInput;
34class TQPushButton;
35class TQGroupBox;
36class KarbonResourceServer;
37
38
39class VGradientListItem : public TQListBoxItem
40{
41public:
42 VGradientListItem( const VGradient& gradient, TQString filename );
43 VGradientListItem( const VGradientListItem& );
44 ~VGradientListItem();
45
46 TQPixmap& pixmap() { return m_pixmap; }
47 const VGradient* gradient() const { return m_gradient; }
48 TQString filename() { return m_filename; }
49 bool canDelete() { return m_delete; }
50
51 virtual int height( const TQListBox* ) const { return 16; }
52 virtual int width( const TQListBox* lb ) const;
53
54protected:
55 virtual void paint( TQPainter* p );
56
57private:
58 VGradient *m_gradient;
59 TQPixmap m_pixmap;
60 TQString m_filename;
61 bool m_delete;
62}; // VGradientListItem
63
64class VGradientPreview : public TQWidget
65{
66 public:
67 VGradientPreview( VGradient& gradient, double& opacity, TQWidget* parent = 0L, const char* name = 0L );
68 ~VGradientPreview();
69
70 virtual void paintEvent( TQPaintEvent* );
71
72 protected:
73 VGradient* m_gradient;
74 double* m_opacity;
75}; // VGradientPreview
76
77class KARBONBASE_EXPORT VGradientTabWidget : public TQTabWidget
78{
79 TQ_OBJECT
80
81
82 public:
83 enum VGradientTarget {
84 STROKE,
85 FILL
86 };
87
88 VGradientTabWidget( VGradient& gradient, KarbonResourceServer* server, TQWidget* parent = 0L, const char* name = 0L );
89 ~VGradientTabWidget();
90
91 const VGradient& gradient();
92 void setGradient( VGradient& gradient );
93
94 VGradientTarget target();
95 void setTarget( VGradientTarget target );
96
97 double opacity() const;
98 void setOpacity( double opacity );
99
100 public slots:
101 void combosChange( int );
102 void addGradientToPredefs();
103 void changeToPredef( TQListBoxItem* );
104 void predefSelected( TQListBoxItem* );
105 void deletePredef();
106 void opacityChanged( int );
107
108 protected:
109 void setupUI();
110 void initUI();
111 void setupConnections();
112
113 private:
114 TQGroupBox *m_editGroup;
115 VGradientWidget *m_gradientWidget;
116 KComboBox *m_gradientTarget;
117 KComboBox *m_gradientRepeat;
118 KComboBox *m_gradientType;
119 VGradientPreview *m_gradientPreview;
120 TDEListBox *m_predefGradientsView;
121 TQPushButton *m_predefDelete;
122 TQPushButton *m_predefImport;
123 TQPushButton *m_addToPredefs;
124 KIntNumInput *m_opacity;
125
126 VGradient m_gradient;
128 KarbonResourceServer* m_resourceServer;
129 double m_gradOpacity;
130}; // VGradientTabWidget
131
132#endif /* _VGRADIENTTABWIDGET_H_ */