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 SwitchExtension class allows developers to access the Switch's components and extend their behavior in various states.
25 [EditorBrowsable(EditorBrowsableState.Never)]
26 public abstract class SwitchExtension : ButtonExtension
28 internal SwitchExtension() : base()
33 /// Called immediately after the Switch creates the track part.
35 /// <param name="switchButton">The Switch instance that the extension currently applied to.</param>
36 /// <param name="track">The created Switch's track part.</param>
37 /// <return>The refined switch track.</return>
38 [EditorBrowsable(EditorBrowsableState.Never)]
39 public virtual ImageView OnCreateTrack(Switch switchButton, ImageView track)
45 /// Called immediately after the Switch creates the thumb part.
47 /// <param name="switchButton">The Switch instance that the extension currently applied to.</param>
48 /// <param name="thumb">The created Switch's thumb part.</param>
49 /// <return>The refined switch thumb.</return>
50 [EditorBrowsable(EditorBrowsableState.Never)]
51 public virtual ImageView OnCreateThumb(Switch switchButton, ImageView thumb)
53 if (switchButton.IsSelected)
55 OnSelectedChanged(switchButton);
61 /// Called when the Switch's selection has changed.
63 /// <param name="switchButton">The Switch instance that the extension currently applied to.</param>
64 [EditorBrowsable(EditorBrowsableState.Never)]
65 public virtual void OnSelectedChanged(Switch switchButton)
69 /// <summary> Called when the Switch's track or thumb resized. </summary>
70 [EditorBrowsable(EditorBrowsableState.Never)]
71 public virtual void OnTrackOrThumbResized(Switch switchButton, ImageView track, ImageView thumb)