Release 4.0.0-preview1-00271
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / UIComponents / ToggleButton.cs
1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 *
15 */
16
17 using Tizen.NUI.BaseComponents;
18
19 namespace Tizen.NUI
20 {
21
22     /// <summary>
23     /// A ToggleButton allows the user to change a setting between two or more states.
24     /// </summary>
25     public class ToggleButton : Tizen.NUI.UIComponents.Button
26     {
27         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
28
29         internal ToggleButton(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.ToggleButton_SWIGUpcast(cPtr), cMemoryOwn)
30         {
31             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
32         }
33
34         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ToggleButton obj)
35         {
36             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
37         }
38
39         protected override void Dispose(DisposeTypes type)
40         {
41             if (disposed)
42             {
43                 return;
44             }
45
46             if (type == DisposeTypes.Explicit)
47             {
48                 //Called by User
49                 //Release your own managed resources here.
50                 //You should release all of your own disposable objects here.
51
52             }
53
54             //Release your own unmanaged resources here.
55             //You should not access any managed member here except static instance.
56             //because the execution order of Finalizes is non-deterministic.
57
58             if (swigCPtr.Handle != global::System.IntPtr.Zero)
59             {
60                 if (swigCMemOwn)
61                 {
62                     swigCMemOwn = false;
63                     NDalicPINVOKE.delete_ToggleButton(swigCPtr);
64                 }
65                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
66             }
67
68             base.Dispose(type);
69         }
70
71         public new class Property
72         {
73             public static readonly int STATE_VISUALS = NDalicPINVOKE.ToggleButton_Property_STATE_VISUALS_get();
74             public static readonly int TOOLTIPS = NDalicPINVOKE.ToggleButton_Property_TOOLTIPS_get();
75             public static readonly int CURRENT_STATE_INDEX = NDalicPINVOKE.ToggleButton_Property_CURRENT_STATE_INDEX_get();
76         }
77
78         /// <summary>
79         /// Create an instance for toggleButton.
80         /// </summary>
81         /// <since_tizen> 3 </since_tizen>
82         public ToggleButton() : this(NDalicPINVOKE.ToggleButton_New(), true)
83         {
84             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
85
86         }
87
88         /// <summary>
89         /// Gets and Sets the state visual array of toggle button.
90         /// </summary>
91         /// <since_tizen> 3 </since_tizen>
92         public Tizen.NUI.PropertyArray StateVisuals
93         {
94             get
95             {
96                 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
97                 GetProperty(ToggleButton.Property.STATE_VISUALS).Get(temp);
98                 return temp;
99             }
100             set
101             {
102                 SetProperty(ToggleButton.Property.STATE_VISUALS, new Tizen.NUI.PropertyValue(value));
103             }
104         }
105
106         /// <summary>
107         /// Gets and Sets the tooltips of toggle button.
108         /// </summary>
109         /// <since_tizen> 3 </since_tizen>
110         public Tizen.NUI.PropertyArray Tooltips
111         {
112             get
113             {
114                 Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray();
115                 GetProperty(ToggleButton.Property.TOOLTIPS).Get(temp);
116                 return temp;
117             }
118             set
119             {
120                 SetProperty(ToggleButton.Property.TOOLTIPS, new Tizen.NUI.PropertyValue(value));
121             }
122         }
123
124         /// <summary>
125         /// Gets and Sets the current state index of toggle button.
126         /// </summary>
127         /// <since_tizen> 3 </since_tizen>
128         public int CurrentStateIndex
129         {
130             get
131             {
132                 int temp = 0;
133                 GetProperty(ToggleButton.Property.CURRENT_STATE_INDEX).Get(out temp);
134                 return temp;
135             }
136             set
137             {
138                 SetProperty(ToggleButton.Property.CURRENT_STATE_INDEX, new Tizen.NUI.PropertyValue(value));
139             }
140         }
141
142     }
143
144 }