Release 8.0.0.15408
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Components / Controls / Extension / ButtonExtension.cs
1 /*
2  * Copyright(c) 2020 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 using System.ComponentModel;
18 using Tizen.NUI.BaseComponents;
19
20 namespace Tizen.NUI.Components.Extension
21 {
22     /// <summary>
23     /// The ButtonExtension class allows developers to access the Button's components and extend their behavior in various states.
24     /// </summary>
25     [EditorBrowsable(EditorBrowsableState.Never)]
26     public abstract class ButtonExtension
27     {
28         /// <summary>
29         /// The Touch info to get current touch position.
30         /// </summary>
31         [EditorBrowsable(EditorBrowsableState.Never)]
32         protected Touch TouchInfo { get; private set; }
33
34         /// <summary>
35         /// Called immediately after the Button creates the text part.
36         /// </summary>
37         /// <param name="button">The Button instance that the extension currently applied to.</param>
38         /// <param name="text">The created Button's text part.</param>
39         /// <return>The refined button text.</return>
40         [EditorBrowsable(EditorBrowsableState.Never)]
41         public virtual TextLabel OnCreateText(Button button, TextLabel text)
42         {
43             return text;
44         }
45
46         /// <summary>
47         /// Called immediately after the Button creates the icon part.
48         /// </summary>
49         /// <param name="button">The Button instance that the extension currently applied to.</param>
50         /// <param name="icon">The created Button's icon part.</param>
51         /// <return>The refined button icon.</return>
52         [EditorBrowsable(EditorBrowsableState.Never)]
53         public virtual ImageView OnCreateIcon(Button button, ImageView icon)
54         {
55             return icon;
56         }
57
58         /// <summary>
59         /// Called immediately after the Button creates the overlay image part.
60         /// </summary>
61         /// <param name="button">The Button instance that the extension currently applied to.</param>
62         /// <param name="overlayImage">The created Button's overlayImage part.</param>
63         /// <return>The refined button overlayImage.</return>
64         [EditorBrowsable(EditorBrowsableState.Never)]
65         public virtual ImageView OnCreateOverlayImage(Button button, ImageView overlayImage)
66         {
67             return overlayImage;
68         }
69
70         /// <summary>
71         /// Describes actions on Button's ControlStates changed.
72         /// </summary>
73         /// <param name="button">The Button instance that the extension currently applied to.</param>
74         /// <param name="args">The control state changed information.</param>
75         [EditorBrowsable(EditorBrowsableState.Never)]
76         public virtual void OnControlStateChanged(Button button, View.ControlStateChangedEventArgs args)
77         {
78         }
79
80         /// <summary>
81         /// Called when the Button is Clicked by a user
82         /// </summary>
83         /// <param name="button">The Button instance that the extension currently applied to.</param>
84         /// <param name="eventArgs">The click event information.</param>
85         [EditorBrowsable(EditorBrowsableState.Never)]
86         public virtual void OnClick(Button button, Button.ClickEventArgs eventArgs)
87         {
88         }
89
90         /// <summary>
91         /// Called after the size negotiation has been finished for the attached Control.
92         /// </summary>
93         /// <param name="button">The Button instance that the extension currently applied to.</param>
94         [EditorBrowsable(EditorBrowsableState.Never)]
95         public virtual void OnRelayout(Button button)
96         {
97         }
98
99         /// <summary>
100         /// Called when the attached Button is explicitly disposing.
101         /// </summary>
102         /// <param name="button">The Button instance that the extension currently applied to.</param>
103         [EditorBrowsable(EditorBrowsableState.Never)]
104         public virtual void OnDispose(Button button)
105         {
106         }
107
108         /// <summary>
109         /// Set the Touch Info.
110         /// </summary>
111         /// <param name="touch">The Touch Info.</param>
112         [EditorBrowsable(EditorBrowsableState.Never)]
113         public void SetTouchInfo(Touch touch) => TouchInfo = touch;
114     }
115 }