Example #1
0
        public override void OnMouseUp(CellContext sender, MouseEventArgs e)
        {
            base.OnMouseUp(sender, e);

            //Note: I can't use the click event because I don't have Button information (Control.MouseButtons returns always None inside the Click event)

            Point     currentPoint = sender.Grid.PointToClient(System.Windows.Forms.Control.MousePosition);
            Rectangle cellRect     = sender.Grid.PositionToRectangle(sender.Position);
            float     distance;

            DevAge.Drawing.RectanglePartType partType = LogicalBorder.GetPointPartType(cellRect, currentPoint, out distance);

            //eseguo il sort solo se non sono attualmente in resize
            if (IsSortEnable(sender) &&
                partType == DevAge.Drawing.RectanglePartType.ContentArea &&
                e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                Models.ISortableHeader sortHeader = (Models.ISortableHeader)sender.Cell.Model.FindModel(typeof(Models.ISortableHeader));
                Models.SortStatus      l_Status   = sortHeader.GetSortStatus(sender);
                if (l_Status.Style == DevAge.Drawing.HeaderSortStyle.Ascending)
                {
                    SortColumn(sender, false, l_Status.Comparer);
                }
                else
                {
                    SortColumn(sender, true, l_Status.Comparer);
                }
            }
        }
Example #2
0
 protected virtual void PrepareVisualElementSortIndicator(CellContext context)
 {
     Models.ISortableHeader sortModel = (Models.ISortableHeader)context.Cell.Model.FindModel(typeof(Models.ISortableHeader));
     if (sortModel != null)
     {
         Models.SortStatus status = sortModel.GetSortStatus(context);
         ElementSort.SortStyle = status.Style;
     }
     else
     {
         ElementSort.SortStyle = DevAge.Drawing.HeaderSortStyle.None;
     }
 }
Example #3
0
        protected override void PrepareView(CellContext context)
        {
            base.PrepareView(context);

            Models.ISortableHeader sortModel = (Models.ISortableHeader)context.Cell.Model.FindModel(typeof(Models.ISortableHeader));
            if (sortModel != null)
            {
                Models.SortStatus status = sortModel.GetSortStatus(context);
                Background.SortStyle = status.Style;
            }
            else
            {
                Background.SortStyle = DevAge.Drawing.HeaderSortStyle.None;
            }
        }
Example #4
0
        public override void OnMouseUp(CellContext sender, MouseEventArgs e)
        {
            base.OnMouseUp(sender, e);

            //Note: I can't use the click event because I don't have Button information (Control.MouseButtons returns always None inside the Click event)

            Point     currentPoint = sender.Grid.PointToClient(System.Windows.Forms.Control.MousePosition);
            Rectangle cellRect     = sender.Grid.PositionToRectangle(sender.Position);
            float     distance;

            DevAge.Drawing.RectanglePartType partType = LogicalBorder.GetPointPartType(cellRect, currentPoint, out distance);

            //eseguo il sort solo se non sono attualmente in resize
            if (IsSortEnable(sender) &&
                partType == DevAge.Drawing.RectanglePartType.ContentArea &&
                e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                // AlanP: Dec 2013.  Do not do a sort if the MouseUp is after a coulmnWidthResize
                Resizable resizableHeader = (Resizable)sender.Cell.Controller.FindController(typeof(Resizable));
                if (resizableHeader != null)
                {
                    // If the mouse down initiated a resize of the header on this cell we don't want to do a sort
                    if (resizableHeader.MouseDownStartedWidthResize)
                    {
                        return;
                    }
                }

                Models.ISortableHeader sortHeader = (Models.ISortableHeader)sender.Cell.Model.FindModel(typeof(Models.ISortableHeader));
                Models.SortStatus      l_Status   = sortHeader.GetSortStatus(sender);
                if (l_Status.Style == DevAge.Drawing.HeaderSortStyle.Ascending)
                {
                    SortColumn(sender, false, l_Status.Comparer);
                }
                else
                {
                    SortColumn(sender, true, l_Status.Comparer);
                }
            }
        }