Example #1
0
        public override void MouseMoved(MouseEvent mouseEvent)
        {
            if (mouseEvent.state.Z.rel != 0 && widgets.Count != 0)
            {
                float distance   = scroll.Height - drag.Height - initDragTop;
                var   moveOffset = distance / (float)rows.Count;

                float offset = mouseEvent.state.Z.rel / Mogre.Math.Abs((float)mouseEvent.state.Z.rel);
                if (offset < 0)
                {
                    if (drag.Top + drag.Height + initDragTop <= scroll.Height)
                    {
                        drag.Top += moveOffset;
                        setDisplayWidgets(ScrollOritentation.Down);
                    }
                }
                else
                {
                    if (drag.Top >= initDragTop)
                    {
                        drag.Top -= moveOffset;
                        setDisplayWidgets(ScrollOritentation.Up);
                    }
                }
                Scrolled?.Invoke();
            }
            foreach (var widget in visualWidgets)
            {
                widget.MouseMoved(mouseEvent);
            }
        }
Example #2
0
        /// <summary>
        /// Creates and initializes a new instance of the Panel class.
        /// </summary>
        /// <param name="parent">The EvasObject to which the new panel will be attached as a child.</param>
        /// <since_tizen> preview </since_tizen>
        public Panel(EvasObject parent) : base(parent)
        {
            _toggled  = new SmartEvent(this, this.RealHandle, "toggled");
            _scrolled = new SmartEvent(this, this.RealHandle, "scroll");

            _toggled.On  += (s, e) => Toggled?.Invoke(this, EventArgs.Empty);
            _scrolled.On += (s, e) => Scrolled?.Invoke(this, EventArgs.Empty);
        }
Example #3
0
 internal void OnScrolled(object sender, EventArgs args)
 {
     //Listener.CancelActiveGestures();  // this breaks UWP listview scrolling!!!
     //System.Diagnostics.Debug.WriteLine("!!! STOP !!!");
     IsScrolling = false;
     Scrolled?.Invoke(this, args);
     //System.Diagnostics.Debug.WriteLine("EnhancedListView.OnScrolled: offset=[" + ScrollOffset + "]");
 }
Example #4
0
 /// <summary>
 /// Constructor of ListView native control.
 /// </summary>
 /// <param name="parent">ElmSharp object which is parent of particular list view</param>
 public ListView(EvasObject parent)
     : base(parent)
 {
     _scrollerExtension = new ScrollerExtension(this);
     new SmartEvent(this, RealHandle, "scroll").On += (s, e) =>
     {
         Scrolled?.Invoke(this, null);
     };
 }
        protected override void OnScrollChanged(int l, int t, int oldl, int oldt)
        {
            base.OnScrollChanged(l, t, oldl, oldt);

            Scrolled?.Invoke(this, new ScrolledEventArgs
            {
                X    = l,
                Y    = t,
                OldX = oldl,
                OldY = oldt
            });
        }
Example #6
0
        public void SetScrolledPosition(double x, double y)
        {
            if (ScrollX == x && ScrollY == y)
            {
                return;
            }

            ScrollX = x;
            ScrollY = y;

            Scrolled?.Invoke(this, new ScrolledEventArgs(x, y));
        }
        /// <summary>
        /// Scrolls down when the user presses on the "scroll down" arrow.
        /// </summary>
        private void BtnScrollDown_LeftClick(object sender, EventArgs e)
        {
            int nonDisplayedLines = Length - DisplayedPixelCount;

            if (ViewTop < nonDisplayedLines)
            {
                ViewTop = Math.Min(ViewTop + ScrollStep, nonDisplayedLines);
            }

            RefreshButtonY();

            Scrolled?.Invoke(this, EventArgs.Empty);
        }
        /// <summary>
        /// Scrolls up when the user presses on the "scroll up" arrow.
        /// </summary>
        private void BtnScrollUp_LeftClick(object sender, EventArgs e)
        {
            if (ViewTop > 0)
            {
                ViewTop -= ScrollStep;
                if (ViewTop < 0)
                {
                    ViewTop = 0;
                }
            }

            RefreshButtonY();

            Scrolled?.Invoke(this, EventArgs.Empty);
        }
        private void Scroll()
        {
            var point = GetCursorPoint();

            if (point.Y < btnScrollUp.Height ||
                point.Y > btnScrollDown.Y)
            {
                return;
            }

            if (point.Y <= buttonMinY)
            {
                ViewTop = 0;
                RefreshButtonY();
                Scrolled?.Invoke(this, EventArgs.Empty);
                return;
            }

            if (point.Y >= buttonMaxY)
            {
                ViewTop = Length - DisplayedPixelCount;
                RefreshButtonY();
                Scrolled?.Invoke(this, EventArgs.Empty);
                ScrolledToBottom?.Invoke(this, EventArgs.Empty);
                return;
            }

            double difference = buttonMaxY - buttonMinY;

            double location = point.Y - buttonMinY;

            int nonDisplayedLines = Length - DisplayedPixelCount;

            ViewTop = (int)(location / difference * nonDisplayedLines);
            RefreshButtonY();

            Scrolled?.Invoke(this, EventArgs.Empty);
        }
Example #10
0
        protected override void OnPaint(PaintEventArgs e)  // .Net itself giving us graphic context in "e"
        {
            x++;
            base.OnPaint(e); // used to make previous setting as it is,

            SolidBrush brush = new SolidBrush(this.ForeColor);
            Font       font  = new Font(this.Font.FontFamily, 30);
            SizeF      sizef = e.Graphics.MeasureString(_label, font);

            Point point = new Point
                              (x,
                              (ClientSize.Height - (int)sizef.Height) / 2
                              );

            e.Graphics.DrawString(_label, font, brush, point);

            if (x == ClientSize.Width)
            {
                x          = 0;
                obj.count += 1;
                Scrolled.Invoke(this, obj);
            }
        }
Example #11
0
 protected virtual void OnScrolled(object sender, EventArgs e)
 {
     Scrolled?.Invoke(this, EventArgs.Empty);
 }
Example #12
0
 private void viewScrolled(object obj) =>
 Scrolled?.Invoke(this);
Example #13
0
 /// <summary>
 /// On scrollbar scroll update the scroll offsets and invalidate.
 /// </summary>
 private void OnScrollBarScroll(object sender, ScrollEventArgs e)
 {
     UpdateScrollOffsets();
     Scrolled?.Invoke(sender, e);
 }
 internal void FireScroll(MouseEventArgs e)
 {
     OnMouseScroll(e);
     Scrolled?.Invoke(this, e);
 }
 public void SendScrolled(double percent)
 {
     Scrolled?.Invoke(this, new ScrolledEventArgs {
         NewValue = percent
     });
 }
 public void SendScrolled(ScrollDirection direction)
 {
     Scrolled?.Invoke(this, new ScrolledEventArgs {
         NewValue = Position, Direction = direction
     });
 }
Example #17
0
 public void SendScrolled(ScrolledEventArgs args)
 => Scrolled?.Invoke(this, args);
Example #18
0
 public override void OnScrolled(RecyclerView recyclerView, int dx, int dy) =>
 Scrolled?.Invoke(recyclerView, dx, dy);
Example #19
0
        private void visibleRecordIndexChanged(object sender)
        {
            var layoutView = getView(sender);

            Scrolled?.Invoke(layoutView);
        }
Example #20
0
 public void OnScrolled(Vector2 delta)
 {
     Scrolled?.Invoke(delta);
 }
Example #21
0
 public void Scroll(WindowScrollInfo windowScrollEvent)
 {
     Scrolled?.Invoke(windowScrollEvent);
 }
Example #22
0
 /// <summary>
 /// Method to be called after a scroll completes.
 /// </summary>
 /// <param name="args">The scroll event arguments.</param>
 public void OnScrolled(ScrolledEventArgs args)
 {
     Scrolled?.Invoke(this, args);
 }
 /// <summary>
 /// Method to be called after a scroll completes.
 /// </summary>
 /// <param name="args">The scroll event arguments.</param>
 public void RaiseScrollEvent(ScrolledEventArgs args)
 {
     Scrolled?.Invoke(this, args);
 }
Example #24
0
 public void SendScrolled(double percent, ScrollDirection direction)
 {
     Scrolled?.Invoke(this, new ScrolledEventArgs {
         NewValue = percent, Direction = direction
     });
 }
Example #25
0
        public int GetSelection(bool canEscape, int selectIndex, List <string> choices)
        {
            _selectIndex = selectIndex;
            _choices     = choices;
            ConsoleKey key = ConsoleKey.Applications;

            if (!_selectionAbles.Exists(a => a == true))
            {
                _scrolled    = Scrolled.Up;
                _selectIndex = 0;
                ChangedSelection();
                _selectIndex = -1;
                DrawSelections();
                NoEnabledSelections();

                while (key != ConsoleKey.Escape)
                {
                    key = Console.ReadKey(true).Key;

                    if (key != ConsoleKey.Escape)
                    {
                        OtherKeyPressed(key);
                    }
                }
            }
            else
            {
                if (!_selectionAbles [_selectIndex])
                {
                    do
                    {
                        _scrolled = Scrolled.Down;
                        _selectIndex++;

                        if (_selectIndex > _selections.Count() - 1)
                        {
                            _selectIndex = _selections.Count() - 1;
                            break;
                        }
                    } while (!_selectionAbles [_selectIndex]);

                    if (!_selectionAbles [_selectIndex])
                    {
                        do
                        {
                            _scrolled = Scrolled.Up;
                            _selectIndex--;

                            if (_selectIndex < 0)
                            {
                                _selectIndex = 0;
                                break;
                            }
                        } while (!_selectionAbles [_selectIndex]);
                    }
                }


                key = ConsoleKey.Applications;
                bool selected = false;

                while (!selected)
                {
                    DrawSelections();
                    ChangedSelection();
                    PreGetSelection();

                    while (key != ConsoleKey.Enter)
                    {
                        key = Console.ReadKey(true).Key;

                        if (key == ConsoleKey.W)
                        {
                            int oldIndex = _selectIndex;

                            do
                            {
                                _selectIndex--;

                                if (_selectIndex < 0)
                                {
                                    _selectIndex = 0;
                                    break;
                                }
                            } while (!_selectionAbles [_selectIndex]);

                            if (!_selectionAbles [_selectIndex])
                            {
                                do
                                {
                                    _selectIndex++;

                                    if (_selectIndex > _selections.Count() - 1)
                                    {
                                        _selectIndex = _selections.Count() - 1;
                                        break;
                                    }
                                } while (!_selectionAbles [_selectIndex]);
                            }

                            if (oldIndex != _selectIndex)
                            {
                                _scrolled = Scrolled.Up;
                                ChangedSelection();
                            }
                        }
                        else if (key == ConsoleKey.S)
                        {
                            int oldIndex = _selectIndex;

                            do
                            {
                                _selectIndex++;

                                if (_selectIndex > _selections.Count() - 1)
                                {
                                    _selectIndex = _selections.Count() - 1;
                                    break;
                                }
                            } while (!_selectionAbles [_selectIndex]);

                            if (!_selectionAbles [_selectIndex])
                            {
                                do
                                {
                                    _selectIndex--;

                                    if (_selectIndex == -1)
                                    {
                                        _selectIndex = 0;
                                        break;
                                    }
                                } while (!_selectionAbles [_selectIndex]);
                            }

                            if (oldIndex != _selectIndex)
                            {
                                _scrolled = Scrolled.Down;
                                ChangedSelection();
                            }
                        }
                        else if (key == ConsoleKey.Escape && canEscape)
                        {
                            _selectIndex = -1;
                        }
                        else if (key != ConsoleKey.Enter)
                        {
                            OtherKeyPressed(key);
                        }

                        if (_selectIndex == -1)
                        {
                            break;
                        }

                        if (!_selectionAbles [_selectIndex])
                        {
                            key = ConsoleKey.Applications;
                        }
                    }

                    if (_selectIndex == -1)
                    {
                        break;
                    }

                    if (_choices.Count() > 0)
                    {
                        GetSelectionSubChoice();

                        if (_choiceIndex == 0)
                        {
                            selected = true;
                        }
                        else
                        {
                            key = ConsoleKey.Applications;
                            Clear(ClearType.AboveDialog);
                            //Clear (_topLine, Data._generalInfo.dividerLine);
                        }

                        _choiceIndex = -1;
                    }
                    else
                    {
                        selected = true;
                    }
                }
            }

            return(_selectIndex);
        }
 /// <summary>
 /// Updates the bounds.
 /// </summary>
 /// <param name="bounds">The bounds.</param>
 public void UpdateBounds(Rectangle bounds)
 {
     Position = bounds.Location;
     Scrolled?.Invoke(this, bounds);
 }
 public void OnScroll(PointerEventData eventData)
 {
     Scrolled?.Invoke(eventData.scrollDelta);
 }