krita

kis_opengl_canvas.h

00001 /*
00002  *  Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  */
00018 
00019 #ifndef KIS_OPENGL_CANVAS_H_
00020 #define KIS_OPENGL_CANVAS_H_
00021 
00022 #ifdef HAVE_CONFIG_H
00023 #include <config.h>
00024 #endif
00025 
00026 #ifdef HAVE_GL
00027 
00028 #include <qwidget.h>
00029 #include <qgl.h>
00030 
00031 #include "kis_global.h"
00032 #include "kis_canvas.h"
00033 
00034 #ifdef Q_WS_X11
00035 #include <X11/Xlib.h>
00036 #endif // Q_WS_X11
00037 
00038 #define KisOpenGLCanvasFormat (QGL::DoubleBuffer|QGL::Rgba|QGL::DirectRendering|QGL::NoDepthBuffer)
00039 
00040 class KisOpenGLCanvasWidget : public virtual QGLWidget, public virtual KisCanvasWidget {
00041 public:
00042     KisOpenGLCanvasWidget(QWidget *parent, const char *name, QGLWidget *sharedContextWidget);
00043     ~KisOpenGLCanvasWidget();
00044 
00045     virtual KisCanvasWidgetPainter *createPainter();
00046 
00047 #if defined(EXTENDED_X11_TABLET_SUPPORT)
00048     virtual void selectTabletDeviceEvents();
00049 #endif
00050 
00051 protected:
00052     virtual void paintEvent(QPaintEvent *event);
00053     virtual void mousePressEvent(QMouseEvent *event);
00054     virtual void mouseReleaseEvent(QMouseEvent *event);
00055     virtual void mouseDoubleClickEvent(QMouseEvent *event);
00056     virtual void mouseMoveEvent(QMouseEvent *event);
00057     virtual void tabletEvent(QTabletEvent *event);
00058     virtual void enterEvent(QEvent *event );
00059     virtual void leaveEvent(QEvent *event);
00060     virtual void wheelEvent(QWheelEvent *event);
00061     virtual void keyPressEvent(QKeyEvent *event);
00062     virtual void keyReleaseEvent(QKeyEvent *event);
00063     virtual void dragEnterEvent(QDragEnterEvent *event);
00064     virtual void dropEvent(QDropEvent *event);
00065 #ifdef Q_WS_X11
00066     bool x11Event(XEvent *event);
00067 #endif // Q_WS_X11
00068 };
00069 #endif // HAVE_GL
00070 
00071 #endif // KIS_OPENGL_CANVAS_H_
00072 
KDE Home | KDE Accessibility Home | Description of Access Keys