예제 #1
0
 protected override void OnMouseMove(MouseEventArgs e)
 {
     base.OnMouseMove(e);
     if (e.Button == MouseButtons.Left)
     {
         if (Math.Abs(new Point(e.X - this.lastMouseMove.X, e.Y - this.lastMouseMove.Y).X) < SystemInformation.DragSize.Width)
         {
             return;
         }
         RadPanoramaElement tilePanelElement = this.FindTilePanelElement();
         if (tilePanelElement == null || tilePanelElement.AllowDragDrop)
         {
             return;
         }
         if (!this.Capture && e.Button == MouseButtons.Left)
         {
             this.Capture = true;
             tilePanelElement.ScrollService.MouseDown(e.Location);
         }
         else
         {
             if (!this.Capture)
             {
                 return;
             }
             tilePanelElement.ScrollService.MouseMove(e.Location);
         }
     }
     else
     {
         this.lastMouseMove = e.Location;
     }
 }
예제 #2
0
 protected override void CreateChildItems(RadElement parent)
 {
     base.CreateChildItems(parent);
     this.tilePanelElement = this.CreatePanoramaElement();
     this.tilePanelElement.PropertyChanged += new PropertyChangedEventHandler(this.tilePanelElement_PropertyChanged);
     parent.Children.Add((RadElement)this.tilePanelElement);
 }
예제 #3
0
 public TileDragDropService(RadPanoramaElement owner)
 {
     this.owner                = owner;
     this.scrollTimer          = new Timer();
     this.scrollTimer.Interval = 20;
     this.scrollTimer.Tick    += new EventHandler(this.scrollTimer_Tick);
 }
예제 #4
0
        protected override void OnPanGesture(PanGestureEventArgs args)
        {
            base.OnPanGesture(args);
            RadPanoramaElement tilePanelElement = this.FindTilePanelElement();

            if (tilePanelElement == null || !this.AllowDrag)
            {
                return;
            }
            RadDragDropService dragDropService = tilePanelElement.DragDropService;

            if (args.IsBegin)
            {
                this.currentPanOffset = SizeF.Empty;
                this.panBeginLocation = this.ElementTree.Control.PointToScreen(args.Location);
                this.ZIndex           = 1000;
            }
            if (dragDropService.State == RadServiceState.Working)
            {
                dragDropService.DoMouseMove(this.ElementTree.Control.PointToScreen(args.Location));
            }
            else
            {
                tilePanelElement.ScrollView(args.Offset.Width, true);
                if (tilePanelElement.AllowDragDrop)
                {
                    if (!args.IsInertia)
                    {
                        this.currentPanOffset.Width  += (float)args.Offset.Width;
                        this.currentPanOffset.Height += (float)args.Offset.Height;
                    }
                    if ((double)Math.Abs(this.currentPanOffset.Height) > (double)(this.Size.Height / this.RowSpan))
                    {
                        this.PositionOffset      = SizeF.Empty;
                        this.panBeginLocation.X += (int)this.currentPanOffset.Width;
                        dragDropService.BeginDrag(this.panBeginLocation, (ISupportDrag)this);
                        if (dragDropService.State == RadServiceState.Working)
                        {
                            dragDropService.DoMouseMove(this.ElementTree.Control.PointToScreen(args.Location));
                        }
                    }
                    else
                    {
                        this.PositionOffset = new SizeF(0.0f, 20f * this.currentPanOffset.Height / (float)(this.Size.Height / this.RowSpan));
                    }
                }
            }
            if (args.IsEnd)
            {
                if (dragDropService.State == RadServiceState.Working)
                {
                    dragDropService.EndDrag();
                }
                this.PositionOffset = SizeF.Empty;
                int num = (int)this.ResetValue(RadElement.ZIndexProperty, ValueResetFlags.Local);
            }
            args.Handled = true;
        }
예제 #5
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);
            RadPanoramaElement tilePanelElement = this.FindTilePanelElement();

            if (tilePanelElement == null || e.Button != MouseButtons.Left || !tilePanelElement.AllowDragDrop)
            {
                return;
            }
            tilePanelElement.DragDropService.Start((object)this);
        }
예제 #6
0
        protected override void OnBubbleEvent(RadElement sender, RoutedEventArgs args)
        {
            MouseEventArgs originalEventArgs = args.OriginalEventArgs as MouseEventArgs;

            if (args.RoutedEvent == RadElement.MouseUpEvent && originalEventArgs != null)
            {
                RadPanoramaElement tilePanelElement = this.FindTilePanelElement();
                if (tilePanelElement != null && !tilePanelElement.AllowDragDrop && this.Capture)
                {
                    tilePanelElement.ScrollService.MouseUp(originalEventArgs.Location);
                    this.Capture  = false;
                    args.Canceled = true;
                    return;
                }
            }
            base.OnBubbleEvent(sender, args);
        }
예제 #7
0
        private void items_ItemsChanged(
            RadItemCollection changed,
            RadItem target,
            ItemsChangeOperation operation)
        {
            RadTileElement     tileElement = target as RadTileElement;
            RadPanoramaElement ancestor    = this.FindAncestor <RadPanoramaElement>();
            RadControl         radControl  = this.ElementTree != null ? this.ElementTree.Control as RadControl : (RadControl)null;

            if (radControl == null || radControl.IsInitializing || this.DesignMode)
            {
                return;
            }
            if (ancestor != null && ancestor.AutoArrangeNewTiles && (tileElement != null && operation == ItemsChangeOperation.Inserted))
            {
                int  num1 = 0;
                int  num2 = 0;
                bool flag = false;
                if (tileElement.GetValueSource(GridLayout.ColumnIndexProperty) > ValueSource.DefaultValue || tileElement.GetValueSource(GridLayout.RowIndexProperty) > ValueSource.DefaultValue)
                {
                    this.UpdateCellCount();
                    this.InvalidateMeasure();
                    return;
                }
                int col = 0;
                while (!flag)
                {
                    for (int row = 0; !flag && row < this.RowsCount; ++row)
                    {
                        if (this.CanPlace(tileElement, row, col))
                        {
                            num1 = row;
                            num2 = col;
                            flag = true;
                        }
                    }
                    ++col;
                }
                tileElement.Column = num2;
                tileElement.Row    = num1;
            }
            this.UpdateCellCount();
            this.InvalidateMeasure();
        }