|
@@ -20,22 +20,20 @@ public class Scroll : View
|
|
ClearOnVisibleFalse = false;
|
|
ClearOnVisibleFalse = false;
|
|
CanFocus = false;
|
|
CanFocus = false;
|
|
Orientation = Orientation.Vertical;
|
|
Orientation = Orientation.Vertical;
|
|
|
|
+ Width = 1;
|
|
|
|
|
|
- _sliderContainer = new () { Width = Dim.Fill (), Height = Dim.Fill (), WantContinuousButtonPressed = true };
|
|
|
|
_slider = new () { Id = "slider" };
|
|
_slider = new () { Id = "slider" };
|
|
- _sliderContainer.Add (_slider);
|
|
|
|
- Add (_sliderContainer);
|
|
|
|
|
|
+ Add (_slider);
|
|
|
|
|
|
Added += Scroll_Added;
|
|
Added += Scroll_Added;
|
|
Removed += Scroll_Removed;
|
|
Removed += Scroll_Removed;
|
|
Initialized += Scroll_Initialized;
|
|
Initialized += Scroll_Initialized;
|
|
- _sliderContainer.DrawContent += SubViews_DrawContent;
|
|
|
|
- _sliderContainer.MouseEvent += SliderContainer_MouseEvent;
|
|
|
|
|
|
+ DrawContent += SubViews_DrawContent;
|
|
|
|
+ MouseEvent += SliderContainer_MouseEvent;
|
|
_slider.DrawContent += SubViews_DrawContent;
|
|
_slider.DrawContent += SubViews_DrawContent;
|
|
_slider.MouseEvent += Slider_MouseEvent;
|
|
_slider.MouseEvent += Slider_MouseEvent;
|
|
}
|
|
}
|
|
|
|
|
|
- private readonly View _sliderContainer;
|
|
|
|
private readonly View _slider;
|
|
private readonly View _slider;
|
|
private int _lastLocation = -1;
|
|
private int _lastLocation = -1;
|
|
|
|
|
|
@@ -120,8 +118,8 @@ public class Scroll : View
|
|
{
|
|
{
|
|
Added -= Scroll_Added;
|
|
Added -= Scroll_Added;
|
|
Initialized -= Scroll_Initialized;
|
|
Initialized -= Scroll_Initialized;
|
|
- _sliderContainer.DrawContent -= SubViews_DrawContent;
|
|
|
|
- _sliderContainer.MouseEvent -= SliderContainer_MouseEvent;
|
|
|
|
|
|
+ DrawContent -= SubViews_DrawContent;
|
|
|
|
+ MouseEvent -= SliderContainer_MouseEvent;
|
|
_slider.DrawContent -= SubViews_DrawContent;
|
|
_slider.DrawContent -= SubViews_DrawContent;
|
|
_slider.MouseEvent -= Slider_MouseEvent;
|
|
_slider.MouseEvent -= Slider_MouseEvent;
|
|
|
|
|
|
@@ -250,48 +248,32 @@ public class Scroll : View
|
|
|
|
|
|
private void SetSliderText ()
|
|
private void SetSliderText ()
|
|
{
|
|
{
|
|
- _sliderContainer.TextDirection = Orientation == Orientation.Vertical ? TextDirection.TopBottom_LeftRight : TextDirection.LeftRight_TopBottom;
|
|
|
|
-
|
|
|
|
- _sliderContainer.Text = string.Concat (
|
|
|
|
- Enumerable.Repeat (
|
|
|
|
- Glyphs.Stipple.ToString (),
|
|
|
|
- Orientation == Orientation.Vertical
|
|
|
|
- ? _sliderContainer.Frame.Height
|
|
|
|
- : _sliderContainer.Frame.Width));
|
|
|
|
|
|
+ TextDirection = Orientation == Orientation.Vertical ? TextDirection.TopBottom_LeftRight : TextDirection.LeftRight_TopBottom;
|
|
|
|
+
|
|
|
|
+ Text = string.Concat (
|
|
|
|
+ Enumerable.Repeat (
|
|
|
|
+ Glyphs.Stipple.ToString (),
|
|
|
|
+ Frame.Width * Frame.Height));
|
|
_slider.TextDirection = Orientation == Orientation.Vertical ? TextDirection.TopBottom_LeftRight : TextDirection.LeftRight_TopBottom;
|
|
_slider.TextDirection = Orientation == Orientation.Vertical ? TextDirection.TopBottom_LeftRight : TextDirection.LeftRight_TopBottom;
|
|
|
|
|
|
_slider.Text = string.Concat (
|
|
_slider.Text = string.Concat (
|
|
Enumerable.Repeat (
|
|
Enumerable.Repeat (
|
|
Glyphs.ContinuousMeterSegment.ToString (),
|
|
Glyphs.ContinuousMeterSegment.ToString (),
|
|
- Orientation == Orientation.Vertical
|
|
|
|
- ? _sliderContainer.Frame.Height
|
|
|
|
- : _slider.Frame.Width));
|
|
|
|
|
|
+ _slider.Frame.Width * _slider.Frame.Height));
|
|
}
|
|
}
|
|
|
|
|
|
private void SetWidthHeight ()
|
|
private void SetWidthHeight ()
|
|
{
|
|
{
|
|
- if (Orientation == Orientation.Vertical)
|
|
|
|
- {
|
|
|
|
- Width = 1;
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- Height = 1;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
if (!IsInitialized)
|
|
if (!IsInitialized)
|
|
{
|
|
{
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- _sliderContainer.Width = Orientation == Orientation.Vertical ? 1 : Dim.Fill ();
|
|
|
|
- _sliderContainer.Height = Orientation == Orientation.Vertical ? Dim.Fill () : 1;
|
|
|
|
-
|
|
|
|
(int Location, int Dimension) slider = GetSliderLocationDimensionFromPosition ();
|
|
(int Location, int Dimension) slider = GetSliderLocationDimensionFromPosition ();
|
|
_slider.X = Orientation == Orientation.Vertical ? 0 : slider.Location;
|
|
_slider.X = Orientation == Orientation.Vertical ? 0 : slider.Location;
|
|
_slider.Y = Orientation == Orientation.Vertical ? slider.Location : 0;
|
|
_slider.Y = Orientation == Orientation.Vertical ? slider.Location : 0;
|
|
- _slider.Width = Orientation == Orientation.Vertical ? 1 : slider.Dimension;
|
|
|
|
- _slider.Height = Orientation == Orientation.Vertical ? slider.Dimension : 1;
|
|
|
|
|
|
+ _slider.Width = Orientation == Orientation.Vertical ? Dim.Fill () : slider.Dimension;
|
|
|
|
+ _slider.Height = Orientation == Orientation.Vertical ? slider.Dimension : Dim.Fill ();
|
|
|
|
|
|
SetSliderText ();
|
|
SetSliderText ();
|
|
}
|
|
}
|