Eneboo - Documentación para desarrolladores
src/qt/src/kernel/qmime.h
Ir a la documentación de este archivo.
00001 /****************************************************************************
00002 ** $Id: qt/qmime.h   3.3.8   edited Jan 11 14:46 $
00003 **
00004 ** Definition of mime classes
00005 **
00006 ** Created : 981204
00007 **
00008 ** Copyright (C) 1998-2007 Trolltech ASA.  All rights reserved.
00009 **
00010 ** This file is part of the kernel module of the Qt GUI Toolkit.
00011 **
00012 ** This file may be distributed under the terms of the Q Public License
00013 ** as defined by Trolltech ASA of Norway and appearing in the file
00014 ** LICENSE.QPL included in the packaging of this file.
00015 **
00016 ** This file may be distributed and/or modified under the terms of the
00017 ** GNU General Public License version 2 as published by the Free Software
00018 ** Foundation and appearing in the file LICENSE.GPL included in the
00019 ** packaging of this file.
00020 **
00021 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
00022 ** licenses may use this file in accordance with the Qt Commercial License
00023 ** Agreement provided with the Software.
00024 **
00025 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00026 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00027 **
00028 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
00029 **   information about Qt Commercial License Agreements.
00030 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
00031 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00032 **
00033 ** Contact info@trolltech.com if any conditions of this licensing are
00034 ** not clear to you.
00035 **
00036 **********************************************************************/
00037 
00038 #ifndef QMIME_H
00039 #define QMIME_H
00040 
00041 #ifndef QT_H
00042 #include "qwindowdefs.h"
00043 #include "qmap.h"
00044 #endif // QT_H
00045 
00046 #ifndef QT_NO_MIME
00047 
00048 class QImageDrag;
00049 class QTextDrag;
00050 
00051 class Q_EXPORT QMimeSource
00052 {
00053     friend class QClipboardData;
00054 
00055 public:
00056     QMimeSource();
00057     virtual ~QMimeSource();
00058     virtual const char* format( int n = 0 ) const = 0;
00059     virtual bool provides( const char* ) const;
00060     virtual QByteArray encodedData( const char* ) const = 0;
00061     int serialNumber() const;
00062 
00063 private:
00064     int ser_no;
00065     enum { NoCache, Text, Graphics } cacheType;
00066     union
00067     {
00068         struct
00069         {
00070             QString *str;
00071             QCString *subtype;
00072         } txt;
00073         struct
00074         {
00075             QImage *img;
00076             QPixmap *pix;
00077         } gfx;
00078     } cache;
00079     void clearCache();
00080 
00081     // friends for caching
00082     friend class QImageDrag;
00083     friend class QTextDrag;
00084 
00085 };
00086 
00087 inline int QMimeSource::serialNumber() const
00088 { return ser_no; }
00089 
00090 class QStringList;
00091 class QMimeSourceFactoryData;
00092 
00093 class Q_EXPORT QMimeSourceFactory {
00094 public:
00095     QMimeSourceFactory();
00096     virtual ~QMimeSourceFactory();
00097 
00098     static QMimeSourceFactory* defaultFactory();
00099     static void setDefaultFactory( QMimeSourceFactory* );
00100     static QMimeSourceFactory* takeDefaultFactory();
00101     static void addFactory( QMimeSourceFactory *f );
00102     static void removeFactory( QMimeSourceFactory *f );
00103 
00104     virtual const QMimeSource* data(const QString& abs_name) const;
00105     virtual QString makeAbsolute(const QString& abs_or_rel_name, const QString& context) const;
00106     const QMimeSource* data(const QString& abs_or_rel_name, const QString& context) const;
00107 
00108     virtual void setText( const QString& abs_name, const QString& text );
00109     virtual void setImage( const QString& abs_name, const QImage& im );
00110     virtual void setPixmap( const QString& abs_name, const QPixmap& pm );
00111     virtual void setData( const QString& abs_name, QMimeSource* data );
00112     virtual void setFilePath( const QStringList& );
00113     virtual QStringList filePath() const;
00114     void addFilePath( const QString& );
00115     virtual void setExtensionType( const QString& ext, const char* mimetype );
00116 
00117 private:
00118     QMimeSource *dataInternal(const QString& abs_name, const QMap<QString, QString> &extensions ) const;
00119     QMimeSourceFactoryData* d;
00120 };
00121 
00122 #if defined(Q_WS_WIN)
00123 
00124 #ifndef QT_H
00125 #include "qptrlist.h" // down here for GCC 2.7.* compatibility
00126 #endif // QT_H
00127 
00128 /*
00129   Encapsulation of conversion between MIME and Windows CLIPFORMAT.
00130   Not need on X11, as the underlying protocol uses the MIME standard
00131   directly.
00132 */
00133 
00134 class Q_EXPORT QWindowsMime {
00135 public:
00136     QWindowsMime();
00137     virtual ~QWindowsMime();
00138 
00139     static void initialize();
00140 
00141     static QPtrList<QWindowsMime> all();
00142     static QWindowsMime* convertor( const char* mime, int cf );
00143     static const char* cfToMime(int cf);
00144 
00145     static int registerMimeType(const char *mime);
00146 
00147     virtual const char* convertorName()=0;
00148     virtual int countCf()=0;
00149     virtual int cf(int index)=0;
00150     virtual bool canConvert( const char* mime, int cf )=0;
00151     virtual const char* mimeFor(int cf)=0;
00152     virtual int cfFor(const char* )=0;
00153     virtual QByteArray convertToMime( QByteArray data, const char* mime, int cf )=0;
00154     virtual QByteArray convertFromMime( QByteArray data, const char* mime, int cf )=0;
00155 };
00156 
00157 #endif
00158 #if defined(Q_WS_MAC)
00159 
00160 #ifndef QT_H
00161 #include "qptrlist.h" // down here for GCC 2.7.* compatibility
00162 #endif // QT_H
00163 
00164 /*
00165   Encapsulation of conversion between MIME and Mac flavor.
00166   Not need on X11, as the underlying protocol uses the MIME standard
00167   directly.
00168 */
00169 
00170 class Q_EXPORT QMacMime {
00171     char type;
00172 public:
00173     enum QMacMimeType { MIME_DND=0x01, MIME_CLIP=0x02, MIME_QT_CONVERTOR=0x04, MIME_ALL=MIME_DND|MIME_CLIP };
00174     QMacMime(char);
00175     virtual ~QMacMime();
00176 
00177     static void initialize();
00178 
00179     static QPtrList<QMacMime> all(QMacMimeType);
00180     static QMacMime* convertor(QMacMimeType, const char* mime, int flav);
00181     static const char* flavorToMime(QMacMimeType, int flav);
00182 
00183     virtual const char* convertorName()=0;
00184     virtual int countFlavors()=0;
00185     virtual int flavor(int index)=0;
00186     virtual bool canConvert(const char* mime, int flav)=0;
00187     virtual const char* mimeFor(int flav)=0;
00188     virtual int flavorFor(const char*)=0;
00189     virtual QByteArray convertToMime(QValueList<QByteArray> data, const char* mime, int flav)=0;
00190     virtual QValueList<QByteArray> convertFromMime(QByteArray data, const char* mime, int flav)=0;
00191 };
00192 
00193 #endif // Q_WS_MAC
00194 
00195 #endif // QT_NO_MIME
00196 
00197 #endif // QMIME_H
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'