2 * Copyright(c) 2020 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.
18 namespace Tizen.NUI.BaseComponents
21 /// The class storing extra data for a View to optimize size of it.
23 internal class ViewSelectorData
25 public TriggerableSelector<Color> BackgroundColor { get; } = new TriggerableSelector<Color>(View.BackgroundColorProperty, delegate (View view)
27 var background = view.Background;
29 background.Find(Visual.Property.Type)?.Get(out visualType);
31 if (visualType == (int)Visual.Type.Color)
33 Color backgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.0f);
34 background.Find(ColorVisualProperty.MixColor)?.Get(backgroundColor);
35 return backgroundColor;
39 public TriggerableSelector<string> BackgroundImage { get; } = new TriggerableSelector<string>(View.BackgroundImageProperty, delegate (View view)
41 string backgroundImage = null;
42 view.Background.Find(ImageVisualProperty.URL)?.Get(out backgroundImage);
43 return backgroundImage;
45 public TriggerableSelector<Rectangle> BackgroundImageBorder { get; } = new TriggerableSelector<Rectangle>(View.BackgroundImageBorderProperty);
46 public TriggerableSelector<Color> Color { get; } = new TriggerableSelector<Color>(View.ColorProperty, delegate (View view)
48 Color color = new Color();
49 if (view.GetProperty(Interop.ActorProperty.ColorGet()).Get(color))
55 public TriggerableSelector<float?> Opacity { get; } = new TriggerableSelector<float?>(View.OpacityProperty);
56 public TriggerableSelector<ImageShadow> ImageShadow { get; } = new TriggerableSelector<ImageShadow>(View.ImageShadowProperty);
57 public TriggerableSelector<Shadow> BoxShadow { get; } = new TriggerableSelector<Shadow>(View.BoxShadowProperty);
59 public void Reset(View view)
61 BackgroundColor.Reset(view);
62 BackgroundImage.Reset(view);
63 BackgroundImageBorder.Reset(view);
66 ImageShadow.Reset(view);
67 BoxShadow.Reset(view);