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.
18 using Tizen.NUI.BaseComponents;
20 namespace Tizen.NUI.UIComponents
24 /// The PushButton changes its appearance when it is pressed, and returns to its original when it is released.
26 public class PushButton : Button
28 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
30 internal PushButton(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.PushButton_SWIGUpcast(cPtr), cMemoryOwn)
32 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
35 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PushButton obj)
37 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
41 /// To dispose the PushButton instance.
43 protected override void Dispose(DisposeTypes type)
50 if(type == DisposeTypes.Explicit)
53 //Release your own managed resources here.
54 //You should release all of your own disposable objects here.
57 //Release your own unmanaged resources here.
58 //You should not access any managed member here except static instance.
59 //because the execution order of Finalizes is non-deterministic.
61 if (swigCPtr.Handle != global::System.IntPtr.Zero)
66 NDalicPINVOKE.delete_PushButton(swigCPtr);
68 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
75 internal new class Property
77 internal static readonly int UNSELECTED_ICON = NDalicPINVOKE.PushButton_Property_UNSELECTED_ICON_get();
78 internal static readonly int SELECTED_ICON = NDalicPINVOKE.PushButton_Property_SELECTED_ICON_get();
79 internal static readonly int ICON_ALIGNMENT = NDalicPINVOKE.PushButton_Property_ICON_ALIGNMENT_get();
80 internal static readonly int LABEL_PADDING = NDalicPINVOKE.PushButton_Property_LABEL_PADDING_get();
81 internal static readonly int ICON_PADDING = NDalicPINVOKE.PushButton_Property_ICON_PADDING_get();
85 /// Creates the PushButton.
87 /// <since_tizen> 3 </since_tizen>
88 public PushButton() : this(NDalicPINVOKE.PushButton_New(), true)
90 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
94 [Obsolete("Please do not use! this will be deprecated")]
95 public new static PushButton DownCast(BaseHandle handle)
97 PushButton ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as PushButton;
98 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
102 [Obsolete("Please do not use! this will be deprecated")]
103 public string UnselectedIcon
107 SetProperty(PushButton.Property.UNSELECTED_ICON, new Tizen.NUI.PropertyValue(value));
110 [Obsolete("Please do not use! this will be deprecated")]
111 public string SelectedIcon
115 SetProperty(PushButton.Property.SELECTED_ICON, new Tizen.NUI.PropertyValue(value));
118 [Obsolete("Please do not use! this will be deprecated")]
119 public IconAlignmentType IconAlignment
124 if (GetProperty(PushButton.Property.ICON_ALIGNMENT).Get(out temp) == false)
126 NUILog.Error("IconAlignment get error!");
131 return IconAlignmentType.Left;
133 return IconAlignmentType.Right;
135 return IconAlignmentType.Top;
137 return IconAlignmentType.Bottom;
139 return IconAlignmentType.Default;
144 string valueToString = "";
147 case IconAlignmentType.Left:
149 valueToString = "LEFT";
152 case IconAlignmentType.Right:
154 valueToString = "RIGHT";
157 case IconAlignmentType.Top:
159 valueToString = "TOP";
162 case IconAlignmentType.Bottom:
164 valueToString = "BOTTOM";
169 valueToString = "DEFAULT";
173 SetProperty(PushButton.Property.ICON_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString));
176 [Obsolete("Please do not use! this will be deprecated")]
177 public new Vector4 LabelPadding
181 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
182 GetProperty(PushButton.Property.LABEL_PADDING).Get(temp);
187 SetProperty(PushButton.Property.LABEL_PADDING, new Tizen.NUI.PropertyValue(value));
191 [Obsolete("Please do not use! this will be deprecated")]
192 public Vector4 IconPadding
196 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
197 GetProperty(PushButton.Property.ICON_PADDING).Get(temp);
202 SetProperty(PushButton.Property.ICON_PADDING, new Tizen.NUI.PropertyValue(value));
206 [Obsolete("Please do not use! this will be deprecated")]
207 public enum IconAlignmentType
210 /// The icon located to the left of text.
214 /// The icon located to the right of text.
218 /// The icon located to the top of text.
222 /// The icon located to the bottom of text.
226 /// The icon located to the right of text by default.