[longomatch] Add a new interface for panels



commit a6f0d5f498ffc950b3f1b74093aa2e9a9495cc17
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Thu Mar 20 17:26:42 2014 +0100

    Add a new interface for panels

 LongoMatch.Core/Interfaces/GUI/IPanel.cs     |   29 ++++++++++++++++++++++++++
 LongoMatch.Core/LongoMatch.Core.mdp          |    1 +
 LongoMatch.GUI/Gui/MainWindow.cs             |    4 ++-
 LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs  |    8 +++---
 LongoMatch.GUI/Gui/Panel/OpenProjectPanel.cs |    3 +-
 5 files changed, 39 insertions(+), 6 deletions(-)
---
diff --git a/LongoMatch.Core/Interfaces/GUI/IPanel.cs b/LongoMatch.Core/Interfaces/GUI/IPanel.cs
new file mode 100644
index 0000000..bc3763d
--- /dev/null
+++ b/LongoMatch.Core/Interfaces/GUI/IPanel.cs
@@ -0,0 +1,29 @@
+//
+//  Copyright (C) 2014 Andoni Morales Alastruey
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation; either version 2 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+using System;
+using LongoMatch.Handlers;
+
+namespace LongoMatch.Interfaces.GUI
+{
+       public interface IPanel
+       {
+               event BackEventHandle BackEvent;
+               
+       }
+}
+
diff --git a/LongoMatch.Core/LongoMatch.Core.mdp b/LongoMatch.Core/LongoMatch.Core.mdp
index 04cc4b0..8c742eb 100644
--- a/LongoMatch.Core/LongoMatch.Core.mdp
+++ b/LongoMatch.Core/LongoMatch.Core.mdp
@@ -113,6 +113,7 @@
     <File subtype="Code" buildaction="EmbedAsResource" name="../images/goal_background.svg" />
     <File subtype="Code" buildaction="EmbedAsResource" name="../images/half_field_background.svg" />
     <File subtype="Code" buildaction="Compile" name="Utils.cs" />
+    <File subtype="Code" buildaction="Compile" name="Interfaces/GUI/IPanel.cs" />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="True" refto="System, Version=4.0.0.0, Culture=neutral, 
PublicKeyToken=b77a5c561934e089" />
diff --git a/LongoMatch.GUI/Gui/MainWindow.cs b/LongoMatch.GUI/Gui/MainWindow.cs
index 1810eee..085464f 100644
--- a/LongoMatch.GUI/Gui/MainWindow.cs
+++ b/LongoMatch.GUI/Gui/MainWindow.cs
@@ -128,6 +128,9 @@ namespace LongoMatch.Gui
                                        }
                                }
                                panel.Show();
+                               if (panel is IPanel) {
+                                       (panel as IPanel).BackEvent += ResetGUI;
+                               }
                                centralbox.PackStart (panel, true, true, 0);
                                welcomepanel1.Hide ();
                        }
@@ -179,7 +182,6 @@ namespace LongoMatch.Gui
                public void SelectProject (List<ProjectDescription> projects) {
                        OpenProjectPanel panel  = new OpenProjectPanel ();
                        panel.Projects = projects;
-                       panel.BackEvent += ResetGUI;
                        panel.OpenProjectEvent += EmitOpenProjectID;
                        SetPanel (panel);
                }
diff --git a/LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs b/LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs
index 0d8d5e8..d2994af 100644
--- a/LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs
+++ b/LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs
@@ -40,9 +40,9 @@ using Device = LongoMatch.Common.Device;
 namespace LongoMatch.Gui.Panel
 {
        [System.ComponentModel.ToolboxItem(true)]
-       public partial class NewProjectPanel : Gtk.Bin
+       public partial class NewProjectPanel : Gtk.Bin, IPanel
        {
-               public event BackEventHandle CancelEvent;
+               public event BackEventHandle BackEvent;
                public event OpenNewProjectHandler OpenNewProjectEvent;
                
                const int PROJECT_TYPE = 0;
@@ -317,8 +317,8 @@ namespace LongoMatch.Gui.Panel
                void HandleBackClicked (object sender, EventArgs e)
                {
                        if (notebook1.Page == PROJECT_TYPE) {
-                               if (CancelEvent != null) {
-                                       CancelEvent ();
+                               if (BackEvent != null) {
+                                       BackEvent ();
                                }
                        } else {
                                notebook1.Page --;
diff --git a/LongoMatch.GUI/Gui/Panel/OpenProjectPanel.cs b/LongoMatch.GUI/Gui/Panel/OpenProjectPanel.cs
index c96483f..8076a50 100644
--- a/LongoMatch.GUI/Gui/Panel/OpenProjectPanel.cs
+++ b/LongoMatch.GUI/Gui/Panel/OpenProjectPanel.cs
@@ -21,11 +21,12 @@ using Gtk;
 using LongoMatch.Handlers;
 using LongoMatch.Gui;
 using LongoMatch.Store;
+using LongoMatch.Interfaces.GUI;
 
 namespace LongoMatch.Gui.Panel
 {
        [System.ComponentModel.ToolboxItem(true)]
-       public partial class OpenProjectPanel : Gtk.Bin
+       public partial class OpenProjectPanel : Gtk.Bin, IPanel
        {
                public event OpenProjectIDHandler OpenProjectEvent;
                public event BackEventHandle BackEvent;


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