protected virtual bool IsBandPositionValid(ColumnInfo ci) { if (ci == null || ci.Column == null) { return(false); } MyTreeListBandInfo bi = ColumnInfoToBandInfo(ci); if (SourceBandInfo != null) { if (bi == null) { return(SourceBandInfo.Band.IsBrother(ci.Column)); } else { return((SourceBandInfo.Band.IsBrother(bi.Band)) && (SourceBandInfo.Band != bi.Band)); } } else { if (bi == null) { return(TreeList.Bands.IsBrotherColumns(SourceInfo.Column, ci.Column)); } else { return(bi.Band.IsBrother(SourceInfo.Column)); } } }
public override void CalcColumnInfo(ColumnInfo ci, ref int left, bool customization) { int offset = 0; base.CalcColumnInfo(ci, ref offset, customization); if (ci.Type == ColumnInfo.ColumnInfoType.Column) { MyTreeListBand ParentBand = TreeList.Bands.GetColumnParentBand(ci.Column); if (ParentBand == null) { ci.Bounds = Rectangle.Empty; return; } MyTreeListBandInfo bi = new MyTreeListBandInfo(ParentBand); bi.CalcBandInfo(this); int VisiblePosition = ParentBand.GetColumnIndex(ci.Column); if (ParentBand.BandColumn == ci.Column) { ci.Bounds = bi.Bounds; ci.CaptionRect = new Rectangle(left + 4, 0, bi.Bounds.Width, bi.Bounds.Height); if (BandLinks.ContainsKey(ci.Column)) { BandLinks[ci.Column] = bi; } else { BandLinks.Add(ci.Column, bi); } } else { int X = bi.Bounds.X; for (int i = 0; i < VisiblePosition; i++) { TreeListColumn Col = ParentBand.GetColumn(i); if ((Col != null) && Col.Visible) { X += Col.Width; } } int Y = bi.Bounds.Bottom - 1; int Width = ci.Column.Width; int Height = BandHeight * (BandMaxLevel - ParentBand.Level); ci.Bounds = new Rectangle(X, Y, Width, Height); ci.CaptionRect = new Rectangle(left + 4, 0, Width, Height); ColCount++; left += Width; } } else { left += offset; } UpdateGlyphInfo(ci); ObjectPainter.CalcObjectBounds(GInfo.Graphics, TreeList.ElementsLookAndFeel.Painter.Header, ci); }
protected MyTreeListBandInfo ColumnInfoToBandInfo(ColumnInfo ci) { MyTreeListBandInfo bi = ci as MyTreeListBandInfo; if ((bi == null) && ViewInfo.BandLinks.ContainsKey(ci.Column)) { bi = ViewInfo.BandLinks[ci.Column]; } return(bi); }
protected internal virtual MyTreeListBandInfo GetBandInfoByPoint(Point pt) { foreach (ColumnInfo ci in ColumnsInfo.Columns) { MyTreeListBandInfo bi = ci as MyTreeListBandInfo; if ((bi != null) && (bi.Bounds.Contains(pt))) { return(bi); } } return(null); }
protected virtual void CalcBandsInfo() { foreach (MyTreeListBand B in TreeList.Bands) { if ((B.Level > 0) && B.Visible && B.BandColumn == null) { MyTreeListBandInfo bi = new MyTreeListBandInfo(B); bi.CalcBandInfo(this); ColumnsInfo.Columns.Add(bi); } } }
protected virtual bool IsDragPositionValid(int index, HitInfoType ht, ColumnInfo ci) { if (ci.Column != null) { MyTreeListBandInfo bi = ColumnInfoToBandInfo(ci); bool inColumn = ht == HitInfoType.Column; if (bi != null) { return(ht == HitInfoType.Column && bi.Band.ThisContainColumn(SourceInfo.Column) && bi.Band.ThisContainColumn(ci.Column)); } return(inColumn); } return(false); }
public override TreeListHitTest GetHitTest(Point pt) { if (ViewRects.ColumnPanel.Contains(pt)) { MyTreeListBandInfo bi = GetBandInfoByPoint(pt); if (bi != null) { TreeListHitTest ht = new TreeListHitTest(); ht.ColumnInfo = bi; ht.HitInfoType = HitInfoType.Column; return(ht); } } return(base.GetHitTest(pt)); }
public override void DoEndColumnDragging(Point p, HitInfoType ht) { Data.DragMaster.EndDrag(); if (LastPosition != null && ht != HitInfoType.CustomizationForm && !IsInCustomizationZone(p)) { MyPositionInfo pos = new MyPositionInfo(); pos.Assign(LastPosition); if (SourceBandInfo == null) { TreeList.MyRaiseDragObjectDrop(new DragObjectDropEventArgs(SourceInfo.Column, pos)); } else { TreeList.MyRaiseDragObjectDrop(new DragObjectDropEventArgs(SourceBandInfo.Band, pos)); } if (LastPosition.Valid) { if (pos.Index >= 0) { MyTreeListBandInfo posBandInfo = ColumnInfoToBandInfo(pos.Info); if (SourceBandInfo == null) { if (posBandInfo == null) { TreeList.Swap(pos.Info.Column, SourceInfo.Column); } else { TreeList.Swap(posBandInfo.Band, SourceInfo.Column); } } else { if (posBandInfo == null) { TreeList.Swap(SourceBandInfo.Band, pos.Info.Column); } else { TreeList.Swap(SourceBandInfo.Band, posBandInfo.Band); } } } } } UpdateColumnDragFrame(Rectangle.Empty); SetState(Regular); }