(StyleManager) Remove StyleManager header include form CAPI
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / internal / styling / util.h
1 #ifndef __DALI_TOOLKIT_INTERNAL_UTIL_H__
2 #define __DALI_TOOLKIT_INTERNAL_UTIL_H__
3
4 //
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 //
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
10 //
11 //     http://floralicense.org/license/
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 // EXTERNAL INCLUDES
21
22 // INTERNAL INCLUDES
23
24 #include <dali/dali.h>
25 #include <dali-toolkit/internal/styling/style-manager-impl.h>
26
27 namespace Dali
28 {
29
30 namespace Toolkit
31 {
32
33 namespace Internal
34 {
35
36 namespace Util
37 {
38
39 /**
40  * @brief Callback that the EventProcessingFinishedSignal signal calls
41  *
42  * Priorities calls to managers
43  */
44 inline void EventProcessingFinishedSignalPrioritizer()
45 {
46   // Priority 0: Set all styles
47   Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
48   if( GetImpl(styleManager).IsThemeRequestPending() )
49   {
50     GetImpl(styleManager).SetTheme();
51   }
52
53   // Todo: Priority 1: Do relayout after styles have been set
54 }
55
56 /**
57  * @brief Connect to the EventProcessingFinishedSignal
58  *
59  * Needs to be called only once, but will still operate successfully if called multiple times.
60  * Makes the assumption that this is the only thing connecting to the EventProcessingFinishedSignal.
61  */
62 inline void ConnectEventProcessingFinishedSignal()
63 {
64   Stage stage = Stage::GetCurrent();
65
66   // This is only intended for one purpose!
67   if( stage.EventProcessingFinishedSignal().GetConnectionCount() == 0 )
68   {
69     stage.EventProcessingFinishedSignal().Connect( &EventProcessingFinishedSignalPrioritizer );
70   }
71 }
72
73 } // namespace Util
74
75 } // namespace Internal
76
77 } // namespace Toolkit
78
79 } // namespace Dali
80
81 #endif // __DALI_TOOLKIT_INTERNAL_STYLE_MANAGER_H__
82