1/*
2 * Copyright 2007 Zack Rusin <zack@kde.org>
3 *
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.
8 *
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
13 *
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.
18 */
19
20#ifndef PLASMA_GLAPPLET_H
21#define PLASMA_GLAPPLET_H
22
23#include <plasma/applet.h>
24
25#include <QtOpenGL/QGLWidget>
26
27namespace Plasma
28{
29
30class GLAppletPrivate;
31
32/**
33 * @class GLApplet plasma/glapplet.h <Plasma/GLApplet>
34 *
35 * @short Plasma Applet that is fully rendered using OpengGL
36 */
37class PLASMA_EXPORT_DEPRECATED GLApplet : public Applet
38{
39 Q_OBJECT
40
41 public:
42 /**
43 * @param parent the QGraphicsItem this applet is parented to
44 * @param serviceId the name of the .desktop file containing the
45 * information about the widget
46 * @param appletId a unique id used to differentiate between multiple
47 * instances of the same Applet type
48 */
49 GLApplet(QGraphicsItem *parent,
50 const QString &serviceId,
51 int appletId);
52
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.
58 *
59 * @param parent a QObject parent; you probably want to pass in 0
60 * @param args a list of strings containing two entries: the service id
61 * and the applet id
62 */
63 GLApplet(QObject *parent, const QVariantList &args);
64
65 ~GLApplet();
66
67 GLuint bindTexture(const QImage &image, GLenum target = GL_TEXTURE_2D);
68 void deleteTexture(GLuint texture_id);
69
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.
74 */
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;
84};
85
86}
87
88#endif
89