From 8eadcf8b5b10da0bc30ab79899df479f2eeb66b7 Mon Sep 17 00:00:00 2001 From: Eunki Hong Date: Tue, 29 Apr 2025 21:32:50 +0900 Subject: [PATCH] [NUI.Sample] Revive Ruler at Tizen.NUI.Samples After remove unused codes #6621 and #6670 Ruler was removed. But the ruler was useful when we use ScrollView at Tizen.NUI.Sample. To make the demo app works well, let we implement it only inside the demo components. Signed-off-by: Eunki Hong --- .../Components/DefaultRuler.cs | 80 +++++ .../Components/FixedRuler.cs | 88 +++++ .../Tizen.NUI.Samples/Components/Ruler.cs | 217 ++++++++++++ .../Components/RulerDomain.cs | 139 ++++++++ .../Tizen.NUI.Samples/Components/RulerPtr.cs | 327 ++++++++++++++++++ .../Components/ScrollView.cs | 20 ++ .../Samples/DaliDemo/DaliTableView.cs | 9 +- 7 files changed, 879 insertions(+), 1 deletion(-) create mode 100644 test/Tizen.NUI.Samples/Tizen.NUI.Samples/Components/DefaultRuler.cs create mode 100644 test/Tizen.NUI.Samples/Tizen.NUI.Samples/Components/FixedRuler.cs create mode 100644 test/Tizen.NUI.Samples/Tizen.NUI.Samples/Components/Ruler.cs create mode 100644 test/Tizen.NUI.Samples/Tizen.NUI.Samples/Components/RulerDomain.cs create mode 100644 test/Tizen.NUI.Samples/Tizen.NUI.Samples/Components/RulerPtr.cs diff --git a/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Components/DefaultRuler.cs b/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Components/DefaultRuler.cs new file mode 100644 index 000000000..65c65c0d1 --- /dev/null +++ b/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Components/DefaultRuler.cs @@ -0,0 +1,80 @@ +/* + * 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 System.ComponentModel; + +namespace Tizen.NUI +{ + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public class DefaultRuler : Ruler + { + internal DefaultRuler(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn) + { + } + + /// This will be public opened. + [EditorBrowsable(EditorBrowsableState.Never)] + protected override void ReleaseSwigCPtr(global::System.Runtime.InteropServices.HandleRef swigCPtr) + { + Interop.Ruler.DeleteDefaultRuler(swigCPtr); + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public DefaultRuler() : this(Interop.Ruler.NewDefaultRuler(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public override float Snap(float x, float bias) + { + float ret = Interop.Ruler.DefaultRulerSnap(SwigCPtr, x, bias); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public override float GetPositionFromPage(uint page, out uint volume, bool wrap) + { + float ret = Interop.Ruler.DefaultRulerGetPositionFromPage(SwigCPtr, page, out volume, wrap); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public override uint GetPageFromPosition(float position, bool wrap) + { + uint ret = Interop.Ruler.DefaultRulerGetPageFromPosition(SwigCPtr, position, wrap); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public override uint GetTotalPages() + { + uint ret = Interop.Ruler.DefaultRulerGetTotalPages(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } +} \ No newline at end of file diff --git a/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Components/FixedRuler.cs b/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Components/FixedRuler.cs new file mode 100644 index 000000000..608e68ec7 --- /dev/null +++ b/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Components/FixedRuler.cs @@ -0,0 +1,88 @@ +/* + * 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 System.ComponentModel; + +namespace Tizen.NUI +{ + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public class FixedRuler : Ruler + { + + internal FixedRuler(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn) + { + } + + /// This will be public opened. + [EditorBrowsable(EditorBrowsableState.Never)] + protected override void ReleaseSwigCPtr(global::System.Runtime.InteropServices.HandleRef swigCPtr) + { + Interop.Ruler.DeleteFixedRuler(swigCPtr); + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public FixedRuler(float spacing) : this(Interop.Ruler.NewFixedRuler(spacing), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public FixedRuler() : this(Interop.Ruler.NewFixedRuler(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public override float Snap(float x, float bias) + { + float ret = Interop.Ruler.FixedRulerSnap(SwigCPtr, x, bias); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public override float GetPositionFromPage(uint page, out uint volume, bool wrap) + { + float ret = Interop.Ruler.FixedRulerGetPositionFromPage(SwigCPtr, page, out volume, wrap); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public override uint GetPageFromPosition(float position, bool wrap) + { + uint ret = Interop.Ruler.FixedRulerGetPageFromPosition(SwigCPtr, position, wrap); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public override uint GetTotalPages() + { + uint ret = Interop.Ruler.FixedRulerGetTotalPages(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } +} \ No newline at end of file diff --git a/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Components/Ruler.cs b/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Components/Ruler.cs new file mode 100644 index 000000000..638b79322 --- /dev/null +++ b/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Components/Ruler.cs @@ -0,0 +1,217 @@ +/* + * 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 System.ComponentModel; + +namespace Tizen.NUI +{ + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public class Ruler : RefObject + { + internal Ruler(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn) + { + } + + /// This will be public opened. + [EditorBrowsable(EditorBrowsableState.Never)] + protected override void ReleaseSwigCPtr(global::System.Runtime.InteropServices.HandleRef swigCPtr) + { + throw new global::System.MethodAccessException("C++ destructor does not have public access"); + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual float Snap(float x, float bias) + { + float ret = Interop.Ruler.Snap(SwigCPtr, x, bias); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual float Snap(float x) + { + float ret = Interop.Ruler.Snap(SwigCPtr, x); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual float GetPositionFromPage(uint page, out uint volume, bool wrap) + { + float ret = Interop.Ruler.GetPositionFromPage(SwigCPtr, page, out volume, wrap); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual uint GetPageFromPosition(float position, bool wrap) + { + uint ret = Interop.Ruler.GetPageFromPosition(SwigCPtr, position, wrap); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual uint GetTotalPages() + { + uint ret = Interop.Ruler.GetTotalPages(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public new Ruler.RulerType GetType() + { + Ruler.RulerType ret = (Ruler.RulerType)Interop.Ruler.GetType(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public bool IsEnabled() + { + bool ret = Interop.Ruler.IsEnabled(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void Enable() + { + Interop.Ruler.Enable(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void Disable() + { + Interop.Ruler.Disable(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetDomain(RulerDomain domain) + { + Interop.Ruler.SetDomain(SwigCPtr, RulerDomain.getCPtr(domain)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public RulerDomain GetDomain() + { + RulerDomain ret = new RulerDomain(Interop.Ruler.GetDomain(SwigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void DisableDomain() + { + Interop.Ruler.DisableDomain(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public float Clamp(float x, float length, float scale) + { + float ret = Interop.Ruler.Clamp(SwigCPtr, x, length, scale); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public float Clamp(float x, float length) + { + float ret = Interop.Ruler.Clamp(SwigCPtr, x, length); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public float Clamp(float x) + { + float ret = Interop.Ruler.Clamp(SwigCPtr, x); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public float SnapAndClamp(float x, float bias, float length, float scale) + { + float ret = Interop.Ruler.SnapAndClamp(SwigCPtr, x, bias, length, scale); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public float SnapAndClamp(float x, float bias, float length) + { + float ret = Interop.Ruler.SnapAndClamp(SwigCPtr, x, bias, length); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public float SnapAndClamp(float x, float bias) + { + float ret = Interop.Ruler.SnapAndClamp(SwigCPtr, x, bias); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public float SnapAndClamp(float x) + { + float ret = Interop.Ruler.SnapAndClamp(SwigCPtr, x); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public enum RulerType + { + /// A Fixed ruler. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + Fixed, + + /// A Free ruler. + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + Free + } + } +} \ No newline at end of file diff --git a/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Components/RulerDomain.cs b/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Components/RulerDomain.cs new file mode 100644 index 000000000..9db1d7d3b --- /dev/null +++ b/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Components/RulerDomain.cs @@ -0,0 +1,139 @@ +/* + * 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 System; +using System.ComponentModel; + +namespace Tizen.NUI +{ + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public class RulerDomain : Disposable + { + internal RulerDomain(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn) + { + } + + /// This will be public opened. + [EditorBrowsable(EditorBrowsableState.Never)] + protected override void ReleaseSwigCPtr(global::System.Runtime.InteropServices.HandleRef swigCPtr) + { + Interop.Ruler.DeleteRulerDomain(swigCPtr); + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public RulerDomain(float min, float max, bool enabled) : this(Interop.Ruler.NewRulerDomain(min, max, enabled), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public RulerDomain(float min, float max) : this(Interop.Ruler.NewRulerDomain(min, max), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public float min + { + set + { + Interop.Ruler.RulerDomainMinSet(SwigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = Interop.Ruler.RulerDomainMinGet(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); + return ret; + } + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public float max + { + set + { + Interop.Ruler.RulerDomainMaxSet(SwigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = Interop.Ruler.RulerDomainMaxGet(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); + return ret; + } + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public bool enabled + { + set + { + Interop.Ruler.RulerDomainEnabledSet(SwigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + bool ret = Interop.Ruler.RulerDomainEnabledGet(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); + return ret; + } + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public float Clamp(float x, float length, float scale) + { + float ret = Interop.Ruler.RulerDomainClamp(SwigCPtr, x, length, scale); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public float Clamp(float x, float length) + { + float ret = Interop.Ruler.RulerDomainClamp(SwigCPtr, x, length); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public float Clamp(float x) + { + float ret = Interop.Ruler.RulerDomainClamp(SwigCPtr, x); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public float GetSize() + { + float ret = Interop.Ruler.RulerDomainGetSize(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } +} \ No newline at end of file diff --git a/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Components/RulerPtr.cs b/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Components/RulerPtr.cs new file mode 100644 index 000000000..bfa3ac4b8 --- /dev/null +++ b/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Components/RulerPtr.cs @@ -0,0 +1,327 @@ +/* + * 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 System.ComponentModel; + +namespace Tizen.NUI +{ + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public class RulerPtr : Disposable + { + internal RulerPtr(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn) + { + } + + /// This will be public opened. + [EditorBrowsable(EditorBrowsableState.Never)] + protected override void ReleaseSwigCPtr(global::System.Runtime.InteropServices.HandleRef swigCPtr) + { + Interop.Ruler.DeleteRulerPtr(swigCPtr); + } + + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public RulerPtr() : this(Interop.Ruler.NewRulerPtr(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + private Ruler mRuler; + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public RulerPtr(Ruler p) : this(Interop.Ruler.NewRulerPtr(Ruler.getCPtr(p)), true) + { + mRuler = p; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public RulerPtr(RulerPtr rhs) : this(Interop.Ruler.NewRulerPtrPtr(RulerPtr.getCPtr(rhs)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public Ruler Get() + { + global::System.IntPtr cPtr = Interop.Ruler.RulerPtrGet(SwigCPtr); + Ruler ret = (cPtr == global::System.IntPtr.Zero) ? null : new Ruler(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public Ruler __deref__() + { + global::System.IntPtr cPtr = Interop.Ruler.RulerPtrDeref(SwigCPtr); + Ruler ret = (cPtr == global::System.IntPtr.Zero) ? null : new Ruler(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public Ruler __ref__() + { + Ruler ret = new Ruler(Interop.Ruler.RulerPtrRef(SwigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public RulerPtr Assign(RulerPtr rhs) + { + RulerPtr ret = new RulerPtr(Interop.Ruler.AssignPtr(SwigCPtr, RulerPtr.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public RulerPtr Assign(Ruler rhs) + { + RulerPtr ret = new RulerPtr(Interop.Ruler.RulerPtrAssign(SwigCPtr, Ruler.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void Reset() + { + Interop.Ruler.RulerPtrReset(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void Reset(Ruler rhs) + { + Interop.Ruler.RulerPtrReset(SwigCPtr, Ruler.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public Ruler Detach() + { + global::System.IntPtr cPtr = Interop.Ruler.RulerPtrDetach(SwigCPtr); + Ruler ret = (cPtr == global::System.IntPtr.Zero) ? null : new Ruler(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public float Snap(float x, float bias) + { + float ret = Interop.Ruler.RulerPtrSnap(SwigCPtr, x, bias); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public float Snap(float x) + { + float ret = Interop.Ruler.RulerPtrSnap(SwigCPtr, x); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public float GetPositionFromPage(uint page, out uint volume, bool wrap) + { + float ret = Interop.Ruler.RulerPtrGetPositionFromPage(SwigCPtr, page, out volume, wrap); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public uint GetPageFromPosition(float position, bool wrap) + { + uint ret = Interop.Ruler.RulerPtrGetPageFromPosition(SwigCPtr, position, wrap); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public uint GetTotalPages() + { + uint ret = Interop.Ruler.RulerPtrGetTotalPages(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public new Ruler.RulerType GetType() + { + Ruler.RulerType ret = (Ruler.RulerType)Interop.Ruler.RulerPtrGetType(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public bool IsEnabled() + { + bool ret = Interop.Ruler.RulerPtrIsEnabled(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void Enable() + { + Interop.Ruler.RulerPtrEnable(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void Disable() + { + Interop.Ruler.RulerPtrDisable(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetDomain(RulerDomain domain) + { + Interop.Ruler.RulerPtrSetDomain(SwigCPtr, RulerDomain.getCPtr(domain)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public RulerDomain GetDomain() + { + RulerDomain ret = new RulerDomain(Interop.Ruler.RulerPtrGetDomain(SwigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void DisableDomain() + { + Interop.Ruler.RulerPtrDisableDomain(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public float Clamp(float x, float length, float scale) + { + float ret = Interop.Ruler.RulerPtrClamp(SwigCPtr, x, length, scale); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public float Clamp(float x, float length) + { + float ret = Interop.Ruler.RulerPtrClamp(SwigCPtr, x, length); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public float Clamp(float x) + { + float ret = Interop.Ruler.RulerPtrClamp(SwigCPtr, x); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public float SnapAndClamp(float x, float bias, float length, float scale) + { + float ret = Interop.Ruler.RulerPtrSnapAndClamp(SwigCPtr, x, bias, length, scale); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public float SnapAndClamp(float x, float bias, float length) + { + float ret = Interop.Ruler.RulerPtrSnapAndClamp(SwigCPtr, x, bias, length); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public float SnapAndClamp(float x, float bias) + { + float ret = Interop.Ruler.RulerPtrSnapAndClamp(SwigCPtr, x, bias); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public float SnapAndClamp(float x) + { + float ret = Interop.Ruler.RulerPtrSnapAndClamp(SwigCPtr, x); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void Reference() + { + Interop.Ruler.RulerPtrReference(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void Unreference() + { + Interop.Ruler.RulerPtrUnreference(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public int ReferenceCount() + { + int ret = Interop.Ruler.RulerPtrReferenceCount(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } +} \ No newline at end of file diff --git a/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Components/ScrollView.cs b/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Components/ScrollView.cs index 205737d32..04453c39d 100755 --- a/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Components/ScrollView.cs +++ b/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Components/ScrollView.cs @@ -1248,6 +1248,26 @@ namespace Tizen.NUI.Samples if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Set ruler X + /// + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetRulerX(RulerPtr ruler) + { + Tizen.NUI.Interop.ScrollView.SetRulerX(SwigCPtr, RulerPtr.getCPtr(ruler)); + } + + /// + /// Set ruler Y + /// + /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetRulerY(RulerPtr ruler) + { + Tizen.NUI.Interop.ScrollView.SetRulerY(SwigCPtr, RulerPtr.getCPtr(ruler)); + } + /// /// Dispose /// diff --git a/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/DaliDemo/DaliTableView.cs b/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/DaliDemo/DaliTableView.cs index 276123bff..988c96afc 100755 --- a/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/DaliDemo/DaliTableView.cs +++ b/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/DaliDemo/DaliTableView.cs @@ -458,7 +458,12 @@ namespace Tizen.NUI.Samples } // Update Ruler info. - // TODO : Implement something to make scroll-view stop fixed position here, without Ruler! + mScrollRulerX = new RulerPtr(new FixedRuler(mPageWidth)); + mScrollRulerY = new RulerPtr(new DefaultRuler()); + mScrollRulerX.SetDomain(new RulerDomain(0.0f, (mTotalPages + 1) * stageSize.Width * TABLE_RELATIVE_SIZE.X * 0.5f, true)); + mScrollRulerY.Disable(); + mScrollView.SetRulerX(mScrollRulerX); + mScrollView.SetRulerY(mScrollRulerY); } private void SetupBackground(View bubbleContainer) @@ -741,6 +746,8 @@ namespace Tizen.NUI.Samples private Animation mPressedAnimation; // Button press scaling animation. private ScrollView mScrollView; // ScrollView container (for all Examples) private ScrollViewPagePathEffect mScrollViewEffect; // Effect to be applied to the scroll view + private RulerPtr mScrollRulerX; // ScrollView X (horizontal) ruler + private RulerPtr mScrollRulerY; // ScrollView Y (vertical) ruler private View mPressedActor; // The currently pressed actor. private Timer mAnimationTimer; // Timer used to turn off animation after a specific time period -- 2.34.1