CanvasRenderer::DrawableGroup: Add RemoveDrawable() API
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / canvas-renderer-drawable-group.h
1 #ifndef DALI_CANVAS_RENDERER_DRAWABLE_GROUP_H
2 #define DALI_CANVAS_RENDERER_DRAWABLE_GROUP_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/public-api/object/base-handle.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/devel-api/adaptor-framework/canvas-renderer-drawable.h>
26 #include <dali/devel-api/adaptor-framework/canvas-renderer.h>
27 #include <dali/public-api/dali-adaptor-common.h>
28
29 namespace Dali
30 {
31 /**
32  * @addtogroup dali_adaptor_framework
33  * @{
34  */
35
36 namespace Internal DALI_INTERNAL
37 {
38 namespace Adaptor
39 {
40 class CanvasRenderer;
41 class DrawableGroup;
42 } // namespace Adaptor
43 } // namespace DALI_INTERNAL
44
45 /**
46  * @brief A class that holds many Drawable object. As a whole they can be transformed, their transparency can be changed.
47  */
48 class DALI_ADAPTOR_API CanvasRenderer::DrawableGroup : public CanvasRenderer::Drawable
49 {
50 public:
51   /**
52    * @brief Creates an initialized handle to a new CanvasRenderer::DrawableGroup.
53    * @return A handle to a newly allocated DrawableGroup
54    */
55   static DrawableGroup New();
56
57 public:
58   /**
59    * @brief Creates an empty handle. Use CanvasRenderer::DrawableGroup::New() to create an initialized object.
60    */
61   DrawableGroup();
62
63   /**
64    * @brief Destructor.
65    */
66   ~DrawableGroup();
67
68   /**
69    * @brief This copy constructor is required for (smart) pointer semantics.
70    *
71    * @param[in] handle A reference to the copied handle
72    */
73   DrawableGroup(const DrawableGroup& handle) = default;
74
75 public:
76   /**
77    * @brief Add drawable object to the DrawableGroup. This method is similar to registration.
78    * @param[in] drawable The drawable object.
79    * @return Returns True when it's successful. False otherwise.
80    */
81   bool AddDrawable(Drawable& drawable);
82
83   /**
84    * @brief Remove drawable object to the DrawableGroup.
85    * This method is similar to deregistration. Freeing memory is not concerned for drawables being removed.
86    * @param[in] drawable the drawable object.
87    * @return Returns True when it's successful. False otherwise.
88    */
89   bool RemoveDrawable(Drawable drawable);
90
91   /**
92    * @brief Remove all drawable objects added to the DrawableGroup.
93    * @return Returns True when it's successful. False otherwise.
94    */
95   bool RemoveAllDrawables();
96
97 public: // Not intended for application developers
98   /// @cond internal
99   /**
100    * @brief The constructor.
101    * @note  Not intended for application developers.
102    *
103    * @param[in] pointer A pointer to a newly allocated CanvasRenderer::DrawableGroup
104    */
105   explicit DALI_INTERNAL DrawableGroup(Internal::Adaptor::DrawableGroup* impl);
106   /// @endcond
107 };
108
109 /**
110  * @}
111  */
112 } // namespace Dali
113
114 #endif // DALI_CANVAS_RENDERER_DRAWABLE_GROUP_H