Gnash  0.8.10
Qt4Glue.h
Go to the documentation of this file.
00001 //
00002 //   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010,
00003 //   2011 Free Software Foundation, Inc
00004 //
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation; either version 3 of the License, or
00008 // (at your option) any later version.
00009 //
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 // 
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018 
00019 #ifndef GNASH_KDE4_GLUE_H
00020 #define GNASH_KDE4_GLUE_H
00021 
00022 #ifdef HAVE_CONFIG_H
00023 #include "gnashconfig.h"
00024 #endif
00025 
00026 #include "snappingrange.h"
00027 
00028 #include <QWidget>
00029 
00030 class QRect;
00031 class QGLWidget;
00032 
00033 namespace gnash {
00034     class Renderer;
00035     class DrawingWidget;
00036     class Qt4Gui;
00037 }
00038 
00039 namespace gnash {
00040 
00041 class DrawingWidget : public QWidget
00042 {
00043     Q_OBJECT
00044 
00045 public:
00046     DrawingWidget(Qt4Gui& gui);
00047     ~DrawingWidget() {}
00048 
00049 #ifdef RENDERER_OPENGL
00050     QGLWidget* _glWidget;
00051 #endif 
00052 
00053 public slots:
00054     
00055     void properties();
00056     void preferences();
00057     void play(); 
00058     void pause();
00059     void stop();
00060     void restart();
00061     void refresh();
00062     void fullscreen(bool isFull); 
00063     void quit();
00064 
00065 protected:
00066     void paintEvent(QPaintEvent* event);
00067     void timerEvent(QTimerEvent* event);
00068     void resizeEvent(QResizeEvent* event);
00069     void mouseReleaseEvent(QMouseEvent* event);
00070     void mousePressEvent(QMouseEvent* event); 
00071     void mouseMoveEvent(QMouseEvent* event); 
00072     void wheelEvent(QWheelEvent* event); 
00073 
00074     void keyPressEvent(QKeyEvent* event);
00075     void keyReleaseEvent(QKeyEvent* event);
00076     void contextMenuEvent(QContextMenuEvent* event);
00077     
00078 private:
00079     Qt4Gui& _gui;
00080 };  
00081 
00082 class Qt4Glue
00083 {
00084   public:
00085     Qt4Glue() : _drawing_area(NULL) {}
00086     virtual ~Qt4Glue() { }
00087     virtual bool init(int argc, char **argv[]) = 0;
00088 
00089     virtual void prepDrawingArea(DrawingWidget *drawing_area) = 0;
00090     virtual Renderer* createRenderHandler() = 0;
00091     virtual void render() = 0;
00092     virtual void render(const QRect& updateRect) = 0;
00093     virtual void setInvalidatedRegions(const InvalidatedRanges& /* ranges */) {}
00094     virtual void resize(int, int) {}
00095     virtual void initBuffer(int, int) {}
00096   protected:
00097     DrawingWidget     *_drawing_area;
00098 };
00099 
00100 } // namespace gnash
00101 
00102 #endif