2 * Copyright(c) 2019 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.
19 using System.ComponentModel;
20 using Tizen.NUI.BaseComponents;
22 namespace Tizen.NUI.Components
25 /// Enumeration for describing the states of the view.
28 // Please remove this enum when 'Tizen.NUI.BaseComponents.Button.StateChangedEventArgs' and 'Tizen.NUI.BaseComponents.Slider.StateChangedArgs' are removed.
29 [Obsolete("This will be removed in API10. Please use Tizen.NUI.BaseComponents.ControlState instead!")]
30 [EditorBrowsable(EditorBrowsableState.Never)]
31 public enum ControlStates
36 [EditorBrowsable(EditorBrowsableState.Never)]
39 /// The focused state.
41 [EditorBrowsable(EditorBrowsableState.Never)]
44 /// The disabled state.
46 [EditorBrowsable(EditorBrowsableState.Never)]
49 /// The Selected state.
51 [EditorBrowsable(EditorBrowsableState.Never)]
54 /// The Pressed state.
56 [EditorBrowsable(EditorBrowsableState.Never)]
59 /// The DisabledFocused state.
61 [EditorBrowsable(EditorBrowsableState.Never)]
62 DisabledFocused = Disabled | Focused,
64 /// The SelectedFocused state.
66 [EditorBrowsable(EditorBrowsableState.Never)]
67 SelectedFocused = Focused | Selected,
69 /// The DisabledSelected state.
71 [EditorBrowsable(EditorBrowsableState.Never)]
72 DisabledSelected = Disabled | Selected,
75 //FIXME: Please remove this Extension class when ControlStates is removed.
76 [EditorBrowsable(EditorBrowsableState.Never)]
77 internal static class ControlStatesExtension
79 public static ControlStates FromControlStateClass(ControlState controlState)
81 if (controlState == ControlState.Normal)
82 return ControlStates.Normal;
83 if (controlState == ControlState.Focused)
84 return ControlStates.Focused;
85 if (controlState == ControlState.Disabled)
86 return ControlStates.Disabled;
87 if (controlState == ControlState.Selected)
88 return ControlStates.Selected;
89 if (controlState == ControlState.Pressed)
90 return ControlStates.Pressed;
91 if (controlState == ControlState.DisabledFocused)
92 return ControlStates.DisabledFocused;
93 if (controlState == ControlState.SelectedFocused)
94 return ControlStates.SelectedFocused;
95 if (controlState == ControlState.DisabledSelected)
96 return ControlStates.DisabledSelected;
98 return ControlStates.Normal;