2007-07-24 23:50:37 +02:00
|
|
|
/*
|
2007-08-06 13:20:02 +02:00
|
|
|
* Copyright 2007 Zack Rusin <zack@kde.org>
|
2007-07-24 23:50:37 +02:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
2007-09-14 21:06:18 +02:00
|
|
|
* it under the terms of the GNU Library General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2, or
|
|
|
|
* (at your option) any later version.
|
2007-07-24 23:50:37 +02:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this program; if not, write to the
|
|
|
|
* Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PLASMA_GLAPPLET_H
|
|
|
|
#define PLASMA_GLAPPLET_H
|
|
|
|
|
|
|
|
#include <plasma/applet.h>
|
|
|
|
|
|
|
|
#include <QtOpenGL/QGLWidget>
|
|
|
|
|
|
|
|
namespace Plasma
|
|
|
|
{
|
|
|
|
|
2008-07-01 20:56:43 +02:00
|
|
|
class GLAppletPrivate;
|
|
|
|
|
2007-07-24 23:50:37 +02:00
|
|
|
/**
|
2008-08-25 19:47:48 +02:00
|
|
|
* @class GLApplet plasma/glapplet.h <Plasma/GLApplet>
|
2007-07-24 23:50:37 +02:00
|
|
|
*
|
2008-08-25 19:47:48 +02:00
|
|
|
* @short Plasma Applet that is fully rendered using OpengGL
|
2007-07-24 23:50:37 +02:00
|
|
|
*/
|
|
|
|
class PLASMA_EXPORT GLApplet : public Applet
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* @arg parent the QGraphicsItem this applet is parented to
|
2008-03-03 20:27:52 +01:00
|
|
|
* @arg serviceId the name of the .desktop file containing the
|
2007-07-24 23:50:37 +02:00
|
|
|
* information about the widget
|
|
|
|
* @arg appletId a unique id used to differentiate between multiple
|
|
|
|
* instances of the same Applet type
|
|
|
|
*/
|
|
|
|
GLApplet(QGraphicsItem *parent,
|
|
|
|
const QString &serviceId,
|
|
|
|
int appletId);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This constructor is to be used with the plugin loading systems
|
|
|
|
* found in KPluginInfo and KService. The argument list is expected
|
|
|
|
* to have two elements: the KService service ID for the desktop entry
|
|
|
|
* and an applet ID which must be a base 10 number.
|
|
|
|
*
|
|
|
|
* @arg parent a QObject parent; you probably want to pass in 0
|
|
|
|
* @arg args a list of strings containing two entries: the service id
|
|
|
|
* and the applet id
|
|
|
|
*/
|
2007-08-29 04:33:22 +02:00
|
|
|
GLApplet(QObject *parent, const QVariantList &args);
|
2007-07-24 23:50:37 +02:00
|
|
|
|
|
|
|
~GLApplet();
|
|
|
|
|
|
|
|
GLuint bindTexture(const QImage &image, GLenum target = GL_TEXTURE_2D);
|
|
|
|
void deleteTexture(GLuint texture_id);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reimplement this method to render using OpenGL. QPainter passed
|
|
|
|
* to this method will always use OpenGL engine and rendering
|
|
|
|
* using OpenGL api directly is supported.
|
|
|
|
*/
|
|
|
|
virtual void paintGLInterface(QPainter *painter,
|
2007-08-30 06:34:09 +02:00
|
|
|
const QStyleOptionGraphicsItem *option);
|
2007-07-24 23:50:37 +02:00
|
|
|
void makeCurrent();
|
|
|
|
private:
|
|
|
|
virtual void paintInterface(QPainter *painter,
|
|
|
|
const QStyleOptionGraphicsItem *option,
|
|
|
|
const QRect &contentsRect);
|
|
|
|
private:
|
2008-07-01 20:56:43 +02:00
|
|
|
GLAppletPrivate *const d;
|
2007-07-24 23:50:37 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|