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 /// A PushButton changes its appearance when is pressed and returns to its original when 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 make PushButton instance be disposed.
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)
67 //Unreference this instance from Registry.
68 Registry.Unregister(this);
70 NDalicPINVOKE.delete_PushButton(swigCPtr);
72 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
79 internal class Property
81 internal static readonly int UNSELECTED_ICON = NDalicPINVOKE.PushButton_Property_UNSELECTED_ICON_get();
82 internal static readonly int SELECTED_ICON = NDalicPINVOKE.PushButton_Property_SELECTED_ICON_get();
83 internal static readonly int ICON_ALIGNMENT = NDalicPINVOKE.PushButton_Property_ICON_ALIGNMENT_get();
84 internal static readonly int LABEL_PADDING = NDalicPINVOKE.PushButton_Property_LABEL_PADDING_get();
85 internal static readonly int ICON_PADDING = NDalicPINVOKE.PushButton_Property_ICON_PADDING_get();
89 /// Creates the PushButton.
91 public PushButton() : this(NDalicPINVOKE.PushButton_New(), true)
93 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
97 [Obsolete("Please do not use! this will be deprecated")]
98 public new static PushButton DownCast(BaseHandle handle)
100 PushButton ret = new PushButton(NDalicPINVOKE.PushButton_DownCast(BaseHandle.getCPtr(handle)), true);
101 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
105 [Obsolete("Please do not use! this will be deprecated")]
106 public string UnselectedIcon
110 SetProperty(PushButton.Property.UNSELECTED_ICON, new Tizen.NUI.PropertyValue(value));
113 [Obsolete("Please do not use! this will be deprecated")]
114 public string SelectedIcon
118 SetProperty(PushButton.Property.SELECTED_ICON, new Tizen.NUI.PropertyValue(value));
121 [Obsolete("Please do not use! this will be deprecated")]
122 public IconAlignmentType IconAlignment
127 if (GetProperty(PushButton.Property.ICON_ALIGNMENT).Get(out temp) == false)
129 NUILog.Error("IconAlignment get error!");
134 return IconAlignmentType.Left;
136 return IconAlignmentType.Right;
138 return IconAlignmentType.Top;
140 return IconAlignmentType.Bottom;
142 return IconAlignmentType.Default;
147 string valueToString = "";
150 case IconAlignmentType.Left:
152 valueToString = "LEFT";
155 case IconAlignmentType.Right:
157 valueToString = "RIGHT";
160 case IconAlignmentType.Top:
162 valueToString = "TOP";
165 case IconAlignmentType.Bottom:
167 valueToString = "BOTTOM";
172 valueToString = "DEFAULT";
176 SetProperty(PushButton.Property.ICON_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString));
179 [Obsolete("Please do not use! this will be deprecated")]
180 public Vector4 LabelPadding
184 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
185 GetProperty(PushButton.Property.LABEL_PADDING).Get(temp);
190 SetProperty(PushButton.Property.LABEL_PADDING, new Tizen.NUI.PropertyValue(value));
194 [Obsolete("Please do not use! this will be deprecated")]
195 public Vector4 IconPadding
199 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
200 GetProperty(PushButton.Property.ICON_PADDING).Get(temp);
205 SetProperty(PushButton.Property.ICON_PADDING, new Tizen.NUI.PropertyValue(value));
209 [Obsolete("Please do not use! this will be deprecated")]
210 public enum IconAlignmentType
213 /// Icon located to the left of text.
217 /// Icon located to the right of text.
221 /// Icon located to the top of text.
225 /// Icon located to the bottom of text.
229 /// Icon located to the right of text by default.