Bind AnimatedVectorImageVisual action : SET_DYNAMIC_PROPERTY
[platform/core/uifw/dali-csharp-binder.git] / dali-csharp-binder / src / processor-controller.h
1 #ifndef CSHARP_PROCESSOR_CONTROLLER_H
2 #define CSHARP_PROCESSOR_CONTROLLER_H
3
4 /*
5  * Copyright (c) 2021 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/integration-api/processor-interface.h>
23
24 // INTERNAL INCLUDES
25 #include "common.h"
26
27 /**
28  * @brief Implements a Integration::Processor interface so can be registered with dali-core as
29  * a Processor.  Enables the setting of a callback so dali-core can execute this callback when
30  * Process() is run.
31  */
32 class ProcessorController : public Dali::Integration::Processor
33 {
34 public:
35
36   // Function pointer matching delegate in C# ProcessorController
37   using ProcessorControllerProcessCallback = void (SWIGSTDCALL*)();
38
39 public:
40   /**
41    * @brief Constructor - creates a ProcessorController and registers it with dali-core.
42    *
43    */
44   ProcessorController();
45
46   /**
47    * @brief Destructor - Unregisters itself from dali-core.
48    */
49   ~ProcessorController();
50
51   /**
52    * @copydoc Dali::Integration::Processor::Process()
53    */
54   void Process(bool postProcessor) override;
55
56    /**
57     * @brief Set the callback to be executed when dali-core calls the overriden Process() api.
58     * @param[in] callback, function to be called
59     */
60   void SetCallback( ProcessorControllerProcessCallback callback );
61
62    /**
63     * @brief Set the postcallback to be executed when dali-core calls the overriden Process(true) api.
64     * @param[in] postCallback, function to be called
65     */
66   void SetPostCallback( ProcessorControllerProcessCallback postCallback );
67
68    /**
69     * @brief Remove callback on this ProcessorController.
70     * The removed callback will not be called anymore.
71     * @param[in] callback, function will be removed
72     */
73   void RemoveCallback( ProcessorControllerProcessCallback callback );
74
75    /**
76     * @brief Remove postcallback on this ProcessorController.
77     * The removed callback will not be called anymore.
78     * @param[in] postCallback, function will be removed
79     */
80   void RemovePostCallback( ProcessorControllerProcessCallback postCallback );
81
82    /**
83     * @brief Awake update thread so dali-core calls the overriden Process() api.
84     */
85   void Awake();
86
87 private:
88
89   ProcessorControllerProcessCallback mHandler;              ///< PreProcessHandler before Relayout
90   ProcessorControllerProcessCallback mPostHandler;          ///< PostProcessHandler after Relayout
91   bool                               mKeepRenderingApplied; ///< True if we call Stage::KeepRendering(0.0f). It need to avoid duplicated keep rendering call
92 };
93
94 #endif // CSHARP_PROCESSOR_CONTROLLER_H