Exemplo n.º 1
0
        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));
                }
            }
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 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);
 }
Exemplo n.º 5
0
 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);
         }
     }
 }
Exemplo n.º 6
0
 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);
 }
Exemplo n.º 7
0
 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));
 }
Exemplo n.º 8
0
 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);
 }