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: 6264 $:
22 $Author: cohen@irascible.com $:
23 $Date: 2012-08-07 17:59:08 +0200 (Di, 07. Aug 2012) $
24 
25 ********************************************************************/
26 
27 
28 
29 #ifndef ITEMDRAG_H
30 #define ITEMDRAG_H
31 
32 #include <QDrag>
33 #include <QHash>
34 #include <QPixmap>
35 #include <QPointer>
36 
37 
38 class ItemDrag : public QObject {
39 
40 Q_OBJECT
41 
42 
43 protected:
44 	ItemDrag(QObject * parent = 0);
45 	void __dragIsDone();
46 
47 public:
48 	static ItemDrag * singleton();
49 	static QHash<QObject *, QObject *> & cache();
50 	static void dragIsDone();
51 	static void cleanup();
52 	static void setOriginator(QWidget *);
53 	static QWidget * originator();
54     static bool originatorIsTempBin();
55     static void setOriginatorIsTempBin(bool);
56 
57 signals:
58 	void dragIsDoneSignal(ItemDrag *);
59 
60 protected:
61 	QHash<QObject *, QObject *> m_cache;
62 	QPointer<QWidget> m_originator;
63     bool m_originatorIsTempBin;
64 
65 protected:
66 	static ItemDrag * Singleton;
67 };
68 
69 #endif
70