[NUI] remove deprecated APIs
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / UIComponents / PushButton.cs
1 /*
2  * Copyright(c) 2017 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 using System;
19 using System.ComponentModel;
20 using Tizen.NUI.BaseComponents;
21
22 namespace Tizen.NUI.UIComponents
23 {
24
25     /// <summary>
26     /// The PushButton changes its appearance when it is pressed, and returns to its original when it is released.
27     /// </summary>
28     public class PushButton : Button
29     {
30         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
31
32         internal PushButton(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.PushButton_SWIGUpcast(cPtr), cMemoryOwn)
33         {
34             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
35         }
36
37         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PushButton obj)
38         {
39             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
40         }
41
42         /// <summary>
43         /// To dispose the PushButton instance.
44         /// </summary>
45         protected override void Dispose(DisposeTypes type)
46         {
47             if (disposed)
48             {
49                 return;
50             }
51
52             if(type == DisposeTypes.Explicit)
53             {
54                 //Called by User
55                 //Release your own managed resources here.
56                 //You should release all of your own disposable objects here.
57             }
58
59             //Release your own unmanaged resources here.
60             //You should not access any managed member here except static instance.
61             //because the execution order of Finalizes is non-deterministic.
62
63             if (swigCPtr.Handle != global::System.IntPtr.Zero)
64             {
65                 if (swigCMemOwn)
66                 {
67                     swigCMemOwn = false;
68                     NDalicPINVOKE.delete_PushButton(swigCPtr);
69                 }
70                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
71             }
72
73             base.Dispose(type);
74         }
75
76
77         internal new class Property
78         {
79             internal static readonly int UNSELECTED_ICON = NDalicPINVOKE.PushButton_Property_UNSELECTED_ICON_get();
80             internal static readonly int SELECTED_ICON = NDalicPINVOKE.PushButton_Property_SELECTED_ICON_get();
81             internal static readonly int ICON_ALIGNMENT = NDalicPINVOKE.PushButton_Property_ICON_ALIGNMENT_get();
82             internal static readonly int LABEL_PADDING = NDalicPINVOKE.PushButton_Property_LABEL_PADDING_get();
83             internal static readonly int ICON_PADDING = NDalicPINVOKE.PushButton_Property_ICON_PADDING_get();
84         }
85
86         /// <summary>
87         /// Creates the PushButton.
88         /// </summary>
89         /// <since_tizen> 3 </since_tizen>
90         public PushButton() : this(NDalicPINVOKE.PushButton_New(), true)
91         {
92             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
93
94         }
95
96         /// <summary>
97         /// Downcasts a handle to pushButton handle.
98         /// </summary>
99         /// <since_tizen> 3 </since_tizen>
100         /// Please do not use! this will be deprecated!
101         /// Instead please use as keyword.
102         [Obsolete("Please DO NOT use! This will be deprecated, instead please USE as keyword.")]
103         [EditorBrowsable(EditorBrowsableState.Never)]
104         public new static PushButton DownCast(BaseHandle handle)
105         {
106             PushButton ret =  Registry.GetManagedBaseHandleFromNativePtr(handle) as PushButton;
107             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
108             return ret;
109         }
110
111         /// <summary>
112         /// UnselectedIcon.
113         /// </summary>
114         /// <since_tizen> 3 </since_tizen>
115         /// Please do not use! this will be deprecated!
116         /// Instead please use UnselectedVisual.
117         [Obsolete("Please DO NOT use! This will be Deprecated!. Please implement by using Visual instead!")]
118         [EditorBrowsable(EditorBrowsableState.Never)]
119         public string UnselectedIcon
120         {
121             set
122             {
123                 SetProperty(PushButton.Property.UNSELECTED_ICON, new Tizen.NUI.PropertyValue(value));
124             }
125         }
126
127         /// <summary>
128         /// SelectedIcon.
129         /// </summary>
130         /// <since_tizen> 3 </since_tizen>
131         /// Please do not use! this will be deprecated!
132         /// Instead please use SelectedVisual.
133         [Obsolete("Please do not use! this will be deprecated, instead please use SelectedVisual.")]
134         [EditorBrowsable(EditorBrowsableState.Never)]
135         public string SelectedIcon
136         {
137             set
138             {
139                 SetProperty(PushButton.Property.SELECTED_ICON, new Tizen.NUI.PropertyValue(value));
140             }
141         }
142         /// <summary>
143         /// Please do not use! this will be deprecated
144         /// </summary>
145         /// <since_tizen> 3 </since_tizen>
146         [Obsolete("Please DO NOT use! This will be deprecated, please implement by using Visual instead!")]
147         [EditorBrowsable(EditorBrowsableState.Never)]
148         public IconAlignmentType IconAlignment
149         {
150             get
151             {
152                 string temp;
153                 if (GetProperty(PushButton.Property.ICON_ALIGNMENT).Get(out temp) == false)
154                 {
155                     NUILog.Error("IconAlignment get error!");
156                 }
157                 switch (temp)
158                 {
159                     case "LEFT":
160                         return IconAlignmentType.Left;
161                     case "RIGHT":
162                         return IconAlignmentType.Right;
163                     case "TOP":
164                         return IconAlignmentType.Top;
165                     case "BOTTOM":
166                         return IconAlignmentType.Bottom;
167                     default:
168                         return IconAlignmentType.Default;
169                 }
170             }
171             set
172             {
173                 string valueToString = "";
174                 switch (value)
175                 {
176                     case IconAlignmentType.Left:
177                         {
178                             valueToString = "LEFT";
179                             break;
180                         }
181                     case IconAlignmentType.Right:
182                         {
183                             valueToString = "RIGHT";
184                             break;
185                         }
186                     case IconAlignmentType.Top:
187                         {
188                             valueToString = "TOP";
189                             break;
190                         }
191                     case IconAlignmentType.Bottom:
192                         {
193                             valueToString = "BOTTOM";
194                             break;
195                         }
196                     default:
197                         {
198                             valueToString = "DEFAULT";
199                             break;
200                         }
201                 }
202                 SetProperty(PushButton.Property.ICON_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString));
203             }
204         }
205         /// <summary>
206         /// Please do not use! this will be deprecated
207         /// </summary>
208         /// <since_tizen> 3 </since_tizen>
209         /// no use
210         [Obsolete("Please DO NOT use! This will be deprecated")]
211         [EditorBrowsable(EditorBrowsableState.Never)]
212         public new Vector4 LabelPadding
213         {
214             get
215             {
216                 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
217                 GetProperty(PushButton.Property.LABEL_PADDING).Get(temp);
218                 return temp;
219             }
220             set
221             {
222                 SetProperty(PushButton.Property.LABEL_PADDING, new Tizen.NUI.PropertyValue(value));
223             }
224         }
225
226         /// <summary>
227         /// Please do not use! this will be deprecated
228         /// </summary>
229         /// <since_tizen> 3 </since_tizen>
230         /// no use
231         [Obsolete("Please DO NOT use! This will be deprecated")]
232         [EditorBrowsable(EditorBrowsableState.Never)]
233         public Vector4 IconPadding
234         {
235             get
236             {
237                 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
238                 GetProperty(PushButton.Property.ICON_PADDING).Get(temp);
239                 return temp;
240             }
241             set
242             {
243                 SetProperty(PushButton.Property.ICON_PADDING, new Tizen.NUI.PropertyValue(value));
244             }
245         }
246
247         /// <summary>
248         /// Please do not use! this will be deprecated
249         /// </summary>
250         /// <since_tizen> 3 </since_tizen>
251         /// no use
252         [Obsolete("Please DO NOT use! This will be deprecated!")]
253         [EditorBrowsable(EditorBrowsableState.Never)]
254         public enum IconAlignmentType
255         {
256             /// <summary>
257             /// The icon located to the left of text.
258             /// </summary>
259             Left,
260             /// <summary>
261             /// The icon located to the right of text.
262             /// </summary>
263             Right,
264             /// <summary>
265             /// The icon located to the top of text.
266             /// </summary>
267             Top,
268             /// <summary>
269             /// The icon located to the bottom of text.
270             /// </summary>
271             Bottom,
272             /// <summary>
273             /// The icon located to the right of text by default.
274             /// </summary>
275             Default = Right
276         }
277
278     }
279 }