Type casting notation in definition of a method's arguments
Submitted by car..@..oo.com
Link to original bug (#650226)
Description
It could be convenient to do type casting with notation directly in the function definition. In this example, the "text" property is not defined in Gtk.CellRenderer but it is in subclass Gtk.CellRendererText. Thus a type cast is needed.
/* The delegate. */ public void TreeCellDataFunc (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter);
/* The callback function, with current enforcements. */ public void my_celldata_func (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter) { CellRendererText textcell = (CellRendererText) cell;// This line could be avoided textcell.text = "my dynamic text"; textcell.font = "Bitstream Vera Sans 10"; }
/* The callback function with suggested casting for the "cell" argument. */ public void my_celldata_func (TreeViewColumn tree_column, CellRenderer cell as CellRendererText, TreeModel tree_model, TreeIter iter) { cell.text = "my dynamic text"; cell.font = "Bitstream Vera Sans 10"; }
Version: 0.12.x