Merge "Add a callback for navigation policy in web engine." into devel/master
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / actor-accessible.h
1 #ifndef DALI_ADAPTOR_ACTOR_ACCESSIBLE_H
2 #define DALI_ADAPTOR_ACTOR_ACCESSIBLE_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 // EXTERNAL INCLUDES
21 #include <dali/public-api/actors/actor.h>
22 #include <dali/public-api/object/weak-handle.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/devel-api/atspi-interfaces/accessible.h>
26 #include <dali/devel-api/atspi-interfaces/collection.h>
27 #include <dali/devel-api/atspi-interfaces/component.h>
28
29 namespace Dali::Accessibility
30 {
31 class DALI_ADAPTOR_API ActorAccessible : public virtual Accessible, public virtual Collection, public virtual Component
32 {
33 public:
34   ActorAccessible() = delete;
35
36   ActorAccessible(Actor actor);
37
38   /**
39    * @copydoc Dali::Accessibility::Accessible::GetName()
40    */
41   std::string GetName() const override;
42
43   /**
44    * @copydoc Dali::Accessibility::Accessible::GetDescription()
45    */
46   std::string GetDescription() const override;
47
48   /**
49    * @copydoc Dali::Accessibility::Accessible::GetParent()
50    */
51   Accessible* GetParent() override;
52
53   /**
54    * @copydoc Dali::Accessibility::Accessible::GetChildCount()
55    */
56   std::size_t GetChildCount() const override;
57
58   /**
59    * @copydoc Dali::Accessibility::Accessible::GetChildren()
60    */
61   std::vector<Accessible*> GetChildren() override;
62
63   /**
64    * @copydoc Dali::Accessibility::Accessible::GetChildAtIndex()
65    */
66   Accessible* GetChildAtIndex(std::size_t index) override;
67
68   /**
69    * @copydoc Dali::Accessibility::Accessible::GetIndexInParent()
70    */
71   std::size_t GetIndexInParent() override;
72
73   /**
74    * @copydoc Dali::Accessibility::Accessible::GetInternalActor()
75    */
76   Dali::Actor GetInternalActor() override;
77
78   /**
79    * @copydoc Dali::Accessibility::Component::GetLayer()
80    */
81   ComponentLayer GetLayer() const override;
82
83   /**
84    * @copydoc Dali::Accessibility::Component::GetMdiZOrder()
85    */
86   std::int16_t GetMdiZOrder() const override;
87
88   /**
89    * @copydoc Dali::Accessibility::Component::GetAlpha()
90    */
91   double GetAlpha() const override;
92
93   /**
94    * @copydoc Dali::Accessibility::Component::IsScrollable()
95    */
96   bool IsScrollable() const override;
97
98   /**
99    * @copydoc Dali::Accessibility::Component::GetExtents()
100    */
101   Dali::Rect<> GetExtents(CoordinateType type) const override;
102
103 protected:
104   Dali::Actor Self() const
105   {
106     auto handle = mSelf.GetHandle();
107
108     // It is a bug if the Accessible outlives its Actor
109     DALI_ASSERT_ALWAYS(handle);
110
111     return handle;
112   }
113
114 private:
115   Dali::WeakHandle<Dali::Actor> mSelf;
116 };
117
118 } // namespace Dali::Accessibility
119
120 #endif // DALI_ADAPTOR_ACTOR_ACCESSIBLE_H