1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 #ifndef PROPERTIESPALETTE_UTILS_H
8 #define PROPERTIESPALETTE_UTILS_H
9 
10 #include <QListWidgetItem>
11 #include <QLineEdit>
12 
13 class QCloseEvent;
14 class QComboBox;
15 class QEvent;
16 class QEvent;
17 class QFocusEvent;
18 class QFrame;
19 class QGridLayout;
20 class QGroupBox;
21 class QHBoxLayout;
22 class QLabel;
23 class QMenu;
24 class QPushButton;
25 class QRadioButton;
26 class QSpinBox;
27 class QStackedWidget;
28 class QToolBox;
29 class QVBoxLayout;
30 class QWidget;
31 
32 
33 #include "scribusapi.h"
34 #include "scrspinbox.h"
35 #include "pageitem.h"
36 #include "linkbutton.h"
37 #include "linecombo.h"
38 #include "sclistboxpixmap.h"
39 #include "scpage.h"
40 #include "sctreewidget.h"
41 
42 class ScribusDoc;
43 class ScribusMainWindow;
44 
45 struct SCRIBUS_API LineStyleValue
46 {
47 	multiLine m_Line;
48 	ScGuardedPtr<ScribusDoc> m_doc;
49 	QString m_name;
50 
51 	LineStyleValue();
52 	LineStyleValue(const multiLine& line, ScribusDoc* doc, const QString& name);
53 	LineStyleValue(const LineStyleValue& other);
54 	LineStyleValue& operator= (const LineStyleValue& other);
55 };
56 
57 
58 Q_DECLARE_METATYPE(LineStyleValue);
59 
60 
61 class SCRIBUS_API LineStyleItem : public QListWidgetItem
62 {
63 	enum usrType {
64 		LineStyleUserType = UserType + 2
65 	};
66 
67 public:
LineStyleItem(ScribusDoc * doc,const multiLine & line,const QString & name)68 	LineStyleItem( ScribusDoc* doc, const multiLine& line, const QString& name ) : QListWidgetItem(NULL, LineStyleUserType)
69 	{
70 		setText(name);
71 		setData(Qt::UserRole, QVariant::fromValue(LineStyleValue(line, doc, name)));
72 	};
LineStyleItem()73 	LineStyleItem( ) : QListWidgetItem(NULL, LineStyleUserType)
74 	{
75 		setText("");
76 		setData(Qt::UserRole, QVariant::fromValue(LineStyleValue()));
77 	};
clone()78 	LineStyleItem * clone () const { return new LineStyleItem(*this); }
79 };
80 
81 
82 
83 class SCRIBUS_API LineStyleItemDelegate : public ScListBoxPixmap<37, 37>
84 {
85 	Q_OBJECT
86 	public:
LineStyleItemDelegate()87 		LineStyleItemDelegate() : ScListBoxPixmap<37, 37>() {}
88 
89 		QString text(const QVariant&) const override;
90 		void redraw(const QVariant&) const override;
91 };
92 
93 class SCRIBUS_API NameWidget : public QLineEdit
94 {
95 	Q_OBJECT
96 
97 public:
98 	NameWidget(QWidget* parent);
~NameWidget()99 	~NameWidget() {}
100 
101 signals:
102 	void Leaved();
103 
104 protected:
105 	virtual void focusOutEvent(QFocusEvent *);
106 };
107 
108 class SCRIBUS_API UserActionSniffer : public QObject
109 {
110 	Q_OBJECT
111 
112 public:
113 	UserActionSniffer( QObject* parent );
114 protected:
115 	bool eventFilter( QObject *o, QEvent *e );
116 signals:
117 	void actionStart();
118 	void actionEnd();
119 };
120 
121 #endif
122