2 * Copyright(c) 2019 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 using System.Collections.Generic;
18 using System.ComponentModel;
19 using Tizen.NUI.BaseComponents;
20 using Tizen.NUI.Binding;
22 namespace Tizen.NUI.Components
25 /// ImageControlStyle is a class which saves Button's ux data.
27 /// <since_tizen> 6 </since_tizen>
28 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
29 [EditorBrowsable(EditorBrowsableState.Never)]
30 public class ImageControlStyle : ControlStyle
32 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
33 [EditorBrowsable(EditorBrowsableState.Never)]
34 public static readonly BindableProperty ResourceUrlProperty = BindableProperty.Create("ImageControlResourceUrl", typeof(Selector<string>), typeof(ImageControlStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
36 var imageControlStyle = (ImageControlStyle)bindable;
37 if (null == imageControlStyle.resourceUrlSelector) imageControlStyle.resourceUrlSelector = new Selector<string>();
38 imageControlStyle.resourceUrlSelector.Clone((Selector<string>)newValue);
40 defaultValueCreator: (bindable) =>
42 var imageControlStyle = (ImageControlStyle)bindable;
43 return imageControlStyle.resourceUrlSelector;
45 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
46 [EditorBrowsable(EditorBrowsableState.Never)]
47 public static readonly BindableProperty BorderProperty = BindableProperty.Create("ImageControlBorder", typeof(Selector<Rectangle>), typeof(ImageControlStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
49 var imageControlStyle = (ImageControlStyle)bindable;
50 if (null == imageControlStyle.borderSelector) imageControlStyle.borderSelector = new Selector<Rectangle>();
51 imageControlStyle.borderSelector.Clone((Selector<Rectangle>)newValue);
53 defaultValueCreator: (bindable) =>
55 var imageControlStyle = (ImageControlStyle)bindable;
56 return imageControlStyle.borderSelector;
59 private Selector<string> resourceUrlSelector;
60 private Selector<Rectangle> borderSelector;
62 static ImageControlStyle() { }
65 /// Creates a new instance of a ImageControlStyle.
67 /// <since_tizen> 6 </since_tizen>
68 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
69 [EditorBrowsable(EditorBrowsableState.Never)]
70 public ImageControlStyle() : base()
75 /// Creates a new instance of a ImageControlStyle with style.
77 /// <param name="style">Create ImageControlStyle by style customized by user.</param>
78 /// <since_tizen> 6 </since_tizen>
79 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
80 [EditorBrowsable(EditorBrowsableState.Never)]
81 public ImageControlStyle(ImageControlStyle style) : base(style)
83 if(null == style) return;
91 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
92 [EditorBrowsable(EditorBrowsableState.Never)]
93 public Selector<string> ResourceUrl
97 Selector<string> url = (Selector<string>)GetValue(ResourceUrlProperty);
98 return (null != url) ? url : resourceUrlSelector = new Selector<string>();
100 set => SetValue(ResourceUrlProperty, value);
106 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
107 [EditorBrowsable(EditorBrowsableState.Never)]
108 public Selector<Rectangle> Border
112 Selector<Rectangle> border = (Selector<Rectangle>)GetValue(BorderProperty);
113 return (null != border) ? border : borderSelector = new Selector<Rectangle>();
115 set => SetValue(BorderProperty, value);
118 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
119 [EditorBrowsable(EditorBrowsableState.Never)]
120 public override void CopyFrom(BindableObject bindableObject)
122 base.CopyFrom(bindableObject);
124 ImageControlStyle imageControlStyle = bindableObject as ImageControlStyle;
126 if (null != imageControlStyle)
128 if (null != imageControlStyle.ResourceUrl)
130 if (null == ResourceUrl) ResourceUrl = new Selector<string>();
131 ResourceUrl.Clone(imageControlStyle.ResourceUrl);
133 if (null != imageControlStyle.Border)
135 if (null == Border) Border = new Selector<Rectangle>();
136 Border.Clone(imageControlStyle.Border);