1 /*******************************************************************
2 
3 Part of the Fritzing project - http://fritzing.org
4 Copyright (c) 2007-2014 Fachhochschule Potsdam - http://fh-potsdam.de
5 
6 Fritzing is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10 
11 Fritzing is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with Fritzing.  If not, see <http://www.gnu.org/licenses/>.
18 
19 ********************************************************************
20 
21 $Revision: 6141 $:
22 $Author: cohen@irascible.com $:
23 $Date: 2012-07-04 21:20:05 +0200 (Mi, 04. Jul 2012) $
24 
25 ********************************************************************/
26 
27 #ifndef CURSORMASTER_H
28 #define CURSORMASTER_H
29 
30 #include <QCursor>
31 #include <QObject>
32 
33 class CursorKeyListener
34 {
35 	public:
36 		virtual void cursorKeyEvent(Qt::KeyboardModifiers) = 0;
37 };
38 
39 class CursorMaster : public QObject {
40 Q_OBJECT
41 
42 protected:
43 	CursorMaster();
44 
45 public:
46 	static CursorMaster * instance();
47 	static void initCursors();
48 
49 	void addCursor(QObject * listener, const QCursor & cursor);
50 	void removeCursor(QObject * listener);
51     void block();
52     void unblock();
53 
54 protected:
55     bool eventFilter(QObject *obj, QEvent *event);
56 
57 protected slots:
58 	void deleteCursor(QObject *);
59 	void moveCursor();
60 
61 public:
62     static void cleanup();
63 
64 public:
65 	static QCursor * BendpointCursor;
66 	static QCursor * NewBendpointCursor;
67 	static QCursor * MakeWireCursor;
68 	static QCursor * MakeCurveCursor;
69 	static QCursor * RubberbandCursor;
70 	static QCursor * MoveCursor;
71 	static QCursor * BendlegCursor;
72 	static QCursor * RotateCursor;
73 	static QCursor * ScaleCursor;
74 
75 protected:
76 	static CursorMaster TheCursorMaster;
77     bool m_blocked;
78 };
79 
80 #endif
81