2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an ”AS IS” BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 #include <FBaseString.h>
19 #include <FGrpFloatRectangle.h>
20 #include <FUiAccessibilityElement.h>
21 #include <FBaseSysLog.h>
22 #include "FUi_AccessibilityElementImpl.h"
23 #include "FUi_AccessibilityElement.h"
25 namespace Tizen { namespace Ui
27 _AccessibilityElementImpl::_AccessibilityElementImpl(const AccessibilityElement& element)
31 __pPublic = &const_cast<AccessibilityElement&>(element);
32 __pCore = new (std::nothrow) _AccessibilityElement();
33 SysTryReturn(NID_UI, __pCore, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
34 __pCore->SetUserData(this);
36 _AccessibilityElementImpl::_AccessibilityElementImpl(const _AccessibilityElement& element)
40 __pPublic = new (std::nothrow) AccessibilityElement();
41 SysTryReturn(NID_UI, __pPublic, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
42 __pPublic->__pAccessibilityElementImpl = this;
43 __pCore = &const_cast<_AccessibilityElement&>(element);
44 __pCore->SetUserData(this);
46 _AccessibilityElementImpl::~_AccessibilityElementImpl(void)
50 if(__pCore->GetParent() == null)
57 __pCore->Activate(false);
58 __pCore->SetUserData(null);
65 _AccessibilityElementImpl::Construct(const Tizen::Base::String& name, const Tizen::Graphics::FloatRectangle& bounds)
67 SysTryReturn(NID_UI, __pCore, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] System Error.");
68 return __pCore->Construct(name, bounds);
71 _AccessibilityElementImpl::SetBounds(const Tizen::Graphics::FloatRectangle& bounds)
73 SysTryReturn(NID_UI, __pCore, , E_SYSTEM, "[E_SYSTEM] System Error.");
74 return __pCore->SetBounds(bounds);
77 _AccessibilityElementImpl::SetName(const Tizen::Base::String& name)
79 SysTryReturn(NID_UI, __pCore, , E_SYSTEM, "[E_SYSTEM] System Error.");
80 return __pCore->SetName(name);
83 _AccessibilityElementImpl::SetLabel(const Tizen::Base::String& label)
85 SysTryReturn(NID_UI, __pCore, , E_SYSTEM, "[E_SYSTEM] System Error.");
86 return __pCore->SetLabel(label);
89 _AccessibilityElementImpl::SetHint(const Tizen::Base::String& hint)
91 SysTryReturn(NID_UI, __pCore, , E_SYSTEM, "[E_SYSTEM] System Error.");
92 return __pCore->SetHint(hint, true);
95 _AccessibilityElementImpl::SetStatus(const Tizen::Base::String& status)
97 SysTryReturn(NID_UI, __pCore, , E_SYSTEM, "[E_SYSTEM] System Error.");
98 return __pCore->SetStatus(status);
101 _AccessibilityElementImpl::SetTrait(AccessibilityTraits trait)
103 SysTryReturn(NID_UI, __pCore, , E_SYSTEM, "[E_SYSTEM] System Error.");
104 return __pCore->SetTrait(trait);
107 _AccessibilityElementImpl::SetTrait(const Tizen::Base::String& trait)
109 SysTryReturn(NID_UI, __pCore, , E_SYSTEM, "[E_SYSTEM] System Error.");
110 return __pCore->SetTrait(trait);
113 _AccessibilityElementImpl::SetValue(const Tizen::Base::String& value)
115 SysTryReturn(NID_UI, __pCore, , E_SYSTEM, "[E_SYSTEM] System Error.");
116 return __pCore->SetValue(value);
119 _AccessibilityElementImpl::SetCore(_AccessibilityElement* pCore)
123 _AccessibilityElement&
124 _AccessibilityElementImpl::GetCore()
128 const _AccessibilityElement&
129 _AccessibilityElementImpl::GetCore() const
133 AccessibilityElement&
134 _AccessibilityElementImpl::GetPublic()
138 const AccessibilityElement&
139 _AccessibilityElementImpl::GetPublic() const
144 _AccessibilityElementImpl::GetName(void) const
146 SysTryReturn(NID_UI, __pCore, L"", E_SYSTEM, "[E_SYSTEM] System Error.");
147 return __pCore->GetName();
149 Tizen::Graphics::FloatRectangle
150 _AccessibilityElementImpl::GetBounds(void) const
152 SysTryReturn(NID_UI, __pCore, Tizen::Graphics::FloatRectangle(0, 0, 0, 0), E_SYSTEM, "[E_SYSTEM] System Error.");
153 return __pCore->GetBounds();
156 _AccessibilityElementImpl::GetLabel(void) const
158 SysTryReturn(NID_UI, __pCore, L"", E_SYSTEM, "[E_SYSTEM] System Error.");
159 return __pCore->GetLabel();
162 _AccessibilityElementImpl::GetHint(void) const
164 SysTryReturn(NID_UI, __pCore, L"", E_SYSTEM, "[E_SYSTEM] System Error.");
165 return __pCore->GetHint();
168 _AccessibilityElementImpl::GetStatus(void) const
170 SysTryReturn(NID_UI, __pCore, L"", E_SYSTEM, "[E_SYSTEM] System Error.");
171 return __pCore->GetStatus();
174 _AccessibilityElementImpl::GetTrait(void) const
176 SysTryReturn(NID_UI, __pCore, ACCESSIBILITY_TRAITS_NONE, E_SYSTEM, "[E_SYSTEM] System Error.");
177 return __pCore->GetTrait();
180 _AccessibilityElementImpl::GetTraitString(void) const
182 SysTryReturn(NID_UI, __pCore, L"", E_SYSTEM, "[E_SYSTEM] System Error.");
183 return __pCore->GetTraitString();
186 _AccessibilityElementImpl::GetValue(void) const
188 SysTryReturn(NID_UI, __pCore, -1, E_SYSTEM, "[E_SYSTEM] System Error.");
189 return __pCore->GetValue();
191 _AccessibilityElementImpl*
192 _AccessibilityElementImpl::GetInstance(AccessibilityElement& element)
194 return static_cast<_AccessibilityElementImpl*> (element.__pAccessibilityElementImpl);
196 const _AccessibilityElementImpl*
197 _AccessibilityElementImpl::GetInstance(const AccessibilityElement& element)
199 return static_cast<_AccessibilityElementImpl*> (element.__pAccessibilityElementImpl);