[longomatch] Add height, weight and birthday to the treeview
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Add height, weight and birthday to the treeview
- Date: Sat, 16 Oct 2010 17:51:07 +0000 (UTC)
commit d36ca7bd44230ccb43c7e56efbae7af4359a97e4
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Fri Oct 8 18:05:10 2010 +0200
Add height, weight and birthday to the treeview
.../Gui/TreeView/PlayerPropertiesTreeView.cs | 47 ++++++++++++++++++-
1 files changed, 44 insertions(+), 3 deletions(-)
---
diff --git a/LongoMatch/Gui/TreeView/PlayerPropertiesTreeView.cs b/LongoMatch/Gui/TreeView/PlayerPropertiesTreeView.cs
index ba5f2cd..eb2e505 100644
--- a/LongoMatch/Gui/TreeView/PlayerPropertiesTreeView.cs
+++ b/LongoMatch/Gui/TreeView/PlayerPropertiesTreeView.cs
@@ -50,8 +50,22 @@ namespace LongoMatch.Gui.Component
nameColumn.Title = Catalog.GetString("Name");
Gtk.CellRendererText nameCell = new Gtk.CellRendererText();
nameColumn.PackStart(nameCell, true);
-
-
+
+ Gtk.TreeViewColumn birthdayColumn = new Gtk.TreeViewColumn();
+ birthdayColumn.Title = Catalog.GetString("Birth Day");
+ Gtk.CellRendererText birthdayCell = new Gtk.CellRendererText();
+ birthdayColumn.PackStart(birthdayCell, true);
+
+ Gtk.TreeViewColumn heightColumn = new Gtk.TreeViewColumn();
+ heightColumn.Title = Catalog.GetString("Height");
+ Gtk.CellRendererText heightCell = new Gtk.CellRendererText();
+ heightColumn.PackStart(heightCell, true);
+
+ Gtk.TreeViewColumn weightColumn = new Gtk.TreeViewColumn();
+ weightColumn.Title = Catalog.GetString("Weight");
+ Gtk.CellRendererText weightCell = new Gtk.CellRendererText();
+ weightColumn.PackStart(weightCell, true);
+
Gtk.TreeViewColumn positionColumn = new Gtk.TreeViewColumn();
positionColumn.Title = Catalog.GetString("Position");
Gtk.CellRendererText positionCell = new Gtk.CellRendererText();
@@ -66,11 +80,17 @@ namespace LongoMatch.Gui.Component
nameColumn.SetCellDataFunc(nameCell, new Gtk.TreeCellDataFunc(RenderName));
positionColumn.SetCellDataFunc(positionCell, new Gtk.TreeCellDataFunc(RenderPosition));
numberColumn.SetCellDataFunc(numberCell, new Gtk.TreeCellDataFunc(RenderNumber));
+ heightColumn.SetCellDataFunc(heightCell, new Gtk.TreeCellDataFunc(RenderHeight));
+ weightColumn.SetCellDataFunc(weightCell, new Gtk.TreeCellDataFunc(RenderWeight));
+ birthdayColumn.SetCellDataFunc(birthdayCell, new Gtk.TreeCellDataFunc(RenderBirthday));
AppendColumn(photoColumn);
AppendColumn(nameColumn);
- AppendColumn(positionColumn);
AppendColumn(numberColumn);
+ AppendColumn(positionColumn);
+ AppendColumn(heightColumn);
+ AppendColumn(weightColumn);
+ AppendColumn(birthdayColumn);
}
private void RenderPhoto(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
@@ -101,6 +121,27 @@ namespace LongoMatch.Gui.Component
(cell as Gtk.CellRendererText).Text = player.Number.ToString();
}
+ private void RenderHeight(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
+ {
+ Player player = (Player) model.GetValue(iter, 0);
+
+ (cell as Gtk.CellRendererText).Text = player.Height.ToString();
+ }
+
+ private void RenderWeight(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
+ {
+ Player player = (Player) model.GetValue(iter, 0);
+
+ (cell as Gtk.CellRendererText).Text = player.Weight.ToString();
+ }
+
+ private void RenderBirthday(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
+ {
+ Player player = (Player) model.GetValue(iter, 0);
+
+ (cell as Gtk.CellRendererText).Text = player.Birthday.ToShortDateString();
+ }
+
protected virtual void OnTreeviewRowActivated(object o, Gtk.RowActivatedArgs args)
{
Gtk.TreeIter iter;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]