Merge "Set proper locale to harfbuzz" into devel/master
[platform/core/uifw/dali-adaptor.git] / adaptors / common / callback-manager.h
1 #ifndef __DALI_INTERNAL_CALLBACK_MANAGER_H__
2 #define __DALI_INTERNAL_CALLBACK_MANAGER_H__
3
4 /*
5  * Copyright (c) 2016 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 <dali/public-api/common/dali-common.h>
23 #include <dali/public-api/signals/callback.h>
24
25 namespace Dali
26 {
27
28 namespace Internal
29 {
30
31 namespace Adaptor
32 {
33
34 /**
35  * Abstract interface to install call backs in to an applications main loop.
36  */
37 class CallbackManager
38 {
39
40 public:
41
42     /**
43      * Create a new call back interface
44      */
45     static CallbackManager* New();
46
47     /**
48      * Virtual destructor
49      */
50     virtual ~CallbackManager() {}
51
52     /**
53      * @brief Adds a @p callback to be run on idle.
54      * @note Must be called from the main thread only.
55      *
56      * @param[in] callback custom callback function.
57      *
58      * @return true on success
59      */
60     virtual bool AddIdleCallback( CallbackBase* callback ) = 0;
61
62     /**
63      * @brief Removes a previously added @p callback.
64      * @note Must be called from main thread only.
65      *
66      * Does nothing if the @p callback doesn't exist.
67      *
68      * @param[in] callback The callback to be removed.
69      */
70     virtual void RemoveIdleCallback( CallbackBase* callback ) = 0;
71
72     /**
73      * Starts the callback manager.
74      */
75     virtual void Start() = 0;
76
77     /**
78      * Stop the callback manager and can remove all pending callbacks synchronously.
79      * This call will synchronise with the main loop and not return
80      * until all call backs have been deleted.
81      */
82     virtual void Stop() = 0;
83
84 protected:
85
86     /**
87      * constructor
88      */
89     CallbackManager() {}
90
91 private:
92
93     // Undefined copy constructor.
94     CallbackManager( const CallbackManager& );
95
96     // Undefined assignment operator.
97     CallbackManager& operator=( const CallbackManager& );
98
99 };
100
101 } // namespace Adaptor
102
103 } // namespace Internal
104
105 } // namespace Dali
106
107 #endif // __DALI_INTERNAL_CALLBACK_MANAGER_H__