karbon
vgradienttabwidget.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _VGRADIENTTABWIDGET_H_
00022 #define _VGRADIENTTABWIDGET_H_
00023
00024 #include <qwidget.h>
00025 #include <qtabwidget.h>
00026 #include <qlistbox.h>
00027 #include <koffice_export.h>
00028 #include "vgradient.h"
00029
00030 class KComboBox;
00031 class VGradientWidget;
00032 class KListBox;
00033 class KIntNumInput;
00034 class QPushButton;
00035 class QGroupBox;
00036 class KarbonResourceServer;
00037
00038
00039 class VGradientListItem : public QListBoxItem
00040 {
00041 public:
00042 VGradientListItem( const VGradient& gradient, QString filename );
00043 VGradientListItem( const VGradientListItem& );
00044 ~VGradientListItem();
00045
00046 QPixmap& pixmap() { return m_pixmap; }
00047 const VGradient* gradient() const { return m_gradient; }
00048 QString filename() { return m_filename; }
00049 bool canDelete() { return m_delete; }
00050
00051 virtual int height( const QListBox* ) const { return 16; }
00052 virtual int width( const QListBox* lb ) const;
00053
00054 protected:
00055 virtual void paint( QPainter* p );
00056
00057 private:
00058 VGradient *m_gradient;
00059 QPixmap m_pixmap;
00060 QString m_filename;
00061 bool m_delete;
00062 };
00063
00064 class VGradientPreview : public QWidget
00065 {
00066 public:
00067 VGradientPreview( VGradient& gradient, double& opacity, QWidget* parent = 0L, const char* name = 0L );
00068 ~VGradientPreview();
00069
00070 virtual void paintEvent( QPaintEvent* );
00071
00072 protected:
00073 VGradient* m_gradient;
00074 double* m_opacity;
00075 };
00076
00077 class KARBONBASE_EXPORT VGradientTabWidget : public QTabWidget
00078 {
00079 Q_OBJECT
00080
00081 public:
00082 enum VGradientTarget {
00083 STROKE,
00084 FILL
00085 };
00086
00087 VGradientTabWidget( VGradient& gradient, KarbonResourceServer* server, QWidget* parent = 0L, const char* name = 0L );
00088 ~VGradientTabWidget();
00089
00090 const VGradient& gradient();
00091 void setGradient( VGradient& gradient );
00092
00093 VGradientTarget target();
00094 void setTarget( VGradientTarget target );
00095
00096 double opacity() const;
00097 void setOpacity( double opacity );
00098
00099 public slots:
00100 void combosChange( int );
00101 void addGradientToPredefs();
00102 void changeToPredef( QListBoxItem* );
00103 void predefSelected( QListBoxItem* );
00104 void deletePredef();
00105 void opacityChanged( int );
00106
00107 protected:
00108 void setupUI();
00109 void initUI();
00110 void setupConnections();
00111
00112 private:
00113 QGroupBox *m_editGroup;
00114 VGradientWidget *m_gradientWidget;
00115 KComboBox *m_gradientTarget;
00116 KComboBox *m_gradientRepeat;
00117 KComboBox *m_gradientType;
00118 VGradientPreview *m_gradientPreview;
00119 KListBox *m_predefGradientsView;
00120 QPushButton *m_predefDelete;
00121 QPushButton *m_predefImport;
00122 QPushButton *m_addToPredefs;
00123 KIntNumInput *m_opacity;
00124
00125 VGradient m_gradient;
00127 KarbonResourceServer* m_resourceServer;
00128 double m_gradOpacity;
00129 };
00130
00131 #endif
|