db7986984f084bd83833ab11582d53bcd5b8eb69
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / UIComponents / PushButton.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 // This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts
17 //------------------------------------------------------------------------------
18 // <auto-generated />
19 //
20 // This file was automatically generated by SWIG (http://www.swig.org).
21 // Version 3.0.9
22 //
23 // Do not make changes to this file unless you know what you are doing--modify
24 // the SWIG interface file instead.
25 //------------------------------------------------------------------------------
26
27 using Tizen.NUI.BaseComponents;
28
29 namespace Tizen.NUI.UIComponents
30 {
31
32     /// <summary>
33     /// A PushButton changes its appearance when is pressed and returns to its original when is released.
34     /// </summary>
35     public class PushButton : Button
36     {
37         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
38
39         internal PushButton(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.PushButton_SWIGUpcast(cPtr), cMemoryOwn)
40         {
41             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
42         }
43
44         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PushButton obj)
45         {
46             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
47         }
48
49         /// <summary>
50         /// To make PushButton instance be disposed.
51         /// </summary>
52         protected override void Dispose(DisposeTypes type)
53         {
54             if (disposed)
55             {
56                 return;
57             }
58
59             if (type == DisposeTypes.Explicit)
60             {
61                 //Called by User
62                 //Release your own managed resources here.
63                 //You should release all of your own disposable objects here.
64             }
65
66             //Release your own unmanaged resources here.
67             //You should not access any managed member here except static instance.
68             //because the execution order of Finalizes is non-deterministic.
69
70             if (swigCPtr.Handle != global::System.IntPtr.Zero)
71             {
72                 if (swigCMemOwn)
73                 {
74                     swigCMemOwn = false;
75                     NDalicPINVOKE.delete_PushButton(swigCPtr);
76                 }
77                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
78             }
79
80             base.Dispose(type);
81         }
82
83
84         internal class Property
85         {
86             internal static readonly int UNSELECTED_ICON = NDalicPINVOKE.PushButton_Property_UNSELECTED_ICON_get();
87             internal static readonly int SELECTED_ICON = NDalicPINVOKE.PushButton_Property_SELECTED_ICON_get();
88             internal static readonly int ICON_ALIGNMENT = NDalicPINVOKE.PushButton_Property_ICON_ALIGNMENT_get();
89             internal static readonly int LABEL_PADDING = NDalicPINVOKE.PushButton_Property_LABEL_PADDING_get();
90             internal static readonly int ICON_PADDING = NDalicPINVOKE.PushButton_Property_ICON_PADDING_get();
91         }
92
93         /// <summary>
94         /// Creates the PushButton.
95         /// </summary>
96         public PushButton() : this(NDalicPINVOKE.PushButton_New(), true)
97         {
98             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
99
100         }
101
102         internal PushButton(PushButton pushButton) : this(NDalicPINVOKE.new_PushButton__SWIG_1(PushButton.getCPtr(pushButton)), true)\r
103         {\r
104             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();\r
105         }\r
106 \r
107         internal PushButton Assign(PushButton pushButton)\r
108         {\r
109             PushButton ret = new PushButton(NDalicPINVOKE.PushButton_Assign(swigCPtr, PushButton.getCPtr(pushButton)), false);\r
110             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();\r
111             return ret;\r
112         }\r
113 \r
114         /// <summary>\r
115         /// Downcasts a handle to PushButton handle.<br>\r
116         /// If handle points to a PushButton, the downcast produces valid handle.<br>\r
117         /// If not the returned handle is left uninitialized.<br>\r
118         /// </summary>\r
119         /// <param name="handle">Handle to an object</param>\r
120         /// <returns>handle to a PushButton or an uninitialized handle</returns>\r
121         internal new static PushButton DownCast(BaseHandle handle)\r
122         {\r
123             PushButton ret = new PushButton(NDalicPINVOKE.PushButton_DownCast(BaseHandle.getCPtr(handle)), true);\r
124             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();\r
125             return ret;\r
126         }\r
127 \r
128         internal new void SetButtonImage(Image image)\r
129         {\r
130             NDalicPINVOKE.PushButton_SetButtonImage__SWIG_0_0(swigCPtr, Image.getCPtr(image));\r
131             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();\r
132         }\r
133 \r
134         internal void SetButtonImage(View image)\r
135         {\r
136             NDalicPINVOKE.PushButton_SetButtonImage__SWIG_1(swigCPtr, View.getCPtr(image));\r
137             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();\r
138         }\r
139 \r
140         internal void SetBackgroundImage(View image)\r
141         {\r
142             NDalicPINVOKE.PushButton_SetBackgroundImage(swigCPtr, View.getCPtr(image));\r
143             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();\r
144         }\r
145 \r
146         internal new void SetSelectedImage(Image image)\r
147         {\r
148             NDalicPINVOKE.PushButton_SetSelectedImage__SWIG_0_0(swigCPtr, Image.getCPtr(image));\r
149             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();\r
150         }\r
151 \r
152         internal void SetSelectedImage(View image)\r
153         {\r
154             NDalicPINVOKE.PushButton_SetSelectedImage__SWIG_1(swigCPtr, View.getCPtr(image));\r
155             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();\r
156         }\r
157 \r
158         internal void SetSelectedBackgroundImage(View image)\r
159         {\r
160             NDalicPINVOKE.PushButton_SetSelectedBackgroundImage(swigCPtr, View.getCPtr(image));\r
161             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();\r
162         }\r
163 \r
164         internal void SetDisabledBackgroundImage(View image)\r
165         {\r
166             NDalicPINVOKE.PushButton_SetDisabledBackgroundImage(swigCPtr, View.getCPtr(image));\r
167             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();\r
168         }\r
169 \r
170         internal void SetDisabledImage(View image)\r
171         {\r
172             NDalicPINVOKE.PushButton_SetDisabledImage(swigCPtr, View.getCPtr(image));\r
173             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();\r
174         }\r
175 \r
176         internal void SetDisabledSelectedImage(View image)\r
177         {\r
178             NDalicPINVOKE.PushButton_SetDisabledSelectedImage(swigCPtr, View.getCPtr(image));\r
179             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();\r
180         }\r
181 \r
182         internal enum PropertyRange\r
183         {\r
184             PROPERTY_START_INDEX = PropertyRanges.PROPERTY_REGISTRATION_START_INDEX,\r
185             PROPERTY_END_INDEX = View.PropertyRange.PROPERTY_START_INDEX + 1000\r
186         }\r
187 \r
188         /// <summary>\r
189         /// Sets the unselected button image.\r
190         /// </summary>\r
191         public string UnselectedIcon\r
192         {\r
193             set\r
194             {\r
195                 SetProperty(PushButton.Property.UNSELECTED_ICON, new Tizen.NUI.PropertyValue(value));\r
196             }\r
197         }\r
198         /// <summary>\r
199         /// Sets the selected button image.\r
200         /// </summary>\r
201         public string SelectedIcon\r
202         {\r
203             set\r
204             {\r
205                 SetProperty(PushButton.Property.SELECTED_ICON, new Tizen.NUI.PropertyValue(value));\r
206             }\r
207         }\r
208         /// <summary>\r
209         /// Sets the icon alignment.\r
210         /// </summary>\r
211         public IconAlignmentType IconAlignment\r
212         {\r
213             get\r
214             {\r
215                 string temp;\r
216                 if (GetProperty(PushButton.Property.ICON_ALIGNMENT).Get(out temp) == false)\r
217                 {\r
218 #if DEBUG_ON\r
219                     Tizen.Log.Error("NUI", "IconAlignment get error!");\r
220 #endif\r
221                 }\r
222                 switch (temp)\r
223                 {\r
224                     case "LEFT":\r
225                         return IconAlignmentType.Left;\r
226                     case "RIGHT":\r
227                         return IconAlignmentType.Right;\r
228                     case "TOP":\r
229                         return IconAlignmentType.Top;\r
230                     case "BOTTOM":\r
231                         return IconAlignmentType.Bottom;\r
232                     default:\r
233                         return IconAlignmentType.Default;\r
234                 }\r
235             }\r
236             set\r
237             {\r
238                 string valueToString = "";\r
239                 switch (value)\r
240                 {\r
241                     case IconAlignmentType.Left:\r
242                         {\r
243                             valueToString = "LEFT";\r
244                             break;\r
245                         }\r
246                     case IconAlignmentType.Right:\r
247                         {\r
248                             valueToString = "RIGHT";\r
249                             break;\r
250                         }\r
251                     case IconAlignmentType.Top:\r
252                         {\r
253                             valueToString = "TOP";\r
254                             break;\r
255                         }\r
256                     case IconAlignmentType.Bottom:\r
257                         {\r
258                             valueToString = "BOTTOM";\r
259                             break;\r
260                         }\r
261                     default:\r
262                         {\r
263                             valueToString = "DEFAULT";\r
264                             break;\r
265                         }\r
266                 }\r
267                 SetProperty(PushButton.Property.ICON_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString));\r
268             }\r
269         }\r
270         /// <summary>\r
271         /// Sets the label padding value.\r
272         /// </summary>\r
273         public Vector4 LabelPadding\r
274         {\r
275             get\r
276             {\r
277                 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);\r
278                 GetProperty(PushButton.Property.LABEL_PADDING).Get(temp);\r
279                 return temp;\r
280             }\r
281             set\r
282             {\r
283                 SetProperty(PushButton.Property.LABEL_PADDING, new Tizen.NUI.PropertyValue(value));\r
284             }\r
285         }\r
286 \r
287         /// <summary>\r
288         /// Sets the icon padding value.\r
289         /// </summary>\r
290         public Vector4 IconPadding\r
291         {\r
292             get\r
293             {\r
294                 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);\r
295                 GetProperty(PushButton.Property.ICON_PADDING).Get(temp);\r
296                 return temp;\r
297             }\r
298             set\r
299             {\r
300                 SetProperty(PushButton.Property.ICON_PADDING, new Tizen.NUI.PropertyValue(value));\r
301             }\r
302         }\r
303 \r
304         /// <summary>\r
305         /// Enumeration for the alignment modes of the icon.\r
306         /// </summary>\r
307         public enum IconAlignmentType\r
308         {\r
309             /// <summary>\r
310             /// Icon located to the left of text.\r
311             /// </summary>\r
312             Left,\r
313             /// <summary>\r
314             /// Icon located to the right of text.\r
315             /// </summary>\r
316             Right,\r
317             /// <summary>\r
318             /// Icon located to the top of text.\r
319             /// </summary>\r
320             Top,\r
321             /// <summary>\r
322             /// Icon located to the bottom of text.\r
323             /// </summary>\r
324             Bottom,\r
325             /// <summary>\r
326             /// Icon located to the right of text by default.\r
327             /// </summary>\r
328             Default = Right\r
329         }\r
330 \r
331     }\r
332 }