コード例 #1
0
ファイル: ExternalLinkButton.cs プロジェクト: Tiller431/yes
 protected override void OnHoverLost(HoverLostEvent e)
 {
     InternalChild.FadeColour(Color4.White, 500, Easing.OutQuint);
     base.OnHoverLost(e);
 }
コード例 #2
0
 protected override bool OnHover(HoverEvent e)
 {
     InternalChild.FadeColour(hoverColour, 500, Easing.OutQuint);
     return(base.OnHover(e));
 }
コード例 #3
0
        public override void Arrange()
        {
            if (InternalChild == null)
            {
                return;
            }

            var bounds         = ActualBounds;
            var availableSize  = bounds.Size();
            var oldMeasureSize = InternalChild.Measure(availableSize);

            _horizontalScrollingOn = oldMeasureSize.X > bounds.Width;
            _verticalScrollingOn   = oldMeasureSize.Y > bounds.Height;
            if (_horizontalScrollingOn || _verticalScrollingOn)
            {
                var vsWidth  = VerticalScrollbarWidth;
                var hsHeight = HorizontalScrollbarHeight;

                if (_horizontalScrollingOn && ShowHorizontalScrollBar)
                {
                    availableSize.Y -= hsHeight;

                    if (availableSize.Y < 0)
                    {
                        availableSize.Y = 0;
                    }
                }

                if (_verticalScrollingOn && ShowVerticalScrollBar)
                {
                    availableSize.X -= vsWidth;

                    if (availableSize.X < 0)
                    {
                        availableSize.X = 0;
                    }
                }

                // Remeasure with scrollbars
                var measureSize = InternalChild.Measure(availableSize);

                var bw = bounds.Width - (_verticalScrollingOn && ShowVerticalScrollBar ? vsWidth : 0);

                _horizontalScrollbarFrame = new Rectangle(bounds.Left,
                                                          bounds.Bottom - hsHeight,
                                                          bw,
                                                          hsHeight);

                var mw = measureSize.X;
                if (mw == 0)
                {
                    mw = 1;
                }

                _horizontalScrollbarThumb = new Rectangle(bounds.Left,
                                                          bounds.Bottom - hsHeight,
                                                          Math.Max(HorizontalScrollKnob.Size.X, bw * bw / mw),
                                                          HorizontalScrollKnob.Size.Y);

                var bh = bounds.Height - (_horizontalScrollingOn ? hsHeight : 0);

                _verticalScrollbarFrame = new Rectangle(
                    bounds.Left + bounds.Width - vsWidth,
                    bounds.Top,
                    vsWidth,
                    bh);

                var mh = measureSize.Y;
                if (mh == 0)
                {
                    mh = 1;
                }

                _verticalScrollbarThumb = new Rectangle(
                    bounds.Left + bounds.Width - vsWidth,
                    bounds.Top,
                    VerticalScrollKnob.Size.X,
                    Math.Max(VerticalScrollKnob.Size.Y, bh * bh / mh));

                _thumbMaximumX = bw - _horizontalScrollbarThumb.Width;
                _thumbMaximumY = bh - _verticalScrollbarThumb.Height;

                if (_thumbMaximumX == 0)
                {
                    _thumbMaximumX = 1;
                }

                if (_thumbMaximumY == 0)
                {
                    _thumbMaximumY = 1;
                }

                if (_horizontalScrollingOn && ShowHorizontalScrollBar)
                {
                    bounds.Width = measureSize.X;
                }
                else if (_horizontalScrollingOn)
                {
                    bounds.Width = oldMeasureSize.X;
                }
                else
                {
                    bounds.Width = availableSize.X;
                }

                if (_verticalScrollingOn && ShowVerticalScrollBar)
                {
                    bounds.Height = measureSize.Y;
                }
                else if (_verticalScrollingOn)
                {
                    bounds.Height = oldMeasureSize.Y;
                }
                else
                {
                    bounds.Height = availableSize.Y;
                }
            }

            InternalChild.Layout(bounds);

            // Fit scroll position in new maximums
            var scrollPosition = ScrollPosition;

            ScrollPosition = scrollPosition;
        }
コード例 #4
0
ファイル: TestCaseLoaderAnimation.cs プロジェクト: DKooPK/osu
 protected override void LogoArriving(OsuLogo logo, bool resuming)
 {
     base.LogoArriving(logo, resuming);
     InternalChild.FadeInFromZero(200);
 }
コード例 #5
0
        public void ApplySliderStyle(SliderStyle style)
        {
            ApplyWidgetStyle(style);

            InternalChild.ApplyImageButtonStyle(style.KnobStyle);
        }
コード例 #6
0
 protected override void LoadComplete()
 {
     base.LoadComplete();
     InternalChild.FadeInFromZero(200);
 }
コード例 #7
0
ファイル: ListBox.cs プロジェクト: randomcrab/Myra
        public override void OnMouseWheel(float delta)
        {
            base.OnMouseWheel(delta);

            InternalChild.OnMouseWheel(delta);
        }
コード例 #8
0
ファイル: ListBox.cs プロジェクト: randomcrab/Myra
        protected override void OnItemCollectionChanged()
        {
            base.OnItemCollectionChanged();

            InternalChild.ResetScroll();
        }
コード例 #9
0
        public override void Arrange()
        {
            if (InternalChild == null)
            {
                return;
            }

            var bounds        = ActualBounds;
            var availableSize = bounds.Size();
            var measureSize   = InternalChild.Measure(availableSize);

            _horizontalScrollbarVisible = AllowHorizontalScrolling && measureSize.X > bounds.Width;
            _verticalScrollbarVisible   = AllowVerticalScrolling && measureSize.Y > bounds.Height;
            if (_horizontalScrollbarVisible || _verticalScrollbarVisible)
            {
                if (_horizontalScrollbarVisible)
                {
                    availableSize.Y -= HorizontalScrollKnob.Size.Y;

                    if (availableSize.Y < 0)
                    {
                        availableSize.Y = 0;
                    }
                }

                if (_verticalScrollbarVisible)
                {
                    availableSize.X -= VerticalScrollKnob.Size.X;

                    if (availableSize.X < 0)
                    {
                        availableSize.X = 0;
                    }
                }

                // Remeasure with scrollbars
                measureSize = InternalChild.Measure(availableSize);

                var vsWidth  = VerticalScrollBackground != null ? VerticalScrollBackground.Size.X : VerticalScrollKnob.Size.X;
                var hsHeight = HorizontalScrollBackground != null ? HorizontalScrollBackground.Size.Y : HorizontalScrollKnob.Size.Y;

                var bw = bounds.Width - (_verticalScrollbarVisible ? vsWidth : 0);

                _horizontalScrollbarFrame = new Rectangle(bounds.Left,
                                                          bounds.Bottom - hsHeight,
                                                          bw,
                                                          hsHeight);

                var mw = measureSize.X;
                if (mw == 0)
                {
                    mw = 1;
                }

                _horizontalScrollbarThumb = new Rectangle(bounds.Left,
                                                          bounds.Bottom - hsHeight,
                                                          Math.Max(HorizontalScrollKnob.Size.X, bw * bw / mw),
                                                          HorizontalScrollKnob.Size.Y);

                var bh = bounds.Height - (_horizontalScrollbarVisible ? hsHeight : 0);

                _verticalScrollbarFrame = new Rectangle(
                    bounds.Left + bounds.Width - vsWidth,
                    bounds.Top,
                    vsWidth,
                    bh);

                var mh = measureSize.Y;
                if (mh == 0)
                {
                    mh = 1;
                }

                _verticalScrollbarThumb = new Rectangle(
                    bounds.Left + bounds.Width - vsWidth,
                    bounds.Top,
                    VerticalScrollKnob.Size.X,
                    Math.Max(VerticalScrollKnob.Size.Y, bh * bh / mh));

                _horizontalMaximum = bw - _horizontalScrollbarThumb.Width;
                _verticalMaximum   = bh - _verticalScrollbarThumb.Height;

                if (_horizontalMaximum == 0)
                {
                    _horizontalMaximum = 1;
                }

                if (_verticalMaximum == 0)
                {
                    _verticalMaximum = 1;
                }

                bounds.Width  = _horizontalScrollbarVisible ? measureSize.X : availableSize.X;
                bounds.Height = _verticalScrollbarVisible ? measureSize.Y : availableSize.Y;

                if (_scrollPosition.X < 0)
                {
                    _scrollPosition.X = 0;
                }

                if (_scrollPosition.X > _horizontalMaximum)
                {
                    _scrollPosition.X = _horizontalMaximum;
                }

                if (_scrollPosition.Y < 0)
                {
                    _scrollPosition.Y = 0;
                }

                if (_scrollPosition.Y > _verticalMaximum)
                {
                    _scrollPosition.Y = _verticalMaximum;
                }
            }

            InternalChild.Layout(bounds);

            UpdateWidgetLocation();
        }