Contains information about the current state of a grouping Cell.
Example #1
0
        /// <summary>
        /// Gets the GroupRendererData specific data used by the Renderer from
        /// the specified Cell
        /// </summary>
        /// <param name="cell">The Cell to get the GroupRendererData data for</param>
        /// <returns>The GroupRendererData data for the specified Cell</returns>
        protected GroupRendererData GetGroupRendererData(Cell cell)
        {
            object rendererData = this.GetRendererData(cell);

            if (rendererData == null || !(rendererData is GroupRendererData))
            {
                rendererData = new GroupRendererData();

                this.SetRendererData(cell, rendererData);
            }

            return((GroupRendererData)rendererData);
        }
Example #2
0
        private void ToggleState(CellMouseEventArgs e)
        {
            GroupRendererData data = this.GetGroupRendererData(e.Cell);

            // Toggle the group state
            data.Grouped = !data.Grouped;

            Row r = e.Table.TableModel.Rows[e.Row];

            r.ExpandSubRows = !r.ExpandSubRows;

            e.Table.Invalidate();
        }
Example #3
0
        /// <summary>
        /// Raises the Paint event
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPaint(PaintCellEventArgs e)
        {
            base.OnPaint(e);

            // don't bother if the Cell is null
            if (e.Cell == null)
            {
                return;
            }

            Rectangle checkRect = this.CalcCheckRect(this.LineAlignment, this.Alignment);

            if (!this.IsSubRow(e.Cell))
            {
                GroupRendererData data = this.GetGroupRendererData(e.Cell);

                DrawBox(e.Graphics, this.LineColorPen, checkRect);

                if (data.Grouped)
                {
                    DrawCross(e.Graphics, Pens.Gray, checkRect);
                }
                else
                {
                    DrawMinus(e.Graphics, Pens.Gray, checkRect);
                    DrawHalfLine2(e.Graphics, this.LineColorPen, checkRect);
                }
            }
            else
            {
                if (this.IsLastRow(e.Cell))
                {
                    DrawEndLine2(e.Graphics, this.LineColorPen, checkRect);
                }
                else
                {
                    DrawLine2(e.Graphics, this.LineColorPen, checkRect);
                }
            }

            #region Draw text
            if (this.drawText)
            {
                string text = e.Cell.Text;

                if (text != null && text.Length != 0)
                {
                    Rectangle textRect = this.ClientRectangle;
                    textRect.X     += checkRect.Width + 1;
                    textRect.Width -= checkRect.Width + 1;

                    if (e.Enabled)
                    {
                        e.Graphics.DrawString(e.Cell.Text, this.Font, this.ForeBrush, textRect, this.StringFormat);
                    }
                    else
                    {
                        e.Graphics.DrawString(e.Cell.Text, this.Font, this.GrayTextBrush, textRect, this.StringFormat);
                    }
                }
            }
            #endregion
        }
Example #4
0
        /// <summary>
        /// Gets the GroupRendererData specific data used by the Renderer from 
        /// the specified Cell
        /// </summary>
        /// <param name="cell">The Cell to get the GroupRendererData data for</param>
        /// <returns>The GroupRendererData data for the specified Cell</returns>
        protected GroupRendererData GetGroupRendererData(Cell cell)
        {
            object rendererData = this.GetRendererData(cell);

            if (rendererData == null || !(rendererData is GroupRendererData))
            {
                rendererData = new GroupRendererData();

                this.SetRendererData(cell, rendererData);
            }

            return (GroupRendererData) rendererData;
        }