[NUI] TCSACR-226 code change (#1032)
[platform/core/csapi/tizenfx.git] / src / ElmSharp / ElmSharp / IndexItem.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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;
18 namespace ElmSharp
19 {
20     /// <summary>
21     /// The IndexItem is used to manage the index item.
22     /// Inherits ItemObject.
23     /// </summary>
24     /// <since_tizen> preview </since_tizen>
25     public class IndexItem : ItemObject
26     {
27         /// <summary>
28         /// Creates and initializes a new instance of the IndexItem class.
29         /// </summary>
30         /// <param name="text">The text is set to the Text. It's the 'string' type.</param>
31         /// <since_tizen> preview </since_tizen>
32         public IndexItem(string text) : base(IntPtr.Zero)
33         {
34             Text = text;
35         }
36
37         /// <summary>
38         /// Creates and initializes a new instance of the IndexItem class with parent
39         /// </summary>
40         /// <param name="text">The text is set to the Text. It's the 'string' type.</param>
41         /// <param name="parent">Parent EvasObject</param>
42         /// <since_tizen> preview </since_tizen>
43         public IndexItem(string text, EvasObject parent) : base(IntPtr.Zero, parent)
44         {
45             Text = text;
46         }
47
48         /// <summary>
49         /// Selected will be triggered when the index item is selected.
50         /// </summary>
51         /// <since_tizen> preview </since_tizen>
52         public event EventHandler Selected;
53
54         /// <summary>
55         /// Gets the text.
56         /// </summary>
57         /// <since_tizen> preview </since_tizen>
58         public string Text { get; private set; }
59
60         /// <summary>
61         /// Sets the selected state of an item.
62         /// </summary>
63         /// <param name="selected">The selected state.</param>
64         /// <since_tizen> preview </since_tizen>
65         public void Select(bool selected)
66         {
67             Interop.Elementary.elm_index_item_selected_set(Handle, selected);
68         }
69         internal void SendSelected()
70         {
71             Selected?.Invoke(this, EventArgs.Empty);
72         }
73
74     }
75 }