1 /***************************************************************************
2 * Copyright (C) 2006 by Pino Toscano <pino@kde.org> *
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_
15 #include "core/annotations.h"
24 class AnnotationWidget
;
26 class PixmapPreviewSelector
32 explicit PixmapPreviewSelector( QWidget
* parent
= 0 );
33 virtual ~PixmapPreviewSelector();
35 void setIcon( const QString
& icon
);
38 void addItem( const QString
& item
, const QString
& id
);
40 void setPreviewSize( int size
);
41 int previewSize() const;
43 void setEditable( bool editable
);
46 void iconChanged( const QString
& );
49 void iconComboChanged( const QString
& icon
);
54 QComboBox
* m_comboItems
;
60 * A factory to create AnnotationWidget's.
62 class AnnotationWidgetFactory
65 static AnnotationWidget
* widgetFor( Okular::Annotation
* ann
);
68 class AnnotationWidget
74 virtual ~AnnotationWidget();
76 virtual Okular::Annotation::SubType
annotationType() const;
78 QWidget
* styleWidget();
79 QWidget
* extraWidget();
81 virtual void applyChanges() = 0;
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
103 TextAnnotationWidget( Okular::Annotation
* ann
);
105 virtual void applyChanges();
108 virtual QWidget
* createStyleWidget();
111 Okular::TextAnnotation
* m_textAnn
;
112 PixmapPreviewSelector
* m_pixmapSelector
;
113 KFontRequester
* m_fontReq
;
116 class StampAnnotationWidget
117 : public AnnotationWidget
122 StampAnnotationWidget( Okular::Annotation
* ann
);
124 virtual void applyChanges();
127 virtual QWidget
* createStyleWidget();
130 Okular::StampAnnotation
* m_stampAnn
;
131 PixmapPreviewSelector
* m_pixmapSelector
;
134 class LineAnnotationWidget
135 : public AnnotationWidget
140 LineAnnotationWidget( Okular::Annotation
* ann
);
142 virtual void applyChanges();
145 virtual QWidget
* createStyleWidget();
148 Okular::LineAnnotation
* m_lineAnn
;
150 QDoubleSpinBox
* m_spinLL
;
151 QDoubleSpinBox
* m_spinLLE
;
152 QDoubleSpinBox
* m_spinSize
;
155 class HighlightAnnotationWidget
156 : public AnnotationWidget
161 HighlightAnnotationWidget( Okular::Annotation
* ann
);
163 virtual void applyChanges();
166 virtual QWidget
* createStyleWidget();
169 Okular::HighlightAnnotation
* m_hlAnn
;
170 QComboBox
* m_typeCombo
;
173 class GeomAnnotationWidget
174 : public AnnotationWidget
179 GeomAnnotationWidget( Okular::Annotation
* ann
);
181 virtual void applyChanges();
184 virtual QWidget
* createStyleWidget();
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
200 FileAttachmentAnnotationWidget( Okular::Annotation
* ann
);
202 virtual void applyChanges();
205 virtual QWidget
* createStyleWidget();
206 virtual QWidget
* createExtraWidget();
209 Okular::FileAttachmentAnnotation
* m_attachAnn
;
210 PixmapPreviewSelector
* m_pixmapSelector
;
213 class CaretAnnotationWidget
214 : public AnnotationWidget
219 CaretAnnotationWidget( Okular::Annotation
* ann
);
221 virtual void applyChanges();
224 virtual QWidget
* createStyleWidget();
227 Okular::CaretAnnotation
* m_caretAnn
;
228 PixmapPreviewSelector
* m_pixmapSelector
;