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 System.ComponentModel;
20 using Tizen.NUI.BaseComponents;
22 namespace Tizen.NUI.UIComponents
26 /// The PushButton changes its appearance when it is pressed, and returns to its original when it is released.
28 public class PushButton : Button
30 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
32 internal PushButton(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.PushButton_SWIGUpcast(cPtr), cMemoryOwn)
34 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
37 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PushButton obj)
39 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
43 /// To dispose the PushButton instance.
45 protected override void Dispose(DisposeTypes type)
52 if(type == DisposeTypes.Explicit)
55 //Release your own managed resources here.
56 //You should release all of your own disposable objects here.
59 //Release your own unmanaged resources here.
60 //You should not access any managed member here except static instance.
61 //because the execution order of Finalizes is non-deterministic.
63 if (swigCPtr.Handle != global::System.IntPtr.Zero)
68 NDalicPINVOKE.delete_PushButton(swigCPtr);
70 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
77 internal new class Property
79 internal static readonly int UNSELECTED_ICON = NDalicPINVOKE.PushButton_Property_UNSELECTED_ICON_get();
80 internal static readonly int SELECTED_ICON = NDalicPINVOKE.PushButton_Property_SELECTED_ICON_get();
81 internal static readonly int ICON_ALIGNMENT = NDalicPINVOKE.PushButton_Property_ICON_ALIGNMENT_get();
82 internal static readonly int LABEL_PADDING = NDalicPINVOKE.PushButton_Property_LABEL_PADDING_get();
83 internal static readonly int ICON_PADDING = NDalicPINVOKE.PushButton_Property_ICON_PADDING_get();
87 /// Creates the PushButton.
89 /// <since_tizen> 3 </since_tizen>
90 public PushButton() : this(NDalicPINVOKE.PushButton_New(), true)
92 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
97 /// Downcasts a handle to pushButton handle.
99 /// <since_tizen> 3 </since_tizen>
100 /// Please do not use! this will be deprecated!
101 /// Instead please use as keyword.
102 [Obsolete("Please DO NOT use! This will be deprecated, instead please USE as keyword.")]
103 [EditorBrowsable(EditorBrowsableState.Never)]
104 public new static PushButton DownCast(BaseHandle handle)
106 PushButton ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as PushButton;
107 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
114 /// <since_tizen> 3 </since_tizen>
115 /// Please do not use! this will be deprecated!
116 /// Instead please use UnselectedVisual.
117 [Obsolete("Please DO NOT use! This will be Deprecated!. Please implement by using Visual instead!")]
118 [EditorBrowsable(EditorBrowsableState.Never)]
119 public string UnselectedIcon
123 SetProperty(PushButton.Property.UNSELECTED_ICON, new Tizen.NUI.PropertyValue(value));
130 /// <since_tizen> 3 </since_tizen>
131 /// Please do not use! this will be deprecated!
132 /// Instead please use SelectedVisual.
133 [Obsolete("Please do not use! this will be deprecated, instead please use SelectedVisual.")]
134 [EditorBrowsable(EditorBrowsableState.Never)]
135 public string SelectedIcon
139 SetProperty(PushButton.Property.SELECTED_ICON, new Tizen.NUI.PropertyValue(value));
143 /// Please do not use! this will be deprecated
145 /// <since_tizen> 3 </since_tizen>
146 [Obsolete("Please DO NOT use! This will be deprecated, please implement by using Visual instead!")]
147 [EditorBrowsable(EditorBrowsableState.Never)]
148 public IconAlignmentType IconAlignment
153 if (GetProperty(PushButton.Property.ICON_ALIGNMENT).Get(out temp) == false)
155 NUILog.Error("IconAlignment get error!");
160 return IconAlignmentType.Left;
162 return IconAlignmentType.Right;
164 return IconAlignmentType.Top;
166 return IconAlignmentType.Bottom;
168 return IconAlignmentType.Default;
173 string valueToString = "";
176 case IconAlignmentType.Left:
178 valueToString = "LEFT";
181 case IconAlignmentType.Right:
183 valueToString = "RIGHT";
186 case IconAlignmentType.Top:
188 valueToString = "TOP";
191 case IconAlignmentType.Bottom:
193 valueToString = "BOTTOM";
198 valueToString = "DEFAULT";
202 SetProperty(PushButton.Property.ICON_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString));
206 /// Please do not use! this will be deprecated
208 /// <since_tizen> 3 </since_tizen>
210 [Obsolete("Please DO NOT use! This will be deprecated")]
211 [EditorBrowsable(EditorBrowsableState.Never)]
212 public new Vector4 LabelPadding
216 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
217 GetProperty(PushButton.Property.LABEL_PADDING).Get(temp);
222 SetProperty(PushButton.Property.LABEL_PADDING, new Tizen.NUI.PropertyValue(value));
227 /// Please do not use! this will be deprecated
229 /// <since_tizen> 3 </since_tizen>
231 [Obsolete("Please DO NOT use! This will be deprecated")]
232 [EditorBrowsable(EditorBrowsableState.Never)]
233 public Vector4 IconPadding
237 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
238 GetProperty(PushButton.Property.ICON_PADDING).Get(temp);
243 SetProperty(PushButton.Property.ICON_PADDING, new Tizen.NUI.PropertyValue(value));
248 /// Please do not use! this will be deprecated
250 /// <since_tizen> 3 </since_tizen>
252 [Obsolete("Please DO NOT use! This will be deprecated!")]
253 [EditorBrowsable(EditorBrowsableState.Never)]
254 public enum IconAlignmentType
257 /// The icon located to the left of text.
261 /// The icon located to the right of text.
265 /// The icon located to the top of text.
269 /// The icon located to the bottom of text.
273 /// The icon located to the right of text by default.