1 #ifndef __DALI_INTERNAL_CALLBACK_MANAGER_H__
2 #define __DALI_INTERNAL_CALLBACK_MANAGER_H__
5 * Copyright (c) 2018 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/public-api/signals/callback.h>
25 #include <dali/public-api/dali-adaptor-common.h>
37 * Abstract interface to install call backs in to an applications main loop.
45 * Create a new call back interface
47 static CallbackManager* New();
52 virtual ~CallbackManager() {}
55 * @brief Adds a @p callback to be run on idle.
56 * @note Must be called from the main thread only.
58 * Callbacks of the following types may be used:
62 * This callback will be deleted once it is called.
67 * This callback will be called repeatedly as long as it returns true. A return of 0 deletes this callback.
69 * @param[in] callback custom callback function.
70 * @param[in] hasReturnValue Sould be set to true if the callback function has a return value.
72 * @return true on success
74 virtual bool AddIdleCallback( CallbackBase* callback, bool hasReturnValue ) = 0;
77 * @brief Removes a previously added @p callback.
78 * @note Must be called from main thread only.
80 * Does nothing if the @p callback doesn't exist.
82 * @param[in] callback The callback to be removed.
84 virtual void RemoveIdleCallback( CallbackBase* callback ) = 0;
87 * @brief Adds a @p callback to be run when entering an idle state.
88 * @note Must be called from the main thread only.
90 * A callback of the following type should be used:
94 * This callback will be called repeatedly as long as it returns true. A return of 0 deletes this callback.
96 * @param[in] callback custom callback function.
98 * @return true on success
100 virtual bool AddIdleEntererCallback( CallbackBase* callback ) = 0;
103 * @brief Removes a previously added the idle enterer callback.
104 * @note Must be called from main thread only.
106 * Does nothing if the @p callback doesn't exist.
108 * @param[in] callback The callback to be removed.
110 virtual void RemoveIdleEntererCallback( CallbackBase* callback ) = 0;
113 * Starts the callback manager.
115 virtual void Start() = 0;
118 * Stop the callback manager and can remove all pending callbacks synchronously.
119 * This call will synchronise with the main loop and not return
120 * until all call backs have been deleted.
122 virtual void Stop() = 0;
133 // Undefined copy constructor.
134 CallbackManager( const CallbackManager& );
136 // Undefined assignment operator.
137 CallbackManager& operator=( const CallbackManager& );
141 } // namespace Adaptor
143 } // namespace Internal
147 #endif // __DALI_INTERNAL_CALLBACK_MANAGER_H__