1 #ifndef __DALI_TOOLKIT_INTERNAL_STYLE_CHANGE_PROCESSOR_H_
2 #define __DALI_TOOLKIT_INTERNAL_STYLE_CHANGE_PROCESSOR_H_
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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.
21 #include <dali/dali.h>
35 * This observes and processes when any style changes occur. When they do occur, it traverses through
36 * all registered controls and calls the StyleChanged method.
38 * This is created when a control first registers with it. Subsequent registrations increase the
39 * reference count. When the last control unregisters, i.e. the reference count is 0, the instance
42 class StyleChangeProcessor : public ConnectionTracker
47 * Non virtual destructor.
48 * We should not derive from StyleChangeProcessor.
49 * Destructor is called when the last control unregisters.
51 ~StyleChangeProcessor();
54 * Registers a control with the StyleChangeProcessor.
55 * @param[in] control The raw Control pointer.
57 static void Register( ControlImpl* control );
60 * Unregisters a control from the StyleChangeProcessor.
61 * @param[in] control The raw Control pointer.
63 static void Unregister( ControlImpl* control );
68 * Increment the processor's reference count.
73 * Decrement the processor's reference count.
78 * Retrieve the processor's reference count.
79 * @return The reference count
81 unsigned int ReferenceCount() const;
87 * We should only create an instance upon first registration.
89 StyleChangeProcessor();
92 StyleChangeProcessor(const StyleChangeProcessor&);
93 StyleChangeProcessor& operator=(const StyleChangeProcessor&);
98 * Callback for the StyleMonitor when the style changes on the platform.
99 * @param[in] styleMonitor The Style Monitor.
100 * @param[in] styleChange The style change information.
102 void StyleChanged(Dali::StyleMonitor styleMonitor, Dali::StyleChange styleChange);
105 * Propagates the style change to all Controls in the actor hierarchy.
106 * This is done with a bottom-up approach, i.e. the leaf Control's StyleChange method gets
107 * called first followed by its parent and so on.
108 * @param[in] actor The actor whose children to process and send style change notification to.
109 * @param[in] change The style change.
111 static void PropagateStyleChange(Actor actor, Dali::StyleChange change);
115 unsigned int mCount; ///< The reference count
116 std::vector<ControlImpl*> mControls; ///< Stores all registered controls.
119 } // namespace Internal
121 } // namespace Toolkit
125 #endif // __DALI_TOOLKIT_INTERNAL_STYLE_CHANGE_PROCESSOR_H_