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