1 // Qt4Glue.cpp: KDE4/Qt4 shared code to connect the various renderers to
4 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010,
5 // 2011 Free Software Foundation, Inc
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 3 of the License, or
10 // (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #include "gnashconfig.h"
27 #include "Qt4Glue.moc"
30 #include <QPaintEvent>
31 #include <QMouseEvent>
32 #include <QWheelEvent>
36 /// DrawingWidget implementation
37 DrawingWidget::DrawingWidget(Qt4Gui
& gui
)
39 #ifdef RENDERER_OPENGL
47 DrawingWidget::paintEvent(QPaintEvent
*event
)
49 _gui
.renderWidget(event
->rect());
53 DrawingWidget::timerEvent(QTimerEvent
*)
55 Gui::advance_movie(&_gui
);
59 DrawingWidget::wheelEvent(QWheelEvent
* event
)
61 _gui
.notifyMouseWheel(event
->delta() > 0 ? 1 : -1);
65 DrawingWidget::mouseMoveEvent(QMouseEvent
*event
)
67 QPoint position
= event
->pos();
68 _gui
.notifyMouseMove(position
.x(), position
.y());
72 DrawingWidget::contextMenuEvent(QContextMenuEvent
* event
)
74 _gui
.popupMenu(event
->globalPos());
78 DrawingWidget::mousePressEvent(QMouseEvent
* event
)
80 if(Qt::LeftButton
& event
->button())
81 _gui
.notifyMouseClick(true);
85 DrawingWidget::mouseReleaseEvent(QMouseEvent
* /* event */)
87 _gui
.notifyMouseClick(false);
91 DrawingWidget::keyPressEvent(QKeyEvent
*event
)
93 _gui
.handleKeyEvent(event
, true);
97 DrawingWidget::keyReleaseEvent(QKeyEvent
*event
)
99 _gui
.handleKeyEvent(event
, false);
103 DrawingWidget::resizeEvent(QResizeEvent
*event
)
105 _gui
.resize(event
->size().width(), event
->size().height());
110 DrawingWidget::properties()
112 _gui
.showProperties();
116 DrawingWidget::preferences()
118 _gui
.showPreferences();
122 DrawingWidget::play()
128 DrawingWidget::pause()
134 DrawingWidget::restart()
140 DrawingWidget::stop()
146 DrawingWidget::refresh()
152 DrawingWidget::quit()
158 DrawingWidget::fullscreen(bool isFull
)
161 _gui
.setFullscreen();
164 _gui
.unsetFullscreen();