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
|
|
|
|
* it under the terms of the GNU Library General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @short Plasma Applet that is fully rendererd using OpengGL
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
class PLASMA_EXPORT GLApplet : public Applet
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* @arg parent the QGraphicsItem this applet is parented to
|
|
|
|
* @arg servideId the name of the .desktop file containing the
|
|
|
|
* 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:
|
|
|
|
class Private;
|
|
|
|
Private *const d;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|