2 * Copyright(c) 2017 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 using Tizen.NUI.BaseComponents;
21 namespace Tizen.NUI.UIComponents
25 /// The PushButton changes its appearance when it is pressed, and returns to its original when it is released.
27 public class PushButton : Button
29 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
31 internal PushButton(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.PushButton_SWIGUpcast(cPtr), cMemoryOwn)
33 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
36 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PushButton obj)
38 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
42 /// To dispose the PushButton instance.
44 protected override void Dispose(DisposeTypes type)
51 if(type == DisposeTypes.Explicit)
54 //Release your own managed resources here.
55 //You should release all of your own disposable objects here.
58 //Release your own unmanaged resources here.
59 //You should not access any managed member here except static instance.
60 //because the execution order of Finalizes is non-deterministic.
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);
76 internal new class Property
78 internal static readonly int UNSELECTED_ICON = NDalicPINVOKE.PushButton_Property_UNSELECTED_ICON_get();
79 internal static readonly int SELECTED_ICON = NDalicPINVOKE.PushButton_Property_SELECTED_ICON_get();
80 internal static readonly int ICON_ALIGNMENT = NDalicPINVOKE.PushButton_Property_ICON_ALIGNMENT_get();
81 internal static readonly int LABEL_PADDING = NDalicPINVOKE.PushButton_Property_LABEL_PADDING_get();
82 internal static readonly int ICON_PADDING = NDalicPINVOKE.PushButton_Property_ICON_PADDING_get();
86 /// Creates the PushButton.
88 /// <since_tizen> 3 </since_tizen>
89 public PushButton() : this(NDalicPINVOKE.PushButton_New(), true)
91 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
96 /// Please do not use! this will be deprecated
98 /// <since_tizen> 3 </since_tizen>
99 [Obsolete("Please do not use! this will be deprecated")]
100 public new static PushButton DownCast(BaseHandle handle)
102 PushButton ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as PushButton;
103 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
108 /// Please do not use! this will be deprecated
110 /// <since_tizen> 3 </since_tizen>
111 [Obsolete("Please do not use! this will be deprecated")]
112 public string UnselectedIcon
116 SetProperty(PushButton.Property.UNSELECTED_ICON, new Tizen.NUI.PropertyValue(value));
121 /// Please do not use! this will be deprecated
123 /// <since_tizen> 3 </since_tizen>
124 [Obsolete("Please do not use! this will be deprecated")]
125 public string SelectedIcon
129 SetProperty(PushButton.Property.SELECTED_ICON, new Tizen.NUI.PropertyValue(value));
133 /// Please do not use! this will be deprecated
135 /// <since_tizen> 3 </since_tizen>
136 [Obsolete("Please do not use! this will be deprecated")]
137 public IconAlignmentType IconAlignment
142 if (GetProperty(PushButton.Property.ICON_ALIGNMENT).Get(out temp) == false)
144 NUILog.Error("IconAlignment get error!");
149 return IconAlignmentType.Left;
151 return IconAlignmentType.Right;
153 return IconAlignmentType.Top;
155 return IconAlignmentType.Bottom;
157 return IconAlignmentType.Default;
162 string valueToString = "";
165 case IconAlignmentType.Left:
167 valueToString = "LEFT";
170 case IconAlignmentType.Right:
172 valueToString = "RIGHT";
175 case IconAlignmentType.Top:
177 valueToString = "TOP";
180 case IconAlignmentType.Bottom:
182 valueToString = "BOTTOM";
187 valueToString = "DEFAULT";
191 SetProperty(PushButton.Property.ICON_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString));
195 /// Please do not use! this will be deprecated
197 /// <since_tizen> 3 </since_tizen>
198 [Obsolete("Please do not use! this will be deprecated")]
199 public new Vector4 LabelPadding
203 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
204 GetProperty(PushButton.Property.LABEL_PADDING).Get(temp);
209 SetProperty(PushButton.Property.LABEL_PADDING, new Tizen.NUI.PropertyValue(value));
214 /// Please do not use! this will be deprecated
216 /// <since_tizen> 3 </since_tizen>
217 [Obsolete("Please do not use! this will be deprecated")]
218 public Vector4 IconPadding
222 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
223 GetProperty(PushButton.Property.ICON_PADDING).Get(temp);
228 SetProperty(PushButton.Property.ICON_PADDING, new Tizen.NUI.PropertyValue(value));
233 /// Please do not use! this will be deprecated
235 /// <since_tizen> 3 </since_tizen>
236 [Obsolete("Please do not use! this will be deprecated")]
237 public enum IconAlignmentType
240 /// The icon located to the left of text.
244 /// The icon located to the right of text.
248 /// The icon located to the top of text.
252 /// The icon located to the bottom of text.
256 /// The icon located to the right of text by default.