~ubuntu-branches/ubuntu/gutsy/kdebase-workspace/gutsy-backports

« back to all changes in this revision

Viewing changes to libs/plasma/glapplet.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2007-09-05 20:45:14 UTC
  • Revision ID: james.westby@ubuntu.com-20070905204514-632hhspl0nvrc84i
Tags: upstream-3.93.0
ImportĀ upstreamĀ versionĀ 3.93.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 version 2 as
 
6
 *   published by the Free Software Foundation
 
7
 *
 
8
 *   This program is distributed in the hope that it will be useful,
 
9
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 *   GNU General Public License for more details
 
12
 *
 
13
 *   You should have received a copy of the GNU Library General Public
 
14
 *   License along with this program; if not, write to the
 
15
 *   Free Software Foundation, Inc.,
 
16
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
17
 */
 
18
 
 
19
#ifndef PLASMA_GLAPPLET_H
 
20
#define PLASMA_GLAPPLET_H
 
21
 
 
22
#include <plasma/applet.h>
 
23
 
 
24
#include <QtOpenGL/QGLWidget>
 
25
 
 
26
namespace Plasma
 
27
{
 
28
 
 
29
/**
 
30
 * @short Plasma Applet that is fully rendererd using OpengGL
 
31
 *
 
32
 */
 
33
class PLASMA_EXPORT GLApplet : public Applet
 
34
{
 
35
    Q_OBJECT
 
36
 
 
37
    public:
 
38
        /**
 
39
         * @arg parent the QGraphicsItem this applet is parented to
 
40
         * @arg servideId the name of the .desktop file containing the
 
41
         *      information about the widget
 
42
         * @arg appletId a unique id used to differentiate between multiple
 
43
         *      instances of the same Applet type
 
44
         */
 
45
        GLApplet(QGraphicsItem *parent,
 
46
                 const QString &serviceId,
 
47
                 int appletId);
 
48
 
 
49
        /**
 
50
         * This constructor is to be used with the plugin loading systems
 
51
         * found in KPluginInfo and KService. The argument list is expected
 
52
         * to have two elements: the KService service ID for the desktop entry
 
53
         * and an applet ID which must be a base 10 number.
 
54
         *
 
55
         * @arg parent a QObject parent; you probably want to pass in 0
 
56
         * @arg args a list of strings containing two entries: the service id
 
57
         *      and the applet id
 
58
         */
 
59
        GLApplet(QObject *parent, const QVariantList &args);
 
60
 
 
61
        ~GLApplet();
 
62
 
 
63
        GLuint bindTexture(const QImage &image, GLenum target = GL_TEXTURE_2D);
 
64
        void deleteTexture(GLuint texture_id);
 
65
 
 
66
        /**
 
67
         * Reimplement this method to render using OpenGL. QPainter passed
 
68
         * to this method will always use OpenGL engine and rendering
 
69
         * using OpenGL api directly is supported.
 
70
         */
 
71
        virtual void paintGLInterface(QPainter *painter,
 
72
                                      const QStyleOptionGraphicsItem *option) = 0;
 
73
        void makeCurrent();
 
74
    private:
 
75
        virtual void paintInterface(QPainter *painter,
 
76
                                    const QStyleOptionGraphicsItem *option,
 
77
                                    const QRect &contentsRect);
 
78
    private:
 
79
        class Private;
 
80
        Private *const d;
 
81
};
 
82
 
 
83
}
 
84
 
 
85
#endif