[AT-SPI] Split accessibility-impl.h
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / proxy-accessible.h
1 #ifndef DALI_ADAPTOR_PROXY_ACCESSIBLE_H
2 #define DALI_ADAPTOR_PROXY_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 <string>
22 #include <vector>
23
24 // INTERNAL INCLUDES
25 #include <dali/devel-api/adaptor-framework/accessibility.h>
26 #include <dali/devel-api/atspi-interfaces/accessible.h>
27
28 namespace Dali::Accessibility
29 {
30 /**
31  * @brief The minimalistic, always empty Accessible object with settable address.
32  *
33  * For those situations, where you want to return address in different bridge
34  * (embedding for example), but the object itself ain't planned to be used otherwise.
35  * This object has null parent, no children, empty name and so on
36  */
37 class DALI_ADAPTOR_API EmptyAccessibleWithAddress : public virtual Accessible
38 {
39 public:
40   EmptyAccessibleWithAddress() = default;
41
42   EmptyAccessibleWithAddress(Address address)
43   : mAddress(std::move(address))
44   {
45   }
46
47   void SetAddress(Address address)
48   {
49     this->mAddress = std::move(address);
50   }
51
52   std::string GetName() override
53   {
54     return "";
55   }
56
57   std::string GetDescription() override
58   {
59     return "";
60   }
61
62   Accessible* GetParent() override
63   {
64     return nullptr;
65   }
66
67   size_t GetChildCount() override
68   {
69     return 0;
70   }
71
72   std::vector<Accessible*> GetChildren() override
73   {
74     return {};
75   }
76
77   Accessible* GetChildAtIndex(size_t index) override
78   {
79     throw std::domain_error{"out of bounds index (" + std::to_string(index) + ") - no children"};
80   }
81
82   size_t GetIndexInParent() override
83   {
84     return static_cast<size_t>(-1);
85   }
86
87   Role GetRole() override
88   {
89     return {};
90   }
91
92   std::string GetRoleName() override;
93
94   States GetStates() override
95   {
96     return {};
97   }
98
99   Attributes GetAttributes() override
100   {
101     return {};
102   }
103
104   Address GetAddress() override
105   {
106     return mAddress;
107   }
108
109   bool DoGesture(const GestureInfo& gestureInfo) override
110   {
111     return false;
112   }
113
114   std::vector<Relation> GetRelationSet() override
115   {
116     return {};
117   }
118
119   Dali::Actor GetInternalActor() override
120   {
121     return Dali::Actor{};
122   }
123
124 private:
125   Address mAddress;
126 };
127
128 } // namespace Dali::Accessibility
129
130 #endif // DALI_ADAPTOR_PROXY_ACCESSIBLE_H