[NUI] Add TabView and related classes
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Components / Controls / TabButton.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
21 {
22     /// <summary>
23     /// TabButton is a class which is used for selecting one content in a TabView.
24     /// </summary>
25     [EditorBrowsable(EditorBrowsableState.Never)]
26     public class TabButton : SelectButton
27     {
28         /// <summary>
29         /// Creates a new instance of TabButton.
30         /// </summary>
31         [EditorBrowsable(EditorBrowsableState.Never)]
32         public TabButton()
33         {
34             GridLayout.SetHorizontalStretch(this, GridLayout.StretchFlags.ExpandAndFill);
35         }
36
37         /// <summary>
38         /// Sets the control state of a TabButton.
39         /// TabButton needs to support this API since 'View.ControlState' is protected
40         /// and cannot be reached by TabButtonGroup.
41         /// </summary>
42         [EditorBrowsable(EditorBrowsableState.Never)]
43         internal void SetTabButtonState(ControlState controlState)
44         {
45             base.ControlState = controlState;
46         }
47
48         /// <summary>
49         /// Sets Button.IsSelected to true after selecting TabButton since it is
50         /// set to false when re-selected according to Button's logic.
51         /// </summary>
52         [EditorBrowsable(EditorBrowsableState.Never)]
53         protected override void OnSelectedChanged()
54         {
55             ControlState = ControlState.Pressed;
56             if (!IsSelected)
57             {
58                 IsSelected = true;
59             }
60         }
61     }
62 }