1 #ifndef DALI_TOOLKIT_INTERNAL_BUILDER_STYLE_H
2 #define DALI_TOOLKIT_INTERNAL_BUILDER_STYLE_H
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
20 #include <dali-toolkit/devel-api/visual-factory/transition-data.h>
21 #include <dali-toolkit/internal/builder/dictionary.h>
22 #include <dali/public-api/object/ref-object.h>
31 typedef IntrusivePtr<Style> StylePtr;
34 * This class encapsulates the style information for a given styled
35 * control. It is generated only when a control instance looks up
36 * it's style information for the first time, and then stored by
39 * It contains the visual, property and transition definitions for the
40 * main control and for each state and sub-state within the control.
42 * It has methods to enable the base control to apply visuals and
43 * properties per state.
45 class Style : public RefObject
48 static StylePtr New();
52 * Apply the visuals and properties for the current state/substate
53 * of the handle to the control pointed at by handle. Recurses
56 * @param[in] handle The handle to apply the visuals to
57 * @param[in] instancedProperties The maps from which to get instanced properties
59 void ApplyVisualsAndPropertiesRecursively(Handle handle,
60 const Dictionary<Property::Map>& instancedProperties) const;
63 * Apply the visuals of the style to the control pointed at by
66 * @param[in] handle The handle to apply the visuals to
67 * @param[in] instancedProperties The maps from which to get instanced properties
69 void ApplyVisuals(Handle handle,
70 const Dictionary<Property::Map>& instancedProperties) const;
73 * Apply the properties from the visualMaps and the instancedProperties
74 * to the control pointed at by handle.
76 * @param[in] handle The handle to apply the properties to
77 * @param[in] visualMaps The visual maps from which to get the styled properties
78 * @param[in] instancedProperties The maps from which to get instanced properties
80 static void ApplyVisuals(Handle handle,
81 const Dictionary<Property::Map>& visualMaps,
82 const Dictionary<Property::Map>& instancedProperties);
85 * Apply the properties from the visualMap and optional instancedProperties
86 * to the control pointed at by handle.
88 static void ApplyVisual(Handle handle,
89 const std::string& visualName,
90 const Property::Map& visualMap,
91 const Property::Map* instancedProperties);
94 * Apply the properties of the style to the control pointed at by
97 * @param[in] handle The handle to apply the properties to
99 void ApplyProperties(Handle handle) const;
103 * @brief Default constructor.
108 * @brief virtual destructor.
114 DALI_INTERNAL Style(const Style& rhs);
117 DALI_INTERNAL Style& operator=(const Style& rhs);
120 // Everything must be shallow-copiable.
121 Dictionary<StylePtr> subStates; // Each named style maps to a state.
122 Dictionary<Property::Map> visuals;
123 Property::Map properties;
124 Property::Array transitions;
125 Toolkit::TransitionData entryTransition;
126 Toolkit::TransitionData exitTransition;
129 } // namespace Internal
130 } // namespace Toolkit
133 #endif //DALI_TOOLKIT_INTERNAL_BUILDER_STYLE_H