Merge "(Vector) Support dynamic properties" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / visuals / animated-vector-image-visual-actions-devel.h
1 #ifndef DALI_TOOLKIT_DEVEL_API_VISUALS_ANIMATED_VECTOR_IMAGE_VISUAL_ACTIONS_DEVEL_H
2 #define DALI_TOOLKIT_DEVEL_API_VISUALS_ANIMATED_VECTOR_IMAGE_VISUAL_ACTIONS_DEVEL_H
3
4 /*
5  * Copyright (c) 2022 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-toolkit/devel-api/toolkit-action-index-ranges.h>
23 #include <dali/public-api/signals/callback.h>
24 #include <string>
25
26 namespace Dali
27 {
28 namespace Toolkit
29 {
30 namespace DevelAnimatedVectorImageVisual
31 {
32 /**
33  * @brief Actions that the animated vector image visual can perform.  These actions are called through the Visual::Base::DoAction API.
34  */
35 namespace Action
36 {
37 /**
38  * @brief The available actions for this visual
39  */
40 enum Type
41 {
42   PLAY = VISUAL_ACTION_START_INDEX, ///< Play the animated vector image.
43   PAUSE,                            ///< Pause the animated vector image.
44   STOP,                             ///< Stop the animated vector image. This is also Default playback mode.
45   JUMP_TO,                          ///< Jump to the specified frame. Property::INTEGER value should be passed.
46   SET_DYNAMIC_PROPERTY              ///< Set the dynamic property.
47 };
48
49 } // namespace Action
50
51 /**
52  * @brief The dynamic property info
53  *
54  * @note A callback of the following type may be used:
55  * @code
56  *   Property::Value MyFunction(int32_t id, VectorAnimationRenderer::VectorProperty property, uint32_t frameNumber);
57  * @endcode
58  *
59  * id  The id to specify the callback.
60  * property The property that represent what you are trying to change.
61  * frameNumber The current frame number.
62  * It returns a Property::Value to set according to the property type.
63  *
64  * The callback will be called on the worker thread. You MUST not call other DALi methods in the callback.
65  * And the object must still be alive when the callback occurs if you make the callback from a class member function.
66  */
67 struct DynamicPropertyInfo
68 {
69   int32_t       id;       ///< The Id to specify the callback. It should be unique and will be passed when the callback is called.
70   std::string   keyPath;  ///< The key path used to target a specific content or a set of contents that will be updated.
71   int32_t       property; ///< The property to set.
72   CallbackBase* callback; ///< The callback that gets called every time the animation is rendered. Ownership of the callback is passed onto the visual.
73 };
74
75 } // namespace DevelAnimatedVectorImageVisual
76
77 } // namespace Toolkit
78
79 } // namespace Dali
80
81 #endif // DALI_TOOLKIT_DEVEL_API_VISUALS_ANIMATED_VECTOR_IMAGE_VISUAL_ACTIONS_DEVEL_H