dali-adaptor internal folder refactoring
[platform/core/uifw/dali-adaptor.git] / dali / internal / system / linux / callback-manager-ecore.h
1 #ifndef __DALI_ECORE_CALLBACK_MANAGER_H__
2 #define __DALI_ECORE_CALLBACK_MANAGER_H__
3
4 /*
5  * Copyright (c) 2018 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
21 // EXTERNAL INCLUDES
22 #include <list>
23
24 // INTERNAL INCLUDES
25 #include <dali/internal/system/common/callback-manager.h>
26
27
28 namespace Dali
29 {
30
31 namespace Internal
32 {
33
34 namespace Adaptor
35 {
36
37 struct CallbackData;
38
39 /**
40  * Ecore interface to install call backs in the applications main loop.
41  */
42 class EcoreCallbackManager : public CallbackManager
43 {
44
45 public:
46
47     /**
48      * @brief constructor
49      */
50     EcoreCallbackManager();
51
52     /**
53      * @brief destructor
54      */
55     ~EcoreCallbackManager()
56     {
57     }
58
59     /**
60      * @copydoc CallbackManager::AddIdleCallback()
61      */
62     virtual bool AddIdleCallback( CallbackBase* callback, bool hasReturnValue );
63
64     /**
65      * @copydoc CallbackManager::RemoveIdleCallback()
66      */
67     virtual void RemoveIdleCallback( CallbackBase* callback );
68
69     /**
70      * @copydoc CallbackManager::AddIdleEntererCallback()
71      */
72     virtual bool AddIdleEntererCallback( CallbackBase* callback );
73
74     /**
75      * @copydoc CallbackManager::RemoveIdleEntererCallback()
76      */
77     virtual void RemoveIdleEntererCallback( CallbackBase* callback );
78
79     /**
80      * @copydoc CallbackManager::Start()
81      */
82     virtual void Start();
83
84     /**
85      * @copydoc CallbackManager::Stop()
86      */
87     virtual void Stop();
88
89 private:
90
91     /**
92      * @brief Remove all idle call backs that are pending
93      * Called by Stop()
94      * Always called from the main thread
95      */
96     void RemoveAllCallbacks();
97
98     /**
99      * @brief Removes a single call back from the container
100      * Always called from main thread
101      * @param callbackData callback data
102      */
103     void RemoveCallbackFromContainer(CallbackData *callbackData);
104
105     /**
106      * @brief Remove a standard call back from ecore
107      * Always called from main thread
108      * @param callbackData callback data
109      */
110     void RemoveStandardCallback(CallbackData *callbackData);
111
112
113     typedef std::list<CallbackData *>  CallbackList;
114
115     bool                           mRunning;            ///< flag is set to true if when running
116     CallbackList                   mCallbackContainer;  ///< container of live idle callbacks
117 };
118
119 } // namespace Adaptor
120
121 } // namespace Internal
122
123 } // namespace Dali
124
125 #endif // __DALI_ECORE_CALLBACK_MANAGER_H__