CanvasRenderer::DrawableGroup: Add RemoveDrawable() API
[platform/core/uifw/dali-adaptor.git] / dali / internal / canvas-renderer / common / drawable-group-impl.h
1 #ifndef DALI_INTERNAL_DRAWABLE_GROUP_IMPL_H
2 #define DALI_INTERNAL_DRAWABLE_GROUP_IMPL_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-object.h>
23 #include <vector>
24
25 // INTERNAL INCLUDES
26 #include <dali/devel-api/adaptor-framework/canvas-renderer-drawable-group.h>
27 #include <dali/internal/canvas-renderer/common/drawable-impl.h>
28
29 namespace Dali
30 {
31 namespace Internal
32 {
33 namespace Adaptor
34 {
35 /**
36  * Dali internal DrawableGroup.
37  */
38 class DrawableGroup : public Internal::Adaptor::Drawable
39 {
40 public:
41   /**
42    * @brief List of drawables.
43    */
44   using DrawableVector = std::vector<Dali::CanvasRenderer::Drawable>;
45
46   /**
47    * @brief Constructor
48    */
49   DrawableGroup();
50
51   /**
52    * @brief Destructor.
53    */
54   ~DrawableGroup() override;
55
56   /**
57    * @copydoc Dali::CanvasRenderer::DrawableGroup::AddDrawable()
58    */
59   virtual bool AddDrawable(Dali::CanvasRenderer::Drawable& drawable);
60
61   /**
62    * @copydoc Dali::CanvasRenderer::DrawableGroup::RemoveDrawable()
63    */
64   virtual bool RemoveDrawable(Dali::CanvasRenderer::Drawable drawable);
65
66   /**
67    * @copydoc Dali::CanvasRenderer::DrawableGroup::RemoveAllDrawables()
68    */
69   virtual bool RemoveAllDrawables();
70
71   /**
72    * @brief Get list of drawables that added this group.
73    * @return Returns list of drawables.
74    */
75   virtual DrawableVector GetDrawables() const;
76
77   DrawableGroup(const DrawableGroup&) = delete;
78   DrawableGroup& operator=(DrawableGroup&) = delete;
79   DrawableGroup(DrawableGroup&&)           = delete;
80   DrawableGroup& operator=(DrawableGroup&&) = delete;
81 };
82
83 } // namespace Adaptor
84
85 } // namespace Internal
86
87 inline static Internal::Adaptor::DrawableGroup& GetImplementation(Dali::CanvasRenderer::DrawableGroup& drawablegroup)
88 {
89   DALI_ASSERT_ALWAYS(drawablegroup && "DrawableGroup handle is empty.");
90
91   BaseObject& handle = drawablegroup.GetBaseObject();
92
93   return static_cast<Internal::Adaptor::DrawableGroup&>(handle);
94 }
95
96 inline static const Internal::Adaptor::DrawableGroup& GetImplementation(const Dali::CanvasRenderer::DrawableGroup& drawablegroup)
97 {
98   DALI_ASSERT_ALWAYS(drawablegroup && "DrawableGroup handle is empty.");
99
100   const BaseObject& handle = drawablegroup.GetBaseObject();
101
102   return static_cast<const Internal::Adaptor::DrawableGroup&>(handle);
103 }
104
105 } // namespace Dali
106
107 #endif // DALI_INTERNAL_DRAWABLE_GROUP_IMPL_H