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_GTKSUP_H
20 #define GNASH_GTKSUP_H
23 #include "gnashconfig.h"
36 class GtkGui
: public Gui
40 GtkGui(unsigned long xid
, float scale
, bool loop
, RunResources
& r
);
44 /// GUI interface implementation
46 virtual bool init(int argc
, char **argv
[]);
47 virtual bool createWindow(int width
, int height
);
48 virtual bool createWindow(const char *title
, int width
, int height
,
49 int xPosition
= 0, int yPosition
= 0);
50 virtual void resizeWindow(int width
, int height
);
54 virtual void quitUI();
56 virtual bool createMenu();
58 virtual bool createMenuAlt(); //an alternative popup menu
60 /// Set up callbacks for key, mouse and other GTK events.
62 /// Must be called after the drawing area has been added to
63 /// a top level window, as it calls setupWindowEvents() to
64 /// add key event callbacks to the top level window.
65 virtual bool setupEvents();
66 virtual void beforeRendering();
67 virtual void renderBuffer();
68 virtual void setInterval(unsigned int interval
);
69 virtual void setTimeout(unsigned int timeout
);
71 virtual void setFullscreen();
72 virtual void unsetFullscreen();
74 virtual void hideMenu();
76 /// For System.capabilities information.
77 virtual double getPixelAspectRatio() const;
78 virtual std::pair
<int, int> screenResolution() const;
79 virtual double getScreenDPI() const;
81 virtual void setClipboard(const std::string
& copy
);
85 /// Grab focus so to receive all key events
87 /// Might become a virtual in the base class
91 /// Create a menu bar for the application, attach to our window.
92 // This should only appear in the standalone player.
94 void createFileMenu(GtkWidget
*obj
);
95 void createEditMenu(GtkWidget
*obj
);
96 void createViewMenu(GtkWidget
*obj
);
97 void createQualityMenu(GtkWidget
*obj
);
98 void createHelpMenu(GtkWidget
*obj
);
99 void createControlMenu(GtkWidget
*obj
);
101 // Display a properties dialogue
102 void showPropertiesDialog();
104 // Display a preferences dialogue
105 void showPreferencesDialog();
107 // Display an About dialogue
108 void showAboutDialog();
110 void expose(const GdkRegion
* region
);
112 void setInvalidatedRegions(const InvalidatedRanges
& ranges
);
114 bool want_multiple_regions() { return true; }
116 virtual void setCursor(gnash_cursor_type newcursor
);
118 virtual bool showMouse(bool show
);
120 virtual void showMenu(bool show
);
122 virtual void error(const std::string
& msg
);
124 bool checkX11Extension(const std::string
& ext
);
129 GtkWidget
* _resumeButton
;
131 // A window only for rendering the plugin as fullscreen.
134 // The area rendered into by Gnash
137 GtkMenu
* _popup_menu
;
138 GtkMenu
* _popup_menu_alt
;
142 /// Add key press events to the toplevel window.
144 /// The plugin fullscreen creates a new top level
145 /// window, so this function must be called every time
146 /// the drawing area is reparented.
147 void setupWindowEvents();
150 // Create a tree model for displaying movie info
151 GtkTreeModel
* makeTreeModel(std::auto_ptr
<movie_root::InfoTree
> tree
);
157 guint _advanceSourceTimer
;
159 void startAdvanceTimer();
161 void stopAdvanceTimer();