Esempio n. 1
0
        /// <summary>
        /// Invoked for every cell in grid.
        /// </summary>
        /// <param name="col">The column.</param>
        /// <param name="cell">The cell.</param>
        /// <param name="model">The tree model.</param>
        /// <param name="iter">The tree iterator.</param>
        public void OnFormatColumn(TreeViewColumn col, CellRenderer baseCell, TreeModel model, TreeIter iter)
        {
            TreePath path     = tree.Model.GetPath(iter);
            int      rowIndex = path.Indices[0];
            int      colIndex = DataSource.Columns.IndexOf(col.Title);

            CellRendererDescription renderDetails = CellRenderDetails.Find(c => c.ColumnIndex == colIndex && c.RowIndex == rowIndex);

            if (renderDetails != null)
            {
                var cell = baseCell as CellRendererText;
                cell.Strikethrough = renderDetails.StrikeThrough;
                if (renderDetails.Bold)
                {
                    cell.Weight = (int)Pango.Weight.Bold;
                }
                if (renderDetails.Italics)
                {
                    cell.Font = "Sans Italic";
                }
                cell.Foreground = renderDetails.Colour.Name; // ?
            }
            else if (baseCell is CellRendererText)
            {
                var cell = baseCell as CellRendererText;
                cell.Strikethrough = false;
                cell.Weight        = (int)Pango.Weight.Normal;
                cell.Font          = "Normal";
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Invoked for every cell in grid.
        /// </summary>
        /// <param name="col">The column.</param>
        /// <param name="cell">The cell.</param>
        /// <param name="model">The tree model.</param>
        /// <param name="iter">The tree iterator.</param>
        private void OnFormatColumn(TreeViewColumn col, CellRenderer baseCell, TreeModel model, TreeIter iter)
        {
            try
            {
                if (CellRenderDetails != null)
                {
                    TreePath path = tree.Model.GetPath(iter);
                    if (path != null)
                    {
                        int rowIndex = path.Indices[0];
                        int colIndex = columns.FindIndex(c => c.Title == col.Title);

                        CellRendererDescription renderDetails = CellRenderDetails.Find(c => c.ColumnIndex == colIndex && c.RowIndex == rowIndex);
                        if (renderDetails != null)
                        {
                            var cell = baseCell as CellRendererText;
                            cell.Strikethrough = renderDetails.StrikeThrough;
                            if (renderDetails.Bold)
                                cell.Weight = (int)Pango.Weight.Bold;
                            if (renderDetails.Italics)
                                cell.Font = "Sans Italic";
                            cell.Foreground = renderDetails.Colour.Name; // ?
                        }
                        else if (baseCell is CellRendererText)
                        {
                            var cell = baseCell as CellRendererText;
                            cell.Strikethrough = false;
                            cell.Weight = (int)Pango.Weight.Normal;
                            cell.Font = "Normal";
                        }
                    }
                }
            }
            catch (Exception err)
            {
                ShowError(err);
            }
        }