2 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010,
3 // 2011 Free Software Foundation, Inc
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 #ifndef GNASH_KDESUP_H
20 #define GNASH_KDESUP_H
23 #include "gnashconfig.h"
28 #include <qapplication.h>
29 #include <qpopupmenu.h>
31 #ifdef RENDERER_OPENGL
33 # include "kde_glue_opengl.h"
34 # define WIDGETCLASS QGLWidget
35 # define GLUE KdeOpenGLGlue
36 #elif defined(RENDERER_CAIRO)
38 // #include "kde_glue_cairo.h"
39 # error "Cairo not supported yet for KDE!"
40 #elif defined(RENDERER_AGG)
41 # include "kde_glue_agg.h"
42 # define WIDGETCLASS QWidget
43 # define GLUE KdeAggGlue
53 class qwidget
: public WIDGETCLASS
57 qwidget(KdeGui
* godfather
);
58 void setInterval(unsigned int interval
);
61 void contextMenuEvent(QContextMenuEvent
*event
);
63 void mousePressEvent(QMouseEvent
*event
);
64 void mouseReleaseEvent( QMouseEvent
* );
65 void mouseMoveEvent(QMouseEvent
*event
);
66 void keyPressEvent(QKeyEvent
*event
);
67 void keyReleaseEvent(QKeyEvent
*event
);
68 void timerEvent(QTimerEvent
*);
69 void resizeEvent(QResizeEvent
*event
);
70 void paintEvent (QPaintEvent
*event
);
72 void menuitem_restart_callback();
73 void menuitem_refresh_callback();
74 void menuitem_quit_callback();
75 void menuitem_play_callback();
76 void menuitem_pause_callback();
77 void menuitem_stop_callback();
84 class DSOEXPORT KdeGui
: public Gui
88 KdeGui(unsigned long xid
, float scale
, bool loop
, RunResources
& r
);
90 virtual bool init(int argc
, char **argv
[]);
91 virtual bool createWindow(const char* windowtitle
, int width
, int height
,
92 int xPosition
= 0, int yPosition
= 0);
94 virtual bool createMenu();
95 virtual bool setupEvents();
96 virtual void renderBuffer();
97 virtual void setInterval(unsigned int interval
);
98 virtual void setTimeout(unsigned int timeout
);
99 virtual void handleKeyEvent(QKeyEvent
*event
, bool down
);
100 virtual void setCursor(gnash_cursor_type newcursor
);
101 void setInvalidatedRegions(const InvalidatedRanges
& ranges
);
102 void resize(int width
, int height
);
105 std::unique_ptr
<QApplication
> _qapp
;
106 std::unique_ptr
<qwidget
> _qwidget
;
109 gnash::key::code
qtToGnashKey(QKeyEvent
*event
);
110 int qtToGnashModifier(Qt::ButtonState state
);
113 // end of namespace gnash
116 // end of __KDESUP_H__