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 <boost/function.hpp>
23 #include <dali/public-api/common/dali-common.h>
35 * Abstract interface to install call backs in to an applications main loop.
42 typedef boost::function<void(void)> Callback; ///< Callback typedef
45 * Determines the priority of the call back
49 IDLE_PRIORITY, ///< idle priority
50 DEFAULT_PRIORITY, ///< priority of the callback will be the same as input handlers and timer callbacks.
54 * Controls whether an event once processed by the handler is passed on to other
59 CALLBACK_PASS_ON, ///< Pass the event on to any other handlers registered for this event
60 CALLBACK_DONE, ///< Don't pass the event to any other handlers
64 * Create a new call back interface
66 static CallbackManager* New();
71 virtual ~CallbackManager() {}
74 * Adds a call back asynchronously.
75 * Can be called from any thread.
76 * @param callback custom call back function
77 * @param priority call back priority
78 * @return true on success
80 virtual bool AddCallback( Callback callback, Priority priority ) = 0;
83 * Adds a call back asynchronously to handle an event.
84 * E.g. to handle a CTRL-C event.
85 * Can be called from any thread.
86 * @param callback custom call back function
87 * @return true on success
89 virtual bool AddEventCallback( Callback callback, int type, EventControl control ) = 0;
92 * Starts the callback manager.
94 virtual void Start() = 0;
97 * Stop the callback manager and can remove all pending callbacks synchronously.
98 * This call will synchronise with the main loop and not return
99 * until all call backs have been deleted.
101 virtual void Stop() = 0;
112 // Undefined copy constructor.
113 CallbackManager( const CallbackManager& );
115 // Undefined assignment operator.
116 CallbackManager& operator=( const CallbackManager& );
120 } // namespace Adaptor
122 } // namespace Internal
126 #endif // __DALI_INTERNAL_CALLBACK_MANAGER_H__