Пример #1
0
 public Scroller(ScrollerType type)
 {
     this.state = ScrollerStates.Normal;
     this.position = new Point();
     this.type = type;
 }
Пример #2
0
 /// <summary>
 /// Create a scroller.
 /// </summary>
 /// <param name="gui">The GUI that this scroller will be a part of.</param>
 /// <param name="position">The position of this scroller.</param>
 /// <param name="type">Whether the item scrolls horizontally or vertically.</param>
 /// <param name="length">The length of this scroller.</param>
 public Scroller(GraphicalUserInterface gui, Vector2 position, ScrollerType type, float length)
 {
     //Initialize some variables.
     Initialize(gui, position, type, length);
 }
Пример #3
0
 public Scroller(ScrollerType type)
 {
     this.state    = ScrollerStates.Normal;
     this.position = new Point();
     this.type     = type;
 }
Пример #4
0
        /// <summary>
        /// Initialize the scroller.
        /// </summary>
        /// <param name="gui">The GUI that this scroller will be a part of.</param>
        /// <param name="position">The position of the scroller.</param>
        /// <param name="type">The scroller type, that is whether it scrolls horizontally or vertically.</param>
        /// <param name="length">The length of this scroller. Minimum is 80.</param>
        public void Initialize(GraphicalUserInterface gui, Vector2 position, ScrollerType type, float length)
        {
            //Call the base class and pass along the appropriate information.
            if (type == ScrollerType.Horizontal) { base.Initialize(gui, position, Math.Max(length, 80), 15); }
            else { base.Initialize(gui, position, 15, Math.Max(length, 80)); }

            //Initialize some variables.
            _Type = type;
            _Value = 0;
            _Thumb = new Button(GUI, Position);
            _Backward = new Button(GUI, Position);
            _Forward = new Button(GUI, Position);

            //Add the controls.
            Add(_Thumb);
            Add(_Backward);
            Add(_Forward);

            //Hook up some events.
            _Thumb.MouseDown += OnThumbDown;
            _Backward.MouseDown += OnBackwardDown;
            _Forward.MouseDown += OnForwardDown;
            _Backward.MouseClick += OnBackwardClick;
            _Forward.MouseClick += OnForwardClick;
        }