[longomatch] Add a new utility to diable focus on childs



commit bcdf7e3cd139b50c269969c1d09a97db24838f97
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Sun Jun 22 14:01:55 2014 +0200

    Add a new utility to diable focus on childs

 LongoMatch.GUI.Helpers/Misc.cs               |   15 +++++++++++++++
 LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs |    3 ++-
 LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs   |   12 +-----------
 LongoMatch.GUI/Gui/Component/CodingWidget.cs |    2 ++
 4 files changed, 20 insertions(+), 12 deletions(-)
---
diff --git a/LongoMatch.GUI.Helpers/Misc.cs b/LongoMatch.GUI.Helpers/Misc.cs
index 95f301d..c999cbf 100644
--- a/LongoMatch.GUI.Helpers/Misc.cs
+++ b/LongoMatch.GUI.Helpers/Misc.cs
@@ -16,6 +16,7 @@
 //  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 // 
 using System;
+using System.Linq;
 using System.IO;
 using Gtk;
 using Gdk;
@@ -24,6 +25,7 @@ using Mono.Unix;
 using LongoMatch.Common;
 using LColor = LongoMatch.Common.Color; 
 using Color = Gdk.Color;
+using System.Collections.Generic;
 
 namespace LongoMatch.Gui.Helpers
 {
@@ -192,6 +194,19 @@ namespace LongoMatch.Gui.Helpers
                                }
                        }
                }
+               
+               public static void DisableFocus (Container w, params Type[] skipTypes) {
+                       w.CanFocus = false;
+                       foreach (Widget child in w.AllChildren) {
+                               if (child is Container) {
+                                       DisableFocus (child as Container);
+                               } else {
+                                       if (!skipTypes.Contains (child.GetType())) {
+                                               child.CanFocus = false;
+                                       }
+                               }
+                       }
+               }
        }
 }
 
diff --git a/LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs b/LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs
index 2ff0621..e579689 100644
--- a/LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs
@@ -60,7 +60,8 @@ namespace LongoMatch.Gui
                        stopbutton.Visible = false;
                        finishbutton.Visible = false;
                        cancelbutton.Visible = true;
-                       videodrawingarea.CanFocus = false;
+                       LongoMatch.Gui.Helpers.Misc.DisableFocus (vbox1);
+                       videodrawingarea.CanFocus = true;
                        ConnectSignals ();
                }
 
diff --git a/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs b/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
index 71d8ad2..66e4db2 100644
--- a/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
@@ -76,17 +76,7 @@ namespace LongoMatch.Gui
                        UnSensitive();
                        timescale.Adjustment.PageIncrement = 0.01;
                        timescale.Adjustment.StepIncrement = 0.0001;
-                       playbutton.CanFocus = false;
-                       pausebutton.CanFocus = false;
-                       prevbutton.CanFocus = false;
-                       nextbutton.CanFocus = false;
-                       jumpspinbutton.CanFocus = false;
-                       detachbutton.CanFocus = false;
-                       volumebutton.CanFocus = false;
-                       timescale.CanFocus = false;
-                       vscale1.CanFocus = false;
-                       drawbutton.CanFocus = false;
-                       videoeventbox.CanFocus = true;
+                       LongoMatch.Gui.Helpers.Misc.DisableFocus (vbox3);
                        videodrawingarea.CanFocus = true;
                        seeksQueue = new double[2];
                        seeksQueue [0] = -1;
diff --git a/LongoMatch.GUI/Gui/Component/CodingWidget.cs b/LongoMatch.GUI/Gui/Component/CodingWidget.cs
index 53b47de..c1eb4e1 100644
--- a/LongoMatch.GUI/Gui/Component/CodingWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/CodingWidget.cs
@@ -22,6 +22,7 @@ using LongoMatch.Common;
 using System.Collections.Generic;
 using LongoMatch.Drawing.Widgets;
 using LongoMatch.Drawing.Cairo;
+using LongoMatch.Gui.Helpers;
 
 namespace LongoMatch.Gui.Component
 {
@@ -53,6 +54,7 @@ namespace LongoMatch.Gui.Component
                        
                        Config.EventsBroker.Tick += HandleTick;
                        Config.EventsBroker.PlaySelected += HandlePlaySelected;
+                       Misc.DisableFocus (vbox2);
                }
                
                protected override void OnDestroyed ()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]