Add comments for ElmSharp APIs.
[platform/core/csapi/tizenfx.git] / src / ElmSharp / ElmSharp / ToolbarItem.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
19 namespace ElmSharp
20 {
21     /// <summary>
22     /// The ToolbarItem is a item of Toolbar.
23     /// </summary>
24     public class ToolbarItem : ItemObject
25     {
26         string _icon;
27         string _text;
28         internal ToolbarItem(string text, string icon) : base(IntPtr.Zero)
29         {
30             _text = text;
31             _icon = icon;
32         }
33
34         /// <summary>
35         /// Sets or gets the icon path of the item.
36         /// </summary>
37         public string Icon
38         {
39             get
40             {
41                 return _icon;
42             }
43             set
44             {
45                 _icon = value;
46                 Interop.Elementary.elm_toolbar_item_icon_set(Handle, value);
47             }
48         }
49
50         /// <summary>
51         /// Sets or gets the text string of the item.
52         /// </summary>
53         public string Text
54         {
55             get
56             {
57                 return _text;
58             }
59             set
60             {
61                 _text = value;
62                 SetPartText(null, value);
63             }
64         }
65
66         /// <summary>
67         /// Sets or gets the enable of the item.
68         /// </summary>
69         public bool Enabled
70         {
71             get
72             {
73                 return !Interop.Elementary.elm_object_disabled_get(Handle);
74             }
75             set
76             {
77                 Interop.Elementary.elm_object_disabled_set(Handle, !value);
78             }
79         }
80
81         /// <summary>
82         /// Sets or gets whether displaying the item as a separator.
83         /// </summary>
84         /// <remarks>Items aren't set as a separator by default. If set as a separator it displays a separator theme, so it won't display icons or labels.</remarks>
85         public bool IsSeparator
86         {
87             get
88             {
89                 return Interop.Elementary.elm_toolbar_item_separator_get(Handle);
90             }
91             set
92             {
93                 Interop.Elementary.elm_toolbar_item_separator_set(Handle, value);
94             }
95         }
96
97         /// <summary>
98         /// Sets or gets whether the item is selected.
99         /// </summary>
100         public bool IsSelected
101         {
102             get
103             {
104                 return Interop.Elementary.elm_toolbar_item_selected_get(Handle);
105             }
106             set
107             {
108                 Interop.Elementary.elm_toolbar_item_selected_set(Handle, value);
109             }
110         }
111
112         /// <summary>
113         /// Selected will be triggered when the item is selected.
114         /// </summary>
115         public event EventHandler Selected;
116
117         /// <summary>
118         /// LongPressed will be triggered when the item is pressed long time.
119         /// </summary>
120         public event EventHandler LongPressed;
121
122         /// <summary>
123         /// Clicked will be triggered when the item is clicked.
124         /// </summary>
125         public event EventHandler Clicked;
126
127         internal void SendSelected()
128         {
129             Selected?.Invoke(this, EventArgs.Empty);
130         }
131         internal void SendLongPressed()
132         {
133             LongPressed?.Invoke(this, EventArgs.Empty);
134         }
135         internal void SendClicked()
136         {
137             Clicked?.Invoke(this, EventArgs.Empty);
138         }
139     }
140 }