From 32f451e76664409bec0a5cc3301eb17f6cbbc806 Mon Sep 17 00:00:00 2001 From: sam Date: Thu, 30 Oct 2008 01:02:29 +0000 Subject: [PATCH] ThePimp: add Fullscreen support, including the F11 binding. git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@3144 92316355-f0b4-4df1-b90c-862c8a59935f --- ThePimp/gtk-gui/ThePimp.MainWindow.cs | 14 ++++++++++---- ThePimp/gtk-gui/gui.stetic | 15 ++++++++++++--- ThePimp/src/MainWindow.cs | 18 ++++++++++++++++++ 3 files changed, 40 insertions(+), 7 deletions(-) diff --git a/ThePimp/gtk-gui/ThePimp.MainWindow.cs b/ThePimp/gtk-gui/ThePimp.MainWindow.cs index 423a5d8..7989b28 100644 --- a/ThePimp/gtk-gui/ThePimp.MainWindow.cs +++ b/ThePimp/gtk-gui/ThePimp.MainWindow.cs @@ -69,6 +69,8 @@ namespace ThePimp { private Gtk.Action saveAsAction; + private Gtk.Action FullscreenAction; + private Gtk.VBox vbox1; private Gtk.MenuBar menubar1; @@ -181,6 +183,9 @@ namespace ThePimp { w2.Add(this.helpAction, null); this.saveAsAction = new Gtk.Action("saveAsAction", null, Mono.Unix.Catalog.GetString("Save active image "), "gtk-save-as"); w2.Add(this.saveAsAction, null); + this.FullscreenAction = new Gtk.Action("FullscreenAction", Mono.Unix.Catalog.GetString("Fullscreen"), null, "gtk-fullscreen"); + this.FullscreenAction.ShortLabel = Mono.Unix.Catalog.GetString("Fullscreen"); + w2.Add(this.FullscreenAction, null); w1.InsertActionGroup(w2, 0); this.AddAccelGroup(w1.AccelGroup); this.Name = "ThePimp.MainWindow"; @@ -191,7 +196,7 @@ namespace ThePimp { this.vbox1 = new Gtk.VBox(); this.vbox1.Name = "vbox1"; // Container child vbox1.Gtk.Box+BoxChild - w1.AddUiFromString(""); + w1.AddUiFromString(""); this.menubar1 = ((Gtk.MenuBar)(w1.GetWidget("/menubar1"))); this.menubar1.Name = "menubar1"; this.vbox1.Add(this.menubar1); @@ -219,7 +224,7 @@ namespace ThePimp { this.vpaned1 = new Gtk.VPaned(); this.vpaned1.CanFocus = true; this.vpaned1.Name = "vpaned1"; - this.vpaned1.Position = 42; + this.vpaned1.Position = 41; this.hpaned1.Add(this.vpaned1); Gtk.Paned.PanedChild w5 = ((Gtk.Paned.PanedChild)(this.hpaned1[this.vpaned1])); w5.Resize = false; @@ -227,7 +232,7 @@ namespace ThePimp { this.hpaned2 = new Gtk.HPaned(); this.hpaned2.CanFocus = true; this.hpaned2.Name = "hpaned2"; - this.hpaned2.Position = 883; + this.hpaned2.Position = 886; // Container child hpaned2.Gtk.Paned+PanedChild this.notebook1 = new Gtk.Notebook(); this.notebook1.CanFocus = true; @@ -241,7 +246,7 @@ namespace ThePimp { this.vpaned2 = new Gtk.VPaned(); this.vpaned2.CanFocus = true; this.vpaned2.Name = "vpaned2"; - this.vpaned2.Position = 42; + this.vpaned2.Position = 41; this.hpaned2.Add(this.vpaned2); Gtk.Paned.PanedChild w7 = ((Gtk.Paned.PanedChild)(this.hpaned2[this.vpaned2])); w7.Resize = false; @@ -277,6 +282,7 @@ namespace ThePimp { this.QuitAction.Activated += new System.EventHandler(this.OnQuitActionActivated); this.AboutAction.Activated += new System.EventHandler(this.OnAboutActionActivated); this.saveAsAction.Activated += new System.EventHandler(this.OnSaveAsActionActivated); + this.FullscreenAction.Activated += new System.EventHandler(this.OnFullscreenActionActivated); } } } diff --git a/ThePimp/gtk-gui/gui.stetic b/ThePimp/gtk-gui/gui.stetic index 06c8656..b57a51e 100644 --- a/ThePimp/gtk-gui/gui.stetic +++ b/ThePimp/gtk-gui/gui.stetic @@ -194,6 +194,13 @@ Save active image + + Action + Fullscreen + Fullscreen + gtk-fullscreen + + The Pimp @@ -223,6 +230,8 @@ + + @@ -274,7 +283,7 @@ True - 42 + 41 @@ -290,7 +299,7 @@ True - 883 + 886 @@ -309,7 +318,7 @@ True - 42 + 41 diff --git a/ThePimp/src/MainWindow.cs b/ThePimp/src/MainWindow.cs index 16df9f9..e8445fd 100644 --- a/ThePimp/src/MainWindow.cs +++ b/ThePimp/src/MainWindow.cs @@ -19,6 +19,8 @@ using ThePimp; namespace ThePimp { + [Gtk.Binding(Gdk.Key.F11, "ToggleFullScreen")] + public partial class MainWindow: Gtk.Window { public MainWindow (): base (Gtk.WindowType.Toplevel) @@ -102,5 +104,21 @@ namespace ThePimp protected virtual void OnSaveActionActivated (object sender, System.EventArgs e) { } + + private bool _fullscreen = false; + protected virtual void ToggleFullScreen() + { + _fullscreen = !_fullscreen; + + if(_fullscreen) + Fullscreen(); + else + Unfullscreen(); + } + + protected virtual void OnFullscreenActionActivated (object sender, System.EventArgs e) + { + ToggleFullScreen(); + } } }