private void PaintCell(object item, int column_index, int row_index, Rectangle area, bool opaque, bool bold,
                               StateType state, bool dragging)
        {
            ColumnCell cell = column_cache[column_index].Column.GetCell(0);

            cell.Bind(item);
            cell.Manager = manager;
            ColumnCellDataProvider(cell, item);

            ITextCell text_cell = cell as ITextCell;

            if (text_cell != null)
            {
                text_cell.FontWeight = bold ? Pango.Weight.Bold : Pango.Weight.Normal;
            }

            if (dragging)
            {
                Cairo.Color fill_color = Theme.Colors.GetWidgetColor(GtkColorClass.Base, StateType.Normal);
                fill_color.A        = 0.5;
                cairo_context.Color = fill_color;
                cairo_context.Rectangle(area.X, area.Y, area.Width, area.Height);
                cairo_context.Fill();
            }

            cairo_context.Save();
            cairo_context.Translate(area.X, area.Y);
            cell_context.Area   = area;
            cell_context.Opaque = opaque;
            cell_context.State  = dragging ? StateType.Normal : state;
            cell.Render(cell_context, area.Width, area.Height);
            cairo_context.Restore();

            AccessibleCellRedrawn(column_index, row_index);
        }
示例#2
0
        #pragma warning disable 0169

        private bool GetEventCell <G> (int x, int y, out G icell, out Column column, out int row_index) where G : class
        {
            icell     = null;
            column    = null;
            row_index = 0;

            if (Model == null)
            {
                return(false);
            }

            x -= list_interaction_alloc.X;
            y -= list_interaction_alloc.Y;

            row_index = GetModelRowAt(x, y);
            if (row_index < 0 || row_index >= Model.Count)
            {
                return(false);
            }

            column = GetColumnAt(x);
            if (column == null)
            {
                return(false);
            }

            ColumnCell cell = column.GetCell(0);

            icell = cell as G;
            if (icell == null)
            {
                return(false);
            }

            // Bind the row to the cell
            cell.Bind(model[row_index]);
            return(true);
        }
示例#3
0
        private void PaintCell(Cairo.Context cr, object item, int column_index, int row_index, Rectangle area, bool opaque, bool bold,
                               StateFlags state, bool dragging)
        {
            ColumnCell cell = column_cache[column_index].Column.GetCell(0);

            cell.Bind(item);
            cell.Manager = manager;
            ColumnCellDataProvider(cell, item);

            ITextCell text_cell = cell as ITextCell;

            if (text_cell != null)
            {
                text_cell.FontWeight = bold ? Pango.Weight.Bold : Pango.Weight.Normal;
            }

            if (dragging)
            {
                StyleContext.Save();
                StyleContext.AddClass("entry");
                Cairo.Color fill_color = CairoExtensions.GdkRGBAToCairoColor(StyleContext.GetBackgroundColor(StateFlags.Normal));
                StyleContext.Restore();
                fill_color.A = 0.5;
                cr.Color     = fill_color;
                cr.Rectangle(area.X, area.Y, area.Width, area.Height);
                cr.Fill();
            }

            cr.Save();
            cr.Translate(area.X, area.Y);
            cell_context.Area   = area;
            cell_context.Opaque = opaque;
            cell_context.State  = dragging ? StateFlags.Normal : state;
            cell.Render(cell_context, area.Width, area.Height);
            cr.Restore();

            AccessibleCellRedrawn(column_index, row_index);
        }