Tizen 2.1 base
[framework/osp/uifw.git] / src / graphics / text / FGrp_TextTextElement.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
18 /*
19  * @file        FGrp_TextTextElement.cpp
20  * @brief       This is the implementation file for TextElement class.
21  */
22
23 #include <new>
24 #include <FBaseSysLog.h>
25 #include "FGrp_TextTextElement.h"
26
27 namespace Tizen { namespace Graphics
28 {
29
30 namespace _Text
31 {
32
33 TextElement::TextElement(void)
34 {
35         _type = TEXT_ELEMENT_TYPE_NONE;
36         _sourceType = TEXT_ELEMENT_SOURCE_TYPE_INTERNAL;
37         _length = 0;
38         _hasFocus = false;
39         _isAlternateLookEnabled = false;
40         _alternativeColor = Color::GetColor(COLOR_ID_GREY);
41 }
42
43 TextElement::~TextElement(void)
44 {
45
46 }
47
48 void
49 TextElement::CopyMembers(TextElement* pTargetTextElement)
50 {
51         SysTryReturn(NID_GRP
52                         , pTargetTextElement
53                         , , E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
54
55         pTargetTextElement->SetFocused(_hasFocus);
56         pTargetTextElement->SetAlternateLookEnabled(_isAlternateLookEnabled);
57         pTargetTextElement->SetAlternativeForegroundColor(_alternativeColor);
58 }
59
60 void
61 TextElement::SetTextLength(int length)
62 {
63         _length = length;
64 }
65
66 int
67 TextElement::ForwardAnalyze(int startTextIndex, int textLength, int maxWidth, TextObjectWrapType wrap,
68                 int& actualLength, int& width,  int& height)
69 {
70         return -1;
71 }
72
73 result
74 TextElement::Draw(_CanvasImpl& canvasImpl, Rectangle& displayRect, int startTextIndex,
75                 int textLength, const TextObjectAlignment alignment, const TextObjectActionType action)
76 {
77         return E_SYSTEM;
78 }
79
80 TextElement*
81 TextElement::CloneN(TextComponentInfoValueType type, unsigned int value)
82 {
83         return null;
84 }
85
86 TextElement*
87 TextElement::CopyN(int textStart, int textLength)
88 {
89         return null;
90 }
91
92 result
93 TextElement::GetRegion(int textIndex, int textLength, int& width, int& height) const
94 {
95         return E_SYSTEM;
96 }
97
98 result
99 TextElement::GetBlockRegion(int textIndex, int textLength, int& width, int& height) const
100 {
101         return E_SYSTEM;
102 }
103
104 int
105 TextElement::GetHeight(void) const
106 {
107         return -1;
108 }
109
110 int
111 TextElement::GetTextLength(void) const
112 {
113         return _length;
114 }
115
116 unsigned int
117 TextElement::GetValue(TextComponentInfoValueType type) const
118 {
119         return 0;
120 }
121
122 result
123 TextElement::SetValue(TextComponentInfoValueType type, unsigned int value)
124 {
125         return E_SYSTEM;
126 }
127
128 TextElementType
129 TextElement::GetType(void) const
130 {
131         return _type;
132 }
133
134 TextElementSourceType
135 TextElement::GetSourceType(void) const
136 {
137         return _sourceType;
138 }
139
140 bool
141 TextElement::SetFocused(bool hasFocus)
142 {
143         _hasFocus = hasFocus;
144         return true;
145 }
146
147 bool
148 TextElement::GetFocused(void) const
149 {
150         return _hasFocus;
151 }
152
153 void
154 TextElement::SetAlternateLookEnabled(bool enable)
155 {
156         _isAlternateLookEnabled = enable;
157 }
158
159 bool
160 TextElement::IsAlternateLookEnabled(void) const
161 {
162         return _isAlternateLookEnabled;
163 }
164
165 void
166 TextElement::SetAlternativeForegroundColor(const Color& foregroundColor)
167 {
168         _alternativeColor = foregroundColor;
169 }
170
171 Color
172 TextElement::GetAlternativeForegroundColor(void) const
173 {
174         return _alternativeColor;
175 }
176
177 int
178 TextElement::GetBaseline(void) const
179 {
180         return -1;
181 }
182 void
183 TextElement::SetForegroundColor(const Color& color)
184 {
185         return;
186 }
187
188 Color
189 TextElement::GetForegroundColor(void) const
190 {
191         return Color::GetColor(COLOR_ID_BLACK);
192 }
193
194 void
195 TextElement::SetBackgroundColor(const Color& color)
196 {
197         return;
198 }
199
200 Color
201 TextElement::GetBackgroundColor(void) const
202 {
203         return Color::GetColor(COLOR_ID_WHITE);
204 }
205
206 void
207 TextElement::SetBackGroundDrawingModeEnabled(bool enable)
208 {
209         return;
210 }
211
212 bool
213 TextElement::IsBackGroundDrawingModeEnable(void) const
214 {
215         return false;
216 }
217
218 }}} // Tizen::Graphics::_Text