krita

kis_opengl_canvas.cc

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.g
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 #include "kis_canvas.h"
00020 #include "kis_opengl_canvas.h"
00021 #include "kis_opengl_canvas_painter.h"
00022 
00023 #ifdef HAVE_GL
00024 KisOpenGLCanvasWidget::KisOpenGLCanvasWidget(QWidget *parent, const char *name, QGLWidget *sharedContextWidget)
00025     : QGLWidget(KisOpenGLCanvasFormat, parent, name, sharedContextWidget)
00026 {
00027     if (isSharing()) {
00028         kdDebug(41001) << "Created QGLWidget with sharing\n";
00029     } else {
00030         kdDebug(41001) << "Created QGLWidget with no sharing\n";
00031     }
00032 }
00033 
00034 KisOpenGLCanvasWidget::~KisOpenGLCanvasWidget()
00035 {
00036 }
00037 
00038 void KisOpenGLCanvasWidget::paintEvent(QPaintEvent *e)
00039 {
00040     QGLWidget::paintEvent(e);
00041 
00042     widgetGotPaintEvent(e);
00043 }
00044 
00045 void KisOpenGLCanvasWidget::mousePressEvent(QMouseEvent *e)
00046 {
00047     widgetGotMousePressEvent(e);
00048 }
00049 
00050 void KisOpenGLCanvasWidget::mouseReleaseEvent(QMouseEvent *e)
00051 {
00052     widgetGotMouseReleaseEvent(e);
00053 }
00054 
00055 void KisOpenGLCanvasWidget::mouseDoubleClickEvent(QMouseEvent *e)
00056 {
00057     widgetGotMouseDoubleClickEvent(e);
00058 }
00059 
00060 void KisOpenGLCanvasWidget::mouseMoveEvent(QMouseEvent *e)
00061 {
00062     widgetGotMouseMoveEvent(e);
00063 }
00064 
00065 void KisOpenGLCanvasWidget::tabletEvent(QTabletEvent *e)
00066 {
00067     widgetGotTabletEvent(e);
00068 }
00069 
00070 void KisOpenGLCanvasWidget::enterEvent(QEvent *e)
00071 {
00072     widgetGotEnterEvent(e);
00073 }
00074 
00075 void KisOpenGLCanvasWidget::leaveEvent(QEvent *e)
00076 {
00077     widgetGotLeaveEvent(e);
00078 }
00079 
00080 void KisOpenGLCanvasWidget::wheelEvent(QWheelEvent *e)
00081 {
00082     widgetGotWheelEvent(e);
00083 }
00084 
00085 void KisOpenGLCanvasWidget::keyPressEvent(QKeyEvent *e)
00086 {
00087     widgetGotKeyPressEvent(e);
00088 }
00089 
00090 void KisOpenGLCanvasWidget::keyReleaseEvent(QKeyEvent *e)
00091 {
00092     widgetGotKeyReleaseEvent(e);
00093 }
00094 
00095 void KisOpenGLCanvasWidget::dragEnterEvent(QDragEnterEvent *e)
00096 {
00097     widgetGotDragEnterEvent(e);
00098 }
00099 
00100 void KisOpenGLCanvasWidget::dropEvent(QDropEvent *e)
00101 {
00102     widgetGotDropEvent(e);
00103 }
00104 
00105 #ifdef Q_WS_X11
00106 
00107 bool KisOpenGLCanvasWidget::x11Event(XEvent *event)
00108 {
00109     return KisCanvasWidget::x11Event(event, x11Display(), winId(), mapToGlobal(QPoint(0, 0)));
00110 }
00111 
00112 #endif // Q_WS_X11
00113 
00114 KisCanvasWidgetPainter *KisOpenGLCanvasWidget::createPainter()
00115 {
00116     return new KisOpenGLCanvasPainter(this);
00117 }
00118 
00119 #if defined(EXTENDED_X11_TABLET_SUPPORT)
00120 void KisOpenGLCanvasWidget::selectTabletDeviceEvents()
00121 {
00122     KisCanvasWidget::selectTabletDeviceEvents(this);
00123 }
00124 #endif
00125 
00126 #endif // HAVE_GL
00127 
KDE Home | KDE Accessibility Home | Description of Access Keys