com.trolltech.qt.gui
Class QIconEngine

java.lang.Object
  extended by com.trolltech.qt.QSignalEmitter
      extended by com.trolltech.qt.QtJambiObject
          extended by com.trolltech.qt.gui.QIconEngine
All Implemented Interfaces:
QtJambiInterface
Direct Known Subclasses:
QIconEngineV2

public abstract class QIconEngine
extends QtJambiObject

The QIconEngine class provides an abstract base class for QIcon renderers.

Use QIconEngineV2 instead.

An icon engine provides the rendering functions for a QIcon. Each icon has a corresponding icon engine that is responsible for drawing the icon with a requested size, mode and state.

The icon is rendered by the paint function, and the icon can additionally be obtained as a pixmap with the pixmap function (the default implementation simply uses paint to achieve this). The addPixmap function can be used to add new pixmaps to the icon engine, and is used by QIcon to add specialized custom pixmaps.

The paint, pixmap, and addPixmap functions are all virtual, and can therefore be reimplemented in subclasses of QIconEngine.

See Also:
QIconEngineV2, QIconEnginePlugin

Nested Class Summary
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I>
 
Method Summary
 QSize actualSize(QSize size, QIcon.Mode mode, QIcon.State state)
          Returns the actual size of the icon the engine provides for the requested size, mode and state.
 void addFile(java.lang.String fileName, QSize size, QIcon.Mode mode, QIcon.State state)
          Called by QIcon::addFile().
 void addPixmap(QPixmap pixmap, QIcon.Mode mode, QIcon.State state)
          Called by QIcon::addPixmap().
static QIconEngine fromNativePointer(QNativePointer nativePointer)
          This function returns the QIconEngine instance pointed to by nativePointer
abstract  void paint(QPainter painter, QRect rect, QIcon.Mode mode, QIcon.State state)
          Uses the given painter to paint the icon with the required mode and state into the rectangle rect.
 QPixmap pixmap(QSize size, QIcon.Mode mode, QIcon.State state)
          Returns the icon as a pixmap with the required size, mode, and state.
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Method Detail

actualSize

public QSize actualSize(QSize size,
                        QIcon.Mode mode,
                        QIcon.State state)

Returns the actual size of the icon the engine provides for the requested size, mode and state. The default implementation returns the given size.


addFile

public void addFile(java.lang.String fileName,
                    QSize size,
                    QIcon.Mode mode,
                    QIcon.State state)

Called by QIcon::addFile(). Adds a specialized pixmap from the file with the given fileName, size, mode and state. The default pixmap-based engine stores any supplied file names, and it loads the pixmaps on demand instead of using scaled pixmaps if the size of a pixmap matches the size of icon requested. Custom icon engines that implement scalable vector formats are free to ignores any extra files.


addPixmap

public void addPixmap(QPixmap pixmap,
                      QIcon.Mode mode,
                      QIcon.State state)

Called by QIcon::addPixmap(). Adds a specialized pixmap for the given mode and state. The default pixmap-based engine stores any supplied pixmaps, and it uses them instead of scaled pixmaps if the size of a pixmap matches the size of icon requested. Custom icon engines that implement scalable vector formats are free to ignores any extra pixmaps.


paint

public abstract void paint(QPainter painter,
                           QRect rect,
                           QIcon.Mode mode,
                           QIcon.State state)

Uses the given painter to paint the icon with the required mode and state into the rectangle rect.


pixmap

public QPixmap pixmap(QSize size,
                      QIcon.Mode mode,
                      QIcon.State state)

Returns the icon as a pixmap with the required size, mode, and state. The default implementation creates a new pixmap and calls paint to fill it.


fromNativePointer

public static QIconEngine fromNativePointer(QNativePointer nativePointer)
This function returns the QIconEngine instance pointed to by nativePointer

Parameters:
nativePointer - the QNativePointer of which object should be returned.