manual nui merge 0.2.38
[platform/core/csapi/nui.git] / 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         public override void Dispose()
53         {
54             if (!Window.IsInstalled())
55             {
56                 DisposeQueue.Instance.Add(this);
57                 return;
58             }
59
60             lock (this)
61             {
62                 if (swigCPtr.Handle != global::System.IntPtr.Zero)
63                 {
64                     if (swigCMemOwn)
65                     {
66                         swigCMemOwn = false;
67                         NDalicPINVOKE.delete_PushButton(swigCPtr);
68                     }
69                     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
70                 }
71                 global::System.GC.SuppressFinalize(this);
72                 base.Dispose();
73             }
74         }
75
76
77         internal class Property : global::System.IDisposable
78         {
79             private global::System.Runtime.InteropServices.HandleRef swigCPtr;
80             protected bool swigCMemOwn;
81
82             internal Property(global::System.IntPtr cPtr, bool cMemoryOwn)
83             {
84                 swigCMemOwn = cMemoryOwn;
85                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
86             }
87
88             internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj)
89             {
90                 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
91             }
92
93             ~Property()
94             {
95                 DisposeQueue.Instance.Add(this);
96             }
97
98             public virtual void Dispose()
99             {
100                 if (!Window.IsInstalled()) {
101                     DisposeQueue.Instance.Add(this);
102                     return;
103                 }
104
105                 lock (this)
106                 {
107                     if (swigCPtr.Handle != global::System.IntPtr.Zero)
108                     {
109                         if (swigCMemOwn)
110                         {
111                             swigCMemOwn = false;
112                             NDalicPINVOKE.delete_PushButton_Property(swigCPtr);
113                         }
114                         swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
115                     }
116                     global::System.GC.SuppressFinalize(this);
117                 }
118             }
119
120             internal Property() : this(NDalicPINVOKE.new_PushButton_Property(), true)
121             {
122                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
123             }
124
125             internal static readonly int UNSELECTED_ICON = NDalicPINVOKE.PushButton_Property_UNSELECTED_ICON_get();
126             internal static readonly int SELECTED_ICON = NDalicPINVOKE.PushButton_Property_SELECTED_ICON_get();
127             internal static readonly int ICON_ALIGNMENT = NDalicPINVOKE.PushButton_Property_ICON_ALIGNMENT_get();
128             internal static readonly int LABEL_PADDING = NDalicPINVOKE.PushButton_Property_LABEL_PADDING_get();
129             internal static readonly int ICON_PADDING = NDalicPINVOKE.PushButton_Property_ICON_PADDING_get();
130
131         }
132
133         /// <summary>
134         /// Creates the PushButton.
135         /// </summary>
136         public PushButton() : this(NDalicPINVOKE.PushButton_New(), true)
137         {
138             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
139
140         }
141         internal PushButton(PushButton pushButton) : this(NDalicPINVOKE.new_PushButton__SWIG_1(PushButton.getCPtr(pushButton)), true)
142         {
143             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
144         }
145
146         internal PushButton Assign(PushButton pushButton)
147         {
148             PushButton ret = new PushButton(NDalicPINVOKE.PushButton_Assign(swigCPtr, PushButton.getCPtr(pushButton)), false);
149             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
150             return ret;
151         }
152
153         /// <summary>
154         /// Downcasts a handle to PushButton handle.<br>
155         /// If handle points to a PushButton, the downcast produces valid handle.<br>
156         /// If not the returned handle is left uninitialized.<br>
157         /// </summary>
158         /// <param name="handle">Handle to an object</param>
159         /// <returns>handle to a PushButton or an uninitialized handle</returns>
160         public new static PushButton DownCast(BaseHandle handle)
161         {
162             PushButton ret = new PushButton(NDalicPINVOKE.PushButton_DownCast(BaseHandle.getCPtr(handle)), true);
163             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
164             return ret;
165         }
166
167         internal new void SetButtonImage(Image image)
168         {
169             NDalicPINVOKE.PushButton_SetButtonImage__SWIG_0_0(swigCPtr, Image.getCPtr(image));
170             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
171         }
172
173         internal void SetButtonImage(View image)
174         {
175             NDalicPINVOKE.PushButton_SetButtonImage__SWIG_1(swigCPtr, View.getCPtr(image));
176             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
177         }
178
179         internal void SetBackgroundImage(View image)
180         {
181             NDalicPINVOKE.PushButton_SetBackgroundImage(swigCPtr, View.getCPtr(image));
182             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
183         }
184
185         internal new void SetSelectedImage(Image image)
186         {
187             NDalicPINVOKE.PushButton_SetSelectedImage__SWIG_0_0(swigCPtr, Image.getCPtr(image));
188             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
189         }
190
191         internal void SetSelectedImage(View image)
192         {
193             NDalicPINVOKE.PushButton_SetSelectedImage__SWIG_1(swigCPtr, View.getCPtr(image));
194             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
195         }
196
197         internal void SetSelectedBackgroundImage(View image)
198         {
199             NDalicPINVOKE.PushButton_SetSelectedBackgroundImage(swigCPtr, View.getCPtr(image));
200             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
201         }
202
203         internal void SetDisabledBackgroundImage(View image)
204         {
205             NDalicPINVOKE.PushButton_SetDisabledBackgroundImage(swigCPtr, View.getCPtr(image));
206             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
207         }
208
209         internal void SetDisabledImage(View image)
210         {
211             NDalicPINVOKE.PushButton_SetDisabledImage(swigCPtr, View.getCPtr(image));
212             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
213         }
214
215         internal void SetDisabledSelectedImage(View image)
216         {
217             NDalicPINVOKE.PushButton_SetDisabledSelectedImage(swigCPtr, View.getCPtr(image));
218             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
219         }
220
221         internal enum PropertyRange
222         {
223             PROPERTY_START_INDEX = PropertyRanges.PROPERTY_REGISTRATION_START_INDEX,
224             PROPERTY_END_INDEX = View.PropertyRange.PROPERTY_START_INDEX + 1000
225         }
226
227         /// <summary>
228         /// Sets the unselected button image.
229         /// </summary>
230         public string UnselectedIcon
231         {
232             set
233             {
234                 SetProperty(PushButton.Property.UNSELECTED_ICON, new Tizen.NUI.PropertyValue(value));
235             }
236         }
237         /// <summary>
238         /// Sets the selected button image.
239         /// </summary>
240         public string SelectedIcon
241         {
242             set
243             {
244                 SetProperty(PushButton.Property.SELECTED_ICON, new Tizen.NUI.PropertyValue(value));
245             }
246         }
247         /// <summary>
248         /// Sets the icon alignment.
249         /// </summary>
250         public IconAlignmentType IconAlignment
251         {
252             get
253             {
254                 string temp;
255                 if (GetProperty(PushButton.Property.ICON_ALIGNMENT).Get(out temp) == false)
256                 {
257 #if DEBUG_ON
258                     Tizen.Log.Error("NUI", "IconAlignment get error!");
259 #endif
260                 }
261                  switch (temp)
262                 {
263                     case "LEFT":
264                         return IconAlignmentType.Left;
265                     case "RIGHT":
266                         return IconAlignmentType.Right;
267                     case "TOP":
268                         return IconAlignmentType.Top;
269                     case "BOTTOM":
270                         return IconAlignmentType.Bottom;
271                     default:
272                         return IconAlignmentType.Default;
273                 }
274             }
275             set
276             {
277                 string valueToString = "";
278                 switch (value)
279                 {
280                     case IconAlignmentType.Left:
281                     {
282                         valueToString = "LEFT";
283                         break;
284                     }
285                     case IconAlignmentType.Right:
286                     {
287                         valueToString = "RIGHT";
288                         break;
289                     }
290                     case IconAlignmentType.Top:
291                     {
292                         valueToString = "TOP";
293                         break;
294                     }
295                     case IconAlignmentType.Bottom:
296                     {
297                         valueToString = "BOTTOM";
298                         break;
299                     }
300                     default:
301                     {
302                         valueToString = "DEFAULT";
303                         break;
304                     }
305                 }
306                 SetProperty(PushButton.Property.ICON_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString));
307             }
308         }
309         /// <summary>
310         /// Sets the label padding value.
311         /// </summary>
312         public Vector4 LabelPadding
313         {
314             get
315             {
316                 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
317                 GetProperty(PushButton.Property.LABEL_PADDING).Get(temp);
318                 return temp;
319             }
320             set
321             {
322                 SetProperty(PushButton.Property.LABEL_PADDING, new Tizen.NUI.PropertyValue(value));
323             }
324         }
325
326         /// <summary>
327         /// Sets the icon padding value.
328         /// </summary>
329         public Vector4 IconPadding
330         {
331             get
332             {
333                 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
334                 GetProperty(PushButton.Property.ICON_PADDING).Get(temp);
335                 return temp;
336             }
337             set
338             {
339                 SetProperty(PushButton.Property.ICON_PADDING, new Tizen.NUI.PropertyValue(value));
340             }
341         }
342
343         /// <summary>
344         /// Enumeration for the alignment modes of the icon.
345         /// </summary>
346         public enum IconAlignmentType
347         {
348             /// <summary>
349             /// Icon located to the left of text.
350             /// </summary>
351             Left,
352             /// <summary>
353             /// Icon located to the right of text.
354             /// </summary>
355             Right,
356             /// <summary>
357             /// Icon located to the top of text.
358             /// </summary>
359             Top,
360             /// <summary>
361             /// Icon located to the bottom of text.
362             /// </summary>
363             Bottom,
364             /// <summary>
365             /// Icon located to the right of text by default.
366             /// </summary>
367             Default = Right
368         }
369
370     }
371
372 }