Example #1
0
        internal static NSTableCellView GetNativeCell(NSTableView tableView, Cell cell, bool recycleCells = false)
        {
            string fullName = ((object)cell).GetType().FullName;

            CellRenderer cellRenderer = (CellRenderer)Registrar.Registered.GetHandler(cell.GetType());

            ContextActionsCell contextActionsCell = (ContextActionsCell)null;
            NSTableCellView    reusableCell       = null;

            if (cell.HasContextActions | recycleCells)
            {
                // Not for Mac
                //contextActionsCell = (ContextActionsCell)tableView.DequeueReusableCell ("ContextActionsCell");
                if (contextActionsCell == null)
                {
                    contextActionsCell = new ContextActionsCell();
                    reusableCell       = new NSTableCellView();

                    //reusableCell = tableView.DequeueReusableCell (fullName);
                }

                /*
                 * else
                 * {
                 *      contextActionsCell.Close ();
                 *      reusableCell = contextActionsCell.ContentCell;
                 *      if (reusableCell.ReuseIdentifier.ToString () != fullName)
                 *              reusableCell = null;
                 * }
                 */
            }
            else
            {
                //reusableCell = tableView.DequeueReusableCell (fullName);
                reusableCell = new NSTableCellView();
            }

            NSTableView     tv         = tableView;
            NSTableCellView nativeCell = cellRenderer.GetCell(cell, reusableCell, tv);


            if (nativeCell.Layer.Hidden)
            {
                nativeCell.Layer.Hidden = false;
            }
            if (contextActionsCell != null)
            {
                contextActionsCell.Update(tableView, cell, nativeCell);
                nativeCell = (NSTableCellView)contextActionsCell;
            }
            if (nativeCell != null)
            {
                nativeCell.Layout();
            }

            return(nativeCell);
        }
Example #2
0
            private static void SetCellBackgroundColor(NSTableCellView cell, NSColor color)
            {
                ContextActionsCell contextActionsCell = cell as ContextActionsCell;

                cell.SetBackgroundColor(color);
                if (contextActionsCell == null)
                {
                    return;
                }
                contextActionsCell.ContentCell.SetBackgroundColor(color);
            }