[NUI] Split NUI Assemblies (#865)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / UIComponents / PushButton.cs
1 /*
2  * Copyright(c) 2018 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 using System;
19 using System.ComponentModel;
20 using System.Windows.Input;
21 using System.Collections.Generic;
22 using Tizen.NUI.Binding;
23
24 namespace Tizen.NUI.UIComponents
25 {
26     /// <summary>
27     /// The PushButton changes its appearance when it is pressed, and returns to its original when it is released.
28     /// </summary>
29     /// <since_tizen> 3 </since_tizen>
30     public class PushButton : Button
31     {
32         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
33         [EditorBrowsable(EditorBrowsableState.Never)]
34         public static readonly BindableProperty CommandProperty = BindableProperty.Create("Command", typeof(ICommand), typeof(PushButton), null, null);
35         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
36         [EditorBrowsable(EditorBrowsableState.Never)]
37         public static readonly BindableProperty CommandParameterProperty = BindableProperty.Create("CommandParameter", typeof(object), typeof(PushButton), null, null);
38
39
40         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
41
42         /// <summary>
43         /// Creates the PushButton.
44         /// </summary>
45         /// <since_tizen> 3 </since_tizen>
46         public PushButton() : this(Interop.PushButton.PushButton_New(), true)
47         {
48             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
49         }
50
51         internal PushButton(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.PushButton.PushButton_SWIGUpcast(cPtr), cMemoryOwn)
52         {
53             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
54         }
55
56         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
57         [EditorBrowsable(EditorBrowsableState.Never)]
58         public ICommand Command
59         {
60             get
61             {
62                 return (ICommand)base.GetValue(PushButton.CommandProperty);
63             }
64             set
65             {
66                 base.SetValue(PushButton.CommandProperty, value);
67             }
68         }
69
70         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
71         [EditorBrowsable(EditorBrowsableState.Never)]
72         public object CommandParameter
73         {
74             get
75             {
76                 return base.GetValue(PushButton.CommandParameterProperty);
77             }
78             set
79             {
80                 base.SetValue(PushButton.CommandParameterProperty, value);
81             }
82         }
83
84         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PushButton obj)
85         {
86             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
87         }
88
89         /// <summary>
90         /// To dispose the PushButton instance.
91         /// </summary>
92         /// <since_tizen> 3 </since_tizen>
93         protected override void Dispose(DisposeTypes type)
94         {
95             if (disposed)
96             {
97                 return;
98             }
99
100             if (type == DisposeTypes.Explicit)
101             {
102                 //Called by User
103                 //Release your own managed resources here.
104                 //You should release all of your own disposable objects here.
105             }
106
107             //Release your own unmanaged resources here.
108             //You should not access any managed member here except static instance.
109             //because the execution order of Finalizes is non-deterministic.
110
111             if (swigCPtr.Handle != global::System.IntPtr.Zero)
112             {
113                 if (swigCMemOwn)
114                 {
115                     swigCMemOwn = false;
116                     Interop.PushButton.delete_PushButton(swigCPtr);
117                 }
118                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
119             }
120
121             base.Dispose(type);
122         }
123
124         internal new class Property
125         {
126             internal static readonly int UNSELECTED_ICON = Interop.PushButton.PushButton_Property_UNSELECTED_ICON_get();
127             internal static readonly int SELECTED_ICON = Interop.PushButton.PushButton_Property_SELECTED_ICON_get();
128             internal static readonly int ICON_ALIGNMENT = Interop.PushButton.PushButton_Property_ICON_ALIGNMENT_get();
129             internal static readonly int LABEL_PADDING = Interop.PushButton.PushButton_Property_LABEL_PADDING_get();
130             internal static readonly int ICON_PADDING = Interop.PushButton.PushButton_Property_ICON_PADDING_get();
131         }
132     }
133 }