1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
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
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 // This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts
17 //------------------------------------------------------------------------------
20 // This file was automatically generated by SWIG (http://www.swig.org).
23 // Do not make changes to this file unless you know what you are doing--modify
24 // the SWIG interface file instead.
25 //------------------------------------------------------------------------------
27 namespace Tizen.NUI.UIComponents
31 /// A PushButton changes its appearance when is pressed and returns to its original when is released.
33 public class PushButton : Button
35 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
37 internal PushButton(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.PushButton_SWIGUpcast(cPtr), cMemoryOwn)
39 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
42 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PushButton obj)
44 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
49 DisposeQueue.Instance.Add(this);
53 /// To make PushButton instance be disposed.
55 public override void Dispose()
57 if (!Stage.IsInstalled())
59 DisposeQueue.Instance.Add(this);
65 if (swigCPtr.Handle != global::System.IntPtr.Zero)
70 NDalicPINVOKE.delete_PushButton(swigCPtr);
72 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
74 global::System.GC.SuppressFinalize(this);
80 internal class Property : global::System.IDisposable
82 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
83 protected bool swigCMemOwn;
85 internal Property(global::System.IntPtr cPtr, bool cMemoryOwn)
87 swigCMemOwn = cMemoryOwn;
88 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
91 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj)
93 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
101 public virtual void Dispose()
105 if (swigCPtr.Handle != global::System.IntPtr.Zero)
110 NDalicPINVOKE.delete_PushButton_Property(swigCPtr);
112 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
114 global::System.GC.SuppressFinalize(this);
118 internal Property() : this(NDalicPINVOKE.new_PushButton_Property(), true)
120 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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();
132 /// Creates the PushButton.
134 public PushButton() : this(NDalicPINVOKE.PushButton_New(), true)
136 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
139 internal PushButton(PushButton pushButton) : this(NDalicPINVOKE.new_PushButton__SWIG_1(PushButton.getCPtr(pushButton)), true)
141 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
144 internal PushButton Assign(PushButton pushButton)
146 PushButton ret = new PushButton(NDalicPINVOKE.PushButton_Assign(swigCPtr, PushButton.getCPtr(pushButton)), false);
147 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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>
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)
160 PushButton ret = new PushButton(NDalicPINVOKE.PushButton_DownCast(BaseHandle.getCPtr(handle)), true);
161 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
165 internal new void SetButtonImage(Image image)
167 NDalicPINVOKE.PushButton_SetButtonImage__SWIG_0_0(swigCPtr, Image.getCPtr(image));
168 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
171 internal void SetButtonImage(Actor image)
173 NDalicPINVOKE.PushButton_SetButtonImage__SWIG_1(swigCPtr, Actor.getCPtr(image));
174 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
177 internal void SetBackgroundImage(Actor image)
179 NDalicPINVOKE.PushButton_SetBackgroundImage(swigCPtr, Actor.getCPtr(image));
180 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
183 internal new void SetSelectedImage(Image image)
185 NDalicPINVOKE.PushButton_SetSelectedImage__SWIG_0_0(swigCPtr, Image.getCPtr(image));
186 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
189 internal void SetSelectedImage(Actor image)
191 NDalicPINVOKE.PushButton_SetSelectedImage__SWIG_1(swigCPtr, Actor.getCPtr(image));
192 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
195 internal void SetSelectedBackgroundImage(Actor image)
197 NDalicPINVOKE.PushButton_SetSelectedBackgroundImage(swigCPtr, Actor.getCPtr(image));
198 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
201 internal void SetDisabledBackgroundImage(Actor image)
203 NDalicPINVOKE.PushButton_SetDisabledBackgroundImage(swigCPtr, Actor.getCPtr(image));
204 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
207 internal void SetDisabledImage(Actor image)
209 NDalicPINVOKE.PushButton_SetDisabledImage(swigCPtr, Actor.getCPtr(image));
210 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
213 internal void SetDisabledSelectedImage(Actor image)
215 NDalicPINVOKE.PushButton_SetDisabledSelectedImage(swigCPtr, Actor.getCPtr(image));
216 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
219 internal enum PropertyRange
221 PROPERTY_START_INDEX = PropertyRanges.PROPERTY_REGISTRATION_START_INDEX,
222 PROPERTY_END_INDEX = View.PropertyRange.PROPERTY_START_INDEX + 1000
226 /// Sets the unselected button image.
228 public string UnselectedIcon
232 SetProperty(PushButton.Property.UNSELECTED_ICON, new Tizen.NUI.PropertyValue(value));
236 /// Sets the selected button image.
238 public string SelectedIcon
242 SetProperty(PushButton.Property.SELECTED_ICON, new Tizen.NUI.PropertyValue(value));
246 /// Sets the icon alignment.
248 public IconAlignmentType IconAlignment
253 if (GetProperty(PushButton.Property.ICON_ALIGNMENT).Get(out temp) == false)
255 //Tizen.Log.Error("NUI", "IconAlignment get error!");
260 return IconAlignmentType.Left;
262 return IconAlignmentType.Right;
264 return IconAlignmentType.Top;
266 return IconAlignmentType.Bottom;
268 return IconAlignmentType.Default;
273 string valueToString = "";
276 case IconAlignmentType.Left:
278 valueToString = "LEFT";
281 case IconAlignmentType.Right:
283 valueToString = "RIGHT";
286 case IconAlignmentType.Top:
288 valueToString = "TOP";
291 case IconAlignmentType.Bottom:
293 valueToString = "BOTTOM";
298 valueToString = "DEFAULT";
302 SetProperty(PushButton.Property.ICON_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString));
306 /// Sets the label padding value.
308 public Vector4 LabelPadding
312 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
313 GetProperty(PushButton.Property.LABEL_PADDING).Get(temp);
318 SetProperty(PushButton.Property.LABEL_PADDING, new Tizen.NUI.PropertyValue(value));
323 /// Sets the icon padding value.
325 public Vector4 IconPadding
329 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
330 GetProperty(PushButton.Property.ICON_PADDING).Get(temp);
335 SetProperty(PushButton.Property.ICON_PADDING, new Tizen.NUI.PropertyValue(value));
340 /// Enumeration for the alignment modes of the icon.
342 public enum IconAlignmentType
345 /// Icon located to the left of text.
349 /// Icon located to the right of text.
353 /// Icon located to the top of text.
357 /// Icon located to the bottom of text.
361 /// Icon located to the right of text by default.