[longomatch] Don't put more than 3 buttons per row



commit a78cd4545434ffe34c94cd3c91ff0ae7900f57d8
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Wed Nov 7 22:39:04 2012 +0100

    Don't put more than 3 buttons per row

 LongoMatch.GUI/Gui/Component/StringTaggerWidget.cs |   16 +++++++++---
 .../LongoMatch.Gui.Component.StringTaggerWidget.cs |   11 ++++---
 LongoMatch.GUI/gtk-gui/gui.stetic                  |   27 +++++++++++++++++--
 LongoMatch.GUI/gtk-gui/objects.xml                 |    4 ---
 4 files changed, 42 insertions(+), 16 deletions(-)
---
diff --git a/LongoMatch.GUI/Gui/Component/StringTaggerWidget.cs b/LongoMatch.GUI/Gui/Component/StringTaggerWidget.cs
index c73b63d..934826b 100644
--- a/LongoMatch.GUI/Gui/Component/StringTaggerWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/StringTaggerWidget.cs
@@ -27,9 +27,11 @@ namespace LongoMatch.Gui.Component
 	[System.ComponentModel.ToolboxItem(true)]
 	public partial class StringTaggerWidget : Gtk.Bin
 	{
-		private Dictionary<StringTag, CheckButton> dict;
-		private StringTagStore tags;
-		private RadioButton firstRB;
+		Dictionary<StringTag, CheckButton> dict;
+		StringTagStore tags;
+		RadioButton firstRB;
+		uint count;
+		const uint BUTTONS_PER_ROW = 3;
 		TagSubCategory subcategory;
 		
 		public StringTaggerWidget (TagSubCategory subcategory, StringTagStore tags)
@@ -37,6 +39,8 @@ namespace LongoMatch.Gui.Component
 			this.Build ();
 			this.subcategory = subcategory;
 			this.tags = tags;
+			count = 0;
+			table.NColumns = 3;
 			PopulateGui();
 			UpdateTags();
 		}
@@ -67,6 +71,7 @@ namespace LongoMatch.Gui.Component
 		
 		private void AddTagWidget (StringTag tag, bool radio){
 			CheckButton button;
+			uint row, col;
 			
 			if (radio) {
 				if (firstRB == null) 
@@ -85,8 +90,11 @@ namespace LongoMatch.Gui.Component
 					tags.Remove(tag);
 			};
 			dict.Add(tag, button);
-			buttonsbox.PackStart(button, false, false, 0);
+			row = count / BUTTONS_PER_ROW;
+			col = count % BUTTONS_PER_ROW;
+			table.Attach (button, row, row+1, col, col+1);
 			button.ShowAll();
+			count ++;
 		} 
 		
 		private string Title {
diff --git a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.StringTaggerWidget.cs b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.StringTaggerWidget.cs
index efa3983..2aff48c 100644
--- a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.StringTaggerWidget.cs
+++ b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.StringTaggerWidget.cs
@@ -6,7 +6,7 @@ namespace LongoMatch.Gui.Component
 	{
 		private global::Gtk.Frame frame;
 		private global::Gtk.Alignment GtkAlignment;
-		private global::Gtk.HBox buttonsbox;
+		private global::Gtk.Table table;
 		private global::Gtk.Label titlelabel;
 		
 		protected virtual void Build ()
@@ -24,10 +24,11 @@ namespace LongoMatch.Gui.Component
 			this.GtkAlignment.Name = "GtkAlignment";
 			this.GtkAlignment.LeftPadding = ((uint)(12));
 			// Container child GtkAlignment.Gtk.Container+ContainerChild
-			this.buttonsbox = new global::Gtk.HBox ();
-			this.buttonsbox.Name = "buttonsbox";
-			this.buttonsbox.Spacing = 6;
-			this.GtkAlignment.Add (this.buttonsbox);
+			this.table = new global::Gtk.Table (((uint)(3)), ((uint)(3)), false);
+			this.table.Name = "table";
+			this.table.RowSpacing = ((uint)(6));
+			this.table.ColumnSpacing = ((uint)(6));
+			this.GtkAlignment.Add (this.table);
 			this.frame.Add (this.GtkAlignment);
 			this.titlelabel = new global::Gtk.Label ();
 			this.titlelabel.Name = "titlelabel";
diff --git a/LongoMatch.GUI/gtk-gui/gui.stetic b/LongoMatch.GUI/gtk-gui/gui.stetic
index f0593be..9831101 100644
--- a/LongoMatch.GUI/gtk-gui/gui.stetic
+++ b/LongoMatch.GUI/gtk-gui/gui.stetic
@@ -5965,7 +5965,7 @@ You can continue with the current capture, cancel it or save your project.
       </widget>
     </child>
   </widget>
-  <widget class="Gtk.Bin" id="LongoMatch.Gui.Component.StringTaggerWidget" design-size="300 33">
+  <widget class="Gtk.Bin" id="LongoMatch.Gui.Component.StringTaggerWidget" design-size="300 61">
     <property name="MemberName" />
     <property name="Visible">False</property>
     <child>
@@ -5979,9 +5979,30 @@ You can continue with the current capture, cancel it or save your project.
             <property name="Yalign">0</property>
             <property name="LeftPadding">12</property>
             <child>
-              <widget class="Gtk.HBox" id="buttonsbox">
+              <widget class="Gtk.Table" id="table">
                 <property name="MemberName" />
-                <property name="Spacing">6</property>
+                <property name="NRows">3</property>
+                <property name="NColumns">3</property>
+                <property name="RowSpacing">6</property>
+                <property name="ColumnSpacing">6</property>
+                <child>
+                  <placeholder />
+                </child>
+                <child>
+                  <placeholder />
+                </child>
+                <child>
+                  <placeholder />
+                </child>
+                <child>
+                  <placeholder />
+                </child>
+                <child>
+                  <placeholder />
+                </child>
+                <child>
+                  <placeholder />
+                </child>
                 <child>
                   <placeholder />
                 </child>
diff --git a/LongoMatch.GUI/gtk-gui/objects.xml b/LongoMatch.GUI/gtk-gui/objects.xml
index 0d24ee1..006521d 100644
--- a/LongoMatch.GUI/gtk-gui/objects.xml
+++ b/LongoMatch.GUI/gtk-gui/objects.xml
@@ -176,10 +176,6 @@
     <itemgroups />
     <signals />
   </object>
-  <object type="LongoMatch.Gui.Component.StringTaggerWidget" palette-category="General" allow-children="false" base-type="Gtk.Bin">
-    <itemgroups />
-    <signals />
-  </object>
   <object type="LongoMatch.Gui.Component.CategoryProperties" palette-category="LongoMatch" allow-children="false" base-type="Gtk.Bin">
     <itemgroups />
     <signals>



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