| 1 | /**************************************************************************** | 
|---|
| 2 | ** $Id: qclipboard.h 2 2005-11-16 15:49:26Z dmik $ | 
|---|
| 3 | ** | 
|---|
| 4 | ** Definition of QClipboard class | 
|---|
| 5 | ** | 
|---|
| 6 | ** Created : 960430 | 
|---|
| 7 | ** | 
|---|
| 8 | ** Copyright (C) 1992-2002 Trolltech AS.  All rights reserved. | 
|---|
| 9 | ** | 
|---|
| 10 | ** This file is part of the kernel module of the Qt GUI Toolkit. | 
|---|
| 11 | ** | 
|---|
| 12 | ** This file may be distributed under the terms of the Q Public License | 
|---|
| 13 | ** as defined by Trolltech AS of Norway and appearing in the file | 
|---|
| 14 | ** LICENSE.QPL included in the packaging of this file. | 
|---|
| 15 | ** | 
|---|
| 16 | ** This file may be distributed and/or modified under the terms of the | 
|---|
| 17 | ** GNU General Public License version 2 as published by the Free Software | 
|---|
| 18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 
|---|
| 19 | ** packaging of this file. | 
|---|
| 20 | ** | 
|---|
| 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 
|---|
| 22 | ** licenses may use this file in accordance with the Qt Commercial License | 
|---|
| 23 | ** Agreement provided with the Software. | 
|---|
| 24 | ** | 
|---|
| 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 
|---|
| 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 
|---|
| 27 | ** | 
|---|
| 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 
|---|
| 29 | **   information about Qt Commercial License Agreements. | 
|---|
| 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 
|---|
| 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 
|---|
| 32 | ** | 
|---|
| 33 | ** Contact info@trolltech.com if any conditions of this licensing are | 
|---|
| 34 | ** not clear to you. | 
|---|
| 35 | ** | 
|---|
| 36 | **********************************************************************/ | 
|---|
| 37 |  | 
|---|
| 38 | #ifndef QCLIPBOARD_H | 
|---|
| 39 | #define QCLIPBOARD_H | 
|---|
| 40 |  | 
|---|
| 41 | #ifndef QT_H | 
|---|
| 42 | #include "qwindowdefs.h" | 
|---|
| 43 | #include "qobject.h" | 
|---|
| 44 | #endif // QT_H | 
|---|
| 45 |  | 
|---|
| 46 | #ifndef QT_NO_CLIPBOARD | 
|---|
| 47 |  | 
|---|
| 48 | class QMimeSource; | 
|---|
| 49 |  | 
|---|
| 50 | class Q_EXPORT QClipboard : public QObject | 
|---|
| 51 | { | 
|---|
| 52 | Q_OBJECT | 
|---|
| 53 | private: | 
|---|
| 54 | QClipboard( QObject *parent=0, const char *name=0 ); | 
|---|
| 55 | ~QClipboard(); | 
|---|
| 56 |  | 
|---|
| 57 | public: | 
|---|
| 58 | enum Mode { Clipboard, Selection }; | 
|---|
| 59 |  | 
|---|
| 60 | void        clear( Mode mode );             // ### default arg = Clipboard in 4.0 | 
|---|
| 61 | void        clear();                        // ### remove 4.0 | 
|---|
| 62 |  | 
|---|
| 63 | bool        supportsSelection() const; | 
|---|
| 64 | bool        ownsSelection() const; | 
|---|
| 65 | bool        ownsClipboard() const; | 
|---|
| 66 |  | 
|---|
| 67 | void        setSelectionMode(bool enable);          // ### remove 4.0 | 
|---|
| 68 | bool        selectionModeEnabled() const;           // ### remove 4.0 | 
|---|
| 69 |  | 
|---|
| 70 | // ### default arg mode = Clipboard in 4.0 for all of these | 
|---|
| 71 | QString     text( Mode mode )        const; | 
|---|
| 72 | QString     text( QCString& subtype, Mode mode ) const; | 
|---|
| 73 | void        setText( const QString &, Mode mode ); | 
|---|
| 74 |  | 
|---|
| 75 | #ifndef QT_NO_MIMECLIPBOARD | 
|---|
| 76 | QMimeSource *data( Mode mode ) const; | 
|---|
| 77 | void setData( QMimeSource*, Mode mode ); | 
|---|
| 78 |  | 
|---|
| 79 | QImage      image( Mode mode ) const; | 
|---|
| 80 | QPixmap     pixmap( Mode mode ) const; | 
|---|
| 81 | void        setImage( const QImage &, Mode mode ); | 
|---|
| 82 | void        setPixmap( const QPixmap &, Mode mode ); | 
|---|
| 83 | #endif | 
|---|
| 84 |  | 
|---|
| 85 | // ### remove all of these in 4.0 | 
|---|
| 86 | QString     text()   const; | 
|---|
| 87 | QString     text(QCString& subtype) const; | 
|---|
| 88 | void        setText( const QString &); | 
|---|
| 89 |  | 
|---|
| 90 | #ifndef QT_NO_MIMECLIPBOARD | 
|---|
| 91 | QMimeSource *data() const; | 
|---|
| 92 | void        setData( QMimeSource* ); | 
|---|
| 93 |  | 
|---|
| 94 | QImage      image() const; | 
|---|
| 95 | QPixmap     pixmap() const; | 
|---|
| 96 | void        setImage( const QImage & ); | 
|---|
| 97 | void        setPixmap( const QPixmap & ); | 
|---|
| 98 | #endif | 
|---|
| 99 |  | 
|---|
| 100 | signals: | 
|---|
| 101 | void        selectionChanged(); | 
|---|
| 102 | void        dataChanged(); | 
|---|
| 103 |  | 
|---|
| 104 | private slots: | 
|---|
| 105 | void        ownerDestroyed(); | 
|---|
| 106 |  | 
|---|
| 107 | protected: | 
|---|
| 108 | void        connectNotify( const char * ); | 
|---|
| 109 | bool        event( QEvent * ); | 
|---|
| 110 |  | 
|---|
| 111 | friend class QApplication; | 
|---|
| 112 | friend class QBaseApplication; | 
|---|
| 113 | friend class QDragManager; | 
|---|
| 114 | friend class QMimeSource; | 
|---|
| 115 |  | 
|---|
| 116 | private: | 
|---|
| 117 | #if defined(Q_WS_MAC) | 
|---|
| 118 | void loadScrap(bool convert); | 
|---|
| 119 | void saveScrap(); | 
|---|
| 120 | #endif | 
|---|
| 121 |  | 
|---|
| 122 | // Disabled copy constructor and operator= | 
|---|
| 123 | #if defined(Q_DISABLE_COPY) | 
|---|
| 124 | QClipboard( const QClipboard & ); | 
|---|
| 125 | QClipboard &operator=( const QClipboard & ); | 
|---|
| 126 | #endif | 
|---|
| 127 | }; | 
|---|
| 128 |  | 
|---|
| 129 | #endif // QT_NO_CLIPBOARD | 
|---|
| 130 |  | 
|---|
| 131 | #endif // QCLIPBOARD_H | 
|---|