Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / FUiAccessibilityElement.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.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
8 //
9 //     http://floralicense.org/license/
10 //
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.
16 //
17 #include <FBaseString.h>
18 #include <FGrpRectangle.h>
19 #include <FUiAccessibilityElement.h>
20 #include <FBaseSysLog.h>
21 #include "FUi_AccessibilityElementImpl.h"
22
23 using namespace Tizen::Base;
24 using namespace Tizen::Graphics;
25
26 namespace Tizen { namespace Ui {
27 AccessibilityElement::AccessibilityElement(void)
28         :__pAccessibilityElementImpl(null)
29 {
30 }
31 AccessibilityElement::~AccessibilityElement(void)
32 {
33         delete __pAccessibilityElementImpl;
34         __pAccessibilityElementImpl = null;
35 }
36 result
37 AccessibilityElement::Construct(const Rectangle& bounds, const String& name)
38 {
39         ClearLastResult();
40         SysAssertf(__pAccessibilityElementImpl == null,
41                                   "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
42         __pAccessibilityElementImpl = new (std::nothrow) _AccessibilityElementImpl(*this);
43         SysTryReturn(NID_UI, __pAccessibilityElementImpl, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed");
44         return __pAccessibilityElementImpl->Construct(name, bounds);
45 }
46
47 void
48 AccessibilityElement::SetBounds(const Rectangle& bounds)
49 {
50         SysAssertf(__pAccessibilityElementImpl != null, "Not yet constructed. Construct() should be called before use.");
51         ClearLastResult();
52         return __pAccessibilityElementImpl->SetBounds(bounds);
53 }
54 void
55 AccessibilityElement::SetLabel(const String& label)
56 {
57         SysAssertf(__pAccessibilityElementImpl != null, "Not yet constructed. Construct() should be called before use.");
58         ClearLastResult();
59         return __pAccessibilityElementImpl->SetLabel(label);
60 }
61 void
62 AccessibilityElement::SetHint(const String& hint)
63 {
64         SysAssertf(__pAccessibilityElementImpl != null, "Not yet constructed. Construct() should be called before use.");
65         ClearLastResult();
66         return __pAccessibilityElementImpl->SetHint(hint);
67 }
68 void
69 AccessibilityElement::SetTrait(const String& trait)
70 {
71         SysAssertf(__pAccessibilityElementImpl != null, "Not yet constructed. Construct() should be called before use.");
72         return __pAccessibilityElementImpl->SetTrait(trait);
73 }
74 void
75 AccessibilityElement::SetValue(const Tizen::Base::String& value)
76 {
77         SysAssertf(__pAccessibilityElementImpl != null, "Not yet constructed. Construct() should be called before use.");
78         return __pAccessibilityElementImpl->SetValue(value);
79 }
80 String
81 AccessibilityElement::GetName(void) const
82 {
83         SysAssertf(__pAccessibilityElementImpl != null, "Not yet constructed. Construct() should be called before use.");
84         return __pAccessibilityElementImpl->GetName();
85 }
86 Rectangle
87 AccessibilityElement::GetBounds(void) const
88 {
89         SysAssertf(__pAccessibilityElementImpl != null, "Not yet constructed. Construct() should be called before use.");
90         return __pAccessibilityElementImpl->GetBounds();
91 }
92 String
93 AccessibilityElement::GetLabel(void) const
94 {
95         SysAssertf(__pAccessibilityElementImpl != null, "Not yet constructed. Construct() should be called before use.");
96         return __pAccessibilityElementImpl->GetLabel();
97 }
98 String
99 AccessibilityElement::GetHint(void) const
100 {
101         SysAssertf(__pAccessibilityElementImpl != null, "Not yet constructed. Construct() should be called before use.");
102         return __pAccessibilityElementImpl->GetHint();
103 }
104 String
105 AccessibilityElement::GetTrait(void) const
106 {
107         SysAssertf(__pAccessibilityElementImpl != null, "Not yet constructed. Construct() should be called before use.");
108         return __pAccessibilityElementImpl->GetTraitString();
109 }
110 Tizen::Base::String
111 AccessibilityElement::GetValue(void) const
112 {
113         SysAssertf(__pAccessibilityElementImpl != null, "Not yet constructed. Construct() should be called before use.");
114         return __pAccessibilityElementImpl->GetValue();
115 }
116
117 }} //Tizen::Ui