1 | /* This file is part of the KDE libraries |
2 | |
3 | Copyright (c) 2000 Carsten Pfeiffer <pfeiffer@kde.org> |
4 | |
5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public |
7 | License (LGPL) as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. |
9 | |
10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. |
14 | |
15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | Boston, MA 02110-1301, USA. |
19 | */ |
20 | |
21 | #ifndef KURLPIXMAPPROVIDER_H |
22 | #define KURLPIXMAPPROVIDER_H |
23 | |
24 | #include <kio/kio_export.h> |
25 | #include <kpixmapprovider.h> |
26 | |
27 | /** |
28 | * Implementation of KPixmapProvider. |
29 | * |
30 | * Uses KMimeType::pixmapForURL() to resolve icons. |
31 | * |
32 | * Instatiate this class and supply it to the desired class, e.g. |
33 | * \code |
34 | * KHistoryCombo *combo = new KHistoryCombo( this ); |
35 | * combo->setPixmapProvider( new KUrlPixmapProvider ); |
36 | * [...] |
37 | * \endcode |
38 | * |
39 | * @short Resolves pixmaps for URLs |
40 | * @author Carsten Pfeiffer <pfeiffer@kde.org> |
41 | */ |
42 | class KIO_EXPORT KUrlPixmapProvider : public KPixmapProvider |
43 | { |
44 | public: |
45 | /** |
46 | * Creates a new url pixmap provider. |
47 | */ |
48 | KUrlPixmapProvider(); |
49 | |
50 | /** |
51 | * Destroys the url pixmap provider. |
52 | */ |
53 | ~KUrlPixmapProvider(); |
54 | |
55 | /** |
56 | * Returns a pixmap for @p url with size @p size. |
57 | * Uses KMimeType::pixmapForURL(). |
58 | * @param url the URL to fetch a pixmap for |
59 | * @param size the size of the pixmap in pixels, or 0 for default. |
60 | * @return the resulting pixmap |
61 | * @see KIconLoader::StdSizes |
62 | */ |
63 | virtual QPixmap pixmapFor( const QString& url, int size = 0 ); |
64 | protected: |
65 | virtual void virtual_hook( int id, void* data ); |
66 | |
67 | private: |
68 | class Private; |
69 | Private* const d; |
70 | }; |
71 | |
72 | #endif // KURLPIXMAPPROVIDER_H |
73 | |