compile
[kdegraphics.git] / okular / ui / annotationwidgets.h
blob183287663566cf72e25bf690acc2fb9ab13a35b2
1 /***************************************************************************
2 * Copyright (C) 2006 by Pino Toscano <pino@kde.org> *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 ***************************************************************************/
10 #ifndef _ANNOTATIONWIDGETS_H_
11 #define _ANNOTATIONWIDGETS_H_
13 #include <qwidget.h>
15 #include "core/annotations.h"
17 class QCheckBox;
18 class QComboBox;
19 class QDoubleSpinBox;
20 class QLabel;
21 class QWidget;
22 class KColorButton;
23 class KFontRequester;
24 class AnnotationWidget;
26 class PixmapPreviewSelector
27 : public QWidget
29 Q_OBJECT
31 public:
32 explicit PixmapPreviewSelector( QWidget * parent = 0 );
33 virtual ~PixmapPreviewSelector();
35 void setIcon( const QString& icon );
36 QString icon() const;
38 void addItem( const QString& item, const QString& id );
40 void setPreviewSize( int size );
41 int previewSize() const;
43 void setEditable( bool editable );
45 signals:
46 void iconChanged( const QString& );
48 private slots:
49 void iconComboChanged( const QString& icon );
51 private:
52 QString m_icon;
53 QLabel * m_iconLabel;
54 QComboBox * m_comboItems;
55 int m_previewSize;
59 /**
60 * A factory to create AnnotationWidget's.
62 class AnnotationWidgetFactory
64 public:
65 static AnnotationWidget * widgetFor( Okular::Annotation * ann );
68 class AnnotationWidget
69 : public QObject
71 Q_OBJECT
73 public:
74 virtual ~AnnotationWidget();
76 virtual Okular::Annotation::SubType annotationType() const;
78 QWidget * styleWidget();
79 QWidget * extraWidget();
81 virtual void applyChanges() = 0;
83 signals:
84 void dataChanged();
86 protected:
87 AnnotationWidget( Okular::Annotation * ann );
89 virtual QWidget * createStyleWidget() = 0;
90 virtual QWidget * createExtraWidget();
92 Okular::Annotation * m_ann;
93 QWidget * m_styleWidget;
94 QWidget * m_extraWidget;
97 class TextAnnotationWidget
98 : public AnnotationWidget
100 Q_OBJECT
102 public:
103 TextAnnotationWidget( Okular::Annotation * ann );
105 virtual void applyChanges();
107 protected:
108 virtual QWidget * createStyleWidget();
110 private:
111 Okular::TextAnnotation * m_textAnn;
112 PixmapPreviewSelector * m_pixmapSelector;
113 KFontRequester * m_fontReq;
116 class StampAnnotationWidget
117 : public AnnotationWidget
119 Q_OBJECT
121 public:
122 StampAnnotationWidget( Okular::Annotation * ann );
124 virtual void applyChanges();
126 protected:
127 virtual QWidget * createStyleWidget();
129 private:
130 Okular::StampAnnotation * m_stampAnn;
131 PixmapPreviewSelector * m_pixmapSelector;
134 class LineAnnotationWidget
135 : public AnnotationWidget
137 Q_OBJECT
139 public:
140 LineAnnotationWidget( Okular::Annotation * ann );
142 virtual void applyChanges();
144 protected:
145 virtual QWidget * createStyleWidget();
147 private:
148 Okular::LineAnnotation * m_lineAnn;
149 int m_lineType;
150 QDoubleSpinBox * m_spinLL;
151 QDoubleSpinBox * m_spinLLE;
152 QDoubleSpinBox * m_spinSize;
155 class HighlightAnnotationWidget
156 : public AnnotationWidget
158 Q_OBJECT
160 public:
161 HighlightAnnotationWidget( Okular::Annotation * ann );
163 virtual void applyChanges();
165 protected:
166 virtual QWidget * createStyleWidget();
168 private:
169 Okular::HighlightAnnotation * m_hlAnn;
170 QComboBox * m_typeCombo;
173 class GeomAnnotationWidget
174 : public AnnotationWidget
176 Q_OBJECT
178 public:
179 GeomAnnotationWidget( Okular::Annotation * ann );
181 virtual void applyChanges();
183 protected:
184 virtual QWidget * createStyleWidget();
186 private:
187 Okular::GeomAnnotation * m_geomAnn;
188 QComboBox * m_typeCombo;
189 QCheckBox * m_useColor;
190 KColorButton * m_innerColor;
191 QDoubleSpinBox * m_spinSize;
194 class FileAttachmentAnnotationWidget
195 : public AnnotationWidget
197 Q_OBJECT
199 public:
200 FileAttachmentAnnotationWidget( Okular::Annotation * ann );
202 virtual void applyChanges();
204 protected:
205 virtual QWidget * createStyleWidget();
206 virtual QWidget * createExtraWidget();
208 private:
209 Okular::FileAttachmentAnnotation * m_attachAnn;
210 PixmapPreviewSelector * m_pixmapSelector;
213 class CaretAnnotationWidget
214 : public AnnotationWidget
216 Q_OBJECT
218 public:
219 CaretAnnotationWidget( Okular::Annotation * ann );
221 virtual void applyChanges();
223 protected:
224 virtual QWidget * createStyleWidget();
226 private:
227 Okular::CaretAnnotation * m_caretAnn;
228 PixmapPreviewSelector * m_pixmapSelector;
231 #endif