1c3303b822b83c43a8adde87abb1a170cec0be38
[framework/osp/uifw.git] / src / ui / controls / FUiCtrl_Edit.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0/
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                FUiCtrl_Edit.cpp
20  * @brief               This is the implementation file for the _Edit class.
21  */
22
23 #include <FBaseErrorDefine.h>
24 #include <FBaseSysLog.h>
25 #include <FGrpFont.h>
26 #include <FGrp_BitmapImpl.h>
27 #include <FGrp_FontImpl.h>
28 #include <FSys_SettingInfoImpl.h>
29 #include "FUi_AccessibilityContainer.h"
30 #include "FUi_AccessibilityElement.h"
31 #include "FUi_CoordinateSystemUtils.h"
32 #include "FUi_IAccessibilityListener.h"
33 #include "FUi_UiEventManager.h"
34 #include "FUiAnim_VisualElement.h"
35 #include "FUiCtrl_Edit.h"
36 #include "FUiCtrl_EditPresenter.h"
37 #include "FUiCtrl_ScrollPanel.h"
38
39 using namespace Tizen::Base;
40 using namespace Tizen::Base::Runtime;
41 using namespace Tizen::Base::Utility;
42 using namespace Tizen::Graphics;
43 using namespace Tizen::Ui;
44 using namespace Tizen::Ui::Animations;
45 using namespace Tizen::Locales;
46 using namespace Tizen::Graphics::_Text;
47 using namespace Tizen::Base::Collection;
48 using namespace Tizen::System;
49
50 namespace Tizen { namespace Ui { namespace Controls
51 {
52 const int EDIT_GESTURE_TAP_INTERVAL = 400;
53 const int EDIT_GESTURE_TAP_MOVE_ALLOWANCE = 50;
54
55 class _EditInternalTouchEventListener
56         : public _ITouchEventListener
57         , virtual public _IUiEventListener
58         , virtual public Tizen::Base::Runtime::IEventListener
59 {
60 // Operation
61 public:
62         _EditInternalTouchEventListener(const _Edit& edit);
63         /**
64         * This is the destructor for this class.
65         */
66         virtual ~_EditInternalTouchEventListener(void) {}
67
68         /**
69          * Notifies when an entity is touch pressed.
70          *
71          * @param[in]   source                  The source of the event
72          * @param[in]   currentPosition The current position
73          * @param[in]   touchInfo               The touch event information
74          */
75         virtual bool OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo);
76
77         /**
78          * Notifies when an entity is touch released.
79          *
80          * @param[in]   source                  The source of the event
81          * @param[in]   currentPosition The current position
82          * @param[in]   touchInfo               The touch event information
83          */
84         virtual bool OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo);
85
86         /**
87          * Notifies when an entity is touch moved.
88          *
89          * @param[in]   source                  The source of the event
90          * @param[in]   currentPosition The current position
91          * @param[in]   touchInfo               The touch event information
92          */
93         virtual bool OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo);
94
95         /**
96          * Notifies when an entity is touch cancelled.
97          *
98          * @param[in]   source                  The source of the event
99          * @param[in]   currentPosition The current position
100          * @param[in]   touchInfo               The touch event information
101          */
102         virtual bool OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo){return false;};
103
104 private:
105         _Edit* __pEdit;
106 }; // _ITouchEventListener
107
108 _EditInternalTouchEventListener::_EditInternalTouchEventListener(const _Edit& edit)
109 {
110         __pEdit = const_cast< _Edit* >(&edit);
111 }
112
113 bool
114 _EditInternalTouchEventListener::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
115 {
116         _EditPresenter* pEditPresenter = __pEdit->GetPresenter();
117         SysTryReturn(NID_UI_CTRL, pEditPresenter, false, E_INVALID_STATE, "[E_INVALID_STATE] pEditPresenter is null.");
118
119         if (pEditPresenter->IsCopyPasteManagerExist())
120         {
121                 pEditPresenter->FinishTextComposition();
122                 if (pEditPresenter->IsCopyPastePopup(source))
123                 {
124                         return false; // CopyPastePopup is touched
125                 }
126                 else if (pEditPresenter->IsCopyPasteHandle(source))
127                 {
128                         pEditPresenter->ReleaseCopyPastePopup();
129                         return false;
130                 }
131                 else if (pEditPresenter->IsCopyPastePopupExist())
132                 {
133                         return true;
134                 }
135                 else
136                 {
137                         return false;
138                 }
139         }
140         return false;
141 }
142
143 bool
144 _EditInternalTouchEventListener::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
145 {
146         _EditPresenter* pEditPresenter = __pEdit->GetPresenter();
147         SysTryReturn(NID_UI_CTRL, pEditPresenter, false, E_INVALID_STATE, "[E_INVALID_STATE] pEditPresenter is null.");
148
149         if (pEditPresenter->IsCopyPasteManagerExist())
150         {
151                 if (!pEditPresenter->IsCopyPastePopup(source) && !pEditPresenter->IsCopyPasteHandle(source))
152                 {
153                         if (pEditPresenter->IsCopyPastePopupExist())
154                         {
155                                 return true;
156                         }
157                         else if (__pEdit == &source)
158                         {
159                                 return false;
160                         }
161                         else
162                         {
163                                 pEditPresenter->InitializeCopyPasteManager();
164                                 return false;
165                         }
166                 }
167         }
168         return false;
169 }
170
171 bool
172 _EditInternalTouchEventListener::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
173 {
174         _EditPresenter* pEditPresenter = __pEdit->GetPresenter();
175         SysTryReturn(NID_UI_CTRL, pEditPresenter, false, E_INVALID_STATE, "[E_INVALID_STATE] pEditPresenter is null.");
176
177         if (pEditPresenter->IsCopyPasteManagerExist())
178         {
179                 if (!pEditPresenter->IsCopyPastePopup(source) && !pEditPresenter->IsCopyPasteHandle(source))
180                 {
181                         if (pEditPresenter->IsCopyPastePopupExist())
182                         {
183                                 if (pEditPresenter->IsCopyPasteHandleExist())
184                                 {
185                                         pEditPresenter->ReleaseCopyPastePopup();
186                                         return true;
187                                 }
188                                 else
189                                 {
190                                         pEditPresenter->InitializeCopyPasteManager();
191                                         return false;
192                                 }
193                         }
194                         else if (__pEdit == &source)
195                         {
196                                 return false;
197                         }
198                         else if (pEditPresenter->IsCopyPasteHandleExist())
199                         {
200                                 pEditPresenter->InitializeCopyPasteManager();
201                                 return false;
202                         }
203                 }
204         }
205
206         return false;
207 }
208
209 IMPLEMENT_PROPERTY(_Edit);
210
211 _Edit::_Edit(void)
212         : _pEditPresenter(null)
213         , __bottomMargin(-1.0f)
214         , __leftMargin(-1.0f)
215         , __lineSpacing(-1.0f)
216         , __rightMargin(-1.0f)
217         , __textSize(-1.0f)
218         , __topMargin(-1.0f)
219         , __editStyle(EDIT_STYLE_NORMAL)
220         , __borderRoundStyle(false)
221         , __ellipsisPosition(ELLIPSIS_POSITION_END)
222         , __inputStyle(INPUT_STYLE_OVERLAY)
223         , __isConstructed(false)
224         , __guideTextColor(Color())
225         , __pressedGuideTextColor(Color())
226         , __isSettingGuideTextColor(false)
227         , __pDefaultBackgroundEffectBitmap(null)
228         , __pDefaultFocusBitmap(null)
229         , __pGestureFlick(null)
230         , __pGestureLongPress(null)
231         , __pGestureTap(null)
232         , __pEditInternalTouchEventListener(null)
233         , __pExpandableEditAreaEvent(null)
234         , __pKeypadEvent(null)
235         , __pLanguageEvent(null)
236         , __pLinkEvent(null)
237         , __pScrollPanelEvent(null)
238         , __pTextBlockEvent(null)
239         , __pTextEvent(null)
240         , __pTextAccessibilityElement(null)
241         , __pClearButtonTextAccessibilityElement(null)
242         , __pToolbarAccessibilityElement(null)
243         , __isAccessibilityCreated(false)
244         , __isFullScreenKeypadEdit(false)
245         , __internalFocus(false)
246         , __isDestroyed(false)
247         , __pTextFilter(null)
248         , __previousBounds()
249         , __isTouchMoving(false)
250         , __isSearchFieldFocused(false)
251         , __isTextEventEnabled(true)
252 {
253         for (int status = 0; status < EDIT_COLOR_MAX; status++)
254         {
255                 __pBackgroundBitmap[status] = null;
256         }
257
258         for (int status = 0; status < EDIT_COLOR_MAX; status++)
259         {
260                 __pDefaultBackgroundBitmap[status] = null;
261         }
262
263         __blockTextColor.used = false;
264         __blockTextColor.blockTextColor = Color();
265 }
266
267 _Edit::~_Edit(void)
268 {
269         delete _pEditPresenter;
270         _pEditPresenter = null;
271
272         for (int status = 0; status < EDIT_COLOR_MAX; status++)
273         {
274                 if (__pBackgroundBitmap[status])
275                 {
276                         delete __pBackgroundBitmap[status];
277                         __pBackgroundBitmap[status] = null;
278                 }
279
280                 if (__pDefaultBackgroundBitmap[status])
281                 {
282                         delete __pDefaultBackgroundBitmap[status];
283                         __pDefaultBackgroundBitmap[status] = null;
284                 }
285         }
286
287         if (__pDefaultBackgroundEffectBitmap)
288         {
289                 delete __pDefaultBackgroundEffectBitmap;
290                 __pDefaultBackgroundEffectBitmap = null;
291         }
292
293         if (__pDefaultFocusBitmap)
294         {
295                 delete __pDefaultFocusBitmap;
296                 __pDefaultFocusBitmap = null;
297         }
298
299         if (__pTextBlockEvent)
300         {
301                 delete __pTextBlockEvent;
302                 __pTextBlockEvent = null;
303         }
304
305         if (__pLinkEvent)
306         {
307                 delete __pLinkEvent;
308                 __pLinkEvent = null;
309         }
310
311         if (__pKeypadEvent)
312         {
313                 delete __pKeypadEvent;
314                 __pKeypadEvent = null;
315         }
316
317         if (__pScrollPanelEvent)
318         {
319                 delete __pScrollPanelEvent;
320                 __pScrollPanelEvent = null;
321         }
322
323         if (__pLanguageEvent)
324         {
325                 delete __pLanguageEvent;
326                 __pLanguageEvent = null;
327         }
328
329         if (__pGestureFlick)
330         {
331                 _ITouchFlickGestureEventListener* pListener = dynamic_cast< _ITouchFlickGestureEventListener* >(this);
332                 __pGestureFlick->RemoveGestureListener(*pListener);
333                 RemoveGestureDetector(*__pGestureFlick);
334                 delete __pGestureFlick;
335                 __pGestureFlick = null;
336         }
337
338         if (__pGestureLongPress)
339         {
340                 _ITouchLongPressGestureEventListener* pListener = dynamic_cast< _ITouchLongPressGestureEventListener* >(this);
341                 __pGestureLongPress->RemoveGestureListener(*pListener);
342                 RemoveGestureDetector(*__pGestureLongPress);
343                 delete __pGestureLongPress;
344                 __pGestureLongPress = null;
345         }
346
347         if (__pGestureTap)
348         {
349                 _ITouchTapGestureEventListener* pListener = dynamic_cast< _ITouchTapGestureEventListener* >(this);
350                 __pGestureTap->RemoveGestureListener(*pListener);
351                 RemoveGestureDetector(*__pGestureTap);
352                 delete __pGestureTap;
353                 __pGestureTap = null;
354         }
355
356         if (__pEditInternalTouchEventListener)
357         {
358                 _UiEventManager::GetInstance()->RemoveTouchEventListener(*__pEditInternalTouchEventListener);
359                 delete __pEditInternalTouchEventListener;
360                 __pEditInternalTouchEventListener = null;
361         }
362
363         if (__pTextEvent)
364         {
365                 delete __pTextEvent;
366                 __pTextEvent = null;
367         }
368
369         if (__pExpandableEditAreaEvent)
370         {
371                 delete __pExpandableEditAreaEvent;
372                 __pExpandableEditAreaEvent = null;
373         }
374
375         if (__pTextAccessibilityElement)
376         {
377                 __pTextAccessibilityElement->Activate(false);
378                 __pTextAccessibilityElement = null;
379         }
380         if (__pClearButtonTextAccessibilityElement)
381         {
382                 __pClearButtonTextAccessibilityElement->Activate(false);
383                 __pClearButtonTextAccessibilityElement = null;
384         }
385         if (__pToolbarAccessibilityElement)
386         {
387                 __pToolbarAccessibilityElement->Activate(false);
388                 __pToolbarAccessibilityElement = null;
389         }
390
391         _SettingInfoImpl::RemoveSettingEventListenerForInternal(*this);
392 }
393
394 _Edit*
395 _Edit::CreateEditN(void)
396 {
397         _EditPresenter* pPresenter = _EditPresenter::CreateInstanceN();
398         if (pPresenter == null)
399         {
400                 SetLastResult(E_OUT_OF_MEMORY);
401
402                 return null;
403         }
404
405         result r = E_SUCCESS;
406         _VisualElement* pBaseVisualElement = null;
407         _Edit* pEdit = new (std::nothrow) _Edit;
408         SysTryCatch(NID_UI_CTRL, pEdit, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
409
410         pBaseVisualElement = pEdit->GetVisualElement();
411         if (pBaseVisualElement)
412         {
413                 r = pBaseVisualElement->SetSurfaceOpaque(false);
414                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
415         }
416
417         pEdit->AcquireHandle();
418
419         r = pEdit->SetPresenter(*pPresenter);
420         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
421
422         return pEdit;
423
424 CATCH:
425         delete pPresenter;
426         delete pEdit;
427
428         return null;
429 }
430
431 result
432 _Edit::Initialize(int editStyle, InputStyle inputStyle, int limitLength, GroupStyle groupStyle)
433 {
434         result r = E_SUCCESS;
435
436         SetEditStyle(editStyle);
437
438         r = LoadDefaultBackgroundBitmap(groupStyle);
439         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Failed to load Bitmaps", GetErrorMessage(r));
440
441         InitializeColorInformation();
442
443         r = _pEditPresenter->Initialize(*this);
444         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Failed to construct", GetErrorMessage(r));
445
446         r = _pEditPresenter->SetTextLimitLength(limitLength);
447         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Failed to set limit length", GetErrorMessage(r));
448
449         __inputStyle = inputStyle;
450         if (inputStyle == INPUT_STYLE_OVERLAY)
451         {
452                 if (!(editStyle & EDIT_STYLE_FLEXIBLE) && !(editStyle & EDIT_STYLE_VIEWER))
453                 {
454                         _pEditPresenter->SetKeypadCommandButtonVisible(true);
455                 }
456         }
457
458         _pEditPresenter->SetEditGroupStyle(groupStyle);
459
460         __textSize = _pEditPresenter->GetTextSize();
461
462         __pGestureFlick = new (std::nothrow) _TouchFlickGestureDetector;
463         SysTryReturn(NID_UI_CTRL, __pGestureFlick, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to create touch flick gesture.");
464         r = AddGestureDetector(*__pGestureFlick);
465         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Failed to add gesture listener", GetErrorMessage(r));
466         r = __pGestureFlick->AddGestureListener(*this);
467         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Failed to add gesture listener", GetErrorMessage(r));
468
469         __pGestureLongPress = new (std::nothrow) _TouchLongPressGestureDetector;
470         SysTryReturn(NID_UI_CTRL, __pGestureLongPress, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to create touch long press gesture.");
471         r = AddGestureDetector(*__pGestureLongPress);
472         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Failed to add gesture detector", GetErrorMessage(r));
473         r = __pGestureLongPress->AddGestureListener(*this);
474         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Failed to add gesture listener", GetErrorMessage(r));
475
476         __pGestureTap = new (std::nothrow) _TouchTapGestureDetector;
477         SysTryReturn(NID_UI_CTRL, __pGestureTap, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to create touch tap gesture.");
478
479         r = __pGestureTap->SetTapInterval(EDIT_GESTURE_TAP_INTERVAL);
480         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Failed to set TapInterval", GetErrorMessage(r));
481
482         r = __pGestureTap->SetMoveAllowance(EDIT_GESTURE_TAP_MOVE_ALLOWANCE);
483         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Failed to set TapMoveAllowance", GetErrorMessage(r));
484
485         r = AddGestureDetector(*__pGestureTap);
486         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Failed to add gesture detector", GetErrorMessage(r));
487         r = __pGestureTap->AddGestureListener(*this);
488         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Failed to add gesture listener", GetErrorMessage(r));
489
490         __pEditInternalTouchEventListener = new (std::nothrow) _EditInternalTouchEventListener(*this);
491         SysTryReturn(NID_UI_CTRL, __pEditInternalTouchEventListener, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to create internal touch listener.");
492         r = _UiEventManager::GetInstance()->AddTouchEventListener(*__pEditInternalTouchEventListener);
493         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Unable to add internal event listener", GetErrorMessage(r));
494
495         __isConstructed = true;
496
497         _AccessibilityContainer* pEditAccessibilityContainer = GetAccessibilityContainer();
498         if (pEditAccessibilityContainer)
499         {
500                 pEditAccessibilityContainer->Activate(true);
501         }
502         if (pEditAccessibilityContainer)
503         {
504                 __pTextAccessibilityElement = new _AccessibilityElement(true);
505                 __pTextAccessibilityElement->SetBounds(FloatRectangle(0.0f, 0.0f, GetBoundsF().width, GetBoundsF().height));
506
507                 if ((GetEditStyle() & EDIT_STYLE_TITLE_TOP) || (GetEditStyle() & EDIT_STYLE_TITLE_LEFT))
508                 {
509                         __pTextAccessibilityElement->SetLabel(GetTitleText() + GetGuideText() + GetText());
510                 }
511                 else
512                 {
513                         __pTextAccessibilityElement->SetLabel(GetGuideText() + GetText());
514                 }
515
516                 __pTextAccessibilityElement->SetTrait(L"Edit Field");
517                 __pTextAccessibilityElement->SetName(L"EditText");
518                 pEditAccessibilityContainer->AddElement(*__pTextAccessibilityElement);
519
520                 if (__editStyle & EDIT_STYLE_CLEAR && GetTextLength())
521                 {
522                         __pClearButtonTextAccessibilityElement = new _AccessibilityElement(true);
523                         __pClearButtonTextAccessibilityElement->SetBounds(_pEditPresenter->GetClearIconBoundsF());
524                         __pClearButtonTextAccessibilityElement->SetLabel(L"all clear");
525                         __pClearButtonTextAccessibilityElement->SetTraitWithStringId("IDS_TPLATFORM_BODY_BUTTON_T_TTS");
526                         __pClearButtonTextAccessibilityElement->SetName(L"EditFieldClearButton");
527                         pEditAccessibilityContainer->AddElement(*__pClearButtonTextAccessibilityElement);
528                 }
529
530                 __isAccessibilityCreated = true;
531         }
532
533         r = _SettingInfoImpl::AddSettingEventListenerForInternal(*this);
534         SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
535
536         return r;
537 }
538
539 void
540 _Edit::InitializeColorInformation(void)
541 {
542         GET_COLOR_CONFIG(EDIT::BG_NORMAL, __color[EDIT_STATUS_NORMAL].backgroundColor);
543         GET_COLOR_CONFIG(EDIT::BG_PRESSED, __color[EDIT_STATUS_PRESSED].backgroundColor);
544         GET_COLOR_CONFIG(EDIT::BG_HIGHLIGHTED, __color[EDIT_STATUS_HIGHLIGHTED].backgroundColor);
545         GET_COLOR_CONFIG(EDIT::BG_DISABLED, __color[EDIT_STATUS_DISABLED].backgroundColor);
546
547         GET_COLOR_CONFIG(EDIT::TITLE_TEXT_NORMAL, __color[EDIT_STATUS_NORMAL].titleTextColor);
548         GET_COLOR_CONFIG(EDIT::TITLE_TEXT_PRESSED, __color[EDIT_STATUS_PRESSED].titleTextColor);
549         GET_COLOR_CONFIG(EDIT::TITLE_TEXT_HIGHLIGHTED, __color[EDIT_STATUS_HIGHLIGHTED].titleTextColor);
550         GET_COLOR_CONFIG(EDIT::TITLE_TEXT_DISABLED, __color[EDIT_STATUS_DISABLED].titleTextColor);
551
552         GET_COLOR_CONFIG(EDIT::TEXT_NORMAL, __color[EDIT_STATUS_NORMAL].textColor);
553         GET_COLOR_CONFIG(EDIT::TEXT_PRESSED, __color[EDIT_STATUS_PRESSED].textColor);
554         GET_COLOR_CONFIG(EDIT::TEXT_HIGHLIGHTED, __color[EDIT_STATUS_HIGHLIGHTED].textColor);
555         GET_COLOR_CONFIG(EDIT::TEXT_DISABLED, __color[EDIT_STATUS_DISABLED].textColor);
556
557         GET_COLOR_CONFIG(EDIT::GUIDE_TEXT_NORMAL, __guideTextColor);
558
559         memset(__cutlinkColor, 0, sizeof(EditCutlinkColor) * EDIT_LINK_TYPE_MAX);
560         for (int i = 0; i < EDIT_LINK_TYPE_MAX; i++)
561         {
562                 EditCutLinkType type = (EditCutLinkType) i;
563                 GET_COLOR_CONFIG(EDIT::CUT_LINK_TEXT_NORMAL, __cutlinkColor[type].cutlinkFgColor);
564                 GET_COLOR_CONFIG(EDIT::CUT_LINK_BG_NORMAL, __cutlinkColor[type].cutlinkBgColor);
565         }
566
567         return;
568 }
569
570 result
571 _Edit::SetPresenter(const _EditPresenter& pPresenter)
572 {
573         result r = E_SUCCESS;
574
575         _pEditPresenter = const_cast< _EditPresenter* >(&pPresenter);
576
577         return r;
578 }
579
580 _EditPresenter*
581 _Edit::GetPresenter(void) const
582 {
583         return _pEditPresenter;
584 }
585
586 FloatDimension
587 _Edit::GetContentSizeInternalF(bool horizontalMode, bool verticalMode) const
588 {
589         if (!GetTextLength())
590         {
591                 return FloatDimension(GetBoundsF().width, GetBoundsF().height);
592         }
593
594         FloatDimension dimension(0.0f, 0.0f);
595         float textLeftMargin = 0.0f;
596         float textRightMargin = 0.0f;
597         float textTopMargin = 0.0f;
598         float textBottomMargin = 0.0f;
599
600         _ControlOrientation orientation = GetOrientation();
601         GET_SHAPE_CONFIG(EDIT::AREA_TEXT_LEFT_MARGIN, orientation, textLeftMargin);
602         GET_SHAPE_CONFIG(EDIT::AREA_TEXT_RIGHT_MARGIN, orientation, textRightMargin);
603         GET_SHAPE_CONFIG(EDIT::AREA_TEXT_TOP_MARGIN, orientation, textTopMargin);
604         GET_SHAPE_CONFIG(EDIT::AREA_TEXT_BOTTOM_MARGIN, orientation, textBottomMargin);
605
606         TextObject* pTextObject = _pEditPresenter->GetTextObject();
607
608         if (!pTextObject)
609         {
610                 return FloatDimension(GetBoundsF().width, GetBoundsF().height);
611         }
612
613         // store
614         TextObjectActionType previousActionType = pTextObject->GetAction();
615         TextObjectWrapType previousWrapType = pTextObject->GetWrap();
616         FloatRectangle previousRect = pTextObject->GetBoundsF();
617         FloatRectangle newRect = previousRect;
618
619         bool fitToHorizontal = horizontalMode;
620         bool fitToVertical = verticalMode;
621
622         if (fitToHorizontal)
623         {
624                 if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
625                 {
626                         newRect.width = _ControlManager::GetInstance()->GetScreenSizeF().width;
627                 }
628                 else
629                 {
630                         newRect.width = _ControlManager::GetInstance()->GetScreenSizeF().height;
631                 }
632                 newRect.width -= (GetBoundsF().x + textLeftMargin + textRightMargin);
633         }
634         if (fitToVertical)
635         {
636                 if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
637                 {
638                         newRect.height = _ControlManager::GetInstance()->GetScreenSizeF().height;
639                 }
640                 else
641                 {
642                         newRect.height = _ControlManager::GetInstance()->GetScreenSizeF().width;
643                 }
644                 newRect.height -= (GetBoundsF().y + textTopMargin + textBottomMargin);
645         }
646
647         pTextObject->SetBounds(newRect);
648         pTextObject->SetAction(TEXT_OBJECT_ACTION_TYPE_NONE);
649         pTextObject->SetWrap(TEXT_OBJECT_WRAP_TYPE_WORD);
650         pTextObject->Compose();
651
652         if (fitToHorizontal && fitToVertical)
653         {
654                 dimension = pTextObject->GetTextExtentF(0, pTextObject->GetTextLength());
655                 if (dimension.width > newRect.width)
656                 {
657                         dimension.width = newRect.width;
658                 }
659                 float height = pTextObject->GetTotalHeightF();
660                 if (height <= newRect.height)
661                 {
662                         dimension.height = height;
663                 }
664                 else
665                 {
666                         dimension.height = newRect.height;
667                 }
668         }
669         else if (fitToHorizontal)
670         {
671                 dimension = pTextObject->GetTextExtentF(0, pTextObject->GetTextLength());
672                 if (dimension.width > newRect.width)
673                 {
674                         dimension.width = newRect.width;
675                 }
676                 dimension.height = GetBoundsF().height;
677         }
678         else if (fitToVertical)
679         {
680                 float height = pTextObject->GetTotalHeightF();
681                 if (height <= newRect.height)
682                 {
683                         dimension.height = height;
684                 }
685                 else
686                 {
687                         dimension.height = newRect.height;
688                 }
689                 dimension.width = GetBoundsF().width;
690         }
691
692         // restore
693         pTextObject->SetBounds(previousRect);
694         pTextObject->SetAction(previousActionType);
695         pTextObject->SetWrap(previousWrapType);
696         pTextObject->Compose();
697
698         if (fitToHorizontal)
699         {
700                 dimension.width += textLeftMargin + textRightMargin;
701         }
702         if (fitToVertical)
703         {
704                 dimension.height += textTopMargin + textBottomMargin;
705         }
706
707         return dimension;
708 }
709
710 bool
711 _Edit::IsInternalFocused(void) const
712 {
713         return __internalFocus;
714 }
715
716 HorizontalAlignment
717 _Edit::GetTextAlignment(void) const
718 {
719         return _pEditPresenter->GetTextAlignment();
720 }
721
722 result
723 _Edit::SetTextAlignment(HorizontalAlignment alignment)
724 {
725         return _pEditPresenter->SetTextAlignment(alignment);
726 }
727
728 bool
729 _Edit::IsViewModeEnabled(void) const
730 {
731         Variant var = GetProperty("viewModeEnabled");
732
733         return var.ToBool();
734 }
735
736 result
737 _Edit::SetViewModeEnabled(bool enable)
738 {
739         Variant var(enable);
740
741         return SetProperty("viewModeEnabled", var);
742 }
743
744 result
745 _Edit::SetAutoLinkMask(unsigned long autoLinks)
746 {
747         SysTryReturn(NID_UI_CTRL, (__inputStyle == INPUT_STYLE_OVERLAY), E_UNSUPPORTED_OPERATION, E_UNSUPPORTED_OPERATION, "[E_UNSUPPORTED_OPERATION] The current state unable to this operation.");
748         Variant var(autoLinks);
749
750         return SetProperty("autoLinkMask", var);
751 }
752
753 unsigned long
754 _Edit::GetAutoLinkMask(void) const
755 {
756         SysTryReturn(NID_UI_CTRL, (__inputStyle == INPUT_STYLE_OVERLAY), LINK_TYPE_NONE, E_UNSUPPORTED_OPERATION, "[E_UNSUPPORTED_OPERATION] The current state unable to this operation.");
757         Variant var = GetProperty("autoLinkMask");
758
759         return var.ToULong();
760 }
761
762 int
763 _Edit::GetLineSpacing(void) const
764 {
765         return _pEditPresenter->GetLineSpacing();
766 }
767
768 float
769 _Edit::GetLineSpacingF(void) const
770 {
771         return _pEditPresenter->GetLineSpacingF();
772 }
773
774 result
775 _Edit::SetLineSpacing(int linePixelGap)
776 {
777         return _pEditPresenter->SetLineSpacing(linePixelGap);
778 }
779
780 result
781 _Edit::SetLineSpacing(float linePixelGap)
782 {
783         return _pEditPresenter->SetLineSpacing(linePixelGap);
784 }
785
786 void
787 _Edit::SetMaxLineCount(int maxLineCount)
788 {
789         _pEditPresenter->SetMaxLineCount(maxLineCount);
790
791         return;
792 }
793
794 int
795 _Edit::GetMaxLineCount(void) const
796 {
797         return _pEditPresenter->GetMaxLineCount();
798 }
799
800 int
801 _Edit::GetHorizontalMargin(EditTextHorizontalMargin marginType) const
802 {
803         return _CoordinateSystemUtils::ConvertToInteger(GetHorizontalMarginF(marginType));
804 }
805
806 float
807 _Edit::GetHorizontalMarginF(EditTextHorizontalMargin marginType) const
808 {
809         Variant var;
810
811         switch (marginType)
812         {
813         case EDIT_TEXT_LEFT_MARGIN:
814                 var = GetProperty("leftMargin");
815                 break;
816
817         case EDIT_TEXT_RIGHT_MARGIN:
818                 var = GetProperty("rightMargin");
819                 break;
820
821         case EDIT_TEXT_HORIZONTAL_MARGIN:
822                 var = GetProperty("leftMargin");
823                 break;
824
825         default:
826                 break;
827         }
828
829         return var.ToFloat();
830 }
831
832
833 int
834 _Edit::GetVerticalMargin(EditTextVerticalMargin marginType) const
835 {
836         return _CoordinateSystemUtils::ConvertToInteger(GetVerticalMarginF(marginType));
837 }
838
839 float
840 _Edit::GetVerticalMarginF(EditTextVerticalMargin marginType) const
841 {
842         Variant var;
843
844         switch (marginType)
845         {
846         case EDIT_TEXT_TOP_MARGIN:
847                 var = GetProperty("topMargin");
848                 break;
849
850         case EDIT_TEXT_BOTTOM_MARGIN:
851                 var = GetProperty("bottomMargin");
852                 break;
853
854         case EDIT_TEXT_VERTICAL_MARGIN:
855                 var = GetProperty("topMargin");
856                 break;
857
858         default:
859                 break;
860         }
861
862         return var.ToFloat();
863 }
864
865 result
866 _Edit::SetHorizontalMargin(int margin, EditTextHorizontalMargin marginType)
867 {
868         float floatMargin = _CoordinateSystemUtils::ConvertToFloat(margin);
869
870         return SetHorizontalMargin(floatMargin, marginType);
871 }
872
873 result
874 _Edit::SetHorizontalMargin(float margin, EditTextHorizontalMargin marginType)
875 {
876         result r = E_SUCCESS;
877         Variant var(margin);
878
879         SysTryReturn(NID_UI_CTRL, margin > 0, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The invalid argument is given.");
880
881         switch (marginType)
882         {
883         case EDIT_TEXT_LEFT_MARGIN:
884                 r = SetProperty("leftMargin", var);
885                 break;
886
887         case EDIT_TEXT_RIGHT_MARGIN:
888                 r = SetProperty("rightMargin", var);
889                 break;
890
891         case EDIT_TEXT_HORIZONTAL_MARGIN:
892                 r = SetProperty("leftMargin", var);
893                 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Faild to set margin.");
894                 r = SetProperty("rightMargin", var);
895                 break;
896
897         default:
898                 break;
899         }
900         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Faild to set margin.");
901
902         _pEditPresenter->SetClientBounds();
903         r = _pEditPresenter->SetInitialBounds();
904         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Faild to set margin.");
905
906         return r;
907 }
908
909 result
910 _Edit::SetVerticalMargin(int margin, EditTextVerticalMargin marginType)
911 {
912         float floatMargin = _CoordinateSystemUtils::ConvertToFloat(margin);
913         return SetVerticalMargin(floatMargin, marginType);
914 }
915
916 result
917 _Edit::SetVerticalMargin(float margin, EditTextVerticalMargin marginType)
918 {
919         result r = E_SUCCESS;
920         Variant var(margin);
921
922         SysTryReturn(NID_UI_CTRL, margin > 0, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The invalid argument is given.");
923
924         switch (marginType)
925         {
926         case EDIT_TEXT_TOP_MARGIN:
927                 r = SetProperty("topMargin", var);
928                 break;
929
930         case EDIT_TEXT_BOTTOM_MARGIN:
931                 r = SetProperty("bottomMargin", var);
932                 break;
933
934         case EDIT_TEXT_VERTICAL_MARGIN:
935                 r = SetProperty("topMargin", var);
936                 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Faild to set margin.");
937                 r = SetProperty("bottomMargin", var);
938                 break;
939
940         default:
941                 break;
942         }
943         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Faild to set margin.");
944
945         _pEditPresenter->SetClientBounds();
946         r = _pEditPresenter->SetInitialBounds();
947         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Faild to set margin.");
948
949         return r;
950 }
951
952 int
953 _Edit::GetTextLimitLength(void) const
954 {
955         return _pEditPresenter->GetTextLimitLength();
956 }
957
958 result
959 _Edit::SetLimitLength(int limitLength)
960 {
961         return _pEditPresenter->SetTextLimitLength(limitLength);
962 }
963
964 result
965 _Edit::SetAutoResizingEnabled(bool enable)
966 {
967         Variant var(enable);
968
969         return SetProperty("autoResizingEnabled", var);
970 }
971
972 bool
973 _Edit::IsAutoResizingEnabled(void) const
974 {
975         Variant var = GetProperty("autoResizingEnabled");
976
977         return var.ToBool();
978 }
979
980 CoreKeypadAction
981 _Edit::GetKeypadAction(void) const
982 {
983         Variant var = GetProperty("keypadAction");
984
985         return (CoreKeypadAction) var.ToInt();
986 }
987
988 result
989 _Edit::SetKeypadAction(CoreKeypadAction keypadAction)
990 {
991         SysTryReturn(NID_UI_CTRL, (__inputStyle == INPUT_STYLE_OVERLAY), E_UNSUPPORTED_OPERATION, E_UNSUPPORTED_OPERATION, "[E_UNSUPPORTED_OPERATION] The current state unable to this operation.");
992         Variant var((int) keypadAction);
993
994         return SetProperty("keypadAction", var);
995 }
996
997 result
998 _Edit::SetKeypadActionEnabled(bool enabled)
999 {
1000         Variant var(enabled);
1001
1002         return SetProperty("keypadActionEnabled", var);
1003 }
1004
1005 bool
1006 _Edit::GetKeypadActionEnabled(void) const
1007 {
1008         Variant var = GetProperty("keypadActionEnabled");
1009
1010         return var.ToBool();
1011 }
1012
1013 KeypadStyle
1014 _Edit::GetKeypadStyle(void) const
1015 {
1016         Variant var = GetProperty("keypadStyle");
1017
1018         return (KeypadStyle) var.ToInt();
1019 }
1020
1021 result
1022 _Edit::SetKeypadStyle(KeypadStyle keypadStyle)
1023 {
1024         SysTryReturn(NID_UI_CTRL, (KEYPAD_STYLE_PASSWORD != keypadStyle), E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The invalid argument is given.");
1025         Variant var((int) keypadStyle);
1026
1027         return SetProperty("keypadStyle", var);
1028 }
1029
1030 result
1031 _Edit::SetKeypadNormalNumberStyle(bool enable)
1032 {
1033         return _pEditPresenter->SetKeypadNormalNumberStyle(enable);
1034 }
1035
1036 bool
1037 _Edit::IsTextPredictionEnabled(void) const
1038 {
1039         return _pEditPresenter->IsTextPredictionEnabled();
1040 }
1041
1042 result
1043 _Edit::SetTextPredictionEnabled(bool enable)
1044 {
1045         return _pEditPresenter->SetTextPredictionEnabled(enable);
1046 }
1047
1048 void
1049 _Edit::UpdateAccessibilityElement(EditAccessibilityElementType type)
1050 {
1051         if (!__isAccessibilityCreated)
1052         {
1053                 return;
1054         }
1055
1056         if (__editStyle & EDIT_STYLE_CLEAR)
1057         {
1058                 _AccessibilityContainer* pEditAccessibilityContainer = GetAccessibilityContainer();
1059                 if (pEditAccessibilityContainer)
1060                 {
1061                         if (!GetTextLength())
1062                         {
1063                                 if (__pClearButtonTextAccessibilityElement)
1064                                 {
1065                                         __pClearButtonTextAccessibilityElement->Activate(false);
1066                                 }
1067                         }
1068                         else
1069                         {
1070                                 if (__pClearButtonTextAccessibilityElement && !__pClearButtonTextAccessibilityElement->IsActivated())
1071                                 {
1072                                         __pClearButtonTextAccessibilityElement->Activate(true);
1073                                 }
1074                                 else if (!__pClearButtonTextAccessibilityElement)
1075                                 {
1076                                         __pClearButtonTextAccessibilityElement = new _AccessibilityElement(true);
1077                                         __pClearButtonTextAccessibilityElement->SetBounds(_pEditPresenter->GetClearIconBoundsF());
1078                                         __pClearButtonTextAccessibilityElement->SetLabel(L"all clear");
1079                                         __pClearButtonTextAccessibilityElement->SetTraitWithStringId("IDS_TPLATFORM_BODY_BUTTON_T_TTS");
1080                                         __pClearButtonTextAccessibilityElement->SetName(L"EditFieldClearButton");
1081                                         pEditAccessibilityContainer->AddElement(*__pClearButtonTextAccessibilityElement);
1082                                 }
1083                         }
1084                 }
1085         }
1086
1087         switch (type)
1088         {
1089         case EDIT_ACCESSIBILITY_ELEMENT_TYPE_TEXT:
1090                 if (__pTextAccessibilityElement)
1091                 {
1092                         __pTextAccessibilityElement->SetBounds(FloatRectangle(0.0f, 0.0f, GetBoundsF().width, GetBoundsF().height));
1093                         if ((GetEditStyle() & EDIT_STYLE_TITLE_TOP) || (GetEditStyle() & EDIT_STYLE_TITLE_LEFT))
1094                         {
1095                                 __pTextAccessibilityElement->SetLabel(GetTitleText() + GetGuideText() + GetText());
1096                         }
1097                         else
1098                         {
1099                                 __pTextAccessibilityElement->SetLabel(GetGuideText() + GetText());
1100                         }
1101                 }
1102                 break;
1103
1104         case EDIT_ACCESSIBILITY_ELEMENT_TYPE_CLEAR_ICON:
1105                 if (__pClearButtonTextAccessibilityElement)
1106                 {
1107                         __pClearButtonTextAccessibilityElement->SetBounds(_pEditPresenter->GetClearIconBoundsF());
1108                 }
1109                 break;
1110
1111         default:
1112                 break;
1113         }
1114
1115         return;
1116 }
1117
1118 void
1119 _Edit::SetFullScreenKeypadEdit(bool enabled)
1120 {
1121         __isFullScreenKeypadEdit = enabled;
1122
1123         return;
1124 }
1125
1126 bool
1127 _Edit::IsFullScreenKeypadEdit(void)
1128 {
1129         return __isFullScreenKeypadEdit;
1130 }
1131
1132 result
1133 _Edit::HideKeypad(void)
1134 {
1135         return _pEditPresenter->HideKeypad(true);
1136 }
1137
1138 int
1139 _Edit::GetTextSize(void) const
1140 {
1141         return _CoordinateSystemUtils::ConvertToInteger(GetTextSizeF());
1142 }
1143
1144 float
1145 _Edit::GetTextSizeF(void) const
1146 {
1147         Variant size = GetProperty("textSize");
1148
1149         return size.ToFloat();
1150 }
1151
1152 result
1153 _Edit::SetTextSize(int size)
1154 {
1155         return SetTextSize(_CoordinateSystemUtils::ConvertToFloat(size));
1156 }
1157
1158 result
1159 _Edit::SetTextSize(float size)
1160 {
1161         Variant var(size);
1162
1163         return SetProperty("textSize", Variant(size));
1164 }
1165
1166 Color
1167 _Edit::GetColor(EditStatus status) const
1168 {
1169         Variant color;
1170         switch (status)
1171         {
1172         case EDIT_STATUS_NORMAL:
1173                 color = GetProperty("normalColor");
1174                 break;
1175
1176         case EDIT_STATUS_DISABLED:
1177                 color = GetProperty("disabledColor");
1178                 break;
1179
1180         case EDIT_STATUS_HIGHLIGHTED:
1181                 color = GetProperty("highlightedColor");
1182                 break;
1183
1184         case EDIT_STATUS_PRESSED:
1185                 color = GetProperty("pressedColor");
1186                 break;
1187
1188         default:
1189                 break;
1190         }
1191
1192         return color.ToColor();
1193 }
1194
1195 Color
1196 _Edit::GetTextColor(EditTextColor type) const
1197 {
1198         Variant variantColor;
1199         Color color;
1200         switch (type)
1201         {
1202         case EDIT_TEXT_COLOR_NORMAL:
1203                 variantColor = GetProperty("normalTextColor");
1204                 color = variantColor.ToColor();
1205                 break;
1206
1207         case EDIT_TEXT_COLOR_DISABLED:
1208                 variantColor = GetProperty("disabledTextColor");
1209                 color = variantColor.ToColor();
1210                 break;
1211
1212         case EDIT_TEXT_COLOR_HIGHLIGHTED:
1213                 variantColor = GetProperty("highlightedTextColor");
1214                 color = variantColor.ToColor();
1215                 break;
1216
1217         case EDIT_TEXT_COLOR_LINK:
1218                 color = __cutlinkColor[EDIT_LINK_TYPE_URL].cutlinkFgColor;
1219                 break;
1220
1221         default:
1222                 break;
1223         }
1224
1225         return color;
1226 }
1227
1228 Color
1229 _Edit::GetTextColor(EditStatus status) const
1230 {
1231         Variant variantColor;
1232         Color color;
1233
1234         switch (status)
1235         {
1236         case EDIT_STATUS_NORMAL:
1237                 variantColor = GetProperty("normalTextColor");
1238                 color = variantColor.ToColor();
1239                 break;
1240
1241         case EDIT_STATUS_DISABLED:
1242                 variantColor = GetProperty("disabledTextColor");
1243                 color = variantColor.ToColor();
1244                 break;
1245
1246         case EDIT_STATUS_HIGHLIGHTED:
1247                 variantColor = GetProperty("highlightedTextColor");
1248                 color = variantColor.ToColor();
1249                 break;
1250
1251         case EDIT_STATUS_PRESSED:
1252                 variantColor = GetProperty("pressedTextColor");
1253                 color = variantColor.ToColor();
1254                 break;
1255
1256         default:
1257                 break;
1258         }
1259
1260         return color;
1261 }
1262
1263 result
1264 _Edit::SetBackgroundBitmap(EditStatus status, const Bitmap& bitmap)
1265 {
1266         result r = E_SUCCESS;
1267
1268         Bitmap* pNewBitmap = _BitmapImpl::CloneN(bitmap);
1269         SysTryReturn(NID_UI_CTRL, pNewBitmap, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
1270
1271         delete __pBackgroundBitmap[status];
1272         __pBackgroundBitmap[status] = pNewBitmap;
1273
1274         return r;
1275 }
1276
1277 result
1278 _Edit::SetColor(EditStatus status, const Color& color)
1279 {
1280         result r = E_SUCCESS;
1281
1282         switch (status)
1283         {
1284         case EDIT_STATUS_NORMAL:
1285                 r = SetProperty("normalColor", Variant(color));
1286                 break;
1287
1288         case EDIT_STATUS_DISABLED:
1289                 r = SetProperty("disabledColor", Variant(color));
1290                 break;
1291
1292         case EDIT_STATUS_HIGHLIGHTED:
1293                 r = SetProperty("highlightedColor", Variant(color));
1294                 break;
1295
1296         case EDIT_STATUS_PRESSED:
1297                 r = SetProperty("pressedColor", Variant(color));
1298                 break;
1299
1300         default:
1301                 r = E_INVALID_ARG;
1302                 break;
1303         }
1304         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Unable to set color.", GetErrorMessage(r));
1305
1306         return r;
1307 }
1308
1309 result
1310 _Edit::SetTextColor(EditTextColor type, const Color& color)
1311 {
1312         result r = E_SUCCESS;
1313         EditCutlinkColor autoLinkColorInfo;
1314
1315         switch (type)
1316         {
1317         case EDIT_TEXT_COLOR_NORMAL:
1318                 r = SetProperty("normalTextColor", Variant(color));
1319                 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] System error occurred.", GetErrorMessage(r));
1320                 break;
1321
1322         case EDIT_TEXT_COLOR_DISABLED:
1323                 r = SetProperty("disabledTextColor", Variant(color));
1324                 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] System error occurred.", GetErrorMessage(r));
1325                 break;
1326
1327         case EDIT_TEXT_COLOR_HIGHLIGHTED:
1328                 r = SetProperty("highlightedTextColor", Variant(color));
1329                 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] System error occurred.", GetErrorMessage(r));
1330
1331                 r = SetProperty("pressedTextColor", Variant(color));
1332                 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] System error occurred.", GetErrorMessage(r));
1333                 break;
1334
1335         case EDIT_TEXT_COLOR_LINK:
1336                 GetCutlinkColorInfo(EDIT_LINK_TYPE_URL, &autoLinkColorInfo);
1337                 autoLinkColorInfo.cutlinkFgColor = color;
1338                 SetCutlinkColorInfo(EDIT_LINK_TYPE_URL, autoLinkColorInfo);
1339                 SetCutlinkColorInfo(EDIT_LINK_TYPE_EMAIL, autoLinkColorInfo);
1340                 SetCutlinkColorInfo(EDIT_LINK_TYPE_PHONE_NUM, autoLinkColorInfo);
1341                 break;
1342
1343         default:
1344                 r = E_INVALID_ARG;
1345                 break;
1346         }
1347
1348         return r;
1349 }
1350
1351 String
1352 _Edit::GetText(int start, int end) const
1353 {
1354         SysTryReturn(NID_UI_CTRL, (start > -1 && end > -1), String(), E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] The invalid argument(start = %d, end = %d) is given.");
1355
1356         return _pEditPresenter->GetText(start, end);
1357 }
1358
1359 result
1360 _Edit::AddExpandableEditAreaEventListener(const _IExpandableEditAreaEventListener& listener)
1361 {
1362         if (__pExpandableEditAreaEvent == null)
1363         {
1364                 __pExpandableEditAreaEvent = _ExpandableEditAreaEvent::CreateInstanceN(*this);
1365                 SysTryReturn(NID_UI_CTRL, __pExpandableEditAreaEvent, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] System error occurred.");
1366         }
1367
1368         return __pExpandableEditAreaEvent->AddListener(listener);
1369 }
1370
1371 result
1372 _Edit::RemoveExpandableEditAreaEventListener(const _IExpandableEditAreaEventListener& listener)
1373 {
1374         SysTryReturn(NID_UI_CTRL, __pExpandableEditAreaEvent, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] This instance isn't constructed.");
1375
1376         return __pExpandableEditAreaEvent->RemoveListener(listener);
1377 }
1378
1379 result
1380 _Edit::AddUiLinkEventListener(const _IUiLinkEventListener& listener)
1381 {
1382         if (__pLinkEvent == null)
1383         {
1384                 __pLinkEvent = _LinkEvent::CreateInstanceN(*this);
1385                 SysTryReturn(NID_UI_CTRL, __pLinkEvent, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] System error occurred.");
1386         }
1387
1388         return __pLinkEvent->AddListener(listener);
1389 }
1390
1391 result
1392 _Edit::RemoveUiLinkEventListener(const _IUiLinkEventListener& listener)
1393 {
1394         SysTryReturn(NID_UI_CTRL, __pLinkEvent, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] This instance isn't constructed.");
1395
1396         return __pLinkEvent->RemoveListener(listener);
1397 }
1398
1399 result
1400 _Edit::AddTextBlockEventListener(const _ITextBlockEventListener& listener)
1401 {
1402         if (__pTextBlockEvent == null)
1403         {
1404                 __pTextBlockEvent = _TextBlockEvent::CreateInstanceN(*this);
1405                 SysTryReturn(NID_UI_CTRL, __pTextBlockEvent, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] System error occurred.");
1406         }
1407
1408         return __pTextBlockEvent->AddListener(listener);
1409 }
1410
1411 result
1412 _Edit::RemoveTextBlockEventListener(const _ITextBlockEventListener& listener)
1413 {
1414         SysTryReturn(NID_UI_CTRL, __pTextBlockEvent, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] This instance isn't constructed.");
1415
1416         __pTextBlockEvent->RemoveListener(listener);
1417
1418         return E_SUCCESS;
1419 }
1420
1421 result
1422 _Edit::AddKeypadEventListener(const _IKeypadEventListener& listener)
1423 {
1424         if (__pKeypadEvent == null)
1425         {
1426                 __pKeypadEvent = _KeypadEvent::CreateInstanceN(*this);
1427                 SysTryReturn(NID_UI_CTRL, __pKeypadEvent, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] System error occurred.");
1428         }
1429
1430         return __pKeypadEvent->AddListener(listener);
1431 }
1432
1433 result
1434 _Edit::RemoveKeypadEventListener(const _IKeypadEventListener& listener)
1435 {
1436         SysTryReturn(NID_UI_CTRL, __pKeypadEvent, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] This instance isn't constructed.");
1437
1438         __pKeypadEvent->RemoveListener(listener);
1439
1440         return E_SUCCESS;
1441 }
1442
1443 result
1444 _Edit::AddTextEventListener(const _ITextEventListener& listener)
1445 {
1446         if (__pTextEvent == null)
1447         {
1448                 __pTextEvent = _TextEvent::CreateInstanceN(*this);
1449                 SysTryReturn(NID_UI_CTRL, __pTextEvent, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] System error occurred.");
1450         }
1451
1452         return __pTextEvent->AddListener(listener);
1453 }
1454
1455 result
1456 _Edit::RemoveTextEventListener(const _ITextEventListener& listener)
1457 {
1458         SysTryReturn(NID_UI_CTRL, __pTextEvent, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] This instance isn't constructed.");
1459         __pTextEvent->RemoveListener(listener);
1460
1461         return E_SUCCESS;
1462 }
1463
1464 result
1465 _Edit::AddScrollPanelEventListener(const _IScrollPanelEventListener& listener)
1466 {
1467         if (__pScrollPanelEvent == null)
1468         {
1469                 if (__inputStyle != INPUT_STYLE_OVERLAY)
1470                 {
1471                         SysLogException(NID_UI_CTRL, E_SYSTEM, "[E_SYSTEM] System error occurred.");
1472                         return E_SYSTEM;
1473                 }
1474                 else
1475                 {
1476                         __pScrollPanelEvent = _ScrollPanelEvent::CreateScrollPanelEventN(*this);
1477                         SysTryReturn(NID_UI_CTRL, __pScrollPanelEvent,
1478                                                  E_SYSTEM, E_SYSTEM, "[E_SYSTEM] System error occurred.");
1479                 }
1480         }
1481
1482         return __pScrollPanelEvent->AddListener(listener);
1483 }
1484
1485 result
1486 _Edit::RemoveScrollPanelEventListener(const _IScrollPanelEventListener& listener)
1487 {
1488         SysTryReturn(NID_UI_CTRL, __pScrollPanelEvent, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] This instance isn't constructed.");
1489         __pScrollPanelEvent->RemoveListener(listener);
1490
1491         return E_SUCCESS;
1492 }
1493
1494 result
1495 _Edit::AddActionEventListener(const _IActionEventListener& listener)
1496 {
1497         _pEditPresenter->AddActionEventListener(listener);
1498
1499         return E_SUCCESS;
1500 }
1501
1502 result
1503 _Edit::RemoveActionEventListener(const _IActionEventListener& listener)
1504 {
1505         _pEditPresenter->RemoveActionEventListener(listener);
1506
1507         return E_SUCCESS;
1508 }
1509
1510 result
1511 _Edit::AddLanguageEventListener(const _ILanguageEventListener& listener)
1512 {
1513         if (__pLanguageEvent == null)
1514         {
1515                 __pLanguageEvent = _LanguageEvent::CreateInstanceN(*this);
1516
1517                 SysTryReturn(NID_UI_CTRL, __pLanguageEvent, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] This instance isn't constructed.")
1518
1519                 __pLanguageEvent->AddListener(listener);
1520         }
1521
1522         return E_SUCCESS;
1523 }
1524
1525 result
1526 _Edit::RemoveLanguageEventListener(const _ILanguageEventListener& listener)
1527 {
1528         SysTryReturn(NID_UI_CTRL, __pLanguageEvent, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] This instance isn't constructed.");
1529
1530         __pLanguageEvent->RemoveListener(listener);
1531
1532         return E_SUCCESS;
1533 }
1534
1535 int
1536 _Edit::GetRemainingLength(void) const
1537 {
1538         return _pEditPresenter->GetRemainingLength();
1539 }
1540
1541 void
1542 _Edit::SetLowerCaseModeEnabled(bool enable)
1543 {
1544         Variant var(enable);
1545
1546         SetProperty("lowerCaseModeEnabled", var);
1547
1548         return;
1549 }
1550
1551 bool
1552 _Edit::IsLowerCaseModeEnabled(void) const
1553 {
1554         Variant var = GetProperty("lowerCaseModeEnabled");
1555
1556         return var.ToBool();
1557 }
1558
1559 result
1560 _Edit::SetCursorPosition(int position)
1561 {
1562         int textLength = GetTextLength();
1563         SysTryReturn(NID_UI_CTRL, (position >= 0 && position <= textLength), E_OUT_OF_RANGE, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] This position is out of range.");
1564
1565         Variant var(position);
1566
1567         return SetProperty("cursorPosition", var);
1568 }
1569
1570 int
1571 _Edit::GetCursorPosition(void) const
1572 {
1573         Variant var = GetProperty("cursorPosition");
1574
1575         return var.ToInt();
1576 }
1577
1578 String
1579 _Edit::GetText(void) const
1580 {
1581         Variant var = GetProperty("text");
1582
1583         return var.ToString();
1584 }
1585
1586 int
1587 _Edit::GetTextLength(void) const
1588 {
1589         return _pEditPresenter->GetTextLength();
1590 }
1591
1592 result
1593 _Edit::SetText(const String& text)
1594 {
1595         Variant var(text);
1596
1597         return SetProperty("text", var);
1598 }
1599
1600 result
1601 _Edit::InsertTextAtCursorPosition(const String& text)
1602 {
1603         return _pEditPresenter->InsertTextAtCursorPosition(text);
1604 }
1605
1606 result
1607 _Edit::InsertCharacterAt(int index, const Character& character)
1608 {
1609         return _pEditPresenter->InsertCharacterAt(index, character);
1610 }
1611
1612 result
1613 _Edit::InsertTextAt(int index, const String& text)
1614 {
1615         return _pEditPresenter->InsertTextAt(index, text);
1616 }
1617
1618 result
1619 _Edit::AppendText(const String& text)
1620 {
1621         return _pEditPresenter->AppendText(text);
1622 }
1623
1624 result
1625 _Edit::AppendCharacter(const Character& character)
1626 {
1627         return _pEditPresenter->AppendCharacter(character);
1628 }
1629
1630 result
1631 _Edit::InsertTextAt(int position, const String& text, const Bitmap& textImage)
1632 {
1633         return _pEditPresenter->InsertTextAt(position, text, textImage);
1634 }
1635
1636 result
1637 _Edit::AppendText(const String& text, const Bitmap& textImage)
1638 {
1639         return _pEditPresenter->InsertTextAt(_pEditPresenter->GetTextLength(), text, textImage);
1640 }
1641
1642 result
1643 _Edit::ClearText(void)
1644 {
1645         return _pEditPresenter->ClearText();
1646 }
1647
1648 result
1649 _Edit::DeleteCharacterAt(int index)
1650 {
1651         return _pEditPresenter->DeleteCharacterAt(index);
1652 }
1653
1654 result
1655 _Edit::DeleteCharacterAtCursorPosition(void)
1656 {
1657         return _pEditPresenter->DeleteCharacterAtCursorPosition();
1658 }
1659
1660 void
1661 _Edit::GetCurrentTextRange(int& start, int& end) const
1662 {
1663         _pEditPresenter->GetCurrentTextRange(start, end);
1664
1665         return;
1666 }
1667
1668 void
1669 _Edit::SetGuideText(const String& guideText)
1670 {
1671         Variant var(guideText);
1672
1673         SetProperty("guideText", var);
1674
1675         return;
1676 }
1677
1678 String
1679 _Edit::GetGuideText(void) const
1680 {
1681         Variant var = GetProperty("guideText");
1682
1683         return var.ToString();
1684 }
1685
1686 Color
1687 _Edit::GetGuideTextColor(void) const
1688 {
1689         Variant color = GetProperty("guideTextColor");
1690
1691         return color.ToColor();
1692 }
1693
1694 result
1695 _Edit::SetGuideTextColor(const Color& color)
1696 {
1697         __isSettingGuideTextColor = true;
1698
1699         return SetProperty("guideTextColor", Variant(color));
1700 }
1701
1702 void
1703 _Edit::SetKeypadEnabled(bool enable)
1704 {
1705         Variant var(enable);
1706
1707         SetProperty("keypadEnabled", var);
1708
1709         return;
1710 }
1711
1712 bool
1713 _Edit::IsKeypadEnabled(void) const
1714 {
1715         Variant var = GetProperty("keypadEnabled");
1716
1717         return var.ToBool();
1718 }
1719
1720 result
1721 _Edit::ShowKeypad(void)
1722 {
1723         SysTryReturn(NID_UI_CTRL, (HasParent() && GetParent()), E_SYSTEM, E_SYSTEM, "[E_SYSTEM] The keypad couldn't be shown.");
1724         SysTryReturn(NID_UI_CTRL, (IsKeypadEnabled() && (__inputStyle == INPUT_STYLE_OVERLAY)), E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] The keypad couldn't be shown.");
1725
1726         if (IsInternalFocused())
1727         {
1728                 return _pEditPresenter->ShowKeypad(false);
1729         }
1730         else
1731         {
1732                 return _pEditPresenter->ShowKeypad();
1733         }
1734 }
1735
1736 int
1737 _Edit::GetTextLineCount(void) const
1738 {
1739         return _pEditPresenter->GetTextLineCount();
1740 }
1741
1742 int
1743 _Edit::GetTextTotalHeight(void) const
1744 {
1745         return _pEditPresenter->GetTextTotalHeight();
1746 }
1747
1748 float
1749 _Edit::GetTextTotalHeightF(void) const
1750 {
1751         return _pEditPresenter->GetTextTotalHeightF();
1752 }
1753
1754 result
1755 _Edit::SetBlockTextColor(const Color& color)
1756 {
1757         Variant var(color);
1758
1759         return SetProperty("blockedTextColor", var);
1760 }
1761
1762 Color
1763 _Edit::GetBlockTextColor(void) const
1764 {
1765         Variant var;
1766
1767         if (__blockTextColor.used)
1768         {
1769                 var = GetProperty("blockedTextColor");
1770         }
1771         else
1772         {
1773                 var = GetProperty("highlightedColor");
1774         }
1775
1776         return var.ToColor();
1777 }
1778
1779 void
1780 _Edit::GetBlockRange(int& start, int& end) const
1781 {
1782         _pEditPresenter->GetBlockRange(start, end);
1783
1784         return;
1785 }
1786
1787 result
1788 _Edit::SetBlockRange(int start, int end)
1789 {
1790         return _pEditPresenter->SetBlockRange(start, end);
1791 }
1792
1793 void
1794 _Edit::GetWordPosition(int cursorPos, int& startPos, int& endPos) const
1795 {
1796         _pEditPresenter->GetWordPosition(cursorPos, startPos, endPos);
1797
1798         return;
1799 }
1800
1801 result
1802 _Edit::GetTextImageRangeAt(int postion, int& startPosition, int& endPosition) const
1803 {
1804         return _pEditPresenter->GetTextImageRangeAt(postion, startPosition, endPosition);
1805 }
1806
1807 result
1808 _Edit::BeginTextBlock(void)
1809 {
1810         return _pEditPresenter->BeginTextBlock();
1811 }
1812
1813 result
1814 _Edit::ReleaseTextBlock(void)
1815 {
1816         return _pEditPresenter->ReleaseTextBlock();
1817 }
1818
1819 bool
1820 _Edit::IsBlocked(void) const
1821 {
1822         return _pEditPresenter->IsBlocked();
1823 }
1824
1825 result
1826 _Edit::CopyText(void)
1827 {
1828         return _pEditPresenter->CopyText();
1829 }
1830
1831 result
1832 _Edit::CutText(void)
1833 {
1834         return _pEditPresenter->CutText();
1835 }
1836
1837 result
1838 _Edit::PasteText(void)
1839 {
1840         return _pEditPresenter->PasteText();
1841 }
1842
1843 result
1844 _Edit::RemoveTextBlock(void)
1845 {
1846         return _pEditPresenter->RemoveTextBlock();
1847 }
1848
1849 bool
1850 _Edit::IsClipped(void) const
1851 {
1852         return _pEditPresenter->IsClipped();
1853 }
1854
1855 result
1856 _Edit::SetCurrentLanguage(LanguageCode languageCode)
1857 {
1858         return _pEditPresenter->SetCurrentLanguage(languageCode);
1859 }
1860
1861 result
1862 _Edit::GetCurrentLanguage(LanguageCode& language) const
1863 {
1864         return _pEditPresenter->GetCurrentLanguage(language);
1865 }
1866
1867 bool
1868 _Edit::CalculateAbsoluteCursorBounds(int index, FloatRectangle& absCursorRect)
1869 {
1870         return _pEditPresenter->CalculateAbsoluteCursorBounds(index, absCursorRect);
1871 }
1872
1873 void
1874 _Edit::OnDraw(void)
1875 {
1876         Canvas* pCanvas = GetCanvasN();
1877         SysTryReturnVoidResult(NID_UI_CTRL, pCanvas, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Unable to create instance.");
1878
1879         _pEditPresenter->Draw(*pCanvas);
1880
1881         delete pCanvas;
1882
1883         return;
1884 }
1885
1886 bool
1887 _Edit::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
1888 {
1889         return _pEditPresenter->OnTouchPressed(source, touchinfo);
1890 }
1891
1892 bool
1893 _Edit::OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
1894 {
1895         return _pEditPresenter->OnTouchCanceled(source, touchinfo);
1896 }
1897
1898 bool
1899 _Edit::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
1900 {
1901         if ((__editStyle ^ EDIT_STYLE_VIEWER) && !__isTouchMoving)
1902         {
1903                 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, this);
1904         }
1905         __isTouchMoving = false;
1906
1907         return _pEditPresenter->OnTouchReleased(source, touchinfo);
1908 }
1909
1910 bool
1911 _Edit::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
1912 {
1913         __isTouchMoving = true;
1914
1915         return _pEditPresenter->OnTouchMoved(source, touchinfo);
1916 }
1917
1918 bool
1919 _Edit::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
1920 {
1921         return _pEditPresenter->OnKeyPressed(source, keyInfo);
1922 }
1923
1924 bool
1925 _Edit::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
1926 {
1927         return _pEditPresenter->OnKeyReleased(source, keyInfo);
1928 }
1929
1930 bool
1931 _Edit::OnNotifiedN(const _Control& source, IList* pArgs)
1932 {
1933         return _pEditPresenter->OnNotifiedN(pArgs);
1934 }
1935
1936
1937 bool
1938 _Edit::OnFlickGestureDetected(_TouchFlickGestureDetector& gesture)
1939 {
1940         float xDistance = 0.0f;
1941         float yDistance = 0.0f;
1942         gesture.GetDistance(xDistance, yDistance);
1943         FloatPoint flickPoint(xDistance, yDistance);
1944
1945         _pEditPresenter->InitializeCopyPasteManager();
1946
1947         _pEditPresenter->StartFlickAnimation(flickPoint, gesture.GetDuration());
1948
1949         return true;
1950 }
1951
1952 bool
1953 _Edit::OnFlickGestureCanceled(_TouchFlickGestureDetector& gesture)
1954 {
1955         return false;
1956 }
1957
1958 bool
1959 _Edit::OnLongPressGestureDetected(_TouchLongPressGestureDetector& gesture)
1960 {
1961         _pEditPresenter->OnLongPressGestureDetected();
1962
1963         return true;
1964 }
1965
1966 bool
1967 _Edit::OnLongPressGestureCanceled(_TouchLongPressGestureDetector& gesture)
1968 {
1969         return false;
1970 }
1971
1972 bool
1973 _Edit::OnTapGestureDetected(_TouchTapGestureDetector& gesture)
1974 {
1975         _pEditPresenter->OnTapGestureDetected();
1976
1977         return true;
1978 }
1979
1980 bool
1981 _Edit::OnTapGestureCanceled(_TouchTapGestureDetector& gesture)
1982 {
1983         return false;
1984 }
1985
1986 void
1987 _Edit::OnClipboardPopupClosed(const ClipboardItem* pClipboardItem)
1988 {
1989         _pEditPresenter->OnClipboardPopupClosed(pClipboardItem);
1990
1991         return;
1992 }
1993
1994 bool
1995 _Edit::OnFocusGained(const _Control& source)
1996 {
1997         __internalFocus = true;
1998         return _pEditPresenter->OnFocusGained();
1999 }
2000
2001 bool
2002 _Edit::OnFocusLost(const _Control& source)
2003 {
2004         __internalFocus = false;
2005         _pEditPresenter->OnFocusLost();
2006         _Control::OnFocusLost(source);
2007
2008         return true;
2009 }
2010
2011 result
2012 _Edit::OnAttachedToMainTree(void)
2013 {
2014         if (__isAccessibilityCreated)
2015         {
2016                 return E_SUCCESS;
2017         }
2018
2019         if (__pTextAccessibilityElement)
2020         {
2021                 __pTextAccessibilityElement->SetBounds(FloatRectangle(0.0f, 0.0f, GetBoundsF().width, GetBoundsF().height));
2022         }
2023         if (__pClearButtonTextAccessibilityElement)
2024         {
2025                 __pClearButtonTextAccessibilityElement->SetBounds(_pEditPresenter->GetClearIconBoundsF());
2026         }
2027
2028         return E_SUCCESS;
2029 }
2030
2031 void
2032 _Edit::OnBoundsChanged(void)
2033 {
2034         if (__isConstructed)
2035         {
2036                 SysAssertf(_pEditPresenter != null, "_pEditPresenter is null");
2037
2038                 if (!((GetEditStyle() & EDIT_STYLE_FLEXIBLE) == false))
2039                 {
2040                         if (_pEditPresenter->IsUpdateInitialBounds())
2041                         {
2042                                 FloatRectangle editBounds = GetBoundsF();
2043                                 if (__previousBounds.height != editBounds.height || __previousBounds.width != editBounds.width)
2044                                 {
2045                                         _pEditPresenter->SetControlInitialBounds(editBounds);
2046                                 }
2047                                 else
2048                                 {
2049                                         _pEditPresenter->SetControlInitialPosition(FloatPoint(editBounds.x, editBounds.y));
2050                                 }
2051                                 __previousBounds = editBounds;
2052                         }
2053                         else
2054                         {
2055                                 __previousBounds = GetBoundsF();
2056                         }
2057                 }
2058
2059                 _pEditPresenter->Resize();
2060
2061                 if (__isAccessibilityCreated)
2062                 {
2063                         if (__pTextAccessibilityElement)
2064                         {
2065                                 __pTextAccessibilityElement->SetBounds(FloatRectangle(0.0f, 0.0f, GetBoundsF().width, GetBoundsF().height));
2066                         }
2067
2068                         if (__pClearButtonTextAccessibilityElement)
2069                         {
2070                                 __pClearButtonTextAccessibilityElement->SetBounds(_pEditPresenter->GetClearIconBoundsF());
2071                         }
2072                 }
2073         }
2074
2075         return;
2076 }
2077
2078 void
2079 _Edit::OnChangeLayout(_ControlOrientation orientation)
2080 {
2081         result r = _pEditPresenter->ChangeLayout(orientation);
2082         SetLastResult(r);
2083
2084         return;
2085 }
2086
2087 void
2088 _Edit::OnScrollPanelBoundsChanged(void)
2089 {
2090         _pEditPresenter->OnScrollPanelBoundsChanged();
2091
2092         return;
2093 }
2094
2095 void
2096 _Edit::OnFontChanged(Font* pFont)
2097 {
2098         _pEditPresenter->OnFontChanged(pFont);
2099
2100         _Control::OnFontChanged(pFont);
2101
2102         return;
2103 }
2104
2105 void
2106 _Edit::OnFontInfoRequested(unsigned long& style, float& size)
2107 {
2108         _pEditPresenter->OnFontInfoRequested(style, size);
2109
2110         return;
2111 }
2112
2113 result
2114 _Edit::OnDetachingFromMainTree(void)
2115 {
2116         __isDestroyed = true;
2117         if (_pEditPresenter->IsBounded())
2118         {
2119                 DetachScrollPanelEvent();
2120         }
2121         return E_SUCCESS;
2122 }
2123
2124 void
2125 _Edit::OnVisibleStateChanged(void)
2126 {
2127         if (GetVisibleState() == false)
2128         {
2129                 if (_pEditPresenter->IsCopyPasteManagerExist())
2130                 {
2131                         _pEditPresenter->InitializeCopyPasteManager();
2132                 }
2133         }
2134
2135         return;
2136 }
2137
2138 void
2139 _Edit::OnAncestorEnableStateChanged(const _Control& control)
2140 {
2141         bool enableState = false;
2142         enableState = control.GetEnableState();
2143
2144         if (!enableState)
2145         {
2146                 if (_pEditPresenter->IsCopyPasteManagerExist())
2147                 {
2148                         _pEditPresenter->InitializeCopyPasteManager();
2149                 }
2150
2151                 if (__internalFocus)
2152                 {
2153                         if (_pEditPresenter->IsKeypadEnabled())
2154                         {
2155                                 _pEditPresenter->HideKeypad(true);
2156                         }
2157                         else
2158                         {
2159                                 SetFocused(false);
2160                         }
2161                         __internalFocus = false;
2162                 }
2163         }
2164
2165         Invalidate();
2166
2167         return;
2168 }
2169
2170 void
2171 _Edit::OnAncestorVisibleStateChanged(const _Control& control)
2172 {
2173         bool visibleState = false;
2174         visibleState = control.GetVisibleState();
2175
2176         if (!visibleState)
2177         {
2178                 if (_pEditPresenter->IsCopyPasteManagerExist())
2179                 {
2180                         _pEditPresenter->InitializeCopyPasteManager();
2181                 }
2182
2183                 if (__internalFocus)
2184                 {
2185                         if (_pEditPresenter->IsKeypadEnabled())
2186                         {
2187                                 _pEditPresenter->HideKeypad(true);
2188                         }
2189                         else
2190                         {
2191                                 SetFocused(false);
2192                         }
2193                         __internalFocus = false;
2194                 }
2195         }
2196
2197         Invalidate();
2198
2199         return;
2200 }
2201
2202 bool
2203 _Edit::IsDestroyed(void) const
2204 {
2205         return __isDestroyed;
2206 }
2207
2208 unsigned long
2209 _Edit::GetEditStyle(void) const
2210 {
2211         return __editStyle;
2212 }
2213
2214 void
2215 _Edit::SetEditStyle(unsigned long style)
2216 {
2217         __editStyle = style;
2218
2219         return;
2220 }
2221
2222 void
2223 _Edit::SetBorderRoundStyleEnabled(bool enable)
2224 {
2225         __borderRoundStyle = enable;
2226
2227         return;
2228 }
2229
2230 bool
2231 _Edit::IsBorderRoundStyleEnabled(void) const
2232 {
2233         return __borderRoundStyle;
2234 }
2235
2236 bool
2237 _Edit::IsUsbKeyboardConnected(void) const
2238 {
2239         return _pEditPresenter->IsUsbKeyboardConnected();
2240 }
2241
2242 bool
2243 _Edit::IsKeypadExist(void) const
2244 {
2245         return _pEditPresenter->IsKeypadExist();
2246 }
2247
2248 bool
2249 _Edit::IsClipboardExist(void) const
2250 {
2251         return _pEditPresenter->IsClipboardExist();
2252 }
2253
2254 bool
2255 _Edit::CheckKeypadExist(_ControlOrientation orientation)
2256 {
2257         return _pEditPresenter->CheckKeypadExist(orientation);
2258 }
2259
2260 void
2261 _Edit::SetAutoShrinkModeEnabled(bool enable)
2262 {
2263         _pEditPresenter->SetAutoShrinkModeEnabled(enable);
2264
2265         return;
2266 }
2267
2268 bool
2269 _Edit::IsAutoShrinkModeEnabled(void) const
2270 {
2271         return _pEditPresenter->IsAutoShrinkModeEnabled();
2272 }
2273
2274 EllipsisPosition
2275 _Edit::GetEllipsisPosition(void) const
2276 {
2277         return __ellipsisPosition;
2278 }
2279
2280 void
2281 _Edit::SetEllipsisPosition(EllipsisPosition position)
2282 {
2283         __ellipsisPosition = position;
2284         _pEditPresenter->SetEllipsisPosition(position);
2285
2286         return;
2287 }
2288
2289 void
2290 _Edit::GetCutlinkColorInfo(EditCutLinkType type, EditCutlinkColor* colorInfo) const
2291 {
2292         *colorInfo = __cutlinkColor[type];
2293
2294         return;
2295 }
2296
2297 void
2298 _Edit::SetCutlinkColorInfo(EditCutLinkType type, EditCutlinkColor colorInfo)
2299 {
2300         __cutlinkColor[type] = colorInfo;
2301
2302         return;
2303 }
2304
2305 Bitmap*
2306 _Edit::GetBackgroundBitmap(EditStatus status) const
2307 {
2308         return __pBackgroundBitmap[status];
2309 }
2310
2311 result
2312 _Edit::LoadDefaultBackgroundBitmap(GroupStyle groupStyle)
2313 {
2314         result r = E_SUCCESS;
2315
2316         switch (groupStyle)
2317         {
2318         case GROUP_STYLE_NONE:
2319                 r = GET_BITMAP_CONFIG_N(EDIT::BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundBitmap[EDIT_STATUS_NORMAL]);
2320                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2321                 r = GET_BITMAP_CONFIG_N(EDIT::BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundBitmap[EDIT_STATUS_DISABLED]);
2322                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2323                 r = GET_BITMAP_CONFIG_N(EDIT::BG_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundBitmap[EDIT_STATUS_HIGHLIGHTED]);
2324                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2325                 r = GET_BITMAP_CONFIG_N(EDIT::BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundBitmap[EDIT_STATUS_PRESSED]);
2326                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2327                 r = GET_BITMAP_CONFIG_N(EDIT::BG_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundEffectBitmap);
2328                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2329                 break;
2330
2331         case GROUP_STYLE_SINGLE:
2332                 r = GET_BITMAP_CONFIG_N(EDIT::GROUPED_SINGLE_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundBitmap[EDIT_STATUS_NORMAL]);
2333                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2334                 r = GET_BITMAP_CONFIG_N(EDIT::GROUPED_SINGLE_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundBitmap[EDIT_STATUS_DISABLED]);
2335                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2336                 r = GET_BITMAP_CONFIG_N(EDIT::GROUPED_SINGLE_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundBitmap[EDIT_STATUS_HIGHLIGHTED]);
2337                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2338                 r = GET_BITMAP_CONFIG_N(EDIT::GROUPED_SINGLE_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundBitmap[EDIT_STATUS_PRESSED]);
2339                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2340                 r = GET_BITMAP_CONFIG_N(EDIT::GROUPED_SINGLE_BG_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundEffectBitmap);
2341                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2342                 break;
2343
2344         case GROUP_STYLE_TOP:
2345                 r = GET_BITMAP_CONFIG_N(EDIT::GROUPED_TOP_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundBitmap[EDIT_STATUS_NORMAL]);
2346                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2347                 r = GET_BITMAP_CONFIG_N(EDIT::GROUPED_TOP_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundBitmap[EDIT_STATUS_DISABLED]);
2348                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2349                 r = GET_BITMAP_CONFIG_N(EDIT::GROUPED_TOP_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundBitmap[EDIT_STATUS_HIGHLIGHTED]);
2350                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2351                 r = GET_BITMAP_CONFIG_N(EDIT::GROUPED_TOP_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundBitmap[EDIT_STATUS_PRESSED]);
2352                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2353                 r = GET_BITMAP_CONFIG_N(EDIT::GROUPED_TOP_BG_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundEffectBitmap);
2354                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2355                 break;
2356
2357         case GROUP_STYLE_MIDDLE:
2358                 r = GET_BITMAP_CONFIG_N(EDIT::GROUPED_MIDDLE_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundBitmap[EDIT_STATUS_NORMAL]);
2359                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2360                 r = GET_BITMAP_CONFIG_N(EDIT::GROUPED_MIDDLE_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundBitmap[EDIT_STATUS_DISABLED]);
2361                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2362                 r = GET_BITMAP_CONFIG_N(EDIT::GROUPED_MIDDLE_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundBitmap[EDIT_STATUS_HIGHLIGHTED]);
2363                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2364                 r = GET_BITMAP_CONFIG_N(EDIT::GROUPED_MIDDLE_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundBitmap[EDIT_STATUS_PRESSED]);
2365                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2366                 r = GET_BITMAP_CONFIG_N(EDIT::GROUPED_MIDDLE_BG_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundEffectBitmap);
2367                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2368                 break;
2369
2370         case GROUP_STYLE_BOTTOM:
2371                 r = GET_BITMAP_CONFIG_N(EDIT::GROUPED_BOTTOM_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundBitmap[EDIT_STATUS_NORMAL]);
2372                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2373                 r = GET_BITMAP_CONFIG_N(EDIT::GROUPED_BOTTOM_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundBitmap[EDIT_STATUS_DISABLED]);
2374                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2375                 r = GET_BITMAP_CONFIG_N(EDIT::GROUPED_BOTTOM_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundBitmap[EDIT_STATUS_HIGHLIGHTED]);
2376                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2377                 r = GET_BITMAP_CONFIG_N(EDIT::GROUPED_BOTTOM_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundBitmap[EDIT_STATUS_PRESSED]);
2378                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2379                 r = GET_BITMAP_CONFIG_N(EDIT::GROUPED_BOTTOM_BG_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundEffectBitmap);
2380                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2381                 break;
2382
2383         default:
2384                 r = GET_BITMAP_CONFIG_N(EDIT::BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundBitmap[EDIT_STATUS_NORMAL]);
2385                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2386                 r = GET_BITMAP_CONFIG_N(EDIT::BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundBitmap[EDIT_STATUS_DISABLED]);
2387                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2388                 r = GET_BITMAP_CONFIG_N(EDIT::BG_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundBitmap[EDIT_STATUS_HIGHLIGHTED]);
2389                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2390                 r = GET_BITMAP_CONFIG_N(EDIT::BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundBitmap[EDIT_STATUS_PRESSED]);
2391                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2392                 r = GET_BITMAP_CONFIG_N(EDIT::BG_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundEffectBitmap);
2393                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2394                 break;
2395         }
2396
2397         return r;
2398
2399 CATCH:
2400         for (int status = 0; status < EDIT_COLOR_MAX; status++)
2401         {
2402                 if (__pDefaultBackgroundBitmap[status])
2403                 {
2404                         delete __pDefaultBackgroundBitmap[status];
2405                         __pDefaultBackgroundBitmap[status] = null;
2406                 }
2407         }
2408
2409         delete __pDefaultBackgroundEffectBitmap;
2410         __pDefaultBackgroundEffectBitmap = null;
2411
2412         return r;
2413 }
2414
2415 result
2416 _Edit::ReplaceDefaultBackgroundBitmapForSearchBar(void)
2417 {
2418         result r = E_SUCCESS;
2419
2420         for (int status = 0; status < EDIT_COLOR_MAX; status++)
2421         {
2422                 if (__pDefaultBackgroundBitmap[status])
2423                 {
2424                         delete __pDefaultBackgroundBitmap[status];
2425                         __pDefaultBackgroundBitmap[status] = null;
2426                 }
2427         }
2428
2429         if (__pDefaultBackgroundEffectBitmap)
2430         {
2431                 delete __pDefaultBackgroundEffectBitmap;
2432                 __pDefaultBackgroundEffectBitmap = null;
2433         }
2434
2435         r = GET_BITMAP_CONFIG_N(SEARCHBAR::EDIT_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundBitmap[EDIT_STATUS_NORMAL]);
2436         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2437         r = GET_BITMAP_CONFIG_N(SEARCHBAR::EDIT_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundBitmap[EDIT_STATUS_DISABLED]);
2438         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2439         r = GET_BITMAP_CONFIG_N(SEARCHBAR::EDIT_BG_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundBitmap[EDIT_STATUS_HIGHLIGHTED]);
2440         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2441         r = GET_BITMAP_CONFIG_N(SEARCHBAR::EDIT_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundBitmap[EDIT_STATUS_PRESSED]);
2442         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2443         r = GET_BITMAP_CONFIG_N(SEARCHBAR::EDIT_BG_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultBackgroundEffectBitmap);
2444         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2445         r = GET_BITMAP_CONFIG_N(SEARCHBAR::EDIT_BG_FOCUS, BITMAP_PIXEL_FORMAT_ARGB8888, __pDefaultFocusBitmap);
2446         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Failed to load bitmap");
2447
2448         _pEditPresenter->SetSearchBarFlag(true);
2449
2450         return r;
2451
2452 CATCH:
2453         for (int status = 0; status < EDIT_COLOR_MAX; status++)
2454         {
2455                 if (__pDefaultBackgroundBitmap[status])
2456                 {
2457                         delete __pDefaultBackgroundBitmap[status];
2458                         __pDefaultBackgroundBitmap[status] = null;
2459                 }
2460         }
2461
2462         delete __pDefaultBackgroundEffectBitmap;
2463         __pDefaultBackgroundEffectBitmap = null;
2464
2465         return r;
2466 }
2467
2468 void
2469 _Edit::SetSearchFieldFocus(bool state)
2470 {
2471         __isSearchFieldFocused = state;
2472         return;
2473 }
2474
2475 bool
2476 _Edit::IsSearchFieldFocused(void) const
2477 {
2478         return __isSearchFieldFocused;
2479 }
2480
2481 Bitmap*
2482 _Edit::GetDefaultBackgroundBitmap(EditStatus status) const
2483 {
2484         return __pDefaultBackgroundBitmap[status];
2485 }
2486
2487 bool
2488 _Edit::IsCustomDefaultBackgroundBitmap(EditStatus status) const
2489 {
2490         bool isCustomBitmap = false;
2491
2492         switch (status)
2493         {
2494         case EDIT_STATUS_NORMAL:
2495                 isCustomBitmap = IS_CUSTOM_BITMAP(EDIT::BG_NORMAL);
2496                 break;
2497
2498         case EDIT_STATUS_DISABLED:
2499                 isCustomBitmap = IS_CUSTOM_BITMAP(EDIT::BG_DISABLED);
2500                 break;
2501
2502         case EDIT_STATUS_HIGHLIGHTED:
2503                 isCustomBitmap = IS_CUSTOM_BITMAP(EDIT::BG_HIGHLIGHTED);
2504                 break;
2505
2506         case EDIT_STATUS_PRESSED:
2507                 isCustomBitmap = IS_CUSTOM_BITMAP(EDIT::BG_PRESSED);
2508                 break;
2509
2510         default:
2511                 isCustomBitmap = false;
2512                 break;
2513         }
2514
2515         return isCustomBitmap;
2516 }
2517
2518 Bitmap*
2519 _Edit::GetDefaultBackgroundEffectBitmap(void) const
2520 {
2521         return __pDefaultBackgroundEffectBitmap;
2522 }
2523
2524 Bitmap*
2525 _Edit::GetDefaultFocusBitmap(void) const
2526 {
2527         return __pDefaultFocusBitmap;
2528 }
2529
2530 bool
2531 _Edit::IsSettingGuideTextColor(void) const
2532 {
2533         return __isSettingGuideTextColor;
2534 }
2535
2536 result
2537 _Edit::SetFont(const Font& font)
2538 {
2539         return _pEditPresenter->SetFont(font);
2540 }
2541
2542 void
2543 _Edit::GetFontType(String& typefaceName, unsigned long& styleMask) const
2544 {
2545         _pEditPresenter->GetFontType(typefaceName, styleMask);
2546 }
2547
2548 result
2549 _Edit::SetFontType(const String& typefaceName, unsigned long styleMask)
2550 {
2551         return _pEditPresenter->SetFontType(typefaceName, styleMask);
2552 }
2553
2554 unsigned long
2555 _Edit::GetTextStyle(void) const
2556 {
2557         return _pEditPresenter->GetTextStyle();
2558 }
2559
2560 result
2561 _Edit::SetTextStyle(unsigned long style)
2562 {
2563         return _pEditPresenter->SetTextStyle(style);
2564 }
2565
2566 String
2567 _Edit::GetTitleText(void) const
2568 {
2569         SysTryReturn(NID_UI_CTRL, (GetEditStyle() & EDIT_STYLE_TITLE_TOP) || (GetEditStyle() & EDIT_STYLE_TITLE_LEFT), String(), E_SYSTEM, "[E_SYSTEM] The EditField has no title style.\n");
2570
2571         Variant var = GetProperty("titleText");
2572
2573         return var.ToString();
2574 }
2575
2576 result
2577 _Edit::SetTitleText(const String& title)
2578 {
2579         SysTryReturn(NID_UI_CTRL, (GetEditStyle() & EDIT_STYLE_TITLE_TOP) || (GetEditStyle() & EDIT_STYLE_TITLE_LEFT), E_SYSTEM, E_SYSTEM, "[E_SYSTEM] The EditField has no title style.\n");
2580         Variant var(title);
2581
2582         return SetProperty("titleText", var);
2583 }
2584
2585 Color
2586 _Edit::GetTitleTextColor(EditStatus status) const
2587 {
2588         Variant var;
2589         switch (status)
2590         {
2591         case EDIT_STATUS_NORMAL:
2592                 var = GetProperty("normalTitleTextColor");
2593                 break;
2594
2595         case EDIT_STATUS_DISABLED:
2596                 var = GetProperty("disabledTitleTextColor");
2597                 break;
2598
2599         case EDIT_STATUS_HIGHLIGHTED:
2600                 var = GetProperty("highlightedTitleTextColor");
2601                 break;
2602
2603         case EDIT_STATUS_PRESSED:
2604                 var = GetProperty("pressedTitleTextColor");
2605                 break;
2606
2607         default:
2608                 break;
2609         }
2610
2611         return var.ToColor();
2612 }
2613
2614 result
2615 _Edit::SetTitleTextColor(EditStatus status, const Color& color)
2616 {
2617         result r = E_SUCCESS;
2618
2619         Variant var(color);
2620
2621         switch (status)
2622         {
2623         case EDIT_STATUS_NORMAL:
2624                 r = SetProperty("normalTitleTextColor", var);
2625                 break;
2626
2627         case EDIT_STATUS_DISABLED:
2628                 r = SetProperty("disabledTitleTextColor", var);
2629                 break;
2630
2631         case EDIT_STATUS_HIGHLIGHTED:
2632                 r = SetProperty("highlightedTitleTextColor", var);
2633                 break;
2634
2635         case EDIT_STATUS_PRESSED:
2636                 r = SetProperty("pressedTitleTextColor", var);
2637                 break;
2638
2639         default:
2640                 r = E_INVALID_ARG;
2641                 break;
2642         }
2643
2644         return r;
2645 }
2646
2647 InputStyle
2648 _Edit::GetInputStyle(void) const
2649 {
2650         return __inputStyle;
2651 }
2652
2653 result
2654 _Edit::SetKeypadCommandButtonVisible(bool visible)
2655 {
2656         Variant var(visible);
2657
2658         return SetProperty("overlayKeypadCommandButtonVisible", var);
2659 }
2660
2661 _Toolbar*
2662 _Edit::GetKeypadCommandButton(void) const
2663 {
2664         return _pEditPresenter->GetKeypadCommandButton();
2665 }
2666
2667
2668 result
2669 _Edit::SetKeypadCommandButton(CommandButtonPosition position, const String& text, int actionId)
2670 {
2671         SysTryReturn(NID_UI_CTRL, (__inputStyle != INPUT_STYLE_FULLSCREEN), E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Unable to show the keypad due to a wrong input style.");
2672
2673         return _pEditPresenter->SetKeypadCommandButton(position, text, actionId);
2674 }
2675
2676 result
2677 _Edit::GetKeypadBounds(FloatRectangle& rect) const
2678 {
2679         return _pEditPresenter->GetKeypadBounds(rect);
2680 }
2681
2682 float
2683 _Edit::GetClipboardHeight(void) const
2684 {
2685         return _pEditPresenter->GetClipboardHeight();
2686 }
2687
2688 result
2689 _Edit::SendExpandableEditAreaEvent(_ExpandableEditAreaEventStatus status, int newLineCount)
2690 {
2691         if (__pExpandableEditAreaEvent)
2692         {
2693                 IEventArg* pEventArg = _ExpandableEditAreaEvent::CreateExpandableEditAreaEventArgN(status, newLineCount);
2694                 SysTryReturn(NID_UI_CTRL, pEventArg, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
2695
2696                 __pExpandableEditAreaEvent->Fire(*pEventArg);
2697         }
2698
2699         return E_SUCCESS;
2700 }
2701
2702 result
2703 _Edit::SendScrollPanelEvent(CoreScrollPanelStatus eventstatus)
2704 {
2705         if (__pScrollPanelEvent)
2706         {
2707                 IEventArg* pEventArg = _ScrollPanelEvent::CreateScrollPanelEventArgN(eventstatus);
2708                 SysTryReturn(NID_UI_CTRL, pEventArg, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Unable to create _CoreScrollPanelEventArg.");
2709
2710                 __pScrollPanelEvent->Fire(*pEventArg);
2711         }
2712
2713         return E_SUCCESS;
2714 }
2715
2716 result
2717 _Edit::SendKeypadEvent(CoreKeypadAction keypadAction, CoreKeypadEventStatus eventstatus)
2718 {
2719         if (__pKeypadEvent)
2720         {
2721                 IEventArg* pEventArg = _KeypadEvent::CreateKeypadEventArgN(keypadAction, eventstatus);
2722                 SysTryReturn(NID_UI_CTRL, pEventArg, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Unable to create _KeypadEventArg.");
2723
2724                 __pKeypadEvent->Fire(*pEventArg);
2725         }
2726
2727         return E_SUCCESS;
2728 }
2729
2730 result
2731 _Edit::SendTextEvent(CoreTextEventStatus textEventStatus)
2732 {
2733         if (__inputStyle == INPUT_STYLE_FULLSCREEN)
2734         {
2735                 _pEditPresenter->DeleteFullscreenKeypad();
2736         }
2737
2738         if (__pTextEvent && IsTextEventEnabled())
2739         {
2740                 IEventArg* pEventArg = _TextEvent::CreateTextEventArgN(textEventStatus);
2741                 SysTryReturn(NID_UI_CTRL, pEventArg, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
2742
2743                 __pTextEvent->Fire(*pEventArg);
2744         }
2745
2746         return E_SUCCESS;
2747 }
2748
2749 result
2750 _Edit::SendTextBlockEvent(int start, int end)
2751 {
2752         if (__pTextBlockEvent)
2753         {
2754                 IEventArg* pTextBlockEventArg = _TextBlockEvent::CreateTextBlockEventArgN(start, end);
2755                 SysTryReturn(NID_UI_CTRL, pTextBlockEventArg, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Unable to create _TextBlockEventArg.");
2756
2757                 __pTextBlockEvent->Fire(*pTextBlockEventArg);
2758         }
2759
2760         return E_SUCCESS;
2761 }
2762
2763 result
2764 _Edit::SendLinkEvent(const String& text, LinkType linkType, const String& link)
2765 {
2766         if (__pLinkEvent)
2767         {
2768                 IEventArg* pLinkEventArg = _LinkEvent::CreateLinkEventArgN(text, linkType, link);
2769                 SysTryReturn(NID_UI_CTRL, pLinkEventArg, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Unable to create _LinkEventArg.");
2770
2771                 __pLinkEvent->Fire(*pLinkEventArg);
2772         }
2773
2774         return E_SUCCESS;
2775 }
2776
2777 result
2778 _Edit::SendLanguageEvent(LanguageCode prevLanguageCode, LanguageCode currentLanguageCode)
2779 {
2780         if (__pLanguageEvent)
2781         {
2782                 IEventArg* pLanguageEventArg = _LanguageEvent::CreateLanguageEventArgN(prevLanguageCode, currentLanguageCode);
2783                 SysTryReturn(NID_UI_CTRL, pLanguageEventArg, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
2784
2785                 __pLanguageEvent->Fire(*pLanguageEventArg);
2786         }
2787
2788         return E_SUCCESS;
2789 }
2790
2791 result
2792 _Edit::AttachScrollPanelEvent(void)
2793 {
2794         _ScrollPanel* pScrollPanelCore = dynamic_cast< _ScrollPanel* >(GetParent());
2795         if (pScrollPanelCore)
2796         {
2797                 if (__pScrollPanelEvent)
2798                 {
2799                         pScrollPanelCore->SetScrollPanelEvent(__pScrollPanelEvent);
2800                 }
2801                 pScrollPanelCore->SetControlKeypadBinding(this);
2802         }
2803
2804         return E_SUCCESS;
2805 }
2806
2807 result
2808 _Edit::DetachScrollPanelEvent(void)
2809 {
2810         _ScrollPanel* pScrollPanelCore = dynamic_cast< _ScrollPanel* >(GetParent());
2811         if (pScrollPanelCore)
2812         {
2813                 if (__pScrollPanelEvent && (pScrollPanelCore->GetScrollPanelEvent() == __pScrollPanelEvent))
2814                 {
2815                         pScrollPanelCore->SetScrollPanelEvent(null);
2816                 }
2817                 pScrollPanelCore->SetControlKeypadBinding(null);
2818         }
2819
2820         return E_SUCCESS;
2821 }
2822
2823 bool
2824 _Edit::IsKeypadCommandButtonVisible(void) const
2825 {
2826         Variant var = GetProperty("overlayKeypadCommandButtonVisible");
2827
2828         return var.ToBool();
2829 }
2830
2831 String
2832 _Edit::GetKeypadCommandButtonText(CommandButtonPosition position) const
2833 {
2834         SysTryReturn(NID_UI_CTRL, (__inputStyle != INPUT_STYLE_FULLSCREEN), String(), E_SYSTEM, "[E_SYSTEM] Unable to show the keypad due to a wrong input style.");
2835
2836         return _pEditPresenter->GetKeypadCommandButtonText(position);
2837 }
2838
2839 int
2840 _Edit::GetKeypadCommandButtonActionId(CommandButtonPosition position) const
2841 {
2842         SysTryReturn(NID_UI_CTRL, (__inputStyle != INPUT_STYLE_FULLSCREEN), -1, E_SYSTEM, "[E_SYSTEM] Unable to show the keypad due to a wrong input style.");
2843
2844         return _pEditPresenter->GetKeypadCommandButtonActionId(position);
2845 }
2846
2847 result
2848 _Edit::GetCursorBounds(bool isAbsRect, FloatRectangle& cursorBounds) const
2849 {
2850         return _pEditPresenter->GetCursorBounds(isAbsRect, cursorBounds);
2851 }
2852
2853 int
2854 _Edit::GetCursorPositionAt(const FloatPoint& touchPoint) const
2855 {
2856         return _pEditPresenter->GetCursorPositionAt(touchPoint);
2857 }
2858
2859 void
2860 _Edit::SetCursorDisabled(bool disabled)
2861 {
2862         _pEditPresenter->SetCursorDisabled(disabled);
2863
2864         return;
2865 }
2866
2867 result
2868 _Edit::SetPropertyAutoResizingEnabled(const Variant& enable)
2869 {
2870         result r = E_SUCCESS;
2871
2872         r = _pEditPresenter->SetAutoResizingEnabled(enable.ToBool());
2873
2874         return r;
2875 }
2876
2877 Variant
2878 _Edit::GetPropertyAutoResizingEnabled(void) const
2879 {
2880         return Variant(_pEditPresenter->IsAutoResizingEnabled());
2881 }
2882
2883 result
2884 _Edit::SetPropertyCursorPosition(const Variant& position)
2885 {
2886         result r = E_SUCCESS;
2887         int textLength = GetTextLength();
2888         int cursorPos = position.ToInt();
2889
2890         SysTryReturn(NID_UI_CTRL, (cursorPos >= 0 && cursorPos <= textLength), E_OUT_OF_RANGE, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] This position is out of range.");
2891
2892         r = _pEditPresenter->SetCursorPosition(cursorPos);
2893
2894         return r;
2895 }
2896
2897 Variant
2898 _Edit::GetPropertyCursorPosition(void) const
2899 {
2900         return Variant(_pEditPresenter->GetCursorPosition());
2901 }
2902
2903 result
2904 _Edit::SetPropertyDisabledColor(const Variant& color)
2905 {
2906         __color[EDIT_STATUS_DISABLED].backgroundColor = color.ToColor();
2907
2908         return E_SUCCESS;
2909 }
2910
2911 Variant
2912 _Edit::GetPropertyDisabledColor(void) const
2913 {
2914         return Variant(__color[EDIT_STATUS_DISABLED].backgroundColor);
2915 }
2916
2917 result
2918 _Edit::SetPropertyDisabledTextColor(const Variant& color)
2919 {
2920         __color[EDIT_STATUS_DISABLED].textColor = color.ToColor();
2921
2922         return E_SUCCESS;
2923 }
2924
2925 Variant
2926 _Edit::GetPropertyDisabledTextColor(void) const
2927 {
2928         return Variant(__color[EDIT_STATUS_DISABLED].textColor);
2929 }
2930
2931 result
2932 _Edit::SetPropertyGuideText(const Variant& guideText)
2933 {
2934         if (__pTextAccessibilityElement)
2935         {
2936                 __pTextAccessibilityElement->SetLabel(guideText.ToString());
2937         }
2938
2939         return _pEditPresenter->SetGuideText(guideText.ToString());
2940 }
2941
2942 Variant
2943 _Edit::GetPropertyGuideText(void) const
2944 {
2945         return Variant(_pEditPresenter->GetGuideText());
2946 }
2947
2948 result
2949 _Edit::SetPropertyGuideTextColor(const Variant& color)
2950 {
2951         __guideTextColor = color.ToColor();
2952
2953         return E_SUCCESS;
2954 }
2955
2956 Variant
2957 _Edit::GetPropertyGuideTextColor(void) const
2958 {
2959         return Variant(__guideTextColor);
2960 }
2961
2962 result
2963 _Edit::SetPropertyKeypadActionEnabled(const Variant& enabled)
2964 {
2965         return _pEditPresenter->SetKeypadActionEnabled(enabled.ToBool());
2966 }
2967
2968 Variant
2969 _Edit::GetPropertyKeypadActionEnabled(void) const
2970 {
2971         return Variant(_pEditPresenter->IsKeypadActionEnabled());
2972 }
2973
2974 result
2975 _Edit::SetPropertyKeypadAction(const Variant& action)
2976 {
2977         SysTryReturn(NID_UI_CTRL, (__inputStyle == INPUT_STYLE_OVERLAY), E_UNSUPPORTED_OPERATION, E_UNSUPPORTED_OPERATION, "[E_UNSUPPORTED_OPERATION] The current state unable to this operation.");
2978
2979         result r = E_SUCCESS;
2980
2981         r = _pEditPresenter->SetKeypadAction((CoreKeypadAction) action.ToInt());
2982
2983         return r;
2984 }
2985
2986 Variant
2987 _Edit::GetPropertyKeypadAction(void) const
2988 {
2989         return Variant((int) _pEditPresenter->GetKeypadAction());
2990 }
2991
2992 result
2993 _Edit::SetPropertyLineSpacing(const Variant& lineSpacing)
2994 {
2995         __lineSpacing = lineSpacing.ToFloat();
2996
2997         return E_SUCCESS;
2998 }
2999
3000 Variant
3001 _Edit::GetPropertyLineSpacing(void) const
3002 {
3003         return Variant(__lineSpacing);
3004 }
3005
3006 result
3007 _Edit::SetPropertyNormalColor(const Variant& color)
3008 {
3009         __color[EDIT_STATUS_NORMAL].backgroundColor = color.ToColor();
3010
3011         return E_SUCCESS;
3012 }
3013
3014 Variant
3015 _Edit::GetPropertyNormalColor(void) const
3016 {
3017         return Variant(__color[EDIT_STATUS_NORMAL].backgroundColor);
3018 }
3019
3020 result
3021 _Edit::SetPropertyPressedColor(const Variant& color)
3022 {
3023         __color[EDIT_STATUS_PRESSED].backgroundColor = color.ToColor();
3024
3025         return E_SUCCESS;
3026 }
3027
3028 Variant
3029 _Edit::GetPropertyPressedColor(void) const
3030 {
3031         return Variant(__color[EDIT_STATUS_PRESSED].backgroundColor);
3032 }
3033
3034 result
3035 _Edit::SetPropertyHighlightedColor(const Variant& color)
3036 {
3037         __color[EDIT_STATUS_HIGHLIGHTED].backgroundColor = color.ToColor();
3038
3039         return E_SUCCESS;
3040 }
3041
3042 Variant
3043 _Edit::GetPropertyHighlightedColor(void) const
3044 {
3045         return Variant(__color[EDIT_STATUS_HIGHLIGHTED].backgroundColor);
3046 }
3047
3048 result
3049 _Edit::SetPropertyTextSize(const Variant& textSize)
3050 {
3051         int fontMinSize = 0;
3052         float size = textSize.ToFloat();
3053         result r = E_SUCCESS;
3054
3055         GET_FIXED_VALUE_CONFIG(EDIT::FONT_MIN_SIZE, _CONTROL_ORIENTATION_PORTRAIT, fontMinSize);
3056         int floatFontMinSize = _CoordinateSystemUtils::ConvertToFloat(fontMinSize);
3057         SysTryReturn(NID_UI_CTRL, size >= floatFontMinSize, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The invalid size is given.");
3058
3059         r = _pEditPresenter->SetTextSize(size);
3060
3061         __textSize = size;
3062
3063         return r;
3064 }
3065
3066 Variant
3067 _Edit::GetPropertyTextSize(void) const
3068 {
3069         return Variant(__textSize);
3070 }
3071
3072 result
3073 _Edit::SetPropertyNormalTextColor(const Variant& color)
3074 {
3075         __color[EDIT_STATUS_NORMAL].textColor = color.ToColor();
3076
3077         return E_SUCCESS;
3078 }
3079
3080 Variant
3081 _Edit::GetPropertyNormalTextColor(void) const
3082 {
3083         return Variant(__color[EDIT_STATUS_NORMAL].textColor);
3084 }
3085
3086 result
3087 _Edit::SetPropertyHighlightedTextColor(const Variant& color)
3088 {
3089         __color[EDIT_STATUS_HIGHLIGHTED].textColor = color.ToColor();
3090
3091         return E_SUCCESS;
3092 }
3093
3094 Variant
3095 _Edit::GetPropertyHighlightedTextColor(void) const
3096 {
3097         return Variant(__color[EDIT_STATUS_HIGHLIGHTED].textColor);
3098 }
3099
3100 result
3101 _Edit::SetPropertyPressedTextColor(const Variant& color)
3102 {
3103         __color[EDIT_STATUS_PRESSED].textColor = color.ToColor();
3104
3105         return E_SUCCESS;
3106 }
3107
3108 Variant
3109 _Edit::GetPropertyPressedTextColor(void) const
3110 {
3111         return Variant(__color[EDIT_STATUS_PRESSED].textColor);
3112 }
3113
3114 result
3115 _Edit::SetPropertyKeypadEnabled(const Variant& enabled)
3116 {
3117         _pEditPresenter->SetKeypadEnabled(enabled.ToBool());
3118
3119         return E_SUCCESS;
3120 }
3121
3122 Variant
3123 _Edit::GetPropertyKeypadEnabled(void) const
3124 {
3125         return Variant(_pEditPresenter->IsKeypadEnabled());
3126 }
3127
3128 result
3129 _Edit::SetPropertyKeypadStyle(const Variant& style)
3130 {
3131         if (!(GetEditStyle() & EDIT_STYLE_SINGLE_LINE))
3132         {
3133                 SysTryReturn(NID_UI_CTRL, (KEYPAD_STYLE_PASSWORD != (KeypadStyle) style.ToInt()), E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The invalid argument is given.");
3134         }
3135
3136         return _pEditPresenter->SetKeypadStyle((KeypadStyle) style.ToInt());
3137 }
3138
3139 Variant
3140 _Edit::GetPropertyKeypadStyle(void) const
3141 {
3142         return Variant((int) _pEditPresenter->GetKeypadStyle());
3143 }
3144
3145 result
3146 _Edit::SetPropertyLowerCaseModeEnabled(const Variant& enabled)
3147 {
3148         _pEditPresenter->SetLowerCaseModeEnabled(enabled.ToBool());
3149
3150         return E_SUCCESS;
3151 }
3152
3153 Variant
3154 _Edit::GetPropertyLowerCaseModeEnabled(void) const
3155 {
3156         return Variant(_pEditPresenter->IsLowerCaseModeEnabled());
3157 }
3158
3159 result
3160 _Edit::SetPropertyOverlayKeypadCommandButtonVisible(const Variant& visible)
3161 {
3162         return _pEditPresenter->SetKeypadCommandButtonVisible(visible.ToBool());
3163 }
3164
3165 Variant
3166 _Edit::GetPropertyOverlayKeypadCommandButtonVisible(void) const
3167 {
3168         return Variant(_pEditPresenter->IsKeypadCommandButtonVisible());
3169 }
3170
3171 result
3172 _Edit::SetPropertyText(const Variant& text)
3173 {
3174         return _pEditPresenter->SetText(text.ToString());
3175 }
3176
3177 Variant
3178 _Edit::GetPropertyText(void) const
3179 {
3180         return Variant(_pEditPresenter->GetText());
3181 }
3182
3183 result
3184 _Edit::SetPropertyViewModeEnabled(const Variant& enabled)
3185 {
3186         return _pEditPresenter->SetViewModeEnabled(enabled.ToBool());
3187 }
3188
3189 Variant
3190 _Edit::GetPropertyViewModeEnabled(void) const
3191 {
3192         return Variant(_pEditPresenter->IsViewModeEnabled());
3193 }
3194
3195 result
3196 _Edit::SetPropertyAutoLinkMask(const Variant& autoLinks)
3197 {
3198         SysTryReturn(NID_UI_CTRL, (__inputStyle == INPUT_STYLE_OVERLAY), E_UNSUPPORTED_OPERATION, E_UNSUPPORTED_OPERATION, "[E_UNSUPPORTED_OPERATION] The current state unable to this operation.");
3199
3200         return _pEditPresenter->SetAutoLinkMask(autoLinks.ToULong());
3201 }
3202
3203 Variant
3204 _Edit::GetPropertyAutoLinkMask(void) const
3205 {
3206         SysTryReturn(NID_UI_CTRL, (__inputStyle == INPUT_STYLE_OVERLAY), Variant((unsigned long) LINK_TYPE_NONE), E_UNSUPPORTED_OPERATION, "[E_UNSUPPORTED_OPERATION] The current state unable to this operation.");
3207
3208         return Variant(_pEditPresenter->GetAutoLinkMask());
3209 }
3210
3211 result
3212 _Edit::SetPropertyTitleText(const Variant& titleText)
3213 {
3214         return _pEditPresenter->SetTitleText(titleText.ToString());
3215 }
3216
3217 Variant
3218 _Edit::GetPropertyTitleText(void) const
3219 {
3220         return Variant(_pEditPresenter->GetTitleText());
3221 }
3222
3223 result
3224 _Edit::SetPropertyNormalTitleTextColor(const Variant& color)
3225 {
3226         __color[EDIT_STATUS_NORMAL].titleTextColor = color.ToColor();
3227
3228         return E_SUCCESS;
3229 }
3230
3231 Variant
3232 _Edit::GetPropertyNormalTitleTextColor(void) const
3233 {
3234         return Variant(__color[EDIT_STATUS_NORMAL].titleTextColor);
3235 }
3236
3237 result
3238 _Edit::SetPropertyDisabledTitleTextColor(const Variant& color)
3239 {
3240         __color[EDIT_STATUS_DISABLED].titleTextColor = color.ToColor();
3241
3242         return E_SUCCESS;
3243 }
3244
3245 Variant
3246 _Edit::GetPropertyDisabledTitleTextColor(void) const
3247 {
3248         return Variant(__color[EDIT_STATUS_DISABLED].titleTextColor);
3249 }
3250
3251 result
3252 _Edit::SetPropertyHighlightedTitleTextColor(const Variant& color)
3253 {
3254         __color[EDIT_STATUS_HIGHLIGHTED].titleTextColor = color.ToColor();
3255
3256         return E_SUCCESS;
3257 }
3258
3259 Variant
3260 _Edit::GetPropertyHighlightedTitleTextColor(void) const
3261 {
3262         return Variant(__color[EDIT_STATUS_HIGHLIGHTED].titleTextColor);
3263 }
3264
3265 result
3266 _Edit::SetPropertyPressedTitleTextColor(const Variant& color)
3267 {
3268         __color[EDIT_STATUS_PRESSED].titleTextColor = color.ToColor();
3269
3270         return E_SUCCESS;
3271 }
3272
3273 Variant
3274 _Edit::GetPropertyPressedTitleTextColor(void) const
3275 {
3276         return Variant(__color[EDIT_STATUS_PRESSED].titleTextColor);
3277 }
3278
3279 result
3280 _Edit::SetPropertyBlockedTextColor(const Variant& color)
3281 {
3282         __blockTextColor.blockTextColor = color.ToColor();
3283         __blockTextColor.used = true;
3284
3285         return E_SUCCESS;
3286 }
3287
3288 Variant
3289 _Edit::GetPropertyBlockedTextColor(void) const
3290 {
3291         return Variant(__blockTextColor.blockTextColor);
3292 }
3293
3294 result
3295 _Edit::SetPropertyTopMargin(const Variant& margin)
3296 {
3297         SysTryReturn(NID_UI_CTRL, margin.ToFloat() > 0.0f, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The invalid argument is given.");
3298
3299         __topMargin = margin.ToFloat();
3300
3301         return E_SUCCESS;
3302 }
3303
3304 Variant
3305 _Edit::GetPropertyTopMargin(void) const
3306 {
3307         return Variant(__topMargin);
3308 }
3309
3310 result
3311 _Edit::SetPropertyBottomMargin(const Variant& margin)
3312 {
3313         SysTryReturn(NID_UI_CTRL, margin.ToFloat() > 0.0f, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The invalid argument is given.");
3314
3315         __bottomMargin = margin.ToFloat();
3316
3317         return E_SUCCESS;
3318 }
3319
3320 Variant
3321 _Edit::GetPropertyBottomMargin(void) const
3322 {
3323         return Variant(__bottomMargin);
3324 }
3325
3326 result
3327 _Edit::SetPropertyLeftMargin(const Variant& margin)
3328 {
3329         SysTryReturn(NID_UI_CTRL, margin.ToFloat() > 0.0f, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The invalid argument is given.");
3330
3331         __leftMargin = margin.ToFloat();
3332
3333         return E_SUCCESS;
3334 }
3335
3336 Variant
3337 _Edit::GetPropertyLeftMargin(void) const
3338 {
3339         return Variant(__leftMargin);
3340 }
3341
3342 result
3343 _Edit::SetPropertyRightMargin(const Variant& margin)
3344 {
3345         SysTryReturn(NID_UI_CTRL, margin.ToFloat() > 0.0f, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The invalid argument is given.");
3346
3347         __rightMargin = margin.ToFloat();
3348
3349         return E_SUCCESS;
3350 }
3351
3352 Variant
3353 _Edit::GetPropertyRightMargin(void) const
3354 {
3355         return Variant(__rightMargin);
3356 }
3357
3358 bool
3359 _Edit::ValidatePastedText(const String& pastedText, String& replacedText)
3360 {
3361         bool enable = false;
3362         if (__pTextFilter)
3363         {
3364                 enable = __pTextFilter->ValidatePastedText(pastedText, replacedText);
3365         }
3366
3367         return enable;
3368 }
3369
3370 void
3371 _Edit::SetEditTextFilter(IEditTextFilter* pFilter)
3372 {
3373         __pTextFilter = pFilter;
3374         _pEditPresenter->SetEditTextFilter(this);
3375
3376         return;
3377 }
3378
3379 void
3380 _Edit::SendOpaqueCommand(const String& command)
3381 {
3382         _pEditPresenter->SendOpaqueCommand(command);
3383
3384         return;
3385 }
3386
3387 void
3388 _Edit::OnSettingChanged(String& key)
3389 {
3390         const wchar_t* LOCALE_LANGUAGE = L"http://tizen.org/setting/locale.language";
3391         if (key == LOCALE_LANGUAGE)
3392         {
3393                 _pEditPresenter->UpdateKeypadCommandString();
3394         }
3395 }
3396
3397 _AccessibilityElement*
3398 _Edit::GetTextAccessibilityElement(void) const
3399 {
3400         return __pTextAccessibilityElement;
3401 }
3402
3403 result
3404 _Edit::SetPasswordVisible(bool visible)
3405 {
3406         return _pEditPresenter->SetPasswordVisible(visible);
3407 }
3408
3409 bool
3410 _Edit::IsPasswordVisible(void) const
3411 {
3412         return _pEditPresenter->IsPasswordVisible();
3413 }
3414
3415 bool
3416 _Edit::IsClearIconPressed(void) const
3417 {
3418         return _pEditPresenter->IsClearIconPressed();
3419 }
3420
3421 void
3422 _Edit::SetTextEventEnabled(bool enable)
3423 {
3424         __isTextEventEnabled = enable;
3425         return;
3426 }
3427
3428 bool
3429 _Edit::IsTextEventEnabled(void) const
3430 {
3431         return __isTextEventEnabled;
3432 }
3433
3434 }}} // Tizen::Ui::Controls