protected void IconDataFunc(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter) { CellRendererPixbuf renderer = cell as CellRendererPixbuf; Do.Universe.Item o = (resultsTreeview.Model as ListStore).GetValue(iter, 0) as Do.Universe.Item; bool isSecondary = false; foreach (int i in secondary) { if (model.GetStringFromIter(iter) == i.ToString()) { isSecondary = true; } } Gdk.Pixbuf final; if (isSecondary) { using (Gdk.Pixbuf source = IconProvider.PixbufFromIconName(o.Icon, DefaultResultIconSize)) using (Gdk.Pixbuf emblem = IconProvider.PixbufFromIconName("gtk-add", DefaultResultIconSize)) { final = new Pixbuf(Colorspace.Rgb, true, 8, DefaultResultIconSize, DefaultResultIconSize); source.CopyArea(0, 0, source.Width, source.Height, final, 0, 0); emblem.Composite(final, 0, 0, DefaultResultIconSize, DefaultResultIconSize, 0, 0, 1, 1, InterpType.Bilinear, 220); } } else { final = IconProvider.PixbufFromIconName(o.Icon, DefaultResultIconSize); } renderer.Pixbuf = final; final.Dispose(); }
/** Return the row index of the iter in the model. * Since we only work with flat models (no children), * the path is a single number. */ public static int IterGetRow(TreeModel model, TreeIter iter) { #if DEBUG Console.WriteLine("TreeviewHelper.IterGetRow"); #endif string path = model.GetStringFromIter (iter); //gint row_idx = (gint)g_ascii_strtod(path, NULL); // Is following correct? int rowIndex = -1; Int32.TryParse (path, out rowIndex); return rowIndex; }