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 using Tizen.NUI.BaseComponents;
29 namespace Tizen.NUI.UIComponents
33 /// A PushButton changes its appearance when is pressed and returns to its original when is released.
35 public class PushButton : Button
37 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
39 internal PushButton(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.PushButton_SWIGUpcast(cPtr), cMemoryOwn)
41 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
44 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PushButton obj)
46 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
50 /// To make PushButton instance be disposed.
52 public override void Dispose()
54 if (!Window.IsInstalled())
56 DisposeQueue.Instance.Add(this);
62 if (swigCPtr.Handle != global::System.IntPtr.Zero)
67 NDalicPINVOKE.delete_PushButton(swigCPtr);
69 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
71 global::System.GC.SuppressFinalize(this);
77 internal class Property : global::System.IDisposable
79 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
80 protected bool swigCMemOwn;
82 internal Property(global::System.IntPtr cPtr, bool cMemoryOwn)
84 swigCMemOwn = cMemoryOwn;
85 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
88 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj)
90 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
95 DisposeQueue.Instance.Add(this);
98 public virtual void Dispose()
100 if (!Window.IsInstalled()) {
101 DisposeQueue.Instance.Add(this);
107 if (swigCPtr.Handle != global::System.IntPtr.Zero)
112 NDalicPINVOKE.delete_PushButton_Property(swigCPtr);
114 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
116 global::System.GC.SuppressFinalize(this);
120 internal Property() : this(NDalicPINVOKE.new_PushButton_Property(), true)
122 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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();
134 /// Creates the PushButton.
136 public PushButton() : this(NDalicPINVOKE.PushButton_New(), true)
138 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
141 internal PushButton(PushButton pushButton) : this(NDalicPINVOKE.new_PushButton__SWIG_1(PushButton.getCPtr(pushButton)), true)
143 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
146 internal PushButton Assign(PushButton pushButton)
148 PushButton ret = new PushButton(NDalicPINVOKE.PushButton_Assign(swigCPtr, PushButton.getCPtr(pushButton)), false);
149 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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>
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)
162 PushButton ret = new PushButton(NDalicPINVOKE.PushButton_DownCast(BaseHandle.getCPtr(handle)), true);
163 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
167 internal new void SetButtonImage(Image image)
169 NDalicPINVOKE.PushButton_SetButtonImage__SWIG_0_0(swigCPtr, Image.getCPtr(image));
170 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
173 internal void SetButtonImage(View image)
175 NDalicPINVOKE.PushButton_SetButtonImage__SWIG_1(swigCPtr, View.getCPtr(image));
176 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
179 internal void SetBackgroundImage(View image)
181 NDalicPINVOKE.PushButton_SetBackgroundImage(swigCPtr, View.getCPtr(image));
182 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
185 internal new void SetSelectedImage(Image image)
187 NDalicPINVOKE.PushButton_SetSelectedImage__SWIG_0_0(swigCPtr, Image.getCPtr(image));
188 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
191 internal void SetSelectedImage(View image)
193 NDalicPINVOKE.PushButton_SetSelectedImage__SWIG_1(swigCPtr, View.getCPtr(image));
194 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
197 internal void SetSelectedBackgroundImage(View image)
199 NDalicPINVOKE.PushButton_SetSelectedBackgroundImage(swigCPtr, View.getCPtr(image));
200 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
203 internal void SetDisabledBackgroundImage(View image)
205 NDalicPINVOKE.PushButton_SetDisabledBackgroundImage(swigCPtr, View.getCPtr(image));
206 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
209 internal void SetDisabledImage(View image)
211 NDalicPINVOKE.PushButton_SetDisabledImage(swigCPtr, View.getCPtr(image));
212 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
215 internal void SetDisabledSelectedImage(View image)
217 NDalicPINVOKE.PushButton_SetDisabledSelectedImage(swigCPtr, View.getCPtr(image));
218 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
221 internal enum PropertyRange
223 PROPERTY_START_INDEX = PropertyRanges.PROPERTY_REGISTRATION_START_INDEX,
224 PROPERTY_END_INDEX = View.PropertyRange.PROPERTY_START_INDEX + 1000
228 /// Sets the unselected button image.
230 public string UnselectedIcon
234 SetProperty(PushButton.Property.UNSELECTED_ICON, new Tizen.NUI.PropertyValue(value));
238 /// Sets the selected button image.
240 public string SelectedIcon
244 SetProperty(PushButton.Property.SELECTED_ICON, new Tizen.NUI.PropertyValue(value));
248 /// Sets the icon alignment.
250 public IconAlignmentType IconAlignment
255 if (GetProperty(PushButton.Property.ICON_ALIGNMENT).Get(out temp) == false)
258 Tizen.Log.Error("NUI", "IconAlignment get error!");
264 return IconAlignmentType.Left;
266 return IconAlignmentType.Right;
268 return IconAlignmentType.Top;
270 return IconAlignmentType.Bottom;
272 return IconAlignmentType.Default;
277 string valueToString = "";
280 case IconAlignmentType.Left:
282 valueToString = "LEFT";
285 case IconAlignmentType.Right:
287 valueToString = "RIGHT";
290 case IconAlignmentType.Top:
292 valueToString = "TOP";
295 case IconAlignmentType.Bottom:
297 valueToString = "BOTTOM";
302 valueToString = "DEFAULT";
306 SetProperty(PushButton.Property.ICON_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString));
310 /// Sets the label padding value.
312 public Vector4 LabelPadding
316 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
317 GetProperty(PushButton.Property.LABEL_PADDING).Get(temp);
322 SetProperty(PushButton.Property.LABEL_PADDING, new Tizen.NUI.PropertyValue(value));
327 /// Sets the icon padding value.
329 public Vector4 IconPadding
333 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
334 GetProperty(PushButton.Property.ICON_PADDING).Get(temp);
339 SetProperty(PushButton.Property.ICON_PADDING, new Tizen.NUI.PropertyValue(value));
344 /// Enumeration for the alignment modes of the icon.
346 public enum IconAlignmentType
349 /// Icon located to the left of text.
353 /// Icon located to the right of text.
357 /// Icon located to the top of text.
361 /// Icon located to the bottom of text.
365 /// Icon located to the right of text by default.