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:
parent
6002d77051
commit
089c820cb7
2 changed files with 8 additions and 12 deletions
|
@ -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>
|
2009-08-05 Christian Hoff <christian_hoff@gmx.net>
|
||||||
|
|
||||||
* generator/InterfaceGen: Override CallByName to handle interface
|
* generator/InterfaceGen: Override CallByName to handle interface
|
||||||
|
|
|
@ -15,7 +15,8 @@ public class CustomCellRenderer : CellRenderer
|
||||||
{
|
{
|
||||||
|
|
||||||
private float percent;
|
private float percent;
|
||||||
|
|
||||||
|
[GLib.Property ("percent")]
|
||||||
public float Percentage
|
public float Percentage
|
||||||
{
|
{
|
||||||
get {
|
get {
|
||||||
|
@ -83,12 +84,6 @@ public class Driver : Gtk.Window
|
||||||
}
|
}
|
||||||
|
|
||||||
ListStore liststore;
|
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")
|
public Driver () : base ("CustomCellRenderer")
|
||||||
{
|
{
|
||||||
|
@ -101,11 +96,7 @@ public class Driver : Gtk.Window
|
||||||
TreeView view = new TreeView (liststore);
|
TreeView view = new TreeView (liststore);
|
||||||
|
|
||||||
view.AppendColumn ("Progress", new CellRendererText (), "text", 1);
|
view.AppendColumn ("Progress", new CellRendererText (), "text", 1);
|
||||||
|
view.AppendColumn ("Progress", new CustomCellRenderer (), "percent", 0);
|
||||||
//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));
|
|
||||||
|
|
||||||
this.Add (view);
|
this.Add (view);
|
||||||
this.ShowAll ();
|
this.ShowAll ();
|
||||||
|
|
Loading…
Reference in a new issue