示例#1
0
        public ThemedScrollView(ScrollDirection scrollDirection = ScrollDirection.Vertical)
        {
            var slider = new Widget();

            slider.Size = new Vector2(10, 5);
            Direction   = scrollDirection;
            slider.CompoundPresenter.Add(new SliderPresenter(this));
            var ae = new AnimationEngineDelegate();

            ae.OnRunAnimation = (_, marker, animationTimeCorrection) => {
                slider.Opacity = marker == "Show" ? 1 : 0;
                return(true);
            };
            slider.DefaultAnimation.AnimationEngine = ae;
            Behaviour = new ScrollViewWithSlider(this, slider, scrollDirection)
            {
                ScrollBySlider = true
            };
        }
示例#2
0
        public ThemedScrollView()
        {
            var slider = new Widget();

            slider.Size = new Vector2(10, 5);
            slider.CompoundPresenter.Add(new DelegatePresenter <Widget>(_ => {
                PrepareRendererState();
                Renderer.DrawRect(new Vector2(Width - slider.Width, 0), Size, Theme.Colors.ScrollbarBackground);
                slider.PrepareRendererState();
                Renderer.DrawRect(new Vector2(2, 0), new Vector2(slider.Width - 2, slider.Height), Theme.Colors.ScrollbarThumb);
            }));
            var ae = new AnimationEngineDelegate();

            ae.OnRunAnimation = (_, marker, animationTimeCorrection) => {
                slider.Opacity = marker == "Show" ? 1 : 0;
                return(true);
            };
            slider.DefaultAnimation.AnimationEngine = ae;
            Behaviour = new ScrollViewWithSlider(this, slider, ScrollDirection.Vertical)
            {
                ScrollBySlider = true
            };
        }