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 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.
22 #include <dali/dali.h>
36 * This observes and processes when any style changes occur. When they do occur, it traverses through
37 * all registered controls and calls the StyleChanged method.
39 * This is created when a control first registers with it. Subsequent registrations increase the
40 * reference count. When the last control unregisters, i.e. the reference count is 0, the instance
43 class StyleChangeProcessor : public ConnectionTracker
48 * Non virtual destructor.
49 * We should not derive from StyleChangeProcessor.
50 * Destructor is called when the last control unregisters.
52 ~StyleChangeProcessor();
55 * Registers a control with the StyleChangeProcessor.
56 * @param[in] control The raw Control pointer.
58 static void Register( ControlImpl* control );
61 * Unregisters a control from the StyleChangeProcessor.
62 * @param[in] control The raw Control pointer.
64 static void Unregister( ControlImpl* control );
69 * Increment the processor's reference count.
74 * Decrement the processor's reference count.
79 * Retrieve the processor's reference count.
80 * @return The reference count
82 unsigned int ReferenceCount() const;
88 * We should only create an instance upon first registration.
90 StyleChangeProcessor();
93 StyleChangeProcessor(const StyleChangeProcessor&);
94 StyleChangeProcessor& operator=(const StyleChangeProcessor&);
99 * Callback for the StyleMonitor when the style changes on the platform.
100 * @param[in] styleMonitor The Style Monitor.
101 * @param[in] styleChange The style change information.
103 void StyleChanged(Dali::StyleMonitor styleMonitor, Dali::StyleChange styleChange);
106 * Propagates the style change to all Controls in the actor hierarchy.
107 * This is done with a bottom-up approach, i.e. the leaf Control's StyleChange method gets
108 * called first followed by its parent and so on.
109 * @param[in] actor The actor whose children to process and send style change notification to.
110 * @param[in] change The style change.
112 static void PropagateStyleChange(Actor actor, Dali::StyleChange change);
116 unsigned int mCount; ///< The reference count
117 std::vector<ControlImpl*> mControls; ///< Stores all registered controls.
120 } // namespace Internal
122 } // namespace Toolkit
126 #endif // __DALI_TOOLKIT_INTERNAL_STYLE_CHANGE_PROCESSOR_H_