Add AllowTextPrediction/IsTextPredictionAllowed api
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / event-thread-callback.h
1 #ifndef __DALI_EVENT_THREAD_CALLBACK_H_
2 #define __DALI_EVENT_THREAD_CALLBACK_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 <dali/public-api/signals/callback.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/public-api/dali-adaptor-common.h>
26
27 namespace Dali
28 {
29
30 /**
31  * @brief The EventThreadCallback class provides a mechanism for the worker thread to trigger the execution of a given callback in main event thread .
32  *
33  * @note The EventThreadCallback object should only be created in the main thread.
34  */
35 class DALI_ADAPTOR_API EventThreadCallback
36 {
37 public:
38
39   /**
40    * @brief Constructor. Create an object that will call the given callback in main event thread.
41    *
42    * @param[in] callback The callback to call.
43    */
44   EventThreadCallback( CallbackBase* callback );
45
46   /**
47    * @brief Destructor.
48    */
49   ~EventThreadCallback();
50
51   /**
52    * @brief Trigger the calling of callback.
53    *
54    * The method can be used from worker threads to notify the main thread as main thread is running the event loop and thus cannot be blocked
55    */
56   void Trigger();
57
58 private:
59
60   // undefined copy constructor.
61   EventThreadCallback( const EventThreadCallback& );
62
63   // undefined assignment operator
64   EventThreadCallback& operator=( const EventThreadCallback& );
65
66 private:
67
68   struct Impl;
69   Impl* mImpl;
70
71 };
72
73 }
74 #endif /* __DALI_EVENT_THREAD_CALLBACK_H_ */