1/* This file is part of the KDE libraries
2 Copyright (C) 2006 Hamish Rodda <rodda@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
7
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
12
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
17*/
18
19#ifndef KICON_H
20#define KICON_H
21
22#include <kdeui_export.h>
23
24#include <QtGui/QIcon>
25
26class KIconLoader;
27class QStringList;
28
29/**
30 * \short A wrapper around QIcon that provides KDE icon features
31 *
32 * KIcon is a convenience class for creating a QIcon with an appropriate
33 * KIconEngine to perform loading and rendering. KIcons thus adhere to
34 * KDE style and effect standards.
35 *
36 * \sa KIconEngine, KIconLoader, KIconTheme
37 *
38 * \author Hamish Rodda <rodda@kde.org>
39 */
40class KDEUI_EXPORT KIcon : public QIcon
41{
42public:
43 /**
44 * Constructor which takes a kde style icon name, and optionally
45 * a custom icon loader.
46 *
47 * \param iconName The name of the kde icon to load
48 * \param iconLoader The icon loader to use in loading this icon, or
49 * null to use the default global icon loader.
50 * @param overlays A list of overlays to apply to this icon. They are
51 * loaded from the emblems icons and up to four (one per
52 * corner) is currently supported
53 */
54 explicit KIcon(const QString& iconName, KIconLoader* iconLoader,
55 const QStringList& overlays);
56
57 /**
58 * \overload
59 */
60 explicit KIcon(const QString& iconName, KIconLoader* iconLoader);
61
62 /**
63 * \overload
64 */
65 explicit KIcon(const QString& iconName);
66
67 /**
68 * Copy constructor which takes any QIcon.
69 *
70 * \param copy the icon to copy. This should have once been a KIcon,
71 * if you want to preserve KDE icon effects.
72 */
73 explicit KIcon(const QIcon& copy);
74
75 /**
76 * Constructor for a null icon.
77 */
78 KIcon();
79
80 /**
81 * Destroys the icon.
82 */
83 ~KIcon();
84
85 KIcon& operator=( const KIcon &other );
86
87private:
88 class Private;
89 Private* const d;
90};
91
92#endif
93