author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 14 May 2010 16:40:13 +0300 | |
changeset 22 | 79de32ba3296 |
parent 18 | 2f34d5167611 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the QtGui module of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#ifndef QMIME_H |
|
43 |
#define QMIME_H |
|
44 |
||
45 |
#include <QtCore/qmimedata.h> |
|
46 |
||
47 |
QT_BEGIN_HEADER |
|
48 |
||
49 |
QT_BEGIN_NAMESPACE |
|
50 |
||
51 |
QT_MODULE(Gui) |
|
52 |
||
53 |
class Q_GUI_EXPORT QMimeSource |
|
54 |
{ |
|
55 |
public: |
|
56 |
virtual ~QMimeSource(); |
|
57 |
virtual const char* format(int n = 0) const = 0; |
|
58 |
virtual bool provides(const char*) const; |
|
59 |
virtual QByteArray encodedData(const char*) const = 0; |
|
60 |
}; |
|
61 |
||
62 |
||
63 |
#if defined(Q_WS_WIN) |
|
64 |
||
65 |
QT_BEGIN_INCLUDE_NAMESPACE |
|
66 |
typedef struct tagFORMATETC FORMATETC; |
|
67 |
typedef struct tagSTGMEDIUM STGMEDIUM; |
|
68 |
struct IDataObject; |
|
69 |
||
70 |
#include <QtCore/qvariant.h> |
|
71 |
QT_END_INCLUDE_NAMESPACE |
|
72 |
||
73 |
/* |
|
74 |
Encapsulation of conversion between MIME and Windows CLIPFORMAT. |
|
75 |
Not need on X11, as the underlying protocol uses the MIME standard |
|
76 |
directly. |
|
77 |
*/ |
|
78 |
||
79 |
class Q_GUI_EXPORT QWindowsMime |
|
80 |
{ |
|
81 |
public: |
|
82 |
QWindowsMime(); |
|
83 |
virtual ~QWindowsMime(); |
|
84 |
||
85 |
// for converting from Qt |
|
86 |
virtual bool canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const = 0; |
|
87 |
virtual bool convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM * pmedium) const = 0; |
|
88 |
virtual QVector<FORMATETC> formatsForMime(const QString &mimeType, const QMimeData *mimeData) const = 0; |
|
89 |
||
90 |
// for converting to Qt |
|
91 |
virtual bool canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const = 0; |
|
92 |
virtual QVariant convertToMime(const QString &mimeType, IDataObject *pDataObj, QVariant::Type preferredType) const = 0; |
|
93 |
virtual QString mimeForFormat(const FORMATETC &formatetc) const = 0; |
|
94 |
||
95 |
static int registerMimeType(const QString &mime); |
|
96 |
||
97 |
private: |
|
98 |
friend class QClipboardWatcher; |
|
99 |
friend class QDragManager; |
|
100 |
friend class QDropData; |
|
101 |
friend class QOleDataObject; |
|
102 |
||
103 |
static QWindowsMime *converterToMime(const QString &mimeType, IDataObject *pDataObj); |
|
104 |
static QStringList allMimesForFormats(IDataObject *pDataObj); |
|
105 |
static QWindowsMime *converterFromMime(const FORMATETC &formatetc, const QMimeData *mimeData); |
|
106 |
static QVector<FORMATETC> allFormatsForMime(const QMimeData *mimeData); |
|
107 |
}; |
|
108 |
||
109 |
#endif |
|
110 |
#if defined(Q_WS_MAC) |
|
111 |
||
112 |
/* |
|
113 |
Encapsulation of conversion between MIME and Mac flavor. |
|
114 |
Not needed on X11, as the underlying protocol uses the MIME standard |
|
115 |
directly. |
|
116 |
*/ |
|
117 |
||
118 |
class Q_GUI_EXPORT QMacMime { //Obsolete |
|
119 |
char type; |
|
120 |
public: |
|
121 |
enum QMacMimeType { MIME_DND=0x01, MIME_CLIP=0x02, MIME_QT_CONVERTOR=0x04, MIME_ALL=MIME_DND|MIME_CLIP }; |
|
122 |
explicit QMacMime(char) { } |
|
123 |
virtual ~QMacMime() { } |
|
124 |
||
125 |
static void initialize() { } |
|
126 |
||
127 |
static QList<QMacMime*> all(QMacMimeType) { return QList<QMacMime*>(); } |
|
128 |
static QMacMime *convertor(QMacMimeType, const QString &, int) { return 0; } |
|
129 |
static QString flavorToMime(QMacMimeType, int) { return QString(); } |
|
130 |
||
131 |
virtual QString convertorName()=0; |
|
132 |
virtual int countFlavors()=0; |
|
133 |
virtual int flavor(int index)=0; |
|
134 |
virtual bool canConvert(const QString &mime, int flav)=0; |
|
135 |
virtual QString mimeFor(int flav)=0; |
|
136 |
virtual int flavorFor(const QString &mime)=0; |
|
137 |
virtual QVariant convertToMime(const QString &mime, QList<QByteArray> data, int flav)=0; |
|
138 |
virtual QList<QByteArray> convertFromMime(const QString &mime, QVariant data, int flav)=0; |
|
139 |
}; |
|
140 |
||
141 |
class Q_GUI_EXPORT QMacPasteboardMime { |
|
142 |
char type; |
|
143 |
public: |
|
144 |
enum QMacPasteboardMimeType { MIME_DND=0x01, |
|
145 |
MIME_CLIP=0x02, |
|
146 |
MIME_QT_CONVERTOR=0x04, |
|
147 |
MIME_QT3_CONVERTOR=0x08, |
|
148 |
MIME_ALL=MIME_DND|MIME_CLIP |
|
149 |
}; |
|
150 |
explicit QMacPasteboardMime(char); |
|
151 |
virtual ~QMacPasteboardMime(); |
|
152 |
||
153 |
static void initialize(); |
|
154 |
||
155 |
static QList<QMacPasteboardMime*> all(uchar); |
|
156 |
static QMacPasteboardMime *convertor(uchar, const QString &mime, QString flav); |
|
157 |
static QString flavorToMime(uchar, QString flav); |
|
158 |
||
159 |
virtual QString convertorName() = 0; |
|
160 |
||
161 |
virtual bool canConvert(const QString &mime, QString flav) = 0; |
|
162 |
virtual QString mimeFor(QString flav) = 0; |
|
163 |
virtual QString flavorFor(const QString &mime) = 0; |
|
164 |
virtual QVariant convertToMime(const QString &mime, QList<QByteArray> data, QString flav) = 0; |
|
165 |
virtual QList<QByteArray> convertFromMime(const QString &mime, QVariant data, QString flav) = 0; |
|
166 |
}; |
|
167 |
||
168 |
// ### Qt 5: Add const QStringList& QMacPasteboardMime::supportedFlavours() |
|
169 |
Q_GUI_EXPORT void qRegisterDraggedTypes(const QStringList &types); |
|
170 |
#endif // Q_WS_MAC |
|
171 |
||
172 |
QT_END_NAMESPACE |
|
173 |
||
174 |
QT_END_HEADER |
|
175 |
||
176 |
#endif // QMIME_H |