Browse Source

Rename to Scroll_ prefix on the Scroll event methods.

BDisp 1 year ago
parent
commit
4cb27fc293
1 changed files with 28 additions and 28 deletions
  1. 28 28
      Terminal.Gui/Views/Scroll.cs

+ 28 - 28
Terminal.Gui/Views/Scroll.cs

@@ -28,9 +28,9 @@ public class Scroll : View
         Added += Scroll_Added;
         Added += Scroll_Added;
         Removed += Scroll_Removed;
         Removed += Scroll_Removed;
         Initialized += Scroll_Initialized;
         Initialized += Scroll_Initialized;
-        DrawContent += SubViews_DrawContent;
-        MouseEvent += SliderContainer_MouseEvent;
-        _slider.DrawContent += SubViews_DrawContent;
+        DrawContent += Scroll_DrawContent;
+        MouseEvent += Scroll_MouseEvent;
+        _slider.DrawContent += Scroll_DrawContent;
         _slider.MouseEvent += Slider_MouseEvent;
         _slider.MouseEvent += Slider_MouseEvent;
     }
     }
 
 
@@ -118,9 +118,9 @@ public class Scroll : View
     {
     {
         Added -= Scroll_Added;
         Added -= Scroll_Added;
         Initialized -= Scroll_Initialized;
         Initialized -= Scroll_Initialized;
-        DrawContent -= SubViews_DrawContent;
-        MouseEvent -= SliderContainer_MouseEvent;
-        _slider.DrawContent -= SubViews_DrawContent;
+        DrawContent -= Scroll_DrawContent;
+        MouseEvent -= Scroll_MouseEvent;
+        _slider.DrawContent -= Scroll_DrawContent;
         _slider.MouseEvent -= Slider_MouseEvent;
         _slider.MouseEvent -= Slider_MouseEvent;
 
 
         base.Dispose (disposing);
         base.Dispose (disposing);
@@ -215,8 +215,30 @@ public class Scroll : View
         parent.MouseLeave += Parent_MouseLeave;
         parent.MouseLeave += Parent_MouseLeave;
     }
     }
 
 
+    private void Scroll_DrawContent (object sender, DrawEventArgs e) { SetColorSchemeWithSuperview (sender as View); }
+
     private void Scroll_Initialized (object sender, EventArgs e) { SetWidthHeight (); }
     private void Scroll_Initialized (object sender, EventArgs e) { SetWidthHeight (); }
 
 
+    private void Scroll_MouseEvent (object sender, MouseEventEventArgs e)
+    {
+        MouseEvent me = e.MouseEvent;
+        int location = Orientation == Orientation.Vertical ? me.Position.Y : me.Position.X;
+        int barSize = Orientation == Orientation.Vertical ? Frame.Height : Frame.Width;
+
+        (int topLeft, int bottomRight) sliderPos = _orientation == Orientation.Vertical
+                                                       ? new (_slider.Frame.Y, _slider.Frame.Bottom - 1)
+                                                       : new (_slider.Frame.X, _slider.Frame.Right - 1);
+
+        if (me.Flags == MouseFlags.Button1Pressed && location < sliderPos.topLeft)
+        {
+            Position = Math.Max (Position - barSize, 0);
+        }
+        else if (me.Flags == MouseFlags.Button1Pressed && location > sliderPos.bottomRight)
+        {
+            Position = Math.Min (Position + barSize, Size - barSize);
+        }
+    }
+
     private void Scroll_Removed (object sender, SuperViewChangedEventArgs e)
     private void Scroll_Removed (object sender, SuperViewChangedEventArgs e)
     {
     {
         if (e.Parent is { })
         if (e.Parent is { })
@@ -330,26 +352,4 @@ public class Scroll : View
 
 
         e.Handled = true;
         e.Handled = true;
     }
     }
-
-    private void SliderContainer_MouseEvent (object sender, MouseEventEventArgs e)
-    {
-        MouseEvent me = e.MouseEvent;
-        int location = Orientation == Orientation.Vertical ? me.Position.Y : me.Position.X;
-        int barSize = Orientation == Orientation.Vertical ? Frame.Height : Frame.Width;
-
-        (int topLeft, int bottomRight) sliderPos = _orientation == Orientation.Vertical
-                                                       ? new (_slider.Frame.Y, _slider.Frame.Bottom - 1)
-                                                       : new (_slider.Frame.X, _slider.Frame.Right - 1);
-
-        if (me.Flags == MouseFlags.Button1Pressed && location < sliderPos.topLeft)
-        {
-            Position = Math.Max (Position - barSize, 0);
-        }
-        else if (me.Flags == MouseFlags.Button1Pressed && location > sliderPos.bottomRight)
-        {
-            Position = Math.Min (Position + barSize, Size - barSize);
-        }
-    }
-
-    private void SubViews_DrawContent (object sender, DrawEventArgs e) { SetColorSchemeWithSuperview (sender as View); }
 }
 }