2 * Copyright 2007 Zack Rusin <zack@kde.org>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library General Public License as
6 * published by the Free Software Foundation; either version 2, or
7 * (at your option) any later version.
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
12 * GNU General Public License for more details
14 * You should have received a copy of the GNU Library General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #ifndef PLASMA_GLAPPLET_H
21 #define PLASMA_GLAPPLET_H
23 #include <plasma/applet.h>
25 #include <QtOpenGL/QGLWidget>
31 * @short Plasma Applet that is fully rendered using OpengGL
34 class PLASMA_EXPORT GLApplet
: public Applet
40 * @arg parent the QGraphicsItem this applet is parented to
41 * @arg servideId the name of the .desktop file containing the
42 * information about the widget
43 * @arg appletId a unique id used to differentiate between multiple
44 * instances of the same Applet type
46 GLApplet(QGraphicsItem
*parent
,
47 const QString
&serviceId
,
51 * This constructor is to be used with the plugin loading systems
52 * found in KPluginInfo and KService. The argument list is expected
53 * to have two elements: the KService service ID for the desktop entry
54 * and an applet ID which must be a base 10 number.
56 * @arg parent a QObject parent; you probably want to pass in 0
57 * @arg args a list of strings containing two entries: the service id
60 GLApplet(QObject
*parent
, const QVariantList
&args
);
64 GLuint
bindTexture(const QImage
&image
, GLenum target
= GL_TEXTURE_2D
);
65 void deleteTexture(GLuint texture_id
);
68 * Reimplement this method to render using OpenGL. QPainter passed
69 * to this method will always use OpenGL engine and rendering
70 * using OpenGL api directly is supported.
72 virtual void paintGLInterface(QPainter
*painter
,
73 const QStyleOptionGraphicsItem
*option
);
76 virtual void paintInterface(QPainter
*painter
,
77 const QStyleOptionGraphicsItem
*option
,
78 const QRect
&contentsRect
);