2 * Copyright(c) 2020 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 using System.ComponentModel;
18 using Tizen.NUI.BaseComponents;
20 namespace Tizen.NUI.Components.Extension
23 /// The ButtonExtension class allows developers to access the Button's components and extend their behavior in various states.
25 [EditorBrowsable(EditorBrowsableState.Never)]
26 public abstract class ButtonExtension
29 /// The Touch info to get current touch position.
31 [EditorBrowsable(EditorBrowsableState.Never)]
32 protected Touch TouchInfo { get; private set; }
35 /// Called immediately after the Button creates the text part.
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)
47 /// Called immediately after the Button creates the icon part.
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)
59 /// Called immediately after the Button creates the overlay image part.
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)
71 /// Describes actions on Button's ControlStates changed.
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)
81 /// Called when the Button is Clicked by a user
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 OnClicked(Button button, ClickedEventArgs eventArgs)
91 /// Called after the size negotiation has been finished for the attached Control.
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)
100 /// Called when the attached Button is explicitly disposing.
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)
109 /// Set the Touch Info.
111 /// <param name="touch">The Touch Info.</param>
112 [EditorBrowsable(EditorBrowsableState.Never)]
113 public void SetTouchInfo(Touch touch) => TouchInfo = touch;