1 #ifndef DALI_TOOLKIT_INTERNAL_BUILDER_STYLE_H
2 #define DALI_TOOLKIT_INTERNAL_BUILDER_STYLE_H
5 * Copyright (c) 2017 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/public-api/object/ref-object.h>
21 #include <dali-toolkit/devel-api/visual-factory/transition-data.h>
22 #include <dali-toolkit/internal/builder/dictionary.h>
32 typedef IntrusivePtr<Style> StylePtr;
35 * This class encapsulates the style information for a given styled
36 * control. It is generated only when a control instance looks up
37 * it's style information for the first time, and then stored by
40 * It contains the visual, property and transition definitions for the
41 * main control and for each state and sub-state within the control.
43 * It has methods to enable the base control to apply visuals and
44 * properties per state.
46 class Style : public RefObject
49 static StylePtr New();
53 * Apply the visuals and properties for the current state/substate
54 * of the handle to the control pointed at by handle. Recurses
57 * @param[in] handle The handle to apply the visuals to
58 * @param[in] instancedProperties The maps from which to get instanced properties
60 void ApplyVisualsAndPropertiesRecursively( Handle handle,
61 const Dictionary<Property::Map>& instancedProperties ) const;
64 * Apply the visuals of the style to the control pointed at by
67 * @param[in] handle The handle to apply the visuals to
68 * @param[in] instancedProperties The maps from which to get instanced properties
70 void ApplyVisuals( Handle handle,
71 const Dictionary<Property::Map>& instancedProperties ) const;
74 * Apply the properties from the visualMaps and the instancedProperties
75 * to the control pointed at by handle.
77 * @param[in] handle The handle to apply the properties to
78 * @param[in] visualMaps The visual maps from which to get the styled properties
79 * @param[in] instancedProperties The maps from which to get instanced properties
81 static void ApplyVisuals( Handle handle,
82 const Dictionary<Property::Map>& visualMaps,
83 const Dictionary<Property::Map>& instancedProperties );
86 * Apply the properties from the visualMap and optional instancedProperties
87 * to the control pointed at by handle.
89 static void ApplyVisual( Handle handle,
90 const std::string& visualName,
91 const Property::Map& visualMap,
92 const Property::Map* instancedProperties );
95 * Apply the properties of the style to the control pointed at by
98 * @param[in] handle The handle to apply the properties to
100 void ApplyProperties( Handle handle ) const;
104 * @brief Default constructor.
109 * @brief virtual destructor.
115 DALI_INTERNAL Style( const Style& rhs );
118 DALI_INTERNAL Style& operator=(const Style& rhs);
121 // Everything must be shallow-copiable.
122 Dictionary<StylePtr> subStates; // Each named style maps to a state.
123 Dictionary<Property::Map> visuals;
124 Property::Map properties;
125 Property::Array transitions;
126 Toolkit::TransitionData entryTransition;
127 Toolkit::TransitionData exitTransition;
135 #endif //DALI_TOOLKIT_INTERNAL_BUILDER_STYLE_H