Merge "Remove the deferred RotationObserver from the Adaptor" into devel/master
[platform/core/uifw/dali-adaptor.git] / dali / internal / system / windows / callback-manager-win.h
1 #ifndef DALI_WIN_CALLBACK_MANAGER_H
2 #define DALI_WIN_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  * @brief LibUV callback manager used to install call backs in the applications main loop.
38  * The manager keeps track of all callbacks, so that if Stop() is called it can remove them.
39  */
40 class WinCallbackManager : public CallbackManager
41 {
42
43 public:
44
45      /**
46      * @brief constructor
47      */
48     WinCallbackManager();
49
50     /**
51      * @brief destructor
52      */
53     ~WinCallbackManager(){}
54
55     /**
56      * @copydoc CallbackManager::AddIdleCallback()
57      */
58     virtual bool AddIdleCallback( CallbackBase* callback, bool hasReturnValue );
59
60     /**
61      * @copydoc CallbackManager::RemoveIdleCallback()
62      */
63     virtual void RemoveIdleCallback( CallbackBase* callback );
64
65     /**
66     * @brief Adds a @p callback to be run when entering an idle state.
67     * @note Must be called from the main thread only.
68     *
69     * A callback of the following type should be used:
70     * @code
71     *   bool MyFunction();
72     * @endcode
73     * This callback will be called repeatedly as long as it returns true. A return of 0 deletes this callback.
74     *
75     * @param[in] callback custom callback function.
76     *
77     * @return true on success
78     */
79     virtual bool AddIdleEntererCallback( CallbackBase* callback );
80
81     /**
82     * @brief Removes a previously added the idle enterer callback.
83     * @note Must be called from main thread only.
84     *
85     * Does nothing if the @p callback doesn't exist.
86     *
87     * @param[in] callback The callback to be removed.
88     */
89     virtual void RemoveIdleEntererCallback( CallbackBase* callback );
90
91     /**
92      * @copydoc CallbackManager::Start()
93      */
94     virtual void Start();
95
96     /**
97      * @copydoc CallbackManager::Stop()
98      */
99     virtual void Stop();
100
101 private:
102     bool                           mRunning;            ///< flag is set to true if when running
103 };
104
105 } // namespace Adaptor
106
107 } // namespace Internal
108
109 } // namespace Dali
110
111 #endif // __DALI_UV_CALLBACK_MANAGER_H__