Overriding virtual destructors are marked as 'override'.
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / builder / style.h
1 #ifndef DALI_TOOLKIT_INTERNAL_BUILDER_STYLE_H
2 #define DALI_TOOLKIT_INTERNAL_BUILDER_STYLE_H
3
4 /*
5  * Copyright (c) 2017 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  */
19
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>
23
24 namespace Dali
25 {
26 namespace Toolkit
27 {
28 namespace Internal
29 {
30
31 class Style;
32 typedef IntrusivePtr<Style> StylePtr;
33
34 /**
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
38  * Builder.
39  *
40  * It contains the visual, property and transition definitions for the
41  * main control and for each state and sub-state within the control.
42  *
43  * It has methods to enable the base control to apply visuals and
44  * properties per state.
45  */
46 class Style : public RefObject
47 {
48 public:
49   static StylePtr New();
50
51 public:
52   /**
53    * Apply the visuals and properties for the current state/substate
54    * of the handle to the control pointed at by handle. Recurses
55    * through sub-states.
56    *
57    * @param[in] handle The handle to apply the visuals to
58    * @param[in] instancedProperties The maps from which to get instanced properties
59    */
60   void ApplyVisualsAndPropertiesRecursively( Handle handle,
61                                              const Dictionary<Property::Map>& instancedProperties ) const;
62
63   /**
64    * Apply the visuals of the style to the control pointed at by
65    * handle.
66    *
67    * @param[in] handle The handle to apply the visuals to
68    * @param[in] instancedProperties The maps from which to get instanced properties
69    */
70   void ApplyVisuals( Handle handle,
71                      const Dictionary<Property::Map>& instancedProperties ) const;
72
73   /**
74    * Apply the properties from the visualMaps and the instancedProperties
75    * to the control pointed at by handle.
76    *
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
80    */
81   static void ApplyVisuals( Handle handle,
82                             const Dictionary<Property::Map>& visualMaps,
83                             const Dictionary<Property::Map>& instancedProperties );
84
85   /**
86    * Apply the properties from the visualMap and optional instancedProperties
87    * to the control pointed at by handle.
88    */
89   static void ApplyVisual( Handle handle,
90                            const std::string& visualName,
91                            const Property::Map& visualMap,
92                            const Property::Map* instancedProperties );
93
94   /**
95    * Apply the properties of the style to the control pointed at by
96    * handle.
97    *
98    * @param[in] handle The handle to apply the properties to
99    */
100   void ApplyProperties( Handle handle ) const;
101
102 protected:
103   /**
104    * @brief Default constructor.
105    */
106   Style();
107
108   /**
109    * @brief virtual destructor.
110    */
111   ~Style() override;
112
113 private:
114   // Not implemented
115   DALI_INTERNAL Style( const Style& rhs );
116
117   // Not implemented
118   DALI_INTERNAL Style& operator=(const Style& rhs);
119
120 public:
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;
128 };
129
130 } // Internal
131 } // Toolkit
132 } // Dali
133
134
135 #endif //DALI_TOOLKIT_INTERNAL_BUILDER_STYLE_H