[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_FeedWheel")]
public static extern void FeedWheelEvent(global::System.Runtime.InteropServices.HandleRef window, global::System.Runtime.InteropServices.HandleRef wheelEvent);
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Window_FeedHover")]
+ public static extern void FeedHoverEvent(global::System.Runtime.InteropServices.HandleRef window, global::System.Runtime.InteropServices.HandleRef touchPoint);
+
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Adaptor_RenderOnce")]
public static extern void RenderOnce(global::System.Runtime.InteropServices.HandleRef jarg1);
private LayoutController localController;
private Key internalLastKeyEvent;
private Touch internalLastTouchEvent;
+ private Timer internalHoverTimer;
static internal bool IsSupportedMultiWindow()
{
}
/// <summary>
+ /// Feeds a hover event into the window. <br />
+ /// This is feed after a default time of 48 ms. You can also set this time.
+ /// </summary>
+ /// <param name="time">The time of how much later it will be feed (default is 48ms)</param>
+ /// <remarks>If you want to do FeedHover after the UI is updated, it is recommended to set the time to at least 16ms. This will be a good time waiting for the UI to update.<br />
+ /// and LazyFeedHover called within the set time are ignored. Only the last request becomes a FeedHover.
+ /// </remarks>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void LazyFeedHover(uint time = 48)
+ {
+ if (internalHoverTimer == null)
+ {
+ internalHoverTimer = new Timer(time);
+ internalHoverTimer.Tick += (s, e) =>
+ {
+ FeedHover();
+ internalHoverTimer?.Stop();
+ internalHoverTimer?.Dispose();
+ internalHoverTimer = null;
+ return false;
+ };
+ internalHoverTimer.Start();
+ }
+ else
+ {
+ internalHoverTimer.Start();
+ }
+ }
+
+ /// <summary>
/// Feeds a touch point into the window.
/// </summary>
/// <param name="touchPoint">The touch point to feed.</param>
}
/// <summary>
+ /// Feeds a hover event into the window.
+ /// </summary>
+ /// <param name="touchPoint">The touch point to feed hover event. If null is entered, the feed hover event is generated with the last inputed touch point.</param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ internal void FeedHover(TouchPoint touchPoint = null)
+ {
+ if (touchPoint == null)
+ {
+ using Touch touch = GetLastTouchEvent();
+ using Vector2 screenPosition = touch.GetScreenPosition(0);
+ touchPoint = new TouchPoint(touch.GetDeviceId(0), TouchPoint.StateType.Motion, screenPosition.X, screenPosition.Y);
+ }
+ Interop.Window.FeedHoverEvent(SwigCPtr, TouchPoint.getCPtr(touchPoint));
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
/// Allows at least one more render, even when paused.
/// The window should be shown, not minimised.
/// </summary>
internalLastKeyEvent = null;
internalLastTouchEvent?.Dispose();
internalLastTouchEvent = null;
+
+ internalHoverTimer?.Stop();
+ internalHoverTimer?.Dispose();
+ internalHoverTimer = null;
}
public class ScrollableFocusSample : IExample
{
public View root;
+ public class CustomScrollableBase : ScrollableBase
+ {
+ public override bool OnWheel(Wheel wheel)
+ {
+ base.OnWheel(wheel);
+ Window window = NUIApplication.GetDefaultWindow();
+ window.LazyFeedHover();
+ return true;
+ }
+ }
public void Activate()
{
};
root.Add(topbtn);
- var scrollview = new ScrollableBase
+ var scrollview = new CustomScrollableBase
{
ScrollingDirection = ScrollableBase.Direction.Vertical,
WidthSpecification = LayoutParamPolicies.MatchParent,
};
root.Add(middle);
- var myscrollview = new ScrollableBase
+ var myscrollview = new CustomScrollableBase
{
ScrollingDirection = ScrollableBase.Direction.Vertical,
WidthSpecification = LayoutParamPolicies.MatchParent,
Focusable = true,
FocusableInTouch = true,
Text = $"Item {index}",
+ LeaveRequired = true,
+ BackgroundColor = Color.DarkOrange,
+ };
+ btn.HoverEvent += (s, e) =>
+ {
+ if(e.Hover.GetState(0) == PointStateType.Started)
+ {
+ btn.BackgroundColor = Color.Red;
+ }
+ else if (e.Hover.GetState(0) == PointStateType.Leave)
+ {
+ btn.BackgroundColor = Color.DarkOrange;
+ }
+ return true;
};
// btn.FocusGained += (s, e) =>
// {