Esempio n. 1
0
        public void LoadEvents(NativeView handler)
        {
            if (_disposed)
            {
                throw new ObjectDisposedException(null);
            }

            _handler = handler;
            OnElementChanged(this, new VisualElementChangedEventArgs(null, _renderer.Element));
        }
Esempio n. 2
0
        public static SizeRequest GetSizeRequest(this Ooui.Html.Element self, double widthConstraint, double heightConstraint,
                                                 double minimumWidth = -1, double minimumHeight = -1)
        {
            var  rw       = 0.0;
            var  rh       = 0.0;
            Size s        = new Size(0, 0);
            var  measured = false;

            if (self.Style.Width.Equals("inherit"))
            {
                s        = self.Text.MeasureSize(self.Style, widthConstraint, heightConstraint);
                measured = true;
                rw       = double.IsPositiveInfinity(s.Width) ? double.PositiveInfinity : Math.Ceiling(s.Width);
            }
            else
            {
                rw = self.Style.GetNumberWithUnits("width", "px", 640);
            }

            if (self.Style.Height.Equals("inherit"))
            {
                if (!measured)
                {
                    s        = self.Text.MeasureSize(self.Style, widthConstraint, heightConstraint);
                    measured = true;
                }
                rh = double.IsPositiveInfinity(s.Height) ? double.PositiveInfinity : Math.Ceiling(s.Height * 1.4);
            }
            else
            {
                rh = self.Style.GetNumberWithUnits("height", "px", 480);
            }

            var minimum = new Size(minimumWidth < 0 ? rw : minimumWidth,
                                   minimumHeight < 0 ? rh : minimumHeight);

            return(new SizeRequest(new Size(rw, rh), minimum));
        }
Esempio n. 3
0
        public void Dispose()
        {
            if (_disposed)
            {
                return;
            }

            _disposed = true;

            foreach (var kvp in _gestureRecognizers)
            {
                RemoveGestureRecognizer(_handler, kvp.Value);
                kvp.Value.Dispose();
            }

            _gestureRecognizers.Clear();

            if (ElementGestureRecognizers != null)
            {
                ElementGestureRecognizers.CollectionChanged -= _collectionChangedHandler;
            }

            _handler = null;
        }
Esempio n. 4
0
 static void RemoveGestureRecognizer(Ooui.Html.Element element, NativeGestureRecognizer recognizer)
 {
     element.RemoveEventListener(recognizer.EventType, recognizer.Handler);
 }
Esempio n. 5
0
 public static void SendViewInitialized(this VisualElement self, Ooui.Html.Element nativeView)
 {
     ViewInitialized?.Invoke(self, new ViewInitializedEventArgs {
         View = self, NativeView = nativeView
     });
 }