chalk

kis_opengl_canvas.cpp
1/*
2 * Copyright (c) 2005 Adrian Page <adrian@pagenet.plus.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.g
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19#include "kis_canvas.h"
20#include "kis_opengl_canvas.h"
21#include "kis_opengl_canvas_painter.h"
22
23#ifdef HAVE_GL
24KisOpenGLCanvasWidget::KisOpenGLCanvasWidget(TQWidget *parent, const char *name, TQGLWidget *sharedContextWidget)
25 : TQGLWidget(KisOpenGLCanvasFormat, parent, name, sharedContextWidget)
26{
27 if (isSharing()) {
28 kdDebug(41001) << "Created TQGLWidget with sharing\n";
29 } else {
30 kdDebug(41001) << "Created TQGLWidget with no sharing\n";
31 }
32}
33
34KisOpenGLCanvasWidget::~KisOpenGLCanvasWidget()
35{
36}
37
38void KisOpenGLCanvasWidget::paintEvent(TQPaintEvent *e)
39{
40 TQGLWidget::paintEvent(e);
41
42 widgetGotPaintEvent(e);
43}
44
45void KisOpenGLCanvasWidget::mousePressEvent(TQMouseEvent *e)
46{
47 widgetGotMousePressEvent(e);
48}
49
50void KisOpenGLCanvasWidget::mouseReleaseEvent(TQMouseEvent *e)
51{
52 widgetGotMouseReleaseEvent(e);
53}
54
55void KisOpenGLCanvasWidget::mouseDoubleClickEvent(TQMouseEvent *e)
56{
57 widgetGotMouseDoubleClickEvent(e);
58}
59
60void KisOpenGLCanvasWidget::mouseMoveEvent(TQMouseEvent *e)
61{
62 widgetGotMouseMoveEvent(e);
63}
64
65void KisOpenGLCanvasWidget::tabletEvent(TQTabletEvent *e)
66{
67 widgetGotTabletEvent(e);
68}
69
70void KisOpenGLCanvasWidget::enterEvent(TQEvent *e)
71{
72 widgetGotEnterEvent(e);
73}
74
75void KisOpenGLCanvasWidget::leaveEvent(TQEvent *e)
76{
77 widgetGotLeaveEvent(e);
78}
79
80void KisOpenGLCanvasWidget::wheelEvent(TQWheelEvent *e)
81{
82 widgetGotWheelEvent(e);
83}
84
85void KisOpenGLCanvasWidget::keyPressEvent(TQKeyEvent *e)
86{
87 widgetGotKeyPressEvent(e);
88}
89
90void KisOpenGLCanvasWidget::keyReleaseEvent(TQKeyEvent *e)
91{
92 widgetGotKeyReleaseEvent(e);
93}
94
95void KisOpenGLCanvasWidget::dragEnterEvent(TQDragEnterEvent *e)
96{
97 widgetGotDragEnterEvent(e);
98}
99
100void KisOpenGLCanvasWidget::dropEvent(TQDropEvent *e)
101{
102 widgetGotDropEvent(e);
103}
104
105#ifdef TQ_WS_X11
106
107bool KisOpenGLCanvasWidget::x11Event(XEvent *event)
108{
109 return KisCanvasWidget::x11Event(event, x11Display(), winId(), mapToGlobal(TQPoint(0, 0)));
110}
111
112#endif // TQ_WS_X11
113
114KisCanvasWidgetPainter *KisOpenGLCanvasWidget::createPainter()
115{
116 return new KisOpenGLCanvasPainter(this);
117}
118
119#if defined(EXTENDED_X11_TABLET_SUPPORT)
120void KisOpenGLCanvasWidget::selectTabletDeviceEvents()
121{
122 KisCanvasWidget::selectTabletDeviceEvents(this);
123}
124#endif
125
126#endif // HAVE_GL
127