/* * Copyright(c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ using Tizen.NUI.BaseComponents; using System.ComponentModel; namespace Tizen.NUI { /// /// This is a calss that sets the configuration options of Gestures /// [EditorBrowsable(EditorBrowsableState.Never)] public sealed class GestureOptions { private static readonly GestureOptions instance = new GestureOptions(); /// /// Constructor. /// private GestureOptions() { } /// /// Gets the singleton of the GestureOptions object. /// [EditorBrowsable(EditorBrowsableState.Never)] public static GestureOptions Instance { get { return instance; } } /// /// Sets the prediction mode for pan gestures
/// * 0 - No prediction
/// * 1 - Prediction using average acceleration
///
/// This is a global configuration option. Affects all gestures. /// The prediction mode [EditorBrowsable(EditorBrowsableState.Never)] public void SetPanGesturePredictionMode(int mode) { Interop.GestureOptions.SetPanGesturePredictionMode(mode); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Sets the prediction amount of the pan gesture /// /// This is a global configuration option. Affects all gestures. /// The prediction amount in milliseconds [EditorBrowsable(EditorBrowsableState.Never)] public void SetPanGesturePredictionAmount(uint amount) { Interop.GestureOptions.SetPanGesturePredictionAmount(amount); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Sets the upper bound of the prediction amount for clamping /// /// This is a global configuration option. Affects all gestures. /// The prediction amount in milliseconds [EditorBrowsable(EditorBrowsableState.Never)] public void SetPanGestureMaximumPredictionAmount(uint amount) { Interop.GestureOptions.SetPanGestureMaximumPredictionAmount(amount); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Sets the lower bound of the prediction amount for clamping /// /// This is a global configuration option. Affects all gestures. /// The prediction amount in milliseconds [EditorBrowsable(EditorBrowsableState.Never)] public void SetPanGestureMinimumPredictionAmount(uint amount) { Interop.GestureOptions.SetPanGestureMinimumPredictionAmount(amount); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Sets the amount of prediction interpolation to adjust when the pan velocity is changed /// /// This is a global configuration option. Affects all gestures. /// The prediction amount in milliseconds [EditorBrowsable(EditorBrowsableState.Never)] public void SetPanGesturePredictionAmountAdjustment(uint amount) { Interop.GestureOptions.SetPanGesturePredictionAmountAdjustment(amount); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Called to set the prediction mode for pan gestures
/// * Valid modes:
/// * 0 - No smoothing
/// * 1 - average between last 2 values
///
/// This is a global configuration option. Affects all gestures. /// The prediction mode [EditorBrowsable(EditorBrowsableState.Never)] public void SetPanGestureSmoothingMode(int mode) { Interop.GestureOptions.SetPanGestureSmoothingMode(mode); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Sets the smoothing amount of the pan gesture /// /// This is a global configuration option. Affects all gestures. /// The smotthing amount from 0.0f (none) to 1.0f (full) [EditorBrowsable(EditorBrowsableState.Never)] public void SetPanGestureSmoothingAmount(float amount) { Interop.GestureOptions.SetPanGestureSmoothingAmount(amount); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Sets whether to use actual times of the real gesture and frames or not. /// /// This is a global configuration option. Affects all gestures. /// True = use actual times, False = use perfect values [EditorBrowsable(EditorBrowsableState.Never)] public void SetPanGestureUseActualTimes(bool enable) { Interop.GestureOptions.SetPanGestureUseActualTimes(enable); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Sets the interpolation time range (ms) of past points to use (with weights) when interpolating. /// /// This is a global configuration option. Affects all gestures. /// Time range in ms [EditorBrowsable(EditorBrowsableState.Never)] public void SetPanGestureInterpolationTimeRange(int range) { Interop.GestureOptions.SetPanGestureInterpolationTimeRange(range); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Sets whether to use scalar only prediction, which when enabled, ignores acceleration. /// /// This is a global configuration option. Affects all gestures. /// True = use scalar prediction only [EditorBrowsable(EditorBrowsableState.Never)] public void SetPanGestureScalarOnlyPredictionEnabled(bool enable) { Interop.GestureOptions.SetPanGestureScalarOnlyPredictionEnabled(enable); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Sets whether to use two point prediction. This combines two interpolated points to get more steady acceleration and velocity values. /// /// This is a global configuration option. Affects all gestures. /// True = use two point prediction [EditorBrowsable(EditorBrowsableState.Never)] public void SetPanGestureTwoPointPredictionEnabled(bool enable) { Interop.GestureOptions.SetPanGestureTwoPointPredictionEnabled(enable); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Sets the time in the past to interpolate the second point when using two point interpolation. /// /// This is a global configuration option. Affects all gestures. /// Time in past in ms [EditorBrowsable(EditorBrowsableState.Never)] public void SetPanGestureTwoPointInterpolatePastTime(int time) { Interop.GestureOptions.SetPanGestureTwoPointInterpolatePastTime(time); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Sets the two point velocity bias. This is the ratio of first and second points to use for velocity. /// /// This is a global configuration option. Affects all gestures. /// 0.0f = 100% first point. 1.0f = 100% of second point. [EditorBrowsable(EditorBrowsableState.Never)] public void SetPanGestureTwoPointVelocityBias(float velocity) { Interop.GestureOptions.SetPanGestureTwoPointVelocityBias(velocity); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Sets the two point acceleration bias. This is the ratio of first and second points to use for acceleration. /// /// This is a global configuration option. Affects all gestures. /// 0.0f = 100% first point. 1.0f = 100% of second point. [EditorBrowsable(EditorBrowsableState.Never)] public void SetPanGestureTwoPointAccelerationBias(float acceleration) { Interop.GestureOptions.SetPanGestureTwoPointAccelerationBias(acceleration); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Sets the range of time (ms) of points in the history to perform multitap smoothing with (if enabled). /// /// This is a global configuration option. Affects all gestures. /// Time in past in ms [EditorBrowsable(EditorBrowsableState.Never)] public void SetPanGestureMultitapSmoothingRange(int range) { Interop.GestureOptions.SetPanGestureMultitapSmoothingRange(range); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Sets the minimum distance required to start a pan event /// /// This is a global configuration option. Affects all gestures. /// Distance in pixels [EditorBrowsable(EditorBrowsableState.Never)] public void SetPanGestureMinimumDistance(int distance) { Interop.GestureOptions.SetPanGestureMinimumDistance(distance); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Sets the minimum number of touch events required to start a pan /// /// This is a global configuration option. Affects all gestures. /// Number of touch events [EditorBrowsable(EditorBrowsableState.Never)] public void SetPanGestureMinimumPanEvents(int number) { Interop.GestureOptions.SetPanGestureMinimumPanEvents(number); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Sets the minimum distance required to start a pinch event /// /// This is a global configuration option. Affects all gestures. /// Distance in pixels [EditorBrowsable(EditorBrowsableState.Never)] public void SetPinchGestureMinimumDistance(int distance) { Interop.GestureOptions.SetPinchGestureMinimumDistance(distance); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Sets the minimum touch events required before a pinch can be started /// /// This is a global configuration option. Affects all gestures. /// The number of touch events [EditorBrowsable(EditorBrowsableState.Never)] public void SetPinchGestureMinimumTouchEvents(uint number) { Interop.GestureOptions.SetPinchGestureMinimumTouchEvents(number); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Sets the minimum touch events required after a pinch started /// /// This is a global configuration option. Affects all gestures. /// The number of touch events [EditorBrowsable(EditorBrowsableState.Never)] public void SetPinchGestureMinimumTouchEventsAfterStart(uint number) { Interop.GestureOptions.SetPinchGestureMinimumTouchEventsAfterStart(number); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Sets the minimum touch events required before a rotation can be started /// /// This is a global configuration option. Affects all gestures. /// The number of touch events [EditorBrowsable(EditorBrowsableState.Never)] public void SetRotationGestureMinimumTouchEvents(uint number) { Interop.GestureOptions.SetRotationGestureMinimumTouchEvents(number); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Sets the minimum touch events required after a rotation started /// /// This is a global configuration option. Affects all gestures. /// The number of touch events [EditorBrowsable(EditorBrowsableState.Never)] public void SetRotationGestureMinimumTouchEventsAfterStart(uint number) { Interop.GestureOptions.SetRotationGestureMinimumTouchEventsAfterStart(number); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Sets the minimum holding time required to be recognized as a long press gesture /// /// This is a global configuration option. Affects all gestures. /// The time value in milliseconds [EditorBrowsable(EditorBrowsableState.Never)] public void SetLongPressMinimumHoldingTime(uint time) { Interop.GestureOptions.SetLongPressMinimumHoldingTime(time); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Sets the duration in milliseconds between the first tap's up event and the second tap's down event to be recognized as a duoble-tap gesture. /// /// This is a global configuration option. Affects all gestures. /// The time value in milliseconds [EditorBrowsable(EditorBrowsableState.Never)] public void SetDoubleTapTimeout(uint ms) { Interop.GestureOptions.SetDoubleTapTimeout(ms); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } } }