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)
66 NDalicPINVOKE.delete_PushButton(swigCPtr);
68 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
75 internal 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 public PushButton() : this(NDalicPINVOKE.PushButton_New(), true)
89 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
93 [Obsolete("Please do not use! this will be deprecated")]
94 public new static PushButton DownCast(BaseHandle handle)
96 PushButton ret = new PushButton(NDalicPINVOKE.PushButton_DownCast(BaseHandle.getCPtr(handle)), true);
97 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
101 [Obsolete("Please do not use! this will be deprecated")]
102 public string UnselectedIcon
106 SetProperty(PushButton.Property.UNSELECTED_ICON, new Tizen.NUI.PropertyValue(value));
109 [Obsolete("Please do not use! this will be deprecated")]
110 public string SelectedIcon
114 SetProperty(PushButton.Property.SELECTED_ICON, new Tizen.NUI.PropertyValue(value));
117 [Obsolete("Please do not use! this will be deprecated")]
118 public IconAlignmentType IconAlignment
123 if (GetProperty(PushButton.Property.ICON_ALIGNMENT).Get(out temp) == false)
125 NUILog.Error("IconAlignment get error!");
130 return IconAlignmentType.Left;
132 return IconAlignmentType.Right;
134 return IconAlignmentType.Top;
136 return IconAlignmentType.Bottom;
138 return IconAlignmentType.Default;
143 string valueToString = "";
146 case IconAlignmentType.Left:
148 valueToString = "LEFT";
151 case IconAlignmentType.Right:
153 valueToString = "RIGHT";
156 case IconAlignmentType.Top:
158 valueToString = "TOP";
161 case IconAlignmentType.Bottom:
163 valueToString = "BOTTOM";
168 valueToString = "DEFAULT";
172 SetProperty(PushButton.Property.ICON_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString));
175 [Obsolete("Please do not use! this will be deprecated")]
176 public Vector4 LabelPadding
180 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
181 GetProperty(PushButton.Property.LABEL_PADDING).Get(temp);
186 SetProperty(PushButton.Property.LABEL_PADDING, new Tizen.NUI.PropertyValue(value));
190 [Obsolete("Please do not use! this will be deprecated")]
191 public Vector4 IconPadding
195 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
196 GetProperty(PushButton.Property.ICON_PADDING).Get(temp);
201 SetProperty(PushButton.Property.ICON_PADDING, new Tizen.NUI.PropertyValue(value));
205 [Obsolete("Please do not use! this will be deprecated")]
206 public enum IconAlignmentType
209 /// Icon located to the left of text.
213 /// Icon located to the right of text.
217 /// Icon located to the top of text.
221 /// Icon located to the bottom of text.
225 /// Icon located to the right of text by default.