96cc498c8f5726c23727780c0000543497fd5617
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Components / Style / InputFieldStyle.cs
1 /*
2  * Copyright(c) 2019 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 using Tizen.NUI.Binding;
20
21 namespace Tizen.NUI.Components
22 {
23     /// <summary>
24     /// InputFieldAttributes is a class which saves InputField's ux data.
25     /// </summary>
26     /// <since_tizen> 6 </since_tizen>
27     /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
28     [EditorBrowsable(EditorBrowsableState.Never)]
29     public class InputFieldStyle : ControlStyle
30     {
31         /// <summary>
32         /// Creates a new instance of a InputFieldAttributes.
33         /// </summary>
34         /// <since_tizen> 6 </since_tizen>
35         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
36         [EditorBrowsable(EditorBrowsableState.Never)]
37         public InputFieldStyle() : base()
38         {
39             BackgroundImageAttributes = new ImageViewStyle();
40             InputBoxAttributes = new TextFieldStyle();
41         }
42
43         /// <summary>
44         /// Creates a new instance of a InputFieldStyle with Style.
45         /// </summary>
46         /// <param name="attrs">Create InputFieldStyle by Style customized by user.</param>
47         /// <since_tizen> 6 </since_tizen>
48         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
49         [EditorBrowsable(EditorBrowsableState.Never)]
50         public InputFieldStyle(InputFieldStyle attrs) : base(attrs)
51         {
52             if (null == attrs)
53             {
54                 return;
55             }
56
57             BackgroundImageAttributes = new ImageViewStyle();
58             InputBoxAttributes = new TextFieldStyle();
59
60             if (null != attrs.BackgroundImageAttributes)
61             {
62                 BackgroundImageAttributes.CopyFrom(attrs.BackgroundImageAttributes);
63             }
64             if (null != attrs.InputBoxAttributes)
65             {
66                 InputBoxAttributes.CopyFrom(attrs.InputBoxAttributes);
67             }
68             if (null != attrs.Space)
69             {
70                 Space = attrs.Space;
71             }
72         }
73
74         /// <summary>
75         /// Gets or sets background image attributes of input field.
76         /// </summary>
77         /// <since_tizen> 6 </since_tizen>
78         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
79         [EditorBrowsable(EditorBrowsableState.Never)]
80         public ImageViewStyle BackgroundImageAttributes { get; set; }
81
82         /// <summary>
83         /// Gets or sets input box attributes of input field.
84         /// </summary>
85         /// <since_tizen> 6 </since_tizen>
86         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
87         [EditorBrowsable(EditorBrowsableState.Never)]
88         public TextFieldStyle InputBoxAttributes { get; set; }
89
90         /// <summary>
91         /// Gets or sets space.
92         /// </summary>
93         /// <since_tizen> 6 </since_tizen>
94         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
95         [EditorBrowsable(EditorBrowsableState.Never)]
96         public int? Space { get; set; } 
97
98         /// <summary>
99         /// Attributes's clone function.
100         /// </summary>
101         /// <since_tizen> 6 </since_tizen>
102         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
103         [EditorBrowsable(EditorBrowsableState.Never)]
104         public override void CopyFrom(BindableObject bindableObject)
105         {
106             InputFieldStyle inputFieldAttributes = bindableObject as InputFieldStyle;
107
108             if (null != inputFieldAttributes)
109             {
110                 Space = inputFieldAttributes.Space;
111
112                 if (null != inputFieldAttributes.BackgroundImageAttributes)
113                 {
114                     BackgroundImageAttributes.CopyFrom(inputFieldAttributes.BackgroundImageAttributes);
115                 }
116
117                 if (null != inputFieldAttributes.InputBoxAttributes)
118                 {
119                     InputBoxAttributes.CopyFrom(inputFieldAttributes.InputBoxAttributes);
120                 }
121             }
122         }
123     }
124 }