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(false);
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->IsSystemElement())
52 __pCore->Activate(false);
53 __pCore->SetUserData(null);
58 _AccessibilityContainer* pContainer = __pCore->GetParent();
59 if(pContainer != null)
61 pContainer->RemoveElement(*__pCore);
73 _AccessibilityElementImpl::Construct(const Tizen::Base::String& name, const Tizen::Graphics::FloatRectangle& bounds)
75 SysTryReturn(NID_UI, __pCore, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] System Error.");
76 return __pCore->Construct(name, bounds);
79 _AccessibilityElementImpl::SetBounds(const Tizen::Graphics::FloatRectangle& bounds)
81 SysTryReturn(NID_UI, __pCore, , E_SYSTEM, "[E_SYSTEM] System Error.");
82 return __pCore->SetBounds(bounds);
85 _AccessibilityElementImpl::SetName(const Tizen::Base::String& name)
87 SysTryReturn(NID_UI, __pCore, , E_SYSTEM, "[E_SYSTEM] System Error.");
88 return __pCore->SetName(name);
91 _AccessibilityElementImpl::SetLabel(const Tizen::Base::String& label)
93 SysTryReturn(NID_UI, __pCore, , E_SYSTEM, "[E_SYSTEM] System Error.");
94 __pCore->SetPublicLabelUpdate(true);
95 return __pCore->SetLabel(label);
98 _AccessibilityElementImpl::SetHint(const Tizen::Base::String& hint)
100 SysTryReturn(NID_UI, __pCore, , E_SYSTEM, "[E_SYSTEM] System Error.");
101 return __pCore->SetHint(hint, true);
104 _AccessibilityElementImpl::SetStatus(const Tizen::Base::String& status)
106 SysTryReturn(NID_UI, __pCore, , E_SYSTEM, "[E_SYSTEM] System Error.");
107 return __pCore->SetStatus(status);
110 _AccessibilityElementImpl::SetTrait(const Tizen::Base::String& trait)
112 SysTryReturn(NID_UI, __pCore, , E_SYSTEM, "[E_SYSTEM] System Error.");
113 return __pCore->SetTrait(trait);
116 _AccessibilityElementImpl::SetValue(const Tizen::Base::String& value)
118 SysTryReturn(NID_UI, __pCore, , E_SYSTEM, "[E_SYSTEM] System Error.");
119 return __pCore->SetValue(value);
122 _AccessibilityElementImpl::SetCore(_AccessibilityElement* pCore)
126 _AccessibilityElement&
127 _AccessibilityElementImpl::GetCore()
131 const _AccessibilityElement&
132 _AccessibilityElementImpl::GetCore() const
136 AccessibilityElement&
137 _AccessibilityElementImpl::GetPublic()
141 const AccessibilityElement&
142 _AccessibilityElementImpl::GetPublic() const
147 _AccessibilityElementImpl::GetName(void) const
149 SysTryReturn(NID_UI, __pCore, L"", E_SYSTEM, "[E_SYSTEM] System Error.");
150 return __pCore->GetName();
152 Tizen::Graphics::FloatRectangle
153 _AccessibilityElementImpl::GetBounds(void) const
155 SysTryReturn(NID_UI, __pCore, Tizen::Graphics::FloatRectangle(0, 0, 0, 0), E_SYSTEM, "[E_SYSTEM] System Error.");
156 return __pCore->GetBounds();
159 _AccessibilityElementImpl::GetLabel(void) const
161 SysTryReturn(NID_UI, __pCore, L"", E_SYSTEM, "[E_SYSTEM] System Error.");
162 return __pCore->GetLabel();
165 _AccessibilityElementImpl::GetHint(void) const
167 SysTryReturn(NID_UI, __pCore, L"", E_SYSTEM, "[E_SYSTEM] System Error.");
168 return __pCore->GetHint();
171 _AccessibilityElementImpl::GetStatus(void) const
173 SysTryReturn(NID_UI, __pCore, L"", E_SYSTEM, "[E_SYSTEM] System Error.");
174 return __pCore->GetStatus();
177 _AccessibilityElementImpl::GetTraitString(void) const
179 SysTryReturn(NID_UI, __pCore, L"", E_SYSTEM, "[E_SYSTEM] System Error.");
180 return __pCore->GetTraitString();
183 _AccessibilityElementImpl::GetValue(void) const
185 SysTryReturn(NID_UI, __pCore, -1, E_SYSTEM, "[E_SYSTEM] System Error.");
186 return __pCore->GetValue();
188 _AccessibilityElementImpl*
189 _AccessibilityElementImpl::GetInstance(AccessibilityElement& element)
191 return static_cast<_AccessibilityElementImpl*> (element.__pAccessibilityElementImpl);
193 const _AccessibilityElementImpl*
194 _AccessibilityElementImpl::GetInstance(const AccessibilityElement& element)
196 return static_cast<_AccessibilityElementImpl*> (element.__pAccessibilityElementImpl);