2 * Copyright(c) 2018 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.ComponentModel;
19 using Tizen.NUI.Binding;
24 /// A ToggleButton allows the user to change a setting between two or more states.
26 /// <since_tizen> 3 </since_tizen>
27 public class ToggleButton : Tizen.NUI.UIComponents.Button
29 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
30 [EditorBrowsable(EditorBrowsableState.Never)]
31 public static readonly BindableProperty StateVisualsProperty = BindableProperty.Create("StateVisuals", typeof(PropertyArray), typeof(ToggleButton), new PropertyArray(), propertyChanged: (bindable, oldValue, newValue) =>
33 var toggleButton = (ToggleButton)bindable;
36 Tizen.NUI.Object.SetProperty(toggleButton.swigCPtr, ToggleButton.Property.STATE_VISUALS, new Tizen.NUI.PropertyValue((PropertyArray)newValue));
39 defaultValueCreator: (bindable) =>
41 var toggleButton = (ToggleButton)bindable;
42 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
43 Tizen.NUI.Object.GetProperty(toggleButton.swigCPtr, ToggleButton.Property.STATE_VISUALS).Get(temp);
47 /// Only for XAML property binding. This will be changed as Inhouse API by ACR later.
48 public static readonly BindableProperty TooltipsProperty = BindableProperty.Create("Tooltips", typeof(PropertyArray), typeof(ToggleButton), new PropertyArray(), propertyChanged: (bindable, oldValue, newValue) =>
50 var toggleButton = (ToggleButton)bindable;
53 Tizen.NUI.Object.SetProperty(toggleButton.swigCPtr, ToggleButton.Property.TOOLTIPS, new Tizen.NUI.PropertyValue((PropertyArray)newValue));
56 defaultValueCreator: (bindable) =>
58 var toggleButton = (ToggleButton)bindable;
59 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
60 Tizen.NUI.Object.GetProperty(toggleButton.swigCPtr, ToggleButton.Property.TOOLTIPS).Get(temp);
64 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
65 [EditorBrowsable(EditorBrowsableState.Never)]
66 public static readonly BindableProperty CurrentStateIndexProperty = BindableProperty.Create("CurrentStateIndex", typeof(int), typeof(ToggleButton), default(int), propertyChanged: (bindable, oldValue, newValue) =>
68 var toggleButton = (ToggleButton)bindable;
71 Tizen.NUI.Object.SetProperty(toggleButton.swigCPtr, ToggleButton.Property.CURRENT_STATE_INDEX, new Tizen.NUI.PropertyValue((int)newValue));
74 defaultValueCreator: (bindable) =>
76 var toggleButton = (ToggleButton)bindable;
78 Tizen.NUI.Object.GetProperty(toggleButton.swigCPtr, ToggleButton.Property.CURRENT_STATE_INDEX).Get(out temp);
82 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
85 /// Create an instance for toggleButton.
87 /// <since_tizen> 3 </since_tizen>
88 public ToggleButton() : this(Interop.ToggleButton.ToggleButton_New(), true)
90 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
93 internal ToggleButton(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.ToggleButton.ToggleButton_SWIGUpcast(cPtr), cMemoryOwn)
95 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
99 /// Gets and Sets the state visual array of toggle button.
101 /// <since_tizen> 3 </since_tizen>
102 public Tizen.NUI.PropertyArray StateVisuals
106 return (PropertyArray)GetValue(StateVisualsProperty);
110 SetValue(StateVisualsProperty, value);
115 /// Gets and Sets the tooltips of toggle button.
117 /// <since_tizen> 3 </since_tizen>
118 public Tizen.NUI.PropertyArray Tooltips
122 return (PropertyArray)GetValue(TooltipsProperty);
126 SetValue(TooltipsProperty, value);
131 /// Gets and Sets the current state index of toggle button.
133 /// <since_tizen> 3 </since_tizen>
134 public int CurrentStateIndex
138 return (int)GetValue(CurrentStateIndexProperty);
142 SetValue(CurrentStateIndexProperty, value);
146 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ToggleButton obj)
148 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
154 /// <param name="type">The dispose type</param>
155 /// <since_tizen> 3 </since_tizen>
156 protected override void Dispose(DisposeTypes type)
163 //Release your own unmanaged resources here.
164 //You should not access any managed member here except static instance.
165 //because the execution order of Finalizes is non-deterministic.
167 if (swigCPtr.Handle != global::System.IntPtr.Zero)
172 Interop.ToggleButton.delete_ToggleButton(swigCPtr);
174 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
181 /// This should be internal, please do not use.
183 /// <since_tizen> 3 </since_tizen>
184 [EditorBrowsable(EditorBrowsableState.Never)]
185 [Obsolete("Deprecated in API6; Will be removed in API9.")]
186 public new class Property
189 /// This should be internal, please do not use.
191 /// <since_tizen> 3 </since_tizen>
192 [EditorBrowsable(EditorBrowsableState.Never)]
193 [Obsolete("Deprecated in API6; Will be removed in API9.")]
194 public static readonly int STATE_VISUALS = Interop.ToggleButton.ToggleButton_Property_STATE_VISUALS_get();
196 /// This should be internal, please do not use.
198 /// <since_tizen> 3 </since_tizen>
199 [EditorBrowsable(EditorBrowsableState.Never)]
200 [Obsolete("Deprecated in API6; Will be removed in API9.")]
201 public static readonly int TOOLTIPS = Interop.ToggleButton.ToggleButton_Property_TOOLTIPS_get();
203 /// This should be internal, please do not use.
205 /// <since_tizen> 3 </since_tizen>
206 [EditorBrowsable(EditorBrowsableState.Never)]
207 [Obsolete("Deprecated in API6; Will be removed in API9.")]
208 public static readonly int CURRENT_STATE_INDEX = Interop.ToggleButton.ToggleButton_Property_CURRENT_STATE_INDEX_get();