Inheritance: CanvasItem
        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.BindListItem(item);
            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.Render(cell_context, dragging ? StateType.Normal : state, area.Width, area.Height);
            cairo_context.Restore();

            AccessibleCellRedrawn(column_index, row_index);
        }
Exemple #2
0
        private void PaintHeaderCell(Cairo.Context cr, Rectangle area, int ci, bool dragging, ref bool have_drawn_separator)
        {
            if (ci < 0 || column_cache.Length <= ci)
            {
                return;
            }

            if (ci == ActiveColumn && HasFocus && HeaderFocused)
            {
                Theme.DrawColumnHeaderFocus(cr, area);
            }

            if (dragging)
            {
                Cairo.Color dark_color = CairoExtensions.GdkRGBAToCairoColor(StyleContext.GetBackgroundColor(StateFlags.Normal));
                dark_color = CairoExtensions.ColorShade(dark_color, 0.7);

                Theme.DrawColumnHighlight(cr, area, dark_color);

                StyleContext.Save();
                StyleContext.AddClass("entry");
                Cairo.Color base_color = CairoExtensions.GdkRGBAToCairoColor(StyleContext.GetBackgroundColor(StateFlags.Normal));
                StyleContext.Restore();

                Cairo.Color stroke_color = CairoExtensions.ColorShade(base_color, 0.0);
                stroke_color.A = 0.3;

                cr.Color = stroke_color;
                cr.MoveTo(area.X + 0.5, area.Y + 1.0);
                cr.LineTo(area.X + 0.5, area.Bottom);
                cr.MoveTo(area.Right - 0.5, area.Y + 1.0);
                cr.LineTo(area.Right - 0.5, area.Bottom);
                cr.Stroke();
            }

            ColumnCell cell = column_cache[ci].Column.HeaderCell;

            if (cell != null)
            {
                cr.Save();
                cr.Translate(area.X, area.Y);
                cell_context.Area  = area;
                cell_context.State = StateFlags.Normal;
                cell.Render(cell_context, area.Width, area.Height);
                cr.Restore();
            }

            if (!dragging && ci < column_cache.Length - 1 && (have_drawn_separator ||
                                                              column_cache[ci].MaxWidth != column_cache[ci].MinWidth))
            {
                have_drawn_separator = true;
                Theme.DrawHeaderSeparator(cr, area, area.Right);
            }
        }
        private void PaintHeaderCell(Rectangle area, int ci, bool dragging, ref bool have_drawn_separator)
        {
            if (ci < 0 || column_cache.Length <= ci)
            {
                return;
            }

            if (ci == ActiveColumn && HasFocus && HeaderFocused)
            {
                Theme.DrawColumnHeaderFocus(cairo_context, area);
            }

            if (dragging)
            {
                Theme.DrawColumnHighlight(cairo_context, area,
                                          CairoExtensions.ColorShade(Theme.Colors.GetWidgetColor(GtkColorClass.Dark, StateType.Normal), 0.9));

                Cairo.Color stroke_color = CairoExtensions.ColorShade(Theme.Colors.GetWidgetColor(
                                                                          GtkColorClass.Base, StateType.Normal), 0.0);
                stroke_color.A = 0.3;

                cairo_context.Color = stroke_color;
                cairo_context.MoveTo(area.X + 0.5, area.Y + 1.0);
                cairo_context.LineTo(area.X + 0.5, area.Bottom);
                cairo_context.MoveTo(area.Right - 0.5, area.Y + 1.0);
                cairo_context.LineTo(area.Right - 0.5, area.Bottom);
                cairo_context.Stroke();
            }

            ColumnCell cell = column_cache[ci].Column.HeaderCell;

            if (cell != null)
            {
                cairo_context.Save();
                cairo_context.Translate(area.X, area.Y);
                cell_context.Area  = area;
                cell_context.State = StateType.Normal;
                cell.Render(cell_context, area.Width, area.Height);
                cairo_context.Restore();
            }

            if (!dragging && ci < column_cache.Length - 1 && (have_drawn_separator ||
                                                              column_cache[ci].MaxWidth != column_cache[ci].MinWidth))
            {
                have_drawn_separator = true;
                Theme.DrawHeaderSeparator(cairo_context, area, area.Right);
            }
        }
Exemple #4
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);
        }
Exemple #5
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);
        }
 protected virtual void ColumnCellDataProvider(ColumnCell cell, object boundItem)
 {
 }
        public static SortableColumn Create(QueryField field, double width, bool visible, ColumnCell cell)
        {
            cell.Property = field.PropertyName;
            SortableColumn col = new SortableColumn (
                field.ShortLabel,
                cell,
                width, field.Name, visible
            );
            col.LongTitle = field.Label;
            col.Field = field;

            return col;
        }
Exemple #8
0
        private void PaintHeaderCell(Cairo.Context cr, Rectangle area, int ci, bool dragging)
        {
            if (ci < 0 || column_cache.Length <= ci)
            {
                return;
            }

            var column_flags = new RegionFlags();

            if (ci == sort_column_index)
            {
                column_flags |= RegionFlags.Sorted;
            }
            if (ci == 0)
            {
                column_flags |= RegionFlags.First;
            }
            if (ci == (column_cache.Length - 1))
            {
                column_flags |= RegionFlags.Last;
            }
            // First column should be odd, but ci starts at 0
            if ((ci + 1) % 2 == 0)
            {
                column_flags |= RegionFlags.Even;
            }
            else
            {
                column_flags |= RegionFlags.Odd;
            }

            StyleContext.Save();
            // RegionFlags.Last is not applied, see https://bugzilla.gnome.org/show_bug.cgi?id=731463
            StyleContext.AddRegion("column-header", column_flags);
            StyleContext.AddClass("button");
            if (dragging)
            {
                // This is not applied in Adwaita, see https://bugzilla.gnome.org/show_bug.cgi?id=731663
                StyleContext.AddClass("dnd");
            }
            StyleContext.RenderBackground(cr, area.X, area.Y, area.Width, area.Height);
            StyleContext.RenderFrame(cr, area.X, area.Y, area.Width, area.Height);

            if (ci == ActiveColumn && HasFocus && HeaderFocused)
            {
                var border   = StyleContext.GetBorder(StyleContext.State);
                var f_x      = area.X + border.Left;
                var f_y      = area.Y + border.Top;
                var f_width  = area.Width - border.Left - border.Right;
                var f_height = area.Height - border.Top - border.Bottom;
                StyleContext.RenderFocus(cr, f_x, f_y, f_width, f_height);
            }

            ColumnCell cell = column_cache[ci].Column.HeaderCell;

            if (cell != null)
            {
                cr.Save();
                cr.Translate(area.X, area.Y);
                cell_context.Area     = area;
                cell_context.Selected = false;
                cell.Render(cell_context, area.Width, area.Height);
                cr.Restore();
            }

            StyleContext.Restore();
        }
Exemple #9
0
 public SortableColumn(ColumnCell header_cell, string title, ColumnCell cell, double width, string sort_key, bool visible) :
     base(header_cell, title, cell, width, visible)
 {
     this.sort_key = sort_key;
 }
Exemple #10
0
 public SortableColumn(ColumnCell header_cell, string title, ColumnCell cell, double width, string sort_key, bool visible) :
     base(header_cell, title, cell, width, visible)
 {
     this.sort_key = sort_key;
 }
		public CS_Column (string id,string t,ColumnCell c,double w) : base(t,c,w)
		{
			_id=id;
		}