2009-08-05 Christian Hoff <christian_hoff@gmx.net>

* sample/CustomcellRenderer.cs: Use GObject property registration
	instead of a CellDataFunc.

svn path=/trunk/gtk-sharp/; revision=139406
This commit is contained in:
Christian Hoff 2009-08-05 15:23:43 +00:00
parent 6002d77051
commit 089c820cb7
2 changed files with 8 additions and 12 deletions

View file

@ -1,3 +1,8 @@
2009-08-05 Christian Hoff <christian_hoff@gmx.net>
* sample/CustomcellRenderer.cs: Use GObject property registration
instead of a CellDataFunc.
2009-08-05 Christian Hoff <christian_hoff@gmx.net>
* generator/InterfaceGen: Override CallByName to handle interface

View file

@ -15,7 +15,8 @@ public class CustomCellRenderer : CellRenderer
{
private float percent;
[GLib.Property ("percent")]
public float Percentage
{
get {
@ -83,12 +84,6 @@ public class Driver : Gtk.Window
}
ListStore liststore;
void ProgressData (Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel tree_model, Gtk.TreeIter iter)
{
float perc = (float) liststore.GetValue (iter, 0);
((CustomCellRenderer)cell).Percentage = perc;
}
public Driver () : base ("CustomCellRenderer")
{
@ -101,11 +96,7 @@ public class Driver : Gtk.Window
TreeView view = new TreeView (liststore);
view.AppendColumn ("Progress", new CellRendererText (), "text", 1);
//Note: This *MUST* be done here, as its the only place Progress is
//accessible. Maybe there should be an attribute that will do some
//magic for you and register a property with the gobject system.
view.AppendColumn ("Progress", new CustomCellRenderer (), new TreeCellDataFunc (ProgressData));
view.AppendColumn ("Progress", new CustomCellRenderer (), "percent", 0);
this.Add (view);
this.ShowAll ();