From f171fedb7f23efd65e434f855032172b0b2b5e51 Mon Sep 17 00:00:00 2001 From: arosis78 Date: Fri, 29 Mar 2019 11:11:54 +0900 Subject: [PATCH] [ElmSharp] Added new Scrolled event in Panel (#767) --- src/ElmSharp/ElmSharp/Panel.cs | 10 ++++++++++ test/ElmSharp.Test/TC/AnimationViewTest1.cs | 2 +- test/ElmSharp.Test/TC/PanelTest2.cs | 4 ++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/ElmSharp/ElmSharp/Panel.cs b/src/ElmSharp/ElmSharp/Panel.cs index 3c6cd78..e1ba995 100644 --- a/src/ElmSharp/ElmSharp/Panel.cs +++ b/src/ElmSharp/ElmSharp/Panel.cs @@ -49,6 +49,7 @@ namespace ElmSharp public class Panel : Layout { SmartEvent _toggled; + SmartEvent _scrolled; /// /// Creates and initializes a new instance of the Panel class. @@ -58,7 +59,10 @@ namespace ElmSharp 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); } /// @@ -100,6 +104,12 @@ namespace ElmSharp public event EventHandler Toggled; /// + /// Scrolled will be triggered when the panel has been scrolled. This event is emitted only when the panel is scrollable + /// + /// preview + public event EventHandler Scrolled; + + /// /// Enable or disable scrolling in the panel. /// /// diff --git a/test/ElmSharp.Test/TC/AnimationViewTest1.cs b/test/ElmSharp.Test/TC/AnimationViewTest1.cs index c297bf4..956f7c6 100644 --- a/test/ElmSharp.Test/TC/AnimationViewTest1.cs +++ b/test/ElmSharp.Test/TC/AnimationViewTest1.cs @@ -37,7 +37,7 @@ namespace ElmSharp.Test { _stateLabel.Text = "State = Playing"; } - else if (_state == AnimationViewState.ReversePlay) + else if (_state == AnimationViewState.ReversedPlay) { _stateLabel.Text = "State = Reverse Playing"; } diff --git a/test/ElmSharp.Test/TC/PanelTest2.cs b/test/ElmSharp.Test/TC/PanelTest2.cs index d40825a..3d9985b 100644 --- a/test/ElmSharp.Test/TC/PanelTest2.cs +++ b/test/ElmSharp.Test/TC/PanelTest2.cs @@ -100,6 +100,10 @@ namespace ElmSharp.Test { Console.WriteLine("Panel Toggled!"); }; + panel.Scrolled += (s, e) => + { + Console.WriteLine("Panel Scrolled! : IsOpen = " + panel.IsOpen); + }; } } -- 2.7.4