1 #ifndef __DALI_INTERNAL_CALLBACK_MANAGER_H__
2 #define __DALI_INTERNAL_CALLBACK_MANAGER_H__
5 * Copyright (c) 2014 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/common/dali-common.h>
23 #include <dali/public-api/signals/callback.h>
35 * Abstract interface to install call backs in to an applications main loop.
43 * Determines the priority of the call back
47 IDLE_PRIORITY, ///< idle priority
48 DEFAULT_PRIORITY, ///< priority of the callback will be the same as input handlers and timer callbacks.
52 * Controls whether an event once processed by the handler is passed on to other
57 CALLBACK_PASS_ON, ///< Pass the event on to any other handlers registered for this event
58 CALLBACK_DONE, ///< Don't pass the event to any other handlers
62 * Create a new call back interface
64 static CallbackManager* New();
69 virtual ~CallbackManager() {}
72 * Adds a call back asynchronously.
73 * Can be called from any thread.
74 * @param callback custom call back function
75 * @param priority call back priority
76 * @return true on success
78 virtual bool AddCallback( CallbackBase* callback, Priority priority ) = 0;
81 * Adds a call back asynchronously to handle an event.
82 * E.g. to handle a CTRL-C event.
83 * Can be called from any thread.
84 * @param callback custom call back function
85 * @return true on success
87 virtual bool AddEventCallback( CallbackBase* callback, int type, EventControl control ) = 0;
90 * Starts the callback manager.
92 virtual void Start() = 0;
95 * Stop the callback manager and can remove all pending callbacks synchronously.
96 * This call will synchronise with the main loop and not return
97 * until all call backs have been deleted.
99 virtual void Stop() = 0;
110 // Undefined copy constructor.
111 CallbackManager( const CallbackManager& );
113 // Undefined assignment operator.
114 CallbackManager& operator=( const CallbackManager& );
118 } // namespace Adaptor
120 } // namespace Internal
124 #endif // __DALI_INTERNAL_CALLBACK_MANAGER_H__