Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / workspace / libs / plasma / glapplet.h
blob4fc79fba3e79bae9fe7c823535da60f2569a0193
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 /**
31 * @short Plasma Applet that is fully rendered using OpengGL
34 class PLASMA_EXPORT GLApplet : public Applet
36 Q_OBJECT
38 public:
39 /**
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,
48 int appletId);
50 /**
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
58 * and the applet id
60 GLApplet(QObject *parent, const QVariantList &args);
62 ~GLApplet();
64 GLuint bindTexture(const QImage &image, GLenum target = GL_TEXTURE_2D);
65 void deleteTexture(GLuint texture_id);
67 /**
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);
74 void makeCurrent();
75 private:
76 virtual void paintInterface(QPainter *painter,
77 const QStyleOptionGraphicsItem *option,
78 const QRect &contentsRect);
79 private:
80 class Private;
81 Private *const d;
86 #endif