[NUI] TCSACR-226 code change (#1032)
[platform/core/csapi/tizenfx.git] / src / ElmSharp.Wearable / ElmSharp.Wearable / MoreOptionItem.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 using System.Collections.Generic;
19 using System.Text;
20
21 namespace ElmSharp.Wearable
22 {
23     /// <summary>
24     /// The MoreOptionItem is an item of the MoreOption widget.
25     /// </summary>
26     /// <since_tizen> preview </since_tizen>
27     public class MoreOptionItem
28     {
29         const string MainTextPartName = "selector,main_text";
30         const string SubTextPartName = "selector,sub_text";
31         const string IconPartName = "item,icon";
32
33         string _mainText;
34         string _subText;
35         Image _icon;
36         IntPtr _handle;
37
38         /// <summary>
39         /// Sets or gets the more option item handle.
40         /// </summary>
41         /// <since_tizen> preview </since_tizen>
42         public IntPtr Handle
43         {
44             get
45             {
46                 return _handle;
47             }
48             set
49             {
50                 if (_handle == value) return;
51                 _handle = value;
52                 if (_mainText != null)
53                     Interop.Eext.eext_more_option_item_part_text_set(Handle, MainTextPartName, _mainText);
54                 if (_subText != null)
55                     Interop.Eext.eext_more_option_item_part_text_set(Handle, SubTextPartName, _subText);
56                 if (_icon != null)
57                     Interop.Eext.eext_more_option_item_part_content_set(Handle, IconPartName, _icon);
58             }
59         }
60
61         /// <summary>
62         /// Creates and initializes a new instance of the MoreOptionItem class.
63         /// </summary>
64         /// <since_tizen> preview </since_tizen>
65         public MoreOptionItem()
66         {
67             _icon = null;
68         }
69
70         /// <summary>
71         /// Sets or gets the main text of the more option object.
72         /// </summary>
73         /// <since_tizen> preview </since_tizen>
74         public string MainText
75         {
76             set
77             {
78                 if (_mainText == value) return;
79                 _mainText = value;
80                 if (Handle != IntPtr.Zero)
81                 {
82                     Interop.Eext.eext_more_option_item_part_text_set(Handle, MainTextPartName, _mainText);
83                 }
84             }
85
86             get
87             {
88                 return _mainText;
89             }
90         }
91
92         /// <summary>
93         /// Sets or gets the subtext of the more option object.
94         /// </summary>
95         /// <since_tizen> preview </since_tizen>
96         public string SubText
97         {
98             set
99             {
100                 if (_subText == value) return;
101                 _subText = value;
102                 if (Handle != IntPtr.Zero)
103                 {
104                     Interop.Eext.eext_more_option_item_part_text_set(Handle, SubTextPartName, _subText);
105                 }
106             }
107
108             get
109             {
110                 return _subText;
111             }
112         }
113
114         /// <summary>
115         /// Sets or gets the icon image.
116         /// </summary>
117         /// <since_tizen> preview </since_tizen>
118         public Image Icon
119         {
120             set
121             {
122                 if (_icon == value) return;
123                 _icon = value;
124                 if (Handle != IntPtr.Zero)
125                 {
126                     Interop.Eext.eext_more_option_item_part_content_set(Handle, IconPartName, _icon);
127                 }
128             }
129             get
130             {
131                 return _icon;
132             }
133         }
134     }
135 }