[longomatch] Resize the tagger dialog when it's bigger than the screen



commit d05c4925b3772694ae28532b809c18a317d60639
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Sat Oct 12 15:35:11 2013 +0200

    Resize the tagger dialog when it's bigger than the screen

 LongoMatch.GUI/Gui/Dialog/TaggerDialog.cs |   37 ++++++++++++++++++++++++++++-
 1 files changed, 36 insertions(+), 1 deletions(-)
---
diff --git a/LongoMatch.GUI/Gui/Dialog/TaggerDialog.cs b/LongoMatch.GUI/Gui/Dialog/TaggerDialog.cs
index 0efc1a9..4041323 100644
--- a/LongoMatch.GUI/Gui/Dialog/TaggerDialog.cs
+++ b/LongoMatch.GUI/Gui/Dialog/TaggerDialog.cs
@@ -20,6 +20,7 @@ using System;
 using System.Linq;
 using System.Collections.Generic;
 using Gdk;
+using Gtk;
 
 using LongoMatch.Common;
 using LongoMatch.Gui.Component;
@@ -35,6 +36,7 @@ namespace LongoMatch.Gui.Dialog
                TeamTemplate localTeamTemplate;
                TeamTemplate visitorTeamTemplate;
                bool subcategoryAdded;
+               bool firstExpose;
                
                public TaggerDialog(Play play,
                                    Categories categoriesTemplate,
@@ -44,6 +46,7 @@ namespace LongoMatch.Gui.Dialog
                {
                        this.Build();
                        
+                       firstExpose = false;
                        tagsnotebook.Visible = false;
                        
                        this.localTeamTemplate = localTeamTemplate;
@@ -117,6 +120,38 @@ namespace LongoMatch.Gui.Dialog
                        playersbox.PackStart(widget, true, true, 0);
                }
                
-               
+               protected override bool OnExposeEvent (EventExpose evnt)
+               {
+                       bool ret = base.OnExposeEvent (evnt);
+                       
+                       Console.WriteLine ("Expose");
+                       
+                       if (!firstExpose) {
+                               Screen screen = Display.Default.DefaultScreen;
+                               int width, height, newWidth, newHeight;
+                               
+                               width = newWidth = Requisition.Width;
+                               height = newHeight = Requisition.Height;
+                               
+                               if (width + 20 > screen.Width) {
+                                       newWidth = screen.Width - 20;
+                               }
+                               if (height + 20 > screen.Height) {
+                                       newHeight = screen.Height - 20;
+                               }
+                               
+                               if (newWidth != width || newHeight != height) {
+                                       ScrolledWindow win = new ScrolledWindow();
+                                       VBox.Remove(mainvbox);
+                                       win.AddWithViewport (mainvbox);
+                                       win.Show ();
+                                       VBox.PackStart (win, true, true, 0);
+                                       this.Resize (newWidth, newHeight);
+                                       this.SetPosition (Gtk.WindowPosition.CenterOnParent);
+                               }
+                               firstExpose = true;
+                       }
+                       return ret;
+               }
        }
 }


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