Esempio n. 1
0
 public RadElement GetElementAtPoint(
   RadElement parent,
   Point point,
   List<RadElement> foundElements,
   Predicate<RadElement> predicate)
 {
   if (parent.Visibility != ElementVisibility.Visible)
     return (RadElement) null;
   ChildrenListOptions options = ChildrenListOptions.ZOrdered | ChildrenListOptions.ReverseOrder | ChildrenListOptions.IncludeOnlyVisible;
   Rectangle clientRectangle = this.Control.ClientRectangle;
   foreach (RadElement child in parent.GetChildren(options))
   {
     if (child.ElementState == ElementState.Loaded && child.HitTest(point))
     {
       if (foundElements != null && !(child is BorderPrimitive))
         foundElements.Add(child);
       RadElement elementAtPoint = this.GetElementAtPoint(child, point, foundElements, predicate);
       if (elementAtPoint != null)
         return elementAtPoint;
       if (predicate == null || predicate(child))
         return child;
     }
   }
   return (RadElement) null;
 }
Esempio n. 2
0
        private void InvalidateChildrenLayout(RadElement element)
        {
            if (this.element.ElementState != ElementState.Loaded)
            {
                return;
            }

            // KOSEV: fix!
            //if (element.CoercedSize != LayoutUtils.InvalidSize)
            //    return;

            foreach (RadElement child in element.GetChildren(ChildrenListOptions.Normal))
            {
                if (child.ElementState != ElementState.Loaded || !child.AutoSize)
                {
                    continue;
                }

                child.LayoutEngine.SetLayoutInvalidated(true);

                if (!child.LayoutEngine.IsValidWrapElement() || child.OverridesDefaultLayout ||
                    child.AffectsInnerLayout)
                {
                    InvalidateChildrenLayout(child);
                }
            }
        }
Esempio n. 3
0
        private SizeF GetMaxChildBorderNumber(RadElement parent, bool getAsSize)
        {
            if (parent == null)
            {
                return(SizeF.Empty);
            }

            SizeF maxBorderSize = SizeF.Empty;

            foreach (RadElement child in parent.GetChildren(ChildrenListOptions.Normal))
            {
                if ((parent == this.Parent) && (child == this.element))
                {
                    continue;
                }

                IBoxElement childBox = child as IBoxElement;

                if (childBox == null)
                {
                    continue;
                }

                if (child.LayoutableChildrenCount != 0)
                {
                    continue;
                }

                maxBorderSize.Width  = Math.Max(maxBorderSize.Width, (getAsSize ? childBox.HorizontalWidth : childBox.Offset.Width));
                maxBorderSize.Height = Math.Max(maxBorderSize.Height, (getAsSize ? childBox.VerticalWidth : childBox.Offset.Height));
            }

            return(maxBorderSize);
        }
Esempio n. 4
0
        private void InvalidateCoercedElements(RadElement parent, RadElement element)
        {
            foreach (RadElement child in parent.GetChildren(ChildrenListOptions.Normal))
            {
                if (child == element)
                {
                    continue;
                }

                if (child.CoercedSize != LayoutUtils.InvalidSize)
                {
                    continue;
                }

                if (child.ElementState == ElementState.Loaded)
                {
                    child.LayoutEngine.SetLayoutInvalidated(true);

                    if (!child.LayoutEngine.IsValidWrapElement() || child.OverridesDefaultLayout || (element != null))
                    {
                        InvalidateCoercedElements(child, null);
                    }
                }
            }
        }
Esempio n. 5
0
        internal RadElement GetElementAtPoint(RadElement parent, Point point, List <RadElement> foundElements)
        {
            if (parent.Visibility != ElementVisibility.Visible)
            {
                return(null);
            }

            ChildrenListOptions childrenFlags = ChildrenListOptions.ZOrdered |
                                                ChildrenListOptions.ReverseOrder |
                                                ChildrenListOptions.IncludeOnlyVisible;

            Rectangle client = this.Control.ClientRectangle;

            foreach (RadElement element in parent.GetChildren(childrenFlags))
            {
                if (element.ElementState != ElementState.Loaded)
                {
                    continue;
                }

                if (element.HitTest(point))
                {
                    bool addElement = (foundElements != null) && !(element is BorderPrimitive);
                    if (addElement)
                    {
                        foundElements.Add(element);
                    }

                    RadElement res = GetElementAtPoint(element, point, foundElements);

                    if (res != null)
                    {
                        return(res);
                    }

                    if (element.ShouldHandleMouseInput)
                    {
                        return(element);
                    }
                }
            }

            return(null);
        }
Esempio n. 6
0
        private void PerformLastSelfExplicit(RadElement element)
        {
            foreach (RadElement child in element.GetChildren(ChildrenListOptions.Normal))
            {
                if (child.ElementState != ElementState.Loaded)
                {
                    continue;
                }

                if (child.PerformLayoutAfterFinishLayout == PerformLayoutType.SelfExplicit)
                {
                    child.PerformLayoutAfterFinishLayout = PerformLayoutType.None;
                    child.LayoutEngine.PerformLayout(child, true);
                    return;
                }

                PerformLastSelfExplicit(child);
            }
        }
 private RadItem FindGesturedItem(GestureEventArgs args, RadElement current)
 {
     foreach (RadElement child in current.GetChildren(ChildrenListOptions.ZOrdered | ChildrenListOptions.ReverseOrder))
     {
         if (child.ControlBoundingRectangle.Contains(args.Location))
         {
             RadItem radItem = child as RadItem;
             if (radItem != null)
             {
                 radItem.CallOnGesture(args);
                 if (args.Handled)
                 {
                     return(radItem);
                 }
             }
             RadItem gesturedItem = this.FindGesturedItem(args, child);
             if (gesturedItem != null)
             {
                 return(gesturedItem);
             }
         }
     }
     return((RadItem)null);
 }