1 | /* This file is part of the KDE project |
2 | Copyright (C) 2004 Esben Mose Hansen <kde@mosehansen.dk> |
3 | |
4 | This program is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU General Public |
6 | License as published by the Free Software Foundation; either |
7 | version 2 of the License, or (at your option) any later version. |
8 | |
9 | This program is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | General Public License for more details. |
13 | |
14 | You should have received a copy of the GNU General Public License |
15 | along with this program; see the file COPYING. If not, write to |
16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 | Boston, MA 02110-1301, USA. |
18 | */ |
19 | |
20 | #ifndef HISTORYIMAGEITEM_H |
21 | #define HISTORYIMAGEITEM_H |
22 | |
23 | #include "historyitem.h" |
24 | |
25 | /** |
26 | * A image entry in the clipboard history. |
27 | */ |
28 | class HistoryImageItem : public HistoryItem |
29 | { |
30 | public: |
31 | HistoryImageItem( const QPixmap& data ); |
32 | virtual ~HistoryImageItem() {} |
33 | virtual QString text() const; |
34 | virtual bool operator==( const HistoryItem& rhs) const { |
35 | if ( const HistoryImageItem* casted_rhs = dynamic_cast<const HistoryImageItem*>( &rhs ) ) { |
36 | return &casted_rhs->m_data == &m_data; // Not perfect, but better than nothing. |
37 | } |
38 | return false; |
39 | } |
40 | virtual const QPixmap& image() const { return m_data; } |
41 | virtual QMimeData* mimeData() const; |
42 | |
43 | virtual void write( QDataStream& stream ) const; |
44 | |
45 | private: |
46 | /** |
47 | * |
48 | */ |
49 | const QPixmap m_data; |
50 | /** |
51 | * Cache for m_data's string representation |
52 | */ |
53 | mutable QString m_text; |
54 | }; |
55 | |
56 | |
57 | |
58 | #endif |
59 | |