Gnash
0.8.10
|
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_GTKSUP_H 00020 #define GNASH_GTKSUP_H 00021 00022 #ifdef HAVE_CONFIG_H 00023 #include "gnashconfig.h" 00024 #endif 00025 00026 #include <string> 00027 #include <utility> 00028 #include <gdk/gdk.h> 00029 #include <gtk/gtk.h> 00030 00031 #include "gui.h" 00032 #include "gtk_glue.h" 00033 00034 namespace gnash { 00035 00036 class GtkGui : public Gui 00037 { 00038 public: 00039 00040 GtkGui(unsigned long xid, float scale, bool loop, RunResources& r); 00041 00042 virtual ~GtkGui(); 00043 00045 00046 virtual bool init(int argc, char **argv[]); 00047 virtual bool createWindow(int width, int height); 00048 virtual bool createWindow(const char *title, int width, int height, 00049 int xPosition = 0, int yPosition = 0); 00050 virtual void resizeWindow(int width, int height); 00051 00052 virtual bool run(); 00053 00054 virtual void quitUI(); 00055 00056 virtual bool createMenu(); 00057 00058 virtual bool createMenuAlt(); //an alternative popup menu 00059 00061 // 00065 virtual bool setupEvents(); 00066 virtual void beforeRendering(); 00067 virtual void renderBuffer(); 00068 virtual void setInterval(unsigned int interval); 00069 virtual void setTimeout(unsigned int timeout); 00070 00071 virtual void setFullscreen(); 00072 virtual void unsetFullscreen(); 00073 00074 virtual void hideMenu(); 00075 00076 virtual bool yesno(const std::string& question); 00077 00079 virtual double getPixelAspectRatio() const; 00080 virtual std::pair<int, int> screenResolution() const; 00081 virtual double getScreenDPI() const; 00082 00083 virtual void setClipboard(const std::string& copy); 00084 00086 // 00089 void grabFocus(); 00090 00092 // This should only appear in the standalone player. 00093 bool createMenuBar(); 00094 void createFileMenu(GtkWidget *obj); 00095 void createEditMenu(GtkWidget *obj); 00096 void createViewMenu(GtkWidget *obj); 00097 void createQualityMenu(GtkWidget *obj); 00098 void createHelpMenu(GtkWidget *obj); 00099 void createControlMenu(GtkWidget *obj); 00100 00101 // Display a properties dialogue 00102 void showPropertiesDialog(); 00103 00104 // Display a preferences dialogue 00105 void showPreferencesDialog(); 00106 00107 // Display an About dialogue 00108 void showAboutDialog(); 00109 00110 void expose(const GdkRegion* region); 00111 00112 void setInvalidatedRegions(const InvalidatedRanges& ranges); 00113 00114 bool want_multiple_regions() { return true; } 00115 00116 virtual void setCursor(gnash_cursor_type newcursor); 00117 00118 virtual bool showMouse(bool show); 00119 00120 virtual void showMenu(bool show); 00121 00122 virtual void error(const std::string& msg); 00123 00124 bool checkX11Extension(const std::string& ext); 00125 00126 virtual bool visible() { return _visible; } 00127 00128 void setVisible(bool visible) { _visible = visible; } 00129 00130 private: 00131 00132 GtkWidget* _window; 00133 GtkWidget* _resumeButton; 00134 00135 // A window only for rendering the plugin as fullscreen. 00136 GtkWidget* _overlay; 00137 00138 // The area rendered into by Gnash 00139 GtkWidget* _canvas; 00140 bool _visible; 00141 00142 GtkMenu* _popup_menu; 00143 GtkMenu* _popup_menu_alt; 00144 GtkWidget* _menubar; 00145 GtkWidget* _vbox; 00146 00147 00149 // 00153 void setupWindowEvents(); 00154 00155 #ifdef USE_SWFTREE 00156 // Create a tree model for displaying movie info 00157 GtkTreeModel* makeTreeModel(std::auto_ptr<movie_root::InfoTree> tree); 00158 #endif 00159 00160 void stopHook(); 00161 void playHook(); 00162 00163 guint _advanceSourceTimer; 00164 00165 void startAdvanceTimer(); 00166 00167 void stopAdvanceTimer(); 00168 }; 00169 00170 } // namespace gnash 00171 00172 #endif 00173 00174 // Local Variables: 00175 // mode: C++ 00176 // indent-tabs-mode: nil 00177 // End: