sync ElmSharp source code latest
[platform/core/csapi/tizenfx.git] / src / ElmSharp.Wearable / ElmSharp.Wearable / MoreOptionItem.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4
5 namespace ElmSharp.Wearable
6 {
7     /// <summary>
8     /// The MoreOptionItem is a item of MoreOption widget.
9     /// </summary>
10     public class MoreOptionItem
11     {
12         const string MainTextPartName = "selector,main_text";
13         const string SubTextPartName = "selector,sub_text";
14         const string IconPartName = "item,icon";
15
16         string _mainText;
17         string _subText;
18         Image _icon;
19         IntPtr _handle;
20
21         /// <summary>
22         /// Sets or gets the more option item handle.
23         /// </summary>
24         public IntPtr Handle
25         {
26             get
27             {
28                 return _handle;
29             }
30             set
31             {
32                 if (_handle == value) return;
33                 _handle = value;
34                 if (_mainText != null)
35                     Interop.Eext.eext_more_option_item_part_text_set(Handle, MainTextPartName, _mainText);
36                 if (_subText != null)
37                     Interop.Eext.eext_more_option_item_part_text_set(Handle, SubTextPartName, _subText);
38                 if (_icon != null)
39                     Interop.Eext.eext_more_option_item_part_content_set(Handle, IconPartName, _icon);
40             }
41         }
42
43         /// <summary>
44         /// Set the icon to null
45         /// </summary>
46         public MoreOptionItem()
47         {
48             _icon = null;
49         }
50
51         /// <summary>
52         /// Sets or gets the main text of a more option object.
53         /// </summary>
54         public string MainText
55         {
56             set
57             {
58                 if (_mainText == value) return;
59                 _mainText = value;
60                 if (Handle != IntPtr.Zero)
61                 {
62                     Interop.Eext.eext_more_option_item_part_text_set(Handle, MainTextPartName, _mainText);
63                 }
64             }
65
66             get
67             {
68                 return _mainText;
69             }
70         }
71
72         /// <summary>
73         /// Sets or gets the sub text of a more option object.
74         /// </summary>
75         public string SubText
76         {
77             set
78             {
79                 if (_subText == value) return;
80                 _subText = value;
81                 if (Handle != IntPtr.Zero)
82                 {
83                     Interop.Eext.eext_more_option_item_part_text_set(Handle, SubTextPartName, _subText);
84                 }
85             }
86
87             get
88             {
89                 return _subText;
90             }
91         }
92
93         /// <summary>
94         /// Sets or gets the icon image
95         /// </summary>
96         public Image Icon
97         {
98             set
99             {
100                 if (_icon == value) return;
101                 _icon = value;
102                 if (Handle != IntPtr.Zero)
103                 {
104                     Interop.Eext.eext_more_option_item_part_content_set(Handle, IconPartName, _icon);
105                 }
106             }
107             get
108             {
109                 return _icon;
110             }
111         }
112     }
113 }