/// <summary> /// Sets the contents of a cell being display on a grid /// </summary> /// <param name="col"></param> /// <param name="cell"></param> /// <param name="model"></param> /// <param name="iter"></param> public void RenderActivityStatus(TreeViewColumn col, CellRenderer cell, ITreeModel model, TreeIter iter) { TreePath path = model.GetPath(iter); int rowNo = path.Indices[0]; int colNo; string text = String.Empty; if (colLookup.TryGetValue(cell, out colNo) && rowNo < this.DataSource.Rows.Count && colNo < this.DataSource.Columns.Count) { object dataVal = this.DataSource.Rows[rowNo][colNo]; cell.Visible = true; string iconName = "blank"; switch (dataVal.ToString()) { case "Success": iconName = "Success"; break; case "Partial": iconName = "Partial"; break; case "Ignored": iconName = "NoTask"; break; case "Critical": iconName = "Critical"; break; case "Timer": iconName = "Timer"; break; case "Calculation": iconName = "Calculation"; break; case "NotNeeded": iconName = "NotNeeded"; break; case "Warning": iconName = "Ignored"; break; case "NoTask": iconName = "NoTask"; break; } (cell as CellRendererPixbuf).Pixbuf = new Gdk.Pixbuf(null, "ApsimNG.Resources.MenuImages." + iconName + ".png"); } }
private void renderCol(TreeViewColumn column, CellRenderer cell, ITreeModel model, TreeIter iter) { if (model.GetPath(iter).Indices[0] % 2 == 0) { cell.CellBackground = "#e6e9ef"; } else { cell.CellBackground = "#FFFFFF"; } }
/// <summary> /// Sets the contents of a cell being display on a grid /// </summary> /// <param name="col"></param> /// <param name="cell"></param> /// <param name="model"></param> /// <param name="iter"></param> public void OnSetCellData(TreeViewColumn col, CellRenderer cell, ITreeModel model, TreeIter iter) { TreePath path = model.GetPath(iter); Gtk.TreeView view = col.TreeView as Gtk.TreeView; int rowNo = path.Indices[0]; int colNo; string text = String.Empty; if (colLookup.TryGetValue(cell, out colNo) && rowNo < this.DataSource.Rows.Count && colNo < this.DataSource.Columns.Count) { object dataVal = this.DataSource.Rows[rowNo][colNo]; text = AsString(dataVal); } cell.Visible = true; (cell as CellRendererText).Text = text; }
/* Cell Renderers */ private void RenderNumberCell(TreeViewColumn column, CellRenderer cell, ITreeModel treeModel, TreeIter iter) { (cell as CellRendererText).Text = (Util.PathToInt(treeModel.GetPath(iter)) + 1).ToString(); }