public virtual Size ScrollOffsetForChildVisible(RadElement childElement, Point currentScrollValue) { int childIndex = this.Children.IndexOf(childElement); if (childIndex < 0 || childIndex >= this.Children.Count) { return(Size.Empty); } Rectangle clientRect = new Rectangle(Point.Empty, this.Size); Rectangle childRect = childElement.FullRectangle; childRect.Offset((int)Math.Round(this.PositionOffset.Width), (int)Math.Round(this.PositionOffset.Height)); Size childOffset = RadCanvasViewport.CalcMinOffset(childRect, clientRect); Size viewportOffset = new Size(-childOffset.Width, -childOffset.Height); if (this.Orientation == System.Windows.Forms.Orientation.Vertical) { viewportOffset.Height = ConvertPixelOffsetToIndexOffset(currentScrollValue.Y, childIndex, viewportOffset.Height); } else { viewportOffset.Width = ConvertPixelOffsetToIndexOffset(currentScrollValue.X, childIndex, viewportOffset.Width); } return(viewportOffset); }
public virtual Point ResetValue(Point currentValue, Size viewportSize, Size extentSize) { if (this.Children.Count <= 0) { return(currentValue); } Point res = currentValue; if (this.Orientation == System.Windows.Forms.Orientation.Vertical) { res.X = RadCanvasViewport.ValidatePosition(currentValue.X, extentSize.Width - viewportSize.Width); int vertPos = GetOffsetFromIndex(currentValue.Y); if (vertPos > extentSize.Height - viewportSize.Height) { res.Y = this.Children.Count - GetLastFullVisibleItemsNum(); } } else { int horizPos = GetOffsetFromIndex(currentValue.X); if (horizPos > extentSize.Width - viewportSize.Width) { res.X = this.Children.Count - GetLastFullVisibleItemsNum(); } res.Y = RadCanvasViewport.ValidatePosition(currentValue.Y, extentSize.Height - viewportSize.Height); } return(res); }
public void ScrollElementIntoView(RadElement childElement) { if (childElement == null) { return; } if (this.UseNewLayoutSystem) { this.UpdateLayout(); } if (this.UsePhysicalScrolling) { Rectangle viewportRect = new Rectangle(Point.Empty, this.viewportSize); Rectangle childRect = childElement.FullBoundingRectangle; childRect.Offset((int)Math.Round(this.viewport.PositionOffset.Width), (int)Math.Round(this.viewport.PositionOffset.Height)); Size childOffset = RadCanvasViewport.CalcMinOffset(childRect, viewportRect); ScrollWith(-childOffset.Width, -childOffset.Height); } else { if (this.viewport != null) { Size offset = ((IRadScrollViewport)this.viewport).ScrollOffsetForChildVisible(childElement, this.Value); ScrollWith(offset.Width, offset.Height); } } }
public void ScrollElementIntoView(RadElement childElement) { if (childElement == null) { return; } this.UpdateLayout(); if (this.UsePhysicalScrolling) { Rectangle dest = new Rectangle(Point.Empty, this.viewportSize); Rectangle src = new Rectangle(childElement.BoundingRectangle.Location, Size.Add(childElement.BoundingRectangle.Size, childElement.Margin.Size)); src.Offset((int)Math.Round((double)this.viewport.PositionOffset.Width), (int)Math.Round((double)this.viewport.PositionOffset.Height)); Size size = RadCanvasViewport.CalcMinOffset(src, dest); this.ScrollWith(-size.Width, -size.Height); } else { if (this.viewport == null) { return; } Size size = ((IRadScrollViewport)this.viewport).ScrollOffsetForChildVisible(childElement, this.Value); this.ScrollWith(size.Width, size.Height); } }
/// <summary> /// Make viewportOffset to be with correct value. /// Set Value of ScrollBars using viewportOffset /// </summary> private void ResetScrollPos() { this.ResetScrollParamsInternal(); Point oldValue = this.Value; Point newValue = oldValue; if (this.UsePhysicalScrolling) { newValue.X = RadCanvasViewport.ValidatePosition(newValue.X, this.extentSize.Width - this.viewportSize.Width); newValue.Y = RadCanvasViewport.ValidatePosition(newValue.Y, this.extentSize.Height - this.viewportSize.Height); } else { if (this.viewport != null) { newValue = ((IRadScrollViewport)this.viewport).ResetValue(this.Value, this.viewportSize, this.extentSize); } } newValue = GetValidValue(newValue); SetScrollValueInternal(newValue); if (oldValue != newValue || newValue == this.MinValue) { DoScroll(oldValue, newValue); } }
public virtual Size ScrollOffsetForChildVisible( RadElement childElement, Point currentScrollValue) { int indexToOffset = this.Children.IndexOf(childElement); if (indexToOffset < 0 || indexToOffset >= this.Children.Count) { return(Size.Empty); } Rectangle dest = new Rectangle(Point.Empty, this.Size); Rectangle src = new Rectangle(childElement.BoundingRectangle.Location, Size.Add(childElement.BoundingRectangle.Size, childElement.Margin.Size)); src.Offset((int)Math.Round((double)this.PositionOffset.Width), (int)Math.Round((double)this.PositionOffset.Height)); Size size1 = RadCanvasViewport.CalcMinOffset(src, dest); Size size2 = new Size(-size1.Width, -size1.Height); if (this.Orientation == Orientation.Vertical) { size2.Height = this.ConvertPixelOffsetToIndexOffset(currentScrollValue.Y, indexToOffset, size2.Height); } else { size2.Width = this.ConvertPixelOffsetToIndexOffset(currentScrollValue.X, indexToOffset, size2.Width); } return(size2); }
public virtual Point ResetValue(Point currentValue, Size viewportSize, Size extentSize) { if (this.Children.Count <= 0) { return(currentValue); } Point point = currentValue; if (this.Orientation == Orientation.Vertical) { point.X = RadCanvasViewport.ValidatePosition(currentValue.X, extentSize.Width - viewportSize.Width); if (this.GetOffsetFromIndex(currentValue.Y) > extentSize.Height - viewportSize.Height) { point.Y = this.Children.Count - this.GetLastFullVisibleItemsNum(); } } else { if (this.GetOffsetFromIndex(currentValue.X) > extentSize.Width - viewportSize.Width) { point.X = this.Children.Count - this.GetLastFullVisibleItemsNum(); } point.Y = RadCanvasViewport.ValidatePosition(currentValue.Y, extentSize.Height - viewportSize.Height); } return(point); }
public Point ResetValue(Point currentValue, Size viewportSize, Size canvasSize) { Point empty = Point.Empty; empty.X = RadCanvasViewport.ValidatePosition(currentValue.X, canvasSize.Width - viewportSize.Width); empty.Y = RadCanvasViewport.ValidatePosition(currentValue.Y, canvasSize.Height - viewportSize.Height); return(empty); }
public override Point ResetValue(Point currentValue, Size viewportSize, Size canvasSize) { Point res = Point.Empty; res.X = RadCanvasViewport.ValidatePosition(currentValue.X, canvasSize.Width - viewportSize.Width); res.Y = RadCanvasViewport.ValidatePosition(currentValue.Y, canvasSize.Height - viewportSize.Height); return(res); }
public override Size ScrollOffsetForChildVisible(RadElement childElement, Point currentScrollValue) { Rectangle clientRect = new Rectangle(Point.Empty, this.Size); Rectangle childRect = childElement.Bounds; childRect.Offset((int)Math.Round(this.PositionOffset.Width), (int)Math.Round(this.PositionOffset.Height)); Size childOffset = RadCanvasViewport.CalcMinOffset(childRect, clientRect); Size viewportOffset = new Size(-childOffset.Width, -childOffset.Height); return(viewportOffset); }
public virtual Size ScrollOffsetForChildVisible( RadElement childElement, Point currentScrollValue) { Rectangle dest = new Rectangle(Point.Empty, this.Size); Rectangle src = new Rectangle(childElement.BoundingRectangle.Location, Size.Add(childElement.BoundingRectangle.Size, childElement.Margin.Size)); src.Offset((int)Math.Round((double)this.PositionOffset.Width), (int)Math.Round((double)this.PositionOffset.Height)); Size size = RadCanvasViewport.CalcMinOffset(src, dest); return(new Size(-size.Width, -size.Height)); }
protected override void CreateChildItems(RadElement parent) { RadCanvasViewport viewport = new RadCanvasViewport(); this.scrollView = new RadScrollViewer(viewport); this.scrollView.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize; this.scrollView.Scroll += delegate(object sender, ScrollPanelEventArgs args) { OnScroll(args); }; this.scrollView.ScrollNeedsChanged += delegate(object sender, ScrollNeedsEventArgs args) { OnScrollNeedsChanged(args); }; this.scrollView.ScrollParametersChanged += delegate(object sender, RadPanelScrollParametersEventArgs args) { OnScrollParametersChanged(args); }; this.rectangle = new RectanglePrimitive(); this.rectangle.AutoSize = false; this.rectangle.SetBounds(10, 10, 190, 190); this.rectangle.ForeColor = Color.Black; this.rectangle.BackColor = Color.Aqua; this.arrow = new ArrowPrimitive(); this.arrow.AutoSize = false; this.arrow.SetBounds(210, 210, 190, 190); this.arrow.ForeColor = Color.Black; this.arrow.BackColor = Color.Wheat; this.RootElement.Children.Add(this.scrollView); foreach (RadElement child in this.scrollView.Children) { if (child.Class == "RadScrollViewFill" && child is FillPrimitive) { background = (FillPrimitive)child; break; } } this.backgroundAdded = true; this.scrollView.Viewport.Children.Add(rectangle); this.squareAdded = true; this.scrollView.Viewport.Children.Add(arrow); this.arrowAdded = true; this.ThemeName = ""; }
protected override void CreateChildElements() { this.filterDropDown = new RadDropDownButtonElement(); this.filterDropDown.Alignment = ContentAlignment.TopLeft; this.filterDropDown.ExpandArrowButton = true; this.filterDropDown.ArrowButton.Arrow.Alignment = ContentAlignment.MiddleLeft; this.filterDropDown.Class = "RadGalleryPopupFilterDropDownButton"; this.filterDropDown.ActionButton.ButtonFillElement.Class = "RadGalleryPopupFilterActionButtonFill"; this.filterDropDown.ActionButton.BorderElement.Class = "RadGalleryPopupFilterActionButtonBorder"; this.filterDropDown.ActionButton.Class = "RadGalleryPopupFilterActionButton"; this.filterDropDown.ArrowButton.Fill.Class = "RadGalleryPopupFilterArrowButtonFill"; this.filterDropDown.ArrowButton.Border.Class = "RadGalleryPopupFilterArrowButtonBorder"; this.filterDropDown.ArrowButton.Arrow.Class = "RadGalleryPopupFilterArrowButtonArrow"; this.filterDropDown.BorderElement.Class = "RadGalleryPopupFilterDropDownButtonBorder"; this.popupGroupsViewport = new RadCanvasViewport(); this.popupScrollViewer = new RadScrollViewer(this.popupGroupsViewport); this.popupScrollViewer.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize; this.popupScrollViewer.HorizontalScrollState = ScrollState.AlwaysHide; this.popupScrollViewer.UsePhysicalScrolling = true; this.popupScrollViewer.Class = "RadGalleryPopupScrollViewer"; this.popupScrollViewer.FillElement.Class = "RadGalleryPopupScrollViewerFill"; this.subMenuLayoutPanel = new RadGalleryMenuLayoutPanel(); this.subMenuLayoutPanel.Alignment = ContentAlignment.BottomLeft; this.subMenuLayoutPanel.Class = "RadGalleryPoupMenuPanel"; this.dropDownPanel = new StackLayoutPanel(); this.dropDownPanel.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize; this.dropDownPanel.Orientation = System.Windows.Forms.Orientation.Vertical; this.dropDownPanel.EqualChildrenWidth = true; this.downMenu = new RadGalleryDropDown(this); this.WireMenuDropDownEvents(); this.downMenu.VerticalPopupAlignment = VerticalPopupAlignment.TopToTop; this.downMenu.HorizontalPopupAlignment = HorizontalPopupAlignment.LeftToLeft; this.downMenu.AnimationEnabled = false; this.galleryPopupElement = new RadGalleryPopupElement( this.Items, this.Groups, this.Filters, this.Tools); this.downMenu.PopupElement = this.galleryPopupElement; this.downMenu.LoadElementTree(); this.dropDownPanel.Children.Add(this.filterDropDown); this.dropDownPanel.Children.Add(this.popupScrollViewer); this.dropDownPanel.Children.Add(this.subMenuLayoutPanel); //TODO: perhaps we should implement RadStackViewport to support integral scrolling this.inribbonItemsLayoutPanel = new IntegralScrollWrapPanel(); this.inribbonItemsLayoutPanel.MaxColumns = this.MaxColumns; this.inribbonItemsLayoutPanel.MaxRows = this.MaxRows; this.Items.Owner = this.inribbonItemsLayoutPanel; this.upButton = new RadImageButtonElement(); this.upButton.Class = "GalleryUpButton"; this.upButton.Enabled = false; this.upButton.MinSize = arrowButtonsMinSize; this.upButton.Click += new EventHandler(upButton_Click); this.upButton.BorderElement.Class = "GalleryUpButtonBorder"; this.upButton.ButtonFillElement.Class = "GalleryArrowButtonFill"; this.downButton = new RadImageButtonElement(); this.downButton.Class = "GalleryDownButton"; this.downButton.MinSize = arrowButtonsMinSize; this.downButton.Click += new EventHandler(downButton_Click); this.downButton.BorderElement.Class = "GalleryDownButtonBorder"; this.downButton.ButtonFillElement.Class = "GalleryArrowButtonFill"; this.popupButton = new RadImageButtonElement(); this.popupButton.Class = "GalleryPopupButtonButton"; this.popupButton.MinSize = arrowButtonsMinSize; this.popupButton.MouseDown += new System.Windows.Forms.MouseEventHandler(popupButton_MouseDown); this.popupButton.BorderElement.Class = "GalleryPopupButtonButtonBorder"; this.popupButton.ButtonFillElement.Class = "GalleryArrowButtonFill"; this.buttonsPanel = new RadGalleryButtonsLayoutPanel(); this.buttonsPanel.MaxSize = buttonsPanelMaxSize; this.buttonsPanel.SetValue(DropDownEditorLayoutPanel.IsArrowButtonProperty, true); this.buttonsPanel.Children.Add(upButton); this.buttonsPanel.Children.Add(downButton); this.buttonsPanel.Children.Add(popupButton); this.inribbonPanel = new DropDownEditorLayoutPanel(); this.inribbonPanel.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize; this.inribbonFillPrimitive = new FillPrimitive(); this.inribbonFillPrimitive.Class = "InribbonGalleryFill"; this.inribbonPanel.Children.Add(this.inribbonItemsLayoutPanel); this.inribbonPanel.Children.Add(this.buttonsPanel); this.inribbonPanelBorder = new BorderPrimitive(); this.inribbonPanelBorder.Visibility = ElementVisibility.Collapsed; this.inribbonPanelBorder.Class = "InribbonGalleryBorder"; this.Children.Add(this.inribbonPanelBorder); this.Children.Add(this.inribbonFillPrimitive); this.Children.Add(this.inribbonPanel); }