better clear the widget style before deletion.
[kdelibs.git] / plasma / glapplet.h
blobff90275a53f6cf59b54d9c30da90c3b8d9f1f575
1 /*
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>
27 namespace Plasma
30 class GLAppletPrivate;
32 /**
33 * @class GLApplet plasma/glapplet.h <Plasma/GLApplet>
35 * @short Plasma Applet that is fully rendered using OpengGL
37 class PLASMA_EXPORT GLApplet : public Applet
39 Q_OBJECT
41 public:
42 /**
43 * @arg parent the QGraphicsItem this applet is parented to
44 * @arg serviceId the name of the .desktop file containing the
45 * information about the widget
46 * @arg appletId a unique id used to differentiate between multiple
47 * instances of the same Applet type
49 GLApplet(QGraphicsItem *parent,
50 const QString &serviceId,
51 int appletId);
53 /**
54 * This constructor is to be used with the plugin loading systems
55 * found in KPluginInfo and KService. The argument list is expected
56 * to have two elements: the KService service ID for the desktop entry
57 * and an applet ID which must be a base 10 number.
59 * @arg parent a QObject parent; you probably want to pass in 0
60 * @arg args a list of strings containing two entries: the service id
61 * and the applet id
63 GLApplet(QObject *parent, const QVariantList &args);
65 ~GLApplet();
67 GLuint bindTexture(const QImage &image, GLenum target = GL_TEXTURE_2D);
68 void deleteTexture(GLuint texture_id);
70 /**
71 * Reimplement this method to render using OpenGL. QPainter passed
72 * to this method will always use OpenGL engine and rendering
73 * using OpenGL api directly is supported.
75 virtual void paintGLInterface(QPainter *painter,
76 const QStyleOptionGraphicsItem *option);
77 void makeCurrent();
78 private:
79 virtual void paintInterface(QPainter *painter,
80 const QStyleOptionGraphicsItem *option,
81 const QRect &contentsRect);
82 private:
83 GLAppletPrivate *const d;
88 #endif