protected override void CreateChildItems(RadElement parent)
        {
            Type baseType = typeof(RadSpinEditor);
            CustomSpinEditorElement element = new CustomSpinEditorElement();
            element.RightToLeft = this.RightToLeft == System.Windows.Forms.RightToLeft.Yes;
            this.RootElement.Children.Add(element);

            element.ValueChanging += spinElement_ValueChanging;
            element.ValueChanged += spinElement_ValueChanged;
            element.TextChanging += spinElement_TextChanging;

            element.KeyDown += OnSpinElementKeyDown;
            element.KeyPress += OnSpinElementKeyPress;
            element.KeyUp += OnSpinElementKeyUp;

            baseType.GetField("spinElement", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(this, element);
        }
 /// <summary>
 /// create element with HostedItem
 /// </summary>
 /// <param name="hostedItem"></param>
 public CarouselContentItem(RadElement hostedItem)
 {
     this.HostedItem = hostedItem;
 }
Exemple #3
0
        //p.p. 27.07.09 - commented the function
        //TODO must be revisied why rootElement.StretchHorizontally = false;
        //protected override void InitializeRootElement(RootRadElement rootElement)
        //{
        //    base.InitializeRootElement(rootElement);

        //    //rootElement.StretchHorizontally = false;
        //    // rootElement.StretchVertically = false;
        //}

        /// <summary>
        /// Creates the children items
        /// </summary>
        /// <param name="parent"></param>
        protected override void CreateChildItems(RadElement parent)
        {
            // The base child items creation is customized by overriding CreateButtonElement()
            base.CreateChildItems(parent);
        }
Exemple #4
0
 protected override void CreateChildItems(RadElement parent)
 {
     this.popupEditorElement = this.CreateElement();
     parent.Children.Add((RadElement)this.popupEditorElement);
 }
Exemple #5
0
 protected override void CreateChildItems(RadElement parent)
 {
     this.breadCrumbElement = this.CraeteBreadCrumbElement();
     parent.Children.Add((RadElement)this.breadCrumbElement);
 }
Exemple #6
0
 /// <summary>
 /// Initializes a new instance of the HoveredElementChangedEventArgs class.
 /// </summary>
 /// <param name="hoveredElement"></param>
 public HoveredElementChangedEventArgs(RadElement hoveredElement)
 {
     this.HoveredElement = hoveredElement;
 }
 /// <summary>
 ///     <para>
 ///       Initializes a new instance of <see cref='RadItemCollection'/>.
 ///    </para>
 /// </summary>
 public RadCommandBarBaseItemCollection(RadElement owner)
 {
     this.owner = owner;
 }
Exemple #8
0
 public virtual void CreateChildItems(RadElement parent)
 {
 }
 protected override void CreateChildItems(RadElement parent)
 {
     this.rangeSelectorElement = this.CreateRangeSelectorElement();
     this.RootElement.Children.Add((RadElement)this.rangeSelectorElement);
     base.CreateChildItems((RadElement)this.rangeSelectorElement);
 }
Exemple #10
0
        /// <summary>
        /// Initializes the Childs Items
        /// </summary>
        /// <param name="parent"></param>
        protected override void CreateChildItems(RadElement parent)
        {
            this.rotatorElement = new RadRotatorElement();

            parent.Children.Add(rotatorElement);
        }
Exemple #11
0
 protected override void OnChildrenChanged(RadElement child, ItemsChangeOperation changeOperation)
 {
     this.collapsibleChildren = null;
     base.OnChildrenChanged(child, changeOperation);
 }
Exemple #12
0
 public ElementValuesAnimator(RadElement element, AnimatedPropertySetting setting)
 {
     this.element = element;
     this.setting = setting;
     this.currentAnimatorState = new ValuesAnimatorNotRunningState(this);
 }
 /// <summary></summary>
 public bool GetIsSelected(RadElement childElement)
 {
     return((bool)childElement.GetValue(RadRibbonBarButtonGroup.IsSelectedProperty));
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="element"></param>
 public void SetSelectedItem(RadElement element)
 {
     this.SetIsSelected(element, true);
     this.RefreshItems(element);
 }
 protected override void CreateChildItems(RadElement parent)
 {
     this.tipElement = new RadOffice2007ScreenTipElement();
     this.RootElement.Children.Add(this.tipElement);
 }
Exemple #16
0
 public abstract void InvalidateElement(RadElement element, Rectangle bounds);
Exemple #17
0
 public override void OnPropertyChange(RadElement element, RadPropertyChangedEventArgs e)
 {
 }
Exemple #18
0
 public CommandBarHostItem(RadElement hostedItem)
 {
     this.HostedItem = hostedItem;
 }
Exemple #19
0
        protected override SizeF ArrangeOverride(SizeF arrangeSize)
        {
            RadElementCollection children = this.Children;
            int   count = children.Count;
            SizeF empty = SizeF.Empty;
            bool  equalChildrenHeight = this.EqualChildrenHeight;
            bool  equalChildrenWidth  = this.EqualChildrenWidth;

            if (equalChildrenHeight || equalChildrenWidth)
            {
                for (int index = 0; index < count; ++index)
                {
                    RadElement radElement = children[index];
                    if (equalChildrenHeight)
                    {
                        empty.Height = Math.Max(radElement.DesiredSize.Height, empty.Height);
                    }
                    if (equalChildrenWidth)
                    {
                        empty.Width = Math.Max(radElement.DesiredSize.Width, empty.Width);
                    }
                }
            }
            bool       flag        = this.Orientation == Orientation.Horizontal;
            bool       rightToLeft = this.RightToLeft;
            float      num         = 0.0f;
            RectangleF finalRect   = new RectangleF(PointF.Empty, arrangeSize);

            if (flag && rightToLeft)
            {
                finalRect.X = arrangeSize.Width;
            }
            for (int index = 0; index < count; ++index)
            {
                RadElement radElement  = children[index];
                SizeF      desiredSize = radElement.DesiredSize;
                if (radElement.Visibility == ElementVisibility.Collapsed)
                {
                    radElement.Arrange(new RectangleF(PointF.Empty, desiredSize));
                }
                else
                {
                    if (equalChildrenHeight)
                    {
                        desiredSize.Height = !flag ? empty.Height : Math.Max(arrangeSize.Height, empty.Height);
                    }
                    if (equalChildrenWidth)
                    {
                        desiredSize.Width = !flag?Math.Max(arrangeSize.Width, empty.Width) : empty.Width;
                    }
                    if (flag)
                    {
                        if (rightToLeft)
                        {
                            num          = desiredSize.Width;
                            finalRect.X -= num;
                        }
                        else
                        {
                            finalRect.X += num;
                            num          = desiredSize.Width;
                        }
                        finalRect.Width = num;
                        if (equalChildrenHeight)
                        {
                            SizeF size = finalRect.Size;
                            finalRect.Height = desiredSize.Height;
                            RectangleF rectangleF = LayoutUtils.Align(finalRect.Size, new RectangleF(PointF.Empty, size), this.Alignment);
                            finalRect.Y += rectangleF.Y;
                        }
                        else
                        {
                            finalRect.Height = arrangeSize.Height;
                        }
                    }
                    else
                    {
                        finalRect.Y     += num;
                        num              = desiredSize.Height;
                        finalRect.Height = num;
                        if (equalChildrenWidth)
                        {
                            SizeF size = finalRect.Size;
                            finalRect.Width = desiredSize.Width;
                            ContentAlignment align      = rightToLeft ? TelerikAlignHelper.RtlTranslateContent(this.Alignment) : this.Alignment;
                            RectangleF       rectangleF = LayoutUtils.Align(finalRect.Size, new RectangleF(PointF.Empty, size), align);
                            finalRect.X += rectangleF.X;
                        }
                        else
                        {
                            finalRect.Width = arrangeSize.Width;
                        }
                    }
                    radElement.Arrange(finalRect);
                }
            }
            return(arrangeSize);
        }
 protected override void CreateChildItems(RadElement parent)
 {
     base.CreateChildItems(parent);
     this.SizingGripDockLayout.LastChildFill = false;
 }
Exemple #21
0
        protected override SizeF MeasureOverride(SizeF constraint)
        {
            RadElementCollection children = this.Children;
            int   count         = children.Count;
            bool  flag          = this.Orientation == Orientation.Horizontal;
            SizeF availableSize = constraint;

            if (flag)
            {
                availableSize.Width = float.PositiveInfinity;
            }
            else
            {
                availableSize.Height = float.PositiveInfinity;
            }
            for (int index = 0; index < count; ++index)
            {
                children[index].Measure(availableSize);
            }
            SizeF empty1 = SizeF.Empty;
            bool  equalChildrenHeight = this.EqualChildrenHeight;
            bool  equalChildrenWidth  = this.EqualChildrenWidth;

            if (equalChildrenHeight || equalChildrenWidth)
            {
                for (int index = 0; index < count; ++index)
                {
                    RadElement radElement = children[index];
                    if (equalChildrenHeight)
                    {
                        empty1.Height = Math.Max(radElement.DesiredSize.Height, empty1.Height);
                    }
                    if (equalChildrenWidth)
                    {
                        empty1.Width = Math.Max(radElement.DesiredSize.Width, empty1.Width);
                    }
                }
            }
            SizeF empty2 = SizeF.Empty;

            for (int index = 0; index < count; ++index)
            {
                SizeF desiredSize = children[index].DesiredSize;
                if (equalChildrenHeight)
                {
                    desiredSize.Height = empty1.Height;
                }
                if (equalChildrenWidth)
                {
                    desiredSize.Width = empty1.Width;
                }
                if (flag)
                {
                    empty2.Width += desiredSize.Width;
                    empty2.Height = Math.Max(empty2.Height, desiredSize.Height);
                }
                else
                {
                    empty2.Width   = Math.Max(empty2.Width, desiredSize.Width);
                    empty2.Height += desiredSize.Height;
                }
            }
            return(empty2);
        }
Exemple #22
0
 protected override bool CanSelectOverride(RadElement element)
 {
     return(element != null && this.elementType == element.GetThemeEffectiveType());
 }
        protected override Size GetPopupSize(RadPopupControlBase popup, bool measure)
        {
            RadSizablePopupControl sizablePopupControl = popup as RadSizablePopupControl;
            int num1 = this.listElement.Items.Count;
            CheckedItemTraverser traverser = this.listElement.Scroller.Traverser as CheckedItemTraverser;

            if (traverser != null && traverser.CheckAll)
            {
                ++num1;
            }
            if (num1 > this.defaultItemsCountInDropDown || num1 == 0)
            {
                num1 = this.defaultItemsCountInDropDown;
            }
            if (num1 > this.maxDropDownItems && this.maxDropDownItems > 0)
            {
                num1 = this.maxDropDownItems;
            }
            int num2 = 0;

            if (sizablePopupControl.SizingGrip.Visibility == ElementVisibility.Visible)
            {
                RadElement sizingGrip = (RadElement)sizablePopupControl.SizingGrip;
                num2 = new Rectangle(sizingGrip.BoundingRectangle.Location, Size.Add(sizingGrip.BoundingRectangle.Size, sizingGrip.Margin.Size)).Height;
            }
            int num3 = 0;

            if (!this.listElement.AutoSizeItems)
            {
                int num4 = this.listElement.ItemHeight;
                for (int index = 0; index < num1 && index < this.listElement.Items.Count; ++index)
                {
                    if (this.listElement.Items[index] is DescriptionTextListDataItem || this.listElement.IsDescriptionText)
                    {
                        num4 *= 2;
                        break;
                    }
                }
                if (this.ListElement.DpiScaleFactor != this.Popup.OwnerElement.DpiScaleFactor)
                {
                    num4 = TelerikDpiHelper.ScaleInt(num4, this.Popup.OwnerElement.DpiScaleFactor);
                }
                int height = num1 * (num4 + this.listElement.Scroller.ItemSpacing) + num2 + (int)((double)this.listElement.BorderWidth * 2.0);
                if (this.DropDownHeight != 106)
                {
                    height = this.DropDownHeight;
                }
                return(new Size(this.Size.Width, height));
            }
            int height1;

            if (this.listElement.Items.Count > 0)
            {
                for (int index = 0; index < num1 && index < this.listElement.Items.Count; ++index)
                {
                    num3 += (int)this.listElement.Items[index].MeasuredSize.Height + this.listElement.Scroller.ItemSpacing;
                }
                height1 = num3 + this.listElement.Scroller.ItemSpacing + num2 + this.listElement.HScrollBar.Size.Height + (int)((double)this.listElement.BorderWidth * 2.0);
            }
            else
            {
                height1 = num1 * (this.listElement.ItemHeight + this.listElement.Scroller.ItemSpacing) + num2 + (int)((double)this.listElement.BorderWidth * 2.0);
            }
            if (this.DropDownHeight != 106)
            {
                height1 = this.DropDownHeight;
            }
            return(new Size(this.Size.Width, height1));
        }
 protected override void DisposeManagedResources()
 {
     this.imageElement = (RadElement)null;
     this.textElement  = (RadElement)null;
     base.DisposeManagedResources();
 }
Exemple #25
0
        public override void PerformLayoutCore(RadElement affectedElement)
        {
            //base.PerformLayoutCore(affectedElement);
            Size paddingSize   = Size.Subtract(this.Size, Size.Truncate(this.border.BorderSize));//CalcOwnSize(this.AvailableSize);
            Size availableSize = Size.Subtract(paddingSize, this.Padding.Size);

            //	if (this.lastAvailableSize != availableSize)
            {
                this.lastAvailableSize = availableSize;

                Size borderSize   = this.border.GetPreferredSize(this.Size);
                Size fillSize     = this.fill.GetPreferredSize(paddingSize);
                Size gripSize     = this.gripElement.GetPreferredSize(availableSize);
                Size itemsSize    = this.itemsLayout.GetPreferredSize(availableSize);
                Size dropDownSize = this.OverflowManager.DropDownButton.GetPreferredSize(availableSize);

                Rectangle   itemsRect          = Rectangle.Empty;
                Orientation currentOrientation = this.Orientation;
                if (currentOrientation == Orientation.Horizontal)
                {
                    gripSize.Width  = GripLength;
                    gripSize.Height = availableSize.Height;

                    dropDownSize.Width  = OverflowButtonLength;
                    dropDownSize.Height = availableSize.Height;

                    itemsRect = new Rectangle(GripOffset + GripLength, 0, itemsSize.Width, availableSize.Height);
                }
                else
                {
                    /*gripSize.Width = availableSize.Width;
                     * gripSize.Height = GripLength;
                     *
                     * dropDownSize.Width = availableSize.Width;
                     * dropDownSize.Height = OverflowButtonLength;*/

                    gripSize.Width  = GripLength;
                    gripSize.Height = availableSize.Width;

                    dropDownSize.Width  = OverflowButtonLength;
                    dropDownSize.Height = availableSize.Width;

                    itemsRect = new Rectangle(0, GripOffset + GripLength, availableSize.Width, itemsSize.Height);
                }

                this.border.Size = this.Size;
                this.fill.Size   = paddingSize;
                if (currentOrientation == Orientation.Horizontal)
                {
                    this.gripElement.SetBounds(GripOffset, 0, gripSize.Width, gripSize.Height);
                    this.OverflowManager.DropDownButton.SetBounds(
                        availableSize.Width - OverflowButtonLength, 0, dropDownSize.Width, dropDownSize.Height);
                }
                else
                {
                    this.gripElement.SetBounds(0, GripOffset, gripSize.Width, gripSize.Height);
                    this.OverflowManager.DropDownButton.SetBounds(
                        0, availableSize.Height - OverflowButtonLength, dropDownSize.Width, dropDownSize.Height);
                }
                this.itemsLayout.SetBounds(itemsRect);

                if (currentOrientation == Orientation.Horizontal)
                {
                    availableSize.Width = availableSize.Width - GripOffset - GripLength - OverflowButtonLength;
                }
                else
                {
                    availableSize.Height = availableSize.Height - GripOffset - GripLength - OverflowButtonLength;
                }

                ResetItemsVisibility(itemsSize, availableSize);
            }
        }
Exemple #26
0
 protected override RectangleF ArrangeElementCore(RadElement element, SizeF finalSize, RectangleF arrangeRect)
 {
     arrangeRect.X     = 0;
     arrangeRect.Width = finalSize.Width;
     return(base.ArrangeElementCore(element, finalSize, arrangeRect));
 }
Exemple #27
0
        /// <summary>
        /// measures the size to layout the children
        /// </summary>
        /// <param name="availableSize"></param>
        /// <returns></returns>
        protected override SizeF MeasureOverride(SizeF availableSize)
        {
            SizeF nonStretchableSize = SizeF.Empty;

            float proportionSum   = 0;
            float availableWidth  = availableSize.Width;
            float availableHeight = availableSize.Height;

            List <RadElement> stretchOnChildren  = new List <RadElement>();
            List <RadElement> stretchOffChildren = new List <RadElement>();


            for (int i = 0; i < this.Children.Count; i++)
            {
                RadElement child = this.Children[i];

                if (child.AutoSize == false)
                {
                    continue;
                }

                float childProportion = GetProportion(child);

                if (childProportion == 0)
                {
                    child.Measure(availableSize);

                    if (Orientation == Orientation.Horizontal)
                    {
                        availableWidth -= child.DesiredSize.Width;

                        nonStretchableSize.Width += child.DesiredSize.Width;
                        nonStretchableSize.Height = Math.Max(nonStretchableSize.Height, child.DesiredSize.Height);
                    }
                    else
                    {
                        availableHeight           -= child.DesiredSize.Height;
                        nonStretchableSize.Height += child.DesiredSize.Height;
                        nonStretchableSize.Width   = Math.Max(nonStretchableSize.Width, child.DesiredSize.Width);
                    }
                    stretchOffChildren.Add(child);
                }
                else
                {
                    stretchOnChildren.Add(child);
                }

                proportionSum += childProportion;
            }

            if (proportionSum == 0)
            {
                availableWidth  = availableSize.Width;
                availableHeight = availableSize.Height;
            }

            for (int i = 0; i < stretchOnChildren.Count; i++)
            {
                RadElement child = stretchOnChildren[i];
                if (child != null)
                {
                    if (child.AutoSize == false)
                    {
                        continue;
                    }

                    float childProportion = GetProportion(child);

                    if (this.Orientation == Orientation.Horizontal)
                    {
                        //       if (!child.StretchHorizontally)
                        {
                            SizeF childSize = new SizeF(((float)childProportion * availableWidth) / proportionSum, availableHeight);

                            child.Measure(childSize);

                            nonStretchableSize.Width += child.DesiredSize.Width;
                            //         if (!child.StretchVertically)
                            nonStretchableSize.Height = Math.Max(nonStretchableSize.Height, child.DesiredSize.Height);

                            continue;
                        }
                    }
                    else
                    {
                        //   if (!child.StretchVertically)
                        {
                            SizeF childSize = new SizeF(availableWidth, ((float)childProportion * availableHeight) / proportionSum);

                            child.Measure(childSize);

                            nonStretchableSize.Height += child.DesiredSize.Height;
                            //     if (!child.StretchHorizontally)
                            nonStretchableSize.Width = Math.Max(nonStretchableSize.Width, child.DesiredSize.Width);
                            //					Console.WriteLine(nonStretchableSize);

                            continue;
                        }
                    }

                    //TODO: Possible BUG - the following code got in a dead code block due to removal of 2 if statemests in the blocks above
                    //child.Measure(availableSize);
                    //
                }
            }

            return(nonStretchableSize);
        }
Exemple #28
0
 protected override void CreateChildItems(RadElement parent)
 {
     this.trackBarElement = this.CreateTrackBarElement();
     this.RootElement.Children.Add((RadElement)this.trackBarElement);
     base.CreateChildItems((RadElement)this.trackBarElement);
 }
Exemple #29
0
        /// <summary>
        /// arranges the children by a given criteria
        /// </summary>
        /// <param name="finalSize"></param>
        /// <returns></returns>
        protected override SizeF ArrangeOverride(SizeF finalSize)
        {
            PointF firstPositions = PointF.Empty;

            PointF lastPositions = PointF.Empty;

            if (this.Orientation == Orientation.Horizontal)
            {
                lastPositions.X = finalSize.Width;
            }
            if (this.Orientation == Orientation.Vertical)
            {
                lastPositions.Y = finalSize.Height;
            }

            SizeF nonStretchableSize = SizeF.Empty;

            List <RadElement> stretchOnChildren    = new List <RadElement>();
            List <RadElement> stretchOffChildren   = new List <RadElement>();
            List <RadElement> proportionedChildren = new List <RadElement>();

            float availableWidth  = finalSize.Width;
            float availableHeight = finalSize.Height;
            float proportionSum   = 0;

            for (int i = 0; i < this.Children.Count; i++)
            {
                RadElement child = this.Children[i];

                if (child.AutoSize == false)
                {
                    continue;
                }

                if (child != null)
                {
                    float childProportion = GetProportion(child);

                    if (this.Orientation == Orientation.Horizontal)
                    {
                        if (child.StretchHorizontally)
                        {
                            stretchOnChildren.Add(child);
                        }
                        else
                        {
                            stretchOffChildren.Add(child);
                        }
                    }
                    else
                    {
                        if (child.StretchVertically)
                        {
                            stretchOnChildren.Add(child);
                        }
                        else
                        {
                            stretchOffChildren.Add(child);
                        }
                    }

                    if (childProportion != 0)
                    {
                        proportionedChildren.Add(child);
                    }
                    else
                    {
                        if (Orientation == Orientation.Horizontal)
                        {
                            availableWidth -= child.DesiredSize.Width;
                        }
                        else
                        {
                            availableHeight -= child.DesiredSize.Height;
                        }
                    }

                    proportionSum += childProportion;
                }
            }

            if (proportionSum == 0)
            {
                availableWidth  = finalSize.Width;
                availableHeight = finalSize.Height;
            }

            for (int i = 0; i < stretchOffChildren.Count; i++)
            {
                RadElement child = stretchOffChildren[i];

                if (child.AutoSize == false)
                {
                    continue;
                }

                SizeF childSize = SizeF.Empty;

                float childProportion = GetProportion(child);

                if (childProportion == 0)
                {
                    childSize = child.DesiredSize;
                }

                if (this.Orientation == Orientation.Horizontal)
                {
                    if (childProportion != 0)
                    {
                        childSize = new SizeF((availableWidth * childProportion) / proportionSum,
                                              availableHeight);
                    }

                    nonStretchableSize.Width += childSize.Width;
                    //if (child.StretchVertically)
                    childSize.Height = availableHeight;

                    StripPosition stripPosition = (StripPosition)child.GetValue(StripPositionProperty);
                    bool          isFirst       = ((stripPosition == StripPosition.First) ^ this.RightToLeft);
                    if (isFirst)
                    {
                        child.Arrange(new RectangleF(firstPositions, childSize));
                        firstPositions.X += childSize.Width;
                    }
                    else
                    {
                        lastPositions.X -= childSize.Width;
                        child.Arrange(new RectangleF(lastPositions, childSize));
                    }
                }
                else
                {
                    if (childProportion != 0)
                    {
                        childSize = new SizeF(availableWidth, (availableHeight * childProportion) / proportionSum);
                    }

                    nonStretchableSize.Height += child.DesiredSize.Height;
                    //if (child.StretchHorizontally)
                    childSize.Width = availableWidth;
                    StripPosition stripPosition = (StripPosition)child.GetValue(StripPositionProperty);
                    switch (stripPosition)
                    {
                    case StripPosition.First:
                        child.Arrange(new RectangleF(firstPositions, childSize));
                        firstPositions.Y += childSize.Height;
                        break;

                    case StripPosition.Last:
                        lastPositions.Y -= childSize.Height;
                        child.Arrange(new RectangleF(lastPositions, childSize));
                        break;
                    }
                }
            }

            for (int i = 0; i < stretchOnChildren.Count; i++)
            {
                float x = 0;
                float y = 0;

                RadElement child = stretchOnChildren[i];

                if (child.AutoSize == false)
                {
                    continue;
                }

                SizeF childSize = SizeF.Empty;

                float childProportion = GetProportion(child);

                if (childProportion == 0)
                {
                    childSize = child.DesiredSize;
                }

                if (this.Orientation == Orientation.Horizontal)
                {
                    if (childProportion != 0)
                    {
                        childSize = new SizeF((availableWidth * childProportion) / proportionSum,
                                              availableHeight);
                    }
                    else
                    {
                        childSize.Width = availableWidth - nonStretchableSize.Width;
                    }
                    x = childSize.Width;
                    //if (child.StretchVertically)
                    childSize.Height = availableHeight;

                    if (!this.RightToLeft)
                    {
                        child.Arrange(new RectangleF(firstPositions, childSize));

                        firstPositions.X += x;
                        firstPositions.Y += y;
                    }
                    else
                    {
                        lastPositions.X -= x;
                        lastPositions.Y -= y;

                        child.Arrange(new RectangleF(lastPositions, childSize));
                    }
                }
                else
                {
                    if (childProportion != 0)
                    {
                        childSize = new SizeF(availableWidth, (availableHeight * childProportion) / proportionSum);
                        y         = childSize.Height;
                    }
                    else
                    {
                        childSize.Height = availableHeight - nonStretchableSize.Height;

                        //if (child.StretchHorizontally)
                        childSize.Width = availableWidth;
                    }

                    child.Arrange(new RectangleF(firstPositions, childSize));

                    firstPositions.X += x;
                    firstPositions.Y += y;
                }
            }

            return(finalSize);
        }
Exemple #30
0
 protected override void OnParentChanged(RadElement previousParent)
 {
     base.OnParentChanged(previousParent);
     this.SynchronizeWithParentBorderThickness();
 }
Exemple #31
0
        public override bool OnMouseWheel(MouseEventArgs e)
        {
            HandledMouseEventArgs handledMouseEventArgs = e as HandledMouseEventArgs;

            if (handledMouseEventArgs != null && handledMouseEventArgs.Handled)
            {
                return(false);
            }
            int        num1           = Math.Max(1, e.Delta / SystemInformation.MouseWheelScrollDelta);
            int        num2           = Math.Sign(e.Delta) * num1 * SystemInformation.MouseWheelScrollLines;
            bool       flag           = Control.ModifierKeys == Keys.Shift;
            RadElement elementAtPoint = this.GridControl.ElementTree.GetElementAtPoint(e.Location);

            if (elementAtPoint != null)
            {
                GroupPanelElement ancestor = elementAtPoint.FindAncestor <GroupPanelElement>();
                if (ancestor != null)
                {
                    RadScrollBarElement scrollBarElement = !flag ? ancestor.ScrollView.VScrollBar : ancestor.ScrollView.HScrollBar;
                    int num3 = scrollBarElement.Value - num2 * scrollBarElement.SmallChange;
                    if (num3 > scrollBarElement.Maximum - scrollBarElement.LargeChange + 1)
                    {
                        num3 = scrollBarElement.Maximum - scrollBarElement.LargeChange + 1;
                    }
                    if (num3 < scrollBarElement.Minimum)
                    {
                        num3 = scrollBarElement.Minimum;
                    }
                    scrollBarElement.Value = num3;
                    return(true);
                }
            }
            IGridBehavior rowBehaviorAtPoint = this.GetRowBehaviorAtPoint(e.Location);

            if (rowBehaviorAtPoint != null && rowBehaviorAtPoint.OnMouseWheel(e))
            {
                return(true);
            }
            this.tableElement = (GridTableElement)null;
            if (this.GridViewElement.UseScrollbarsInHierarchy)
            {
                this.tableElement = this.ScrollableTableElement(e.Delta < 0);
            }
            else if (this.GridViewElement.SplitMode != RadGridViewSplitMode.None)
            {
                this.tableElement = this.GetGridTableElementAtPoint(e.Location);
            }
            if (this.tableElement == null)
            {
                this.tableElement = this.GridViewElement.TableElement;
            }
            if (this.tableElement != null && (!this.GridViewElement.IsInEditMode || this.GridViewElement.EndEdit()))
            {
                RadScrollBarElement scrollBarElement = !flag ? this.tableElement.VScrollBar : this.tableElement.HScrollBar;
                int num3 = scrollBarElement.Value - num2 * scrollBarElement.SmallChange;
                if (num3 > scrollBarElement.Maximum - scrollBarElement.LargeChange + 1)
                {
                    num3 = scrollBarElement.Maximum - scrollBarElement.LargeChange + 1;
                }
                if (num3 < scrollBarElement.Minimum)
                {
                    num3 = 0;
                }
                else if (num3 > scrollBarElement.Maximum)
                {
                    num3 = scrollBarElement.Maximum;
                }
                if (num3 != scrollBarElement.Value)
                {
                    if (this.scrollDelta == 0)
                    {
                        this.scrollTimer.Start();
                    }
                    this.scrollDelta += num3 - scrollBarElement.Value;
                    if (handledMouseEventArgs != null)
                    {
                        handledMouseEventArgs.Handled = true;
                    }
                }
            }
            return(false);
        }