public CustomizeCellEventArgs(Resco.Controls.AdvancedList.Cell cell, object data, Row dataRow) { this.m_cell = cell.Clone(); this.m_cell.Owner = cell.Owner; this.m_data = data; this.m_dataRow = dataRow; }
public CellEventArgs(Row r, Resco.Controls.AdvancedList.Cell c, int ri, int ci, int yoff) : base(r, ri, yoff) { this.CellIndex = ci; this.Cell = c; if (c != null) { this.CellData = c[r, ci]; } else { this.CellData = null; } }
public LinkEventArgs(Row r, Cell c, int ri, int ci, int yoff) : base(r, c, ri, ci, yoff) { this.Target = ((LinkCell) base.Cell).GetLink(base.CellData); }
private bool LoadDataChunk(bool bDelay) { int height = this.CalculateClientRect().Height; while (this.m_connector.MoveNext()) { Row row = new Row(this.TemplateIndex, this.SelectedTemplateIndex, this.m_connector.Current, this.m_mapLast); row.AlternateTemplateIndex = this.AlternateTemplateIndex; row.ActiveTemplateIndex = this.ActiveTemplateIndex; this.m_iInsertIndex = this.InsertRow(row, this.m_iInsertIndex); height -= row.GetHeight(this.Templates); if (bDelay && (height < 0)) { return false; } } return true; }
public ValidateDataArgs(Row r, int insertIndex) { this.DataRow = r; this.InsertIndex = insertIndex; }
internal void OnRowChange(object sender, RowEventArgsType e, object oParam) { object obj2 = oParam; Row r = (Row) sender; RowTemplate template = this.GetTemplate(r); switch (e) { case RowEventArgsType.Selection: { if (!r.Selected) { if (this.m_cSelected > 0) { this.m_cSelected--; } if (r != this.m_rActive) { break; } this.m_rActive = null; return; } bool flag = (bool) oParam; if (this.m_rActive != null) { this.m_rActive.ChangeSelection(this.Parent.MultiSelect, false, false); } if (!flag) { this.m_cSelected = this.m_pParent.MultiSelect ? (this.m_cSelected + 1) : 1; } this.m_rActive = r; return; } case RowEventArgsType.TemplateIndex: { int num = 0; num = -this.GetTemplate(r, (int) oParam).GetHeight(r); r.ResetCachedBounds(); num += template.GetHeight(r); this.OnChanged(base.List.IndexOf(r), GridEventArgsType.Resize, num); return; } default: if (template.AutoHeight) { int actualHeight = r.ActualHeight; r.ResetCachedBounds(); int height = template.GetHeight(r); if (height != actualHeight) { this.OnChanged(base.List.IndexOf(r), GridEventArgsType.Resize, height - actualHeight); return; } } this.Changed(base.List.IndexOf(sender), GridEventArgsType.RowChange, obj2); break; } }
protected override void OnClearComplete() { base.OnClearComplete(); this.m_cSelected = 0; this.m_rActive = null; this.LastDrawnRow = 0; if (this.Parent != null) { this.Parent.OnClear(this); } }
public void Insert(int index, Row row) { if (row.Parent != null) { throw new ApplicationException("Row can't be in more collections"); } base.List.Insert(index, row); }
internal RowTemplate GetTemplate(Row r) { TemplateSet templates = this.m_pParent.Templates; int count = templates.Count; int currentTemplateIndex = r.CurrentTemplateIndex; if ((currentTemplateIndex >= 0) && (currentTemplateIndex < count)) { return templates[currentTemplateIndex]; } return RowTemplate.Default; }
public virtual int GetAutoHeight(Row r, int index, RowSpecificCellProperties preRscp) { RowSpecificCellProperties properties = (preRscp == null) ? this.GetRowSpecificProperties(r) : preRscp; properties.CachedAutoHeight = this.m_Bounds.Height; return properties.CachedAutoHeight; }
public bool IsSelectable(Row row) { return this.GetRowSpecificProperties(row).Selectable.Value; }
internal int GetCellClick(int pos_x, int pos_y, Row row) { int num = this.m_CellTemplates.Count - 1; while (num >= 0) { RowSpecificCellProperties rowSpecificProperties = this.m_CellTemplates[num].GetRowSpecificProperties(row); if ((rowSpecificProperties.Visible.Value && rowSpecificProperties.CachedBounds.HasValue) && rowSpecificProperties.CachedBounds.Value.Contains(pos_x, pos_y)) { return num; } num--; } return num; }
public object this[Row r, int index] { get { switch (this.m_cellSource.SourceType) { case CellSourceType.Constant: return this.m_cellSource.ConstantData; case CellSourceType.ColumnIndex: { int columnIndex = this.m_cellSource.ColumnIndex; if (columnIndex < 0) { columnIndex = index; } return r[columnIndex]; } case CellSourceType.ColumnName: return r[this.m_cellSource.ColumnName]; } return null; } set { switch (this.m_cellSource.SourceType) { case CellSourceType.ColumnIndex: { int columnIndex = this.m_cellSource.ColumnIndex; if (columnIndex < 0) { columnIndex = index; } r[columnIndex] = value; return; } case (CellSourceType.ColumnIndex | CellSourceType.Constant): break; case CellSourceType.ColumnName: r[this.m_cellSource.ColumnName] = value; break; default: return; } } }
protected internal virtual void Draw(Graphics gr, int xOffset, int yOffset, Row row, int width, int height) { Color colorKey; this.CurrentRow = row; if (height == -1) { height = this.GetHeight(row); } if (this.m_BackColor == Color.Transparent) { if (this.Parent.BackgroundType == BackgroundType.btGradient) { colorKey = this.Parent.m_colorKey; } else { colorKey = this.Parent.BackColor; } } else { colorKey = this.m_BackColor; } if (((this.GradientBackColor != null) && !this.GradientBackColor.CanDraw()) && (this.Parent != null)) { if ((this.Parent.BackgroundType == BackgroundType.btSolid) || (this.m_BackColor != Color.Transparent)) { gr.FillRectangle(Resco.Controls.AdvancedList.AdvancedList.GetBrush(colorKey), xOffset, yOffset, width, height); } } else { this.m_bgRect.X = xOffset; this.m_bgRect.Y = yOffset; this.m_bgRect.Width = width; this.m_bgRect.Height = height; this.m_gradientBackColor.DrawGradient(gr, this.m_bgRect); } int count = this.m_CellTemplates.Count; for (int i = 0; i < count; i++) { Cell cell = this.m_CellTemplates[i]; RowSpecificCellProperties rscp = null; object data = null; if (cell.CustomizeCell && (this.Parent != null)) { rscp = cell.GetRowSpecificProperties(row); if (rscp.Cea != null) { cell = rscp.Cea.Cell; data = rscp.Cea.Data; } } else { data = cell[row, i]; } if (cell is ButtonCell) { ((ButtonCell) cell).Pressed = row.PressedButtonIndex == i; } if ((cell != null) && cell.Visible) { cell.Draw(gr, xOffset, yOffset, width, data, rscp); } if (rscp != null) { rscp.Cea = null; } } }
internal bool CustomizeCells(Row row) { bool flag = false; if (!this.HasCustomizedCells || (this.Parent == null)) { return false; } int count = this.m_CellTemplates.Count; for (int i = 0; i < count; i++) { Cell cell = this.m_CellTemplates[i]; if (cell.CustomizeCell) { object data = cell[row, i]; CustomizeCellEventArgs e = new CustomizeCellEventArgs(cell, data, row); this.OnCustomizeCell(e); RowSpecificCellProperties rowSpecificProperties = cell.GetRowSpecificProperties(row); bool flag2 = rowSpecificProperties.Visible.Value; rowSpecificProperties.Selectable = new bool?(e.Cell.Selectable); rowSpecificProperties.Visible = new bool?(e.Cell.Visible); rowSpecificProperties.CachedAutoHeight = e.Cell.GetAutoHeight(e.DataRow, i, rowSpecificProperties); rowSpecificProperties.Cea = e; if (e.Cell.Visible != flag2) { flag = true; } } } return flag; }
public int GetHeight(Row row) { if (row.RecalculationNeeded) { row.RecalculationNeeded = false; if (!this.AutoHeight) { row.ActualHeight = this.m_iHeight; return this.m_iHeight; } int iHeight = this.m_iHeight; for (int i = 0; i < this.CellTemplates.Count; i++) { Cell cell = this.CellTemplates[i]; if (cell.AutoHeight) { int num3 = ((cell.Anchor & AnchorStyles.Bottom) == AnchorStyles.Bottom) ? cell.m_anchorSizeBottom : 0; iHeight = Math.Max(iHeight, (cell.GetAutoHeight(row, i, null) + cell.Bounds.Top) + num3); } } row.ActualHeight = iHeight; } return row.ActualHeight; }
public bool Contains(Row value) { return base.List.Contains(value); }
protected internal virtual Rectangle CalculateBounds(int xOffset, int yOffset, Row row, int gridWidth, RowSpecificCellProperties preRscp) { Rectangle rectangle; RowSpecificCellProperties rowSpecificProperties = preRscp; if (rowSpecificProperties == null) { rowSpecificProperties = this.GetRowSpecificProperties(row); } if ((rowSpecificProperties != null) && rowSpecificProperties.CachedBounds.HasValue) { rectangle = rowSpecificProperties.CachedBounds.Value; } else { int cachedAutoHeight = 0; if ((rowSpecificProperties != null) && (rowSpecificProperties.CachedAutoHeight >= 0)) { cachedAutoHeight = rowSpecificProperties.CachedAutoHeight; } rectangle = this.CalculateCellWidth(gridWidth); if (this.AutoHeight && (cachedAutoHeight > this.m_Bounds.Height)) { rectangle.Height = cachedAutoHeight; } if ((this.Anchor & AnchorStyles.Bottom) == AnchorStyles.Bottom) { if ((this.Anchor & AnchorStyles.Top) == AnchorStyles.Top) { rectangle.Height = row.ActualHeight - (this.m_anchorSizeTop + this.m_anchorSizeBottom); if (rectangle.Height < 0) { rectangle.Height = 0; } } else { rectangle.Y = row.ActualHeight - (this.m_anchorSizeBottom + rectangle.Height); if (rectangle.Y < 0) { rectangle.Y = 0; } } } else if (rectangle.Bottom > row.ActualHeight) { rectangle.Height = row.ActualHeight - rectangle.Y; } if ((this.Parent != null) ? this.Parent.RightToLeft : false) { rectangle.X = gridWidth - rectangle.Right; } if (rowSpecificProperties != null) { rowSpecificProperties.CachedBounds = new Rectangle?(rectangle); } } rectangle.Offset(xOffset, yOffset); return rectangle; }
public int IndexOf(Row row) { return base.List.IndexOf(row); }
internal RowSpecificCellProperties GetRowSpecificProperties(Row row) { RowSpecificCellProperties properties = null; if (row != null) { properties = (RowSpecificCellProperties) row.RowSpecificCellProperties[this]; if (properties == null) { properties = new RowSpecificCellProperties(this); row.RowSpecificCellProperties[this] = properties; } } return properties; }
public void Remove(Row row) { base.List.Remove(row); }
public RowEventArgs(Row r, int i, int yoff) { this.DataRow = r; this.RowIndex = i; this.Offset = yoff; }
internal RowTemplate GetTemplate(Row r, int ix) { TemplateSet templates = this.m_pParent.Templates; int count = templates.Count; if ((ix >= 0) && (ix < count)) { return templates[ix]; } return RowTemplate.Default; }
public int Add(Row row) { if (row.Parent != null) { throw new ApplicationException("Row can't be in more collections"); } return base.List.Add(row); }
internal void ResetSelected() { for (int i = 0; i < base.List.Count; i++) { ((Row) base.InnerList[i]).Selected = false; } this.m_cSelected = 0; this.m_rActive = null; }
protected void OnRowSelect(Row row, int index, int yOffset, bool bSelectedChanged, bool bActiveChanged) { yOffset = this.EnsureVisible(index, false); if ((this.RowSelect != null) && bSelectedChanged) { this.RowSelect(this, new RowEventArgs(row, index, yOffset)); } if (this.m_rcRows != null) { if ((this.m_innerListManager != null) && (this.ActiveRowIndex != -1)) { this.m_innerListManager.PositionChanged -= new EventHandler(this.m_innerListManager_PositionChanged); this.m_innerListManager.Position = this.ActiveRowIndex; this.m_innerListManager.PositionChanged += new EventHandler(this.m_innerListManager_PositionChanged); } if (bActiveChanged && (this.ActiveRowChanged != null)) { this.ActiveRowChanged(this, EventArgs.Empty); } } }
protected override void OnRemoveComplete(int index, object value) { base.OnRemoveComplete(index, value); for (int i = index; i < base.Count; i++) { Row row1 = this[i]; row1.m_index--; } Row row = value as Row; if (row != null) { if (this.Parent != null) { this.Parent.OnRowRemoved(row, index); } row.Parent = null; if (row.Selected) { if (row.Active) { this.m_rActive = null; } if (this.m_cSelected > 0) { this.m_cSelected--; } } } }
private int CustomizeHeaderFooter(RowTemplate t, Row r, ref bool bResetScrollbar) { int num2 = -1; if (t.CustomizeCells(r)) { num2 = t.GetHeight(r); r.ResetCachedBounds(); } int height = t.GetHeight(r); if ((num2 >= 0) && (height != num2)) { bResetScrollbar = true; } return height; }
public override int GetAutoHeight(Row r, int index, RowSpecificCellProperties preRscp) { int num = 0; if (!base.AutoHeight) { return base.Bounds.Height; } RowSpecificCellProperties properties = (preRscp == null) ? base.GetRowSpecificProperties(r) : preRscp; if (properties.CachedAutoHeight >= 0) { return properties.CachedAutoHeight; } string text = this.GetText(base[r, index]); if (((text == null) || (text.Length == 0)) || !properties.Visible.Value) { return 0; } int gridWidth = 0; Resco.Controls.AdvancedList.AdvancedList parent = base.Parent; if (parent != null) { gridWidth = parent.CalculateClientRect().Width - (parent.ScrollbarVisible ? parent.ScrollbarWidth : 0); } if (gridWidth != 0) { Rectangle rectangle = base.CalculateCellWidth(gridWidth); rectangle.Width -= 3; if (rectangle.Width > base.Parent.ScrollbarWidth) { Graphics gr = base.Graphics; bool flag = false; if ((gr == null) && (base.Parent != null)) { gr = base.Parent.CreateGraphics(); flag = true; } WrapTextData data = Utility.WrapText(gr, text, this.m_Font, rectangle.Width); if ((gr != null) && flag) { gr.Dispose(); } num = (data != null) ? (data.Height + 2) : 0; } } properties.CachedAutoHeight = num; return num; }
public Row(Row toCopy) : this(toCopy.TemplateIndex, toCopy.SelectedTemplateIndex, toCopy, toCopy.FieldNames) { }