1
/****************************************************************************
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
5
** This file is part of the painting module of the Qt Toolkit.
7
** This file may be distributed under the terms of the Q Public License
8
** as defined by Trolltech AS of Norway and appearing in the file
9
** LICENSE.QPL included in the packaging of this file.
11
** This file may be distributed and/or modified under the terms of the
12
** GNU General Public License version 2 as published by the Free Software
13
** Foundation and appearing in the file LICENSE.GPL included in the
14
** packaging of this file.
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
17
** information about Qt Commercial License Agreements.
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
21
** Contact info@trolltech.com if any conditions of this licensing are
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27
****************************************************************************/
29
#include "qiconengine.h"
35
\brief The QIconEngine class provides an abstract base class for QIcon renderers.
39
An icon engine provides the rendering functions for a QIcon. Each icon has a
40
corresponding icon engine that is responsible for drawing the icon with a
41
requested size, mode and state.
43
The icon is rendered by the paint() function, and the icon can additionally be
44
obtained as a pixmap with the pixmap() function (the default implementation
45
simply uses paint() to achieve this). The addPixmap() function can be used to
46
add new pixmaps to the icon engine, and is used by QIcon to add specialized
49
The paint(), pixmap(), and addPixmap() functions are all virtual, and can
50
therefore be reimplemented in subclasses of QIconEngine.
57
\fn virtual void QIconEngine::paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) = 0;
59
Uses the given \a painter to paint the icon with the required \a mode and
60
\a state into the rectangle \a rect.
63
/*! Returns the actual size of the icon the engine provides for the
64
requested \a size, \a mode and \a state. The default implementation
65
returns the given \a size.
67
QSize QIconEngine::actualSize(const QSize &size, QIcon::Mode /*mode*/, QIcon::State /*state*/)
74
Destroys the icon engine.
76
QIconEngine::~QIconEngine()
82
Returns the icon as a pixmap with the required \a size, \a mode,
83
and \a state. The default implementation creates a new pixmap and
84
calls paint() to fill it.
86
QPixmap QIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state)
91
paint(&p, QRect(QPoint(0,0),size), mode, state);
97
Called by QIcon::addPixmap(). Adds a specialized \a pixmap for the given
98
\a mode and \a state. The default pixmap-based engine stores any supplied
99
pixmaps, and it uses them instead of scaled pixmaps if the size of a pixmap
100
matches the size of icon requested. Custom icon engines that implement
101
scalable vector formats are free to ignores any extra pixmaps.
103
void QIconEngine::addPixmap(const QPixmap &/*pixmap*/, QIcon::Mode /*mode*/, QIcon::State /*state*/)
108
/*! Called by QIcon::addFile(). Adds a specialized pixmap from the
109
file with the given \a fileName, \a size, \a mode and \a state. The
110
default pixmap-based engine stores any supplied file names, and it
111
loads the pixmaps on demand instead of using scaled pixmaps if the
112
size of a pixmap matches the size of icon requested. Custom icon
113
engines that implement scalable vector formats are free to ignores
116
void QIconEngine::addFile(const QString &/*fileName*/, const QSize &/*size*/, QIcon::Mode /*mode*/, QIcon::State /*state*/)