Changed indicator bg color.
[platform/framework/native/uifw.git] / src / ui / controls / FUiCtrl_FormImpl.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 #include <app.h>
19 #include <new>
20 #include <FUiControls.h>
21 #include <FBaseInteger.h>
22 #include <FBaseColLinkedListT.h>
23 #include <FUiCtrlHeader.h>
24 #include <FUiCtrlFooter.h>
25 #include <FUiCtrlTab.h>
26 #include <FUiLayout.h>
27 #include <FBaseSysLog.h>
28 #include <FApp_AppInfo.h>
29 #include <FGrpFloatRectangle.h>
30 #include "FUi_LayoutImpl.h"
31 #include "FUi_LayoutLayoutMaker.h"
32 #include "FUi_EcoreEvasMgr.h"
33 #include "FUi_EcoreEvas.h"
34 #include "FUi_ControlImplManager.h"
35 #include "FUi_OrientationAgent.h"
36 #include "FUi_ImeOrientationAgent.h"
37 #include "FUi_UiBuilder.h"
38 #include "FUi_CoordinateSystemUtils.h"
39 #include "FUi_DataBindingContextImpl.h"
40 #include "FUi_ResourceSizeInfo.h"
41 #include "FUi_ResourceManager.h"
42 #include "FUiAnim_VisualElement.h"
43 #include "FUiCtrl_FormImpl.h"
44 #include "FUiCtrl_HeaderImpl.h"
45 #include "FUiCtrl_FooterImpl.h"
46 #include "FUiCtrl_Form.h"
47 #include "FUiCtrl_Frame.h"
48 #include "FUiCtrl_FrameImpl.h"
49 #include "FUiCtrl_TabImpl.h"
50 #include "FUiCtrl_Indicator.h"
51
52 using namespace Tizen::App;
53 using namespace Tizen::Base;
54 using namespace Tizen::Base::Runtime;
55 using namespace Tizen::Base::Collection;
56 using namespace Tizen::Graphics;
57 using namespace Tizen::Ui;
58 using namespace Tizen::Ui::Animations;
59
60 #define OPTIONKEY       SOFTKEY_COUNT
61
62 namespace
63 {
64 const wchar_t* _REQUEST_ORIENTATION_EVENT = L"RequestOrientationEvent";
65 }
66
67 namespace Tizen { namespace Ui { namespace Controls
68 {
69
70 Dimension
71 _FormImpl::FormSizeInfo::GetDefaultMinimumSize(_ControlOrientation orientation) const
72 {
73         result r = E_SUCCESS;
74         Dimension dimension(0, 0);
75         SetLastResult(r);
76
77         return dimension;
78 }
79
80 FloatDimension
81 _FormImpl::FormSizeInfo::GetDefaultMinimumSizeF(_ControlOrientation orientation) const
82 {
83         result r = E_SUCCESS;
84         FloatDimension dimension(0.0f, 0.0f);
85         SetLastResult(r);
86
87         return dimension;
88 }
89
90 const _FormImpl*
91 _FormImpl::GetInstance(const Form& form)
92 {
93         return static_cast<const _FormImpl*> (form._pControlImpl);
94 }
95
96 _FormImpl*
97 _FormImpl::GetInstance(Form& form)
98 {
99         return static_cast<_FormImpl*> (form._pControlImpl);
100 }
101
102 _FormImpl::_FormImpl(Form* pPublic, _Form* pCore, Layout* pPublicPortraitLayout, Layout* pPublicLandscapeLayout)
103         : _ContainerImpl(pPublic, pCore, pPublicPortraitLayout, pPublicLandscapeLayout)
104         , __pForm(null)
105         , __pFormBackEventListener(null)
106         , __pFormMenuEventListener(null)
107         , __pOriAgent(null)
108         , __pImeOriAgent(null)
109         , __pLeftSoftkeyActionEvent(null)
110         , __pRightSoftkeyActionEvent(null)
111         , __pOptionMenuActionEvent(null)
112 {
113         __pForm = pCore;
114
115         int appType = _AppInfo::GetAppType();
116         if (appType & _APP_TYPE_IME_APP)
117         {
118                 __pImeOriAgent = _ImeOrientationAgent::CreateInstanceN(*pPublic);
119                 SysTryReturnVoidResult(NID_UI_CTRL, __pImeOriAgent != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
120         }
121         else
122         {
123                 __pOriAgent = _OrientationAgent::CreateInstanceN(*pPublic);
124                 SysTryReturnVoidResult(NID_UI_CTRL, __pOriAgent != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
125         }
126 }
127
128 _FormImpl::~_FormImpl(void)
129 {
130         if (__pImeOriAgent)
131         {
132                 delete __pImeOriAgent;
133                 __pImeOriAgent = null;
134         }
135
136         if (__pOriAgent)
137         {
138                 delete __pOriAgent;
139                 __pOriAgent = null;
140         }
141
142         if (__pLeftSoftkeyActionEvent)
143         {
144                 delete __pLeftSoftkeyActionEvent;
145                 __pLeftSoftkeyActionEvent = null;
146         }
147
148         if (__pRightSoftkeyActionEvent)
149         {
150                 delete __pRightSoftkeyActionEvent;
151                 __pRightSoftkeyActionEvent = null;
152         }
153
154         if (__pOptionMenuActionEvent)
155         {
156                 delete __pOptionMenuActionEvent;
157                 __pOptionMenuActionEvent = null;
158         }
159
160         __leftSoftkeyActionList.RemoveAll(false);
161         __rightSoftkeyActionList.RemoveAll(false);
162
163         RemoveHeader();
164         RemoveFooter();
165         RemoveTabImpl();
166
167         __pForm = null;
168
169         ClearLastResult();
170 }
171
172 _FormImpl*
173 _FormImpl::CreateFormImplN(Form* pControl, Layout* pPublicPortraitLayout, Layout* pPublicLandscapeLayout)
174 {
175         result r = E_SUCCESS;
176         _VisualElement* pVisualElement = null;
177
178         _Form* pCore = _Form::CreateFormN();
179         r = GetLastResult();
180         SysTryReturn(NID_UI_CTRL, pCore, null, r, "[%s] Propagating.", GetErrorMessage(r)); // [ToDo] interpret last result.
181
182         _FormImpl* pImpl = new (std::nothrow) _FormImpl(pControl, pCore, pPublicPortraitLayout, pPublicLandscapeLayout);
183
184         r = _ControlImpl::CheckConstruction(pCore, pImpl);
185         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
186
187         const FloatDimension portraitSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF();
188         const FloatDimension landscapeSize = FloatDimension(portraitSize.height, portraitSize.width);
189
190         _ControlOrientation orientation = pCore->GetOrientation();
191
192         if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
193         {
194                 r = pImpl->InitializeBoundsPropertiesF(GET_SIZE_INFO(Form), portraitSize, orientation);
195         }
196         else
197         {
198                 r = pImpl->InitializeBoundsPropertiesF(GET_SIZE_INFO(Form), landscapeSize, orientation);
199         }
200         SysAssert(r == E_SUCCESS);
201
202         pCore->SetFormOrientationStatusEventListener(pImpl);
203
204         // Make surface opaque.
205         pVisualElement = pCore->GetVisualElement();
206         SysTryCatch(NID_UI_CTRL, pVisualElement, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
207         r = pVisualElement->SetSurfaceOpaque(true);
208         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r)); // [ToDo] interpret last result.
209
210         SetLastResult(E_SUCCESS);
211
212         return pImpl;
213
214 CATCH:
215         delete pCore;
216         delete pImpl;
217
218         return null;
219 }
220
221 const char*
222 _FormImpl::GetPublicClassName(void) const
223 {
224         return "Tizen::Ui::Controls::Form";
225 }
226
227 const Form&
228 _FormImpl::GetPublic(void) const
229 {
230         return static_cast<const Form&>(_ControlImpl::GetPublic());
231 }
232
233 Form&
234 _FormImpl::GetPublic(void)
235 {
236         return static_cast<Form&>(_ControlImpl::GetPublic());
237 }
238
239 const _Form&
240 _FormImpl::GetCore(void) const
241 {
242         return static_cast<const _Form&>(_ControlImpl::GetCore());
243 }
244
245 _Form&
246 _FormImpl::GetCore(void)
247 {
248         return static_cast<_Form&>(_ControlImpl::GetCore());
249 }
250
251 _ControlImpl*
252 _FormImpl::GetFocusControl(void)
253 {
254         return null;
255 }
256
257 unsigned long
258 _FormImpl::GetFormStyle(void) const
259 {
260         return GetCore().GetFormStyle();
261 }
262
263 bool
264 _FormImpl::HasIndicator(void) const
265 {
266         return GetCore().HasIndicator();
267 }
268
269 void
270 _FormImpl::SetFormStyle(unsigned long formStyle)
271 {
272         result r = E_SUCCESS;
273
274         _HeaderImpl* pHeader = GetHeader();
275         _FooterImpl* pFooter = GetFooter();
276         _TabImpl* pTabImpl = GetTabImpl();
277
278         if (IsAttachedToMainTree())
279         {
280                 if (FORM_STYLE_INDICATOR & formStyle)
281                 {
282                         _Frame* pFrame = dynamic_cast<_Frame*>(GetCore().GetParent());
283                         SysTryReturnVoidResult(NID_UI_CTRL, pFrame != null, E_INVALID_ARG, "A Form which has FORM_STYLE_INDICATOR style cannot be added to a container except Frame.");
284                 }
285         }
286
287         if ((formStyle & FORM_STYLE_INDICATOR) && (formStyle & FORM_STYLE_INDICATOR_AUTO_HIDE))
288         {
289                 SysLogException(NID_UI_CTRL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid form style. FORM_STYLE_INDICATOR and FORM_STYLE_INDICATOR_AUTO_HIDE can't use each other.");
290                 return;
291         }
292
293         // check formstyle
294         if (((formStyle & FORM_STYLE_TITLE) || (formStyle & FORM_STYLE_TEXT_TAB) || (formStyle & FORM_STYLE_ICON_TAB)) && (formStyle & FORM_STYLE_HEADER))
295         {
296                 SysLogException(NID_UI_CTRL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid form style. FORM_STYLE_TITLE, FORM_STYLE_TEXT_TAB or FORM_STYLE_ICON_TAB and FORM_STYLE_HEADER can't use each other.");
297
298                 // remove Header
299                 if (pHeader)
300                 {
301                         RemoveHeader();
302                         r = GetLastResult();
303                         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
304                 }
305
306                 return;
307         }
308
309         if (((formStyle & FORM_STYLE_SOFTKEY_0) || (formStyle & FORM_STYLE_SOFTKEY_1) || (formStyle & FORM_STYLE_OPTIONKEY)) && (formStyle & FORM_STYLE_FOOTER))
310         {
311                 SysLogException(NID_UI_CTRL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid form style. FORM_STYLE_SOFTKEY0, FORM_STYLE_SOFTKEY_1 or FORM_STYLE_OPTIONKEY and FORM_STYLE_FOOTER can't use each other.");
312
313                 // remove Footer
314                 if (pFooter)
315                 {
316                         RemoveFooter();
317                         r = GetLastResult();
318                         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
319                 }
320                 return;
321         }
322
323         _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
324         SysTryReturnVoidResult(NID_UI_CTRL, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] Unable to get evas.");
325
326         GetCore().SetFormStyle(formStyle);
327
328         FloatRectangle indicatorBounds(0.0f, 0.0f, 0.0f, 0.0f);
329
330         if (FORM_STYLE_INDICATOR & formStyle)
331         {
332                 GetCore().SetIndicatorShowState(true);
333                 indicatorBounds = GetCore().GetIndicatorBoundsF();
334
335                 if (FORM_STYLE_LANDSCAPE_INDICATOR_AUTO_HIDE & formStyle)
336                 {
337                         GetCore().SetIndicatorAutoHide(false, true);
338                 }
339                 else
340                 {
341                         if (OnFormOrientationStatusRequested() == ORIENTATION_STATUS_PORTRAIT || OnFormOrientationStatusRequested() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
342                         {
343                                 GetCore().SetIndicatorShowState(true);
344                         }
345                         else
346                         {
347                                 GetCore().SetIndicatorShowState(false);
348                         }
349
350                         GetCore().SetIndicatorAutoHide(false, false);
351                 }
352                 r = GetLastResult();
353                 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
354
355         }
356         else
357         {
358                 if ((FORM_STYLE_INDICATOR_AUTO_HIDE & formStyle) && (FORM_STYLE_LANDSCAPE_INDICATOR_AUTO_HIDE & formStyle))
359                 {
360                         r = GetCore().SetIndicatorShowState(true);
361                         GetCore().SetIndicatorAutoHide(true, true);
362                         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
363                 }
364                 else
365                 {
366                         if (FORM_STYLE_INDICATOR_AUTO_HIDE & formStyle)
367                         {
368                                 r = GetCore().SetIndicatorShowState(true);
369                                 GetCore().SetIndicatorAutoHide(true, false);
370                                 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
371                         }
372                         else if(FORM_STYLE_LANDSCAPE_INDICATOR_AUTO_HIDE & formStyle)
373                         {
374                                 r = GetCore().SetIndicatorShowState(true);
375                                 GetCore().SetIndicatorAutoHide(false, true);
376                                 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
377                         }
378                         else
379                         {
380                                 r = GetCore().SetIndicatorShowState(false);
381                                 GetCore().SetIndicatorAutoHide(false, false);
382                                 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
383                         }
384                 }
385         }
386
387         if (formStyle & FORM_STYLE_HEADER)
388         {
389                 if (!pHeader)
390                 {
391                         pHeader = CreateHeaderN();
392                         SysTryReturnVoidResult(NID_UI_CTRL, pHeader != null, r, "[%s] Propagating.", GetErrorMessage(r));
393
394                         GetCore().SetHeader(&pHeader->GetCore());
395                         GetCore().AdjustClientBounds();
396
397                         if (GetCore().IsIndicatorTranslucent())
398                         {
399                                 if (!GetCore().IsHeaderTranslucent())
400                                 {
401                                         indicatorBounds.height = 0.0f;
402                                 }
403                                 else
404                                 {
405                                         if (GetOrientation() == _CONTROL_ORIENTATION_LANDSCAPE)
406                                         {
407                                                 indicatorBounds.height = 0.0f;
408                                         }
409                                 }
410                         }
411
412                         FloatRectangle bounds(0.0f, indicatorBounds.height, GetClientBoundsF().width, GetCore().GetToolbarHeightF(true));
413                         GetCore().SetHeaderBounds(bounds);
414
415                         r = GetCore().AttachSystemChild(pHeader->GetCore());
416                         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
417
418                         GetCore().SetFormBackEventListener(this);
419                 }
420         }
421         else if (formStyle & FORM_STYLE_TITLE)
422         {
423                 if (!pHeader)
424                 {
425                         pHeader = CreateHeaderN();
426                         SysTryReturnVoidResult(NID_UI_CTRL, pHeader != null, r, "[%s] Propagating.", GetErrorMessage(r));
427
428                         GetCore().SetHeader(&pHeader->GetCore());
429                         GetCore().AdjustClientBounds();
430
431                         FloatRectangle bounds(0.0f, indicatorBounds.height, GetClientBoundsF().width, GetCore().GetToolbarHeightF(true));
432                         GetCore().SetHeaderBounds(bounds);
433
434                         r = GetCore().AttachSystemChild(pHeader->GetCore());
435                         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
436                 }
437         }
438         else
439         {
440                 // remove Header
441                 if (pHeader)
442                 {
443                         RemoveHeader();
444                         r = GetLastResult();
445                         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
446                 }
447         }
448
449         if (formStyle & FORM_STYLE_TEXT_TAB)
450         {
451                 float titleHeight = 0.0f;
452
453                 if (formStyle & FORM_STYLE_TITLE)
454                 {
455                         if (pHeader)
456                         {
457                                 titleHeight = pHeader->GetBoundsF().height;
458                         }
459                 }
460
461                 if (!pTabImpl)
462                 {
463                         pTabImpl = CreateTabImplN();
464                         SysTryReturnVoidResult(NID_UI_CTRL, pTabImpl != null, r, "[%s] Propagating.", GetErrorMessage(r));
465
466                         float posY = indicatorBounds.height + titleHeight;
467
468                         GetCore().SetTab(&pTabImpl->GetCore());
469                         GetCore().AdjustClientBounds();
470
471                         FloatRectangle bounds(0.0f, posY, GetClientBoundsF().width, GetCore().GetTabHeightF());
472                         GetCore().SetTabBounds(bounds);
473
474                         r = GetCore().AttachSystemChild(pTabImpl->GetCore());
475                         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
476                 }
477                 GetCore().SetTabStyle(_TAB_STYLE_TEXT);
478         }
479         else if (formStyle & FORM_STYLE_ICON_TAB)
480         {
481                 float titleHeight = 0.0f;
482
483                 if (formStyle & FORM_STYLE_TITLE)
484                 {
485                         if (pHeader)
486                         {
487                                 titleHeight = pHeader->GetBoundsF().height;
488                         }
489                 }
490
491                 if (!pTabImpl)
492                 {
493                         pTabImpl = CreateTabImplN();
494                         SysTryReturnVoidResult(NID_UI_CTRL, pTabImpl != null, r, "[%s] Propagating.", GetErrorMessage(r));
495
496                         float posY = indicatorBounds.height + titleHeight;
497
498                         GetCore().SetTab(&pTabImpl->GetCore());
499                         GetCore().AdjustClientBounds();
500
501                         FloatRectangle bounds(0.0f, posY, GetClientBoundsF().width, GetCore().GetTabHeightF());
502                         GetCore().SetTabBounds(bounds);
503
504                         r = GetCore().AttachSystemChild(pTabImpl->GetCore());
505                         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
506                 }
507                 GetCore().SetTabStyle(_TAB_STYLE_ICON);
508         }
509         else
510         {
511                 if (pTabImpl)
512                 {
513                         RemoveTabImpl();
514                         r = GetLastResult();
515                         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
516                 }
517         }
518
519         if (formStyle & FORM_STYLE_FOOTER)
520         {
521                 if (!pFooter)
522                 {
523                         pFooter = CreateFooterN();
524                         SysTryReturnVoidResult(NID_UI_CTRL, pFooter != null, r, "[%s] Propagating.", GetErrorMessage(r));
525
526                         GetCore().SetFooter(&pFooter->GetCore());
527                         GetCore().AdjustClientBounds();
528
529                         FloatRectangle clientbounds = GetClientBoundsF();
530                         FloatRectangle bounds(0.0f, clientbounds.y + clientbounds.height, clientbounds.width, GetCore().GetToolbarHeightF(false));
531
532                         GetCore().SetFooterBounds(bounds);
533
534                         r = GetCore().AttachSystemChild(pFooter->GetCore());
535                         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
536
537                         GetCore().SetFormBackEventListener(this);
538                         GetCore().SetFormMenuEventListener(this);
539                 }
540         }
541         else if (formStyle & FORM_STYLE_SOFTKEY_0 || formStyle & FORM_STYLE_SOFTKEY_1 || formStyle & FORM_STYLE_OPTIONKEY)
542         {
543                 if (pFooter)
544                 {
545                         RemoveFooter();
546                         r = GetLastResult();
547                         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
548                 }
549
550                 pFooter = GetFooter();
551
552                 if (!pFooter)
553                 {
554                         pFooter = CreateFooterN();
555                         SysTryReturnVoidResult(NID_UI_CTRL, pFooter != null, r, "[%s] Propagating.", GetErrorMessage(r));
556
557                         GetCore().SetFooter(&pFooter->GetCore());
558                         GetCore().AdjustClientBounds();
559
560                         FloatRectangle clientbounds = GetClientBoundsF();
561                         FloatRectangle bounds(0.0f, clientbounds.y + clientbounds.height - GetCore().GetToolbarHeightF(false), clientbounds.width, GetCore().GetToolbarHeightF(false));
562
563                         GetCore().SetFooterBounds(bounds);
564
565                         r = GetCore().AttachSystemChild(pFooter->GetCore());
566                         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
567
568                         GetCore().CreateSoftkey(formStyle);
569
570                         pFooter->GetCore().AddActionEventListener(*this);
571                 }
572         }
573         else
574         {
575                 // remove Footer
576                 if (pFooter)
577                 {
578                         RemoveFooter();
579                         r = GetLastResult();
580                         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
581                         GetCore().AdjustClientBounds();
582                 }
583         }
584
585         GetCore().AdjustClientBounds();
586
587         SetLastResult(E_SUCCESS);
588
589         return;
590 }
591
592 _FooterImpl*
593 _FormImpl::GetFooter(void) const
594 {
595         _Toolbar* pToolbar = __pForm->GetFooter();
596         if (pToolbar == null)
597         {
598                 return null;
599         }
600
601         _FooterImpl* pFooterImpl = static_cast<_FooterImpl*>(pToolbar->GetUserData());
602
603         return pFooterImpl;
604 }
605
606 _HeaderImpl*
607 _FormImpl::GetHeader(void) const
608 {
609         _Toolbar* pToolbar = __pForm->GetHeader();
610         if (pToolbar == null)
611         {
612                 return null;
613         }
614
615         _HeaderImpl* pHeaderImpl = static_cast<_HeaderImpl*>(pToolbar->GetUserData());
616
617         return pHeaderImpl;
618 }
619
620 // Ki-Dong,Hong.Temp
621 _TabImpl*
622 _FormImpl::GetTabImpl(void) const
623 {
624         _Tab* pTab = __pForm->GetTab();
625         if (pTab == null)
626         {
627                 return null;
628         }
629
630         _TabImpl* pTabImpl = static_cast<_TabImpl*>(pTab->GetUserData());
631
632         return pTabImpl;
633 }
634
635 String
636 _FormImpl::GetTitleText(void) const
637 {
638         return GetCore().GetTitleText();
639 }
640
641 HorizontalAlignment
642 _FormImpl::GetTitleTextHorizontalAlignment(void) const
643 {
644         return GetCore().GetTitleTextHorizontalAlignment();
645 }
646
647 bool
648 _FormImpl::HasFooter(void) const
649 {
650         return GetCore().HasFooter();
651 }
652
653 bool
654 _FormImpl::HasHeader(void) const
655 {
656         return GetCore().HasHeader();
657 }
658
659 bool
660 _FormImpl::HasTitle(void) const
661 {
662         return GetCore().HasTitle();
663 }
664
665 bool
666 _FormImpl::HasTab(void) const
667 {
668         return GetCore().HasTab();
669 }
670
671 bool
672 _FormImpl::IsIndicatorVisible(void) const
673 {
674         return GetCore().IsIndicatorVisible();
675 }
676
677 bool
678 _FormImpl::IsHeaderVisible(void) const
679 {
680         return GetCore().IsHeaderVisible();
681 }
682
683 bool
684 _FormImpl::IsFooterVisible(void) const
685 {
686         return GetCore().IsFooterVisible();
687 }
688
689 bool
690 _FormImpl::IsIndicatorTranslucent(void) const
691 {
692         return GetCore().IsIndicatorTranslucent();
693 }
694
695 bool
696 _FormImpl::IsHeaderTranslucent(void) const
697 {
698         return GetCore().IsHeaderTranslucent();
699 }
700
701 bool
702 _FormImpl::IsFooterTranslucent(void) const
703 {
704         return GetCore().IsFooterTranslucent();
705 }
706
707 // Ki-Dong,Hong.Temp
708 bool
709 _FormImpl::IsTabTranslucent(void) const
710 {
711         return GetCore().IsTabTranslucent();
712 }
713
714 result
715 _FormImpl::SetActionBarsTranslucent(unsigned long actionBars, bool translucent)
716 {
717         return GetCore().SetActionBarsTranslucent(actionBars, translucent);
718 }
719
720 result
721 _FormImpl::SetActionBarsVisible(unsigned long actionBars, bool visible)
722 {
723         return GetCore().SetActionBarsVisible(actionBars, visible);
724 }
725
726 result
727 _FormImpl::SetTitleIcon(const Bitmap* pTitleBitmap)
728 {
729         return GetCore().SetTitleIcon(pTitleBitmap);
730 }
731
732 result
733 _FormImpl::SetTitleText(const String& title, HorizontalAlignment alignment)
734 {
735         return GetCore().SetTitleText(title, alignment);
736 }
737
738 OverlayRegion*
739 _FormImpl::GetOverlayRegionN(const Rectangle& rect, OverlayRegionType regionType)
740 {
741         return GetCore().GetOverlayRegionN(rect, regionType);
742 }
743
744 OverlayRegion*
745 _FormImpl::GetOverlayRegionN(const FloatRectangle& rect, OverlayRegionType regionType)
746 {
747         return GetCore().GetOverlayRegionN(rect, regionType);
748 }
749
750 void
751 _FormImpl::OnDraw(void)
752 {
753         if (__pOriAgent)
754         {
755                 __pOriAgent->FireOrientationEvent();
756         }
757
758         _ContainerImpl::OnDraw();
759 }
760
761 bool
762 _FormImpl::OnKeyReleased(const _ControlImpl& source, _KeyCode keyCode)
763 {
764         switch (keyCode)
765         {
766         case _KEY_BACKSPACE:
767                 if (GetCore().GetFooter() || GetCore().GetHeader())
768                 {
769                         if (__pFormBackEventListener)
770                         {
771                                 Form* pForm = dynamic_cast <Form*>(&GetPublic());
772                                 if (pForm)
773                                 {
774                                         __pFormBackEventListener->OnFormBackRequested(*pForm);
775                                 }
776                         }
777                         else
778                         {
779                                 break;
780                         }
781                 }
782                 else
783                 {
784                         break;
785                 }
786                 break;
787
788         default:
789                 return false;
790         }
791
792         return true;
793 }
794
795 void
796 _FormImpl::OnActionPerformed(const _Control& source, int actionId)
797 {
798         if (GetFormStyle() & FORM_STYLE_SOFTKEY_0 || GetFormStyle() & FORM_STYLE_SOFTKEY_1 || GetFormStyle() & FORM_STYLE_OPTIONKEY)
799         {
800                 Tizen::Base::Runtime::IEventArg* tempArg = null;
801                 tempArg = _PublicActionEvent::CreateActionEventArgN(actionId);
802                 SysTryReturnVoidResult(NID_UI_CTRL, tempArg , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Unable to create Eventarg.");
803                 bool fired = true;
804
805                 _PublicActionEvent* pSoftkeyActionEvent = null;
806
807                 if (GetCore().GetFooter()->IsButtonSet(LEFT_BUTTON) && GetSoftkeyActionId(SOFTKEY_0) == actionId)
808                 {
809                         for (int i = 0; i < __leftSoftkeyActionList.GetCount(); i++)
810                         {
811                                 pSoftkeyActionEvent = dynamic_cast<_PublicActionEvent*>(__leftSoftkeyActionList.GetAt(i));
812
813                                 if (pSoftkeyActionEvent)
814                                 {
815                                         pSoftkeyActionEvent->Fire(*tempArg);
816                                         fired = false;
817                                 }
818                         }
819                 }
820
821                 if (GetCore().GetFooter()->IsButtonSet(RIGHT_BUTTON) && GetSoftkeyActionId(SOFTKEY_1) == actionId)
822                 {
823                         for (int i = 0; i < __rightSoftkeyActionList.GetCount(); i++)
824                         {
825                                 pSoftkeyActionEvent = dynamic_cast<_PublicActionEvent*>(__rightSoftkeyActionList.GetAt(i));
826
827                                 if (pSoftkeyActionEvent)
828                                 {
829                                         pSoftkeyActionEvent->Fire(*tempArg);
830                                         fired = false;
831                                 }
832                         }
833                 }
834
835                 if (GetCore().GetFooter()->IsButtonSet(MIDDLE_BUTTON) && GetOptionkeyActionId() == actionId)
836                 {
837                         if (__pOptionMenuActionEvent)
838                         {
839                                 __pOptionMenuActionEvent->Fire(*tempArg);
840                                 fired = false;
841                         }
842                 }
843                 if (fired)
844                 {
845                         delete tempArg;
846                 }
847         }
848 }
849
850 Canvas*
851 _FormImpl::GetClientAreaCanvasN(void) const
852 {
853         return GetCore().GetClientAreaCanvasN();
854 }
855
856 Point
857 _FormImpl::TranslateToClientAreaPosition(const Point& position) const
858 {
859         return GetCore().TranslateToClientAreaPosition(position);
860 }
861
862 FloatPoint
863 _FormImpl::TranslateToClientAreaPosition(const FloatPoint& position) const
864 {
865         return GetCore().TranslateToClientAreaPosition(position);
866 }
867
868 Point
869 _FormImpl::TranslateFromClientAreaPosition(const Point& clientPosition) const
870 {
871         return GetCore().TranslateFromClientAreaPosition(clientPosition);
872 }
873
874 FloatPoint
875 _FormImpl::TranslateFromClientAreaPosition(const FloatPoint& clientPosition) const
876 {
877         return GetCore().TranslateFromClientAreaPosition(clientPosition);
878 }
879
880 void
881 _FormImpl::SetFormBackEventListener(const IFormBackEventListener* pFormBackEventListener)
882 {
883         __pFormBackEventListener = const_cast <IFormBackEventListener*>(pFormBackEventListener);
884         GetCore().SetFormBackEventListener(this);
885         result r = GetLastResult();
886         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
887 }
888
889 void
890 _FormImpl::SetFormMenuEventListener(const IFormMenuEventListener* pFormMenuEventListener)
891 {
892         __pFormMenuEventListener = const_cast <IFormMenuEventListener*>(pFormMenuEventListener);
893         GetCore().SetFormMenuEventListener(this);
894         result r = GetLastResult();
895         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
896 }
897
898 void
899 _FormImpl::AddOrientationEventListener(IOrientationEventListener& listener)
900 {
901         if (__pOriAgent)
902         {
903                 __pOriAgent->AddListener(listener);
904         }
905         else if (__pImeOriAgent)
906         {
907                 __pImeOriAgent->AddListener(listener);
908         }
909 }
910
911 void
912 _FormImpl::AddOptionkeyActionListener(const IActionEventListener& listener)
913 {
914         if (HasOptionkey() == false)
915         {
916                 return ;
917         }
918
919         __pOptionMenuActionEvent = _PublicActionEvent::CreateInstanceN(GetPublic());
920
921         SysTryReturnVoidResult(NID_UI_CTRL, __pOptionMenuActionEvent != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
922
923         __pOptionMenuActionEvent->AddListener(listener);
924 }
925
926 void
927 _FormImpl::AddSoftkeyActionListener(Softkey softkey, const IActionEventListener& listener)
928 {
929         _Softkey _softkey = ConvertSoftkey(softkey);
930
931         if (GetCore().CheckSoftkey(_softkey) == false)
932         {
933                 return ;
934         }
935
936         if (softkey == SOFTKEY_0)
937         {
938                 __pLeftSoftkeyActionEvent = _PublicActionEvent::CreateInstanceN(GetPublic());
939
940                 SysTryReturnVoidResult(NID_UI_CTRL, __pLeftSoftkeyActionEvent != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
941
942                 __pLeftSoftkeyActionEvent->AddListener(listener);
943
944                 __leftSoftkeyActionList.Add(*__pLeftSoftkeyActionEvent);
945         }
946         else if (softkey == SOFTKEY_1)
947         {
948                 __pRightSoftkeyActionEvent = _PublicActionEvent::CreateInstanceN(GetPublic());
949
950                 SysTryReturnVoidResult(NID_UI_CTRL, __pRightSoftkeyActionEvent != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
951
952                 __pRightSoftkeyActionEvent->AddListener(listener);
953
954                 __rightSoftkeyActionList.Add(*__pRightSoftkeyActionEvent);
955         }
956 }
957
958 void
959 _FormImpl::RemoveOrientationEventListener(IOrientationEventListener& listener)
960 {
961         if (__pOriAgent)
962         {
963                 __pOriAgent->RemoveListener(listener);
964         }
965         else if (__pImeOriAgent)
966         {
967                 __pImeOriAgent->RemoveListener(listener);
968         }
969 }
970
971 void
972 _FormImpl::RemoveOptionkeyActionListener(const IActionEventListener& listener)
973 {
974         if (HasOptionkey() == false)
975         {
976                 return ;
977         }
978
979         if (__pOptionMenuActionEvent)
980         {
981                 __pOptionMenuActionEvent->RemoveListener(listener);
982         }
983 }
984
985 void
986 _FormImpl::RemoveSoftkeyActionListener(Softkey softkey, const IActionEventListener& listener)
987 {
988         _Softkey _softkey = ConvertSoftkey(softkey);
989
990         if (GetCore().CheckSoftkey(_softkey) == false)
991         {
992                 return ;
993         }
994
995         if (softkey == SOFTKEY_0)
996         {
997                 if (__pLeftSoftkeyActionEvent)
998                 {
999                         __pLeftSoftkeyActionEvent->RemoveListener(listener);
1000                 }
1001         }
1002         else if (softkey == SOFTKEY_1)
1003         {
1004                 if (__pRightSoftkeyActionEvent)
1005                 {
1006                         __pRightSoftkeyActionEvent->RemoveListener(listener);
1007                 }
1008         }
1009 }
1010
1011 void
1012 _FormImpl::SetOrientation(Orientation orientation)
1013 {
1014         if (__pOriAgent)
1015         {
1016                 __pOriAgent->SetMode(orientation);
1017         }
1018 }
1019
1020 Orientation
1021 _FormImpl::GetOrientation(void) const
1022 {
1023         if (__pOriAgent)
1024         {
1025                 return __pOriAgent->GetMode();
1026         }
1027
1028         return ORIENTATION_NONE;
1029 }
1030
1031 OrientationStatus
1032 _FormImpl::GetOrientationStatus(void) const
1033 {
1034         if (__pOriAgent)
1035         {
1036                 return __pOriAgent->GetStatus();
1037         }
1038         else if (__pImeOriAgent)
1039         {
1040                 return __pImeOriAgent->GetStatus();
1041         }
1042
1043         return ORIENTATION_STATUS_NONE;
1044 }
1045
1046 void
1047 _FormImpl::UpdateOrientationStatus(bool draw)
1048 {
1049         if (__pOriAgent)
1050         {
1051                 __pOriAgent->Update(draw);
1052         }
1053 }
1054
1055 void
1056 _FormImpl::UpdateOrientation(void)
1057 {
1058         if (__pOriAgent)
1059         {
1060                 __pOriAgent->UpdateOrientation();
1061         }
1062 }
1063
1064 void
1065 _FormImpl::UpdateOrientation(int angle)
1066 {
1067         SysLog(NID_UI_CTRL, "[Ime Rotation]");
1068
1069         if (__pImeOriAgent)
1070         {
1071                 __pImeOriAgent->UpdateOrientation(angle);
1072         }
1073 }
1074
1075 bool
1076 _FormImpl::HasOptionkey(void) const
1077 {
1078         return GetCore().HasOptionkey();
1079 }
1080
1081 bool
1082 _FormImpl::HasSoftkey(Softkey softkey) const
1083 {
1084         _Softkey _softkey = ConvertSoftkey(softkey);
1085
1086         return GetCore().HasSoftkey(_softkey);
1087 }
1088
1089 result
1090 _FormImpl::SetSoftkeyEnabled(Softkey softkey, bool enable)
1091 {
1092         _Softkey _softkey = ConvertSoftkey(softkey);
1093
1094         result r = GetCore().SetSoftkeyEnabled(_softkey, enable);
1095         SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
1096
1097         return r;
1098 }
1099
1100 bool
1101 _FormImpl::IsSoftkeyEnabled(Softkey softkey) const
1102 {
1103         _Softkey _softkey = ConvertSoftkey(softkey);
1104
1105         return GetCore().IsSoftkeyEnabled(_softkey);
1106 }
1107
1108 int
1109 _FormImpl::GetSoftkeyActionId(Softkey softkey) const
1110 {
1111         _Softkey _softkey = ConvertSoftkey(softkey);
1112
1113         return GetCore().GetSoftkeyActionId(_softkey);
1114 }
1115
1116 int
1117 _FormImpl::GetOptionkeyActionId(void) const
1118 {
1119         return GetCore().GetOptionkeyActionId();
1120 }
1121
1122 String
1123 _FormImpl::GetSoftkeyText(Softkey softkey) const
1124 {
1125         _Softkey _softkey = ConvertSoftkey(softkey);
1126
1127         return GetCore().GetSoftkeyText(_softkey);
1128 }
1129
1130 result
1131 _FormImpl::SetOptionkeyActionId(int actionId)
1132 {
1133         result r = GetCore().SetOptionkeyActionId(actionId);
1134         SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
1135
1136         return r;
1137 }
1138
1139 result
1140 _FormImpl::SetSoftkeyActionId(Softkey softkey, int actionId)
1141 {
1142         _Softkey _softkey = ConvertSoftkey(softkey);
1143
1144         result r = GetCore().SetSoftkeyActionId(_softkey, actionId);
1145         SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
1146
1147         return r;
1148 }
1149
1150 result
1151 _FormImpl::SetSoftkeyText(Softkey softkey, const String& text)
1152 {
1153         _Softkey _softkey = ConvertSoftkey(softkey);
1154
1155         result r = GetCore().SetSoftkeyText(_softkey, text);
1156         SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
1157
1158         return r;
1159 }
1160
1161 result
1162 _FormImpl::SetSoftkeyIcon(Softkey softkey, const Bitmap& pNormalBitmap, const Bitmap* ppPressedBitmap)
1163 {
1164         _Softkey _softkey = ConvertSoftkey(softkey);
1165
1166         result r = GetCore().SetSoftkeyIcon(_softkey, pNormalBitmap, ppPressedBitmap);
1167         SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
1168
1169         return r;
1170 }
1171
1172 void
1173 _FormImpl::OnChangeLayout(_ControlOrientation orientation)
1174 {
1175         FloatDimension portraitSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF();
1176         FloatDimension landscapeSize = FloatDimension(portraitSize.height, portraitSize.width);
1177
1178         _FrameImpl* pFrameImpl = dynamic_cast<_FrameImpl*>(GetParent());
1179         if (pFrameImpl)
1180         {
1181                 FrameShowMode frameShowMode = pFrameImpl->GetShowMode();
1182
1183                 if ((frameShowMode == FRAME_SHOW_MODE_PARTIAL_SCREEN) || (frameShowMode == FRAME_SHOW_MODE_PARTIAL_SCREEN_FLOATING))
1184                 {
1185                         bool movable = pFrameImpl->GetCore().IsMovable();
1186                         pFrameImpl->GetCore().SetMovable(true);
1187
1188                         FloatPoint prevPoint = pFrameImpl->GetPositionF();
1189                         FloatPoint curPoint(prevPoint.x, prevPoint.y);
1190                         float ratio = portraitSize.width / portraitSize.height;
1191                         if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
1192                         {
1193                                 if (prevPoint.x > 0.0f)
1194                                 {
1195                                         curPoint.x = prevPoint.x * ratio;
1196                                 }
1197
1198                                 if (prevPoint.y > 0.0f)
1199                                 {
1200                                         curPoint.y = prevPoint.y / ratio;
1201                                 }
1202                         }
1203                         else
1204                         {
1205                                 if (prevPoint.x > 0.0f)
1206                                 {
1207                                         curPoint.x = prevPoint.x / ratio;
1208                                 }
1209
1210                                 if (prevPoint.y > 0.0f)
1211                                 {
1212                                         curPoint.y = prevPoint.y * ratio;
1213                                 }
1214                         }
1215
1216                         pFrameImpl->SetPosition(curPoint);
1217                         portraitSize = pFrameImpl->GetSizeF();
1218                         landscapeSize = portraitSize;
1219                         pFrameImpl->GetCore().SetMovable(movable);
1220                         pFrameImpl->GetCore().SetFloatingOrientation(orientation);
1221                 }
1222         }
1223
1224         // Change layout.
1225         _ContainerImpl::OnChangeLayout(orientation);
1226         SysTryReturnVoidResult(NID_UI_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1227
1228         if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
1229         {
1230                 SetSize(portraitSize);
1231         }
1232         else
1233         {
1234                 SetSize(landscapeSize);
1235         }
1236
1237         float indicatorheight = 0.0f;
1238
1239         GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, GetCore().GetOrientation(), indicatorheight);
1240         _Indicator* pIndicator = GetCore().GetIndicator();
1241         if (GetCore().HasIndicator())
1242         {
1243                 if (pIndicator)
1244                 {
1245                         pIndicator->SetIndicatorOrientation(orientation);
1246                         if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
1247                         {
1248                                 pIndicator->SetBounds(FloatRectangle(0.0f, 0.0f, GetClientBoundsF().width, indicatorheight));
1249                                 if ((FORM_STYLE_INDICATOR & GetFormStyle()) || (FORM_STYLE_INDICATOR_AUTO_HIDE & GetFormStyle()))
1250                                 {
1251                                         GetCore().SetIndicatorShowState(true);
1252                                 }
1253                                 else
1254                                 {
1255                                         GetCore().SetIndicatorShowState(false);
1256                                 }
1257                         }
1258                         else
1259                         {
1260                                 if (FORM_STYLE_LANDSCAPE_INDICATOR_AUTO_HIDE & GetFormStyle())
1261                                 {
1262                                         GetCore().SetIndicatorShowState(true);
1263                                 }
1264                                 else
1265                                 {
1266                                         GetCore().SetIndicatorShowState(false);
1267                                 }
1268                         }
1269                 }
1270                 GetCore().AdjustClientBounds();
1271         }
1272         else
1273         {
1274                 GetCore().SetIndicatorShowState(false);
1275         }
1276         if (pIndicator)
1277         {
1278                 pIndicator->OnChangeLayout(orientation);
1279         }
1280
1281         float adjHeight = 0.0f;
1282
1283         if (GetCore().HasHeader())
1284         {
1285                 FloatRectangle indicatorBounds(0.0f, 0.0f, 0.0f, 0.0f);
1286                 if (GetCore().IsIndicatorVisible())
1287                 {
1288                         indicatorBounds = GetCore().GetIndicatorBoundsF();
1289                         if (GetCore().IsIndicatorTranslucent())
1290                         {
1291                                 if (!GetCore().IsHeaderTranslucent())
1292                                 {
1293                                         indicatorBounds.height = 0.0f;
1294                                 }
1295                                 else
1296                                 {
1297                                         if (orientation == _CONTROL_ORIENTATION_LANDSCAPE)
1298                                         {
1299                                                 indicatorBounds.height = 0.0f;
1300                                         }
1301                                         else
1302                                         {
1303                                                 if (FORM_STYLE_INDICATOR_AUTO_HIDE & GetFormStyle())
1304                                                 {
1305                                                         indicatorBounds.height = 0.0f;
1306                                                 }
1307                                         }
1308                                 }
1309                         }
1310                 }
1311
1312                 FloatRectangle bounds(0.0f, indicatorBounds.height, GetClientBoundsF().width, GetCore().GetToolbarHeightF(true));
1313                 GetCore().SetHeaderBounds(bounds);
1314         }
1315
1316         if (GetCore().HasTab())                         // Ki-Dong,Hong.Temp
1317         {
1318                 float titleHeight = 0.0f;
1319
1320                 if (GetCore().GetFormStyle() & FORM_STYLE_TITLE)
1321                 {
1322                         if (GetCore().HasHeader())
1323                         {
1324                                 _HeaderImpl* pHeaderImpl = GetHeader();
1325                                 if (pHeaderImpl)
1326                                 {
1327                                         titleHeight = pHeaderImpl->GetBoundsF().height;
1328                                 }
1329                         }
1330                 }
1331
1332                 FloatRectangle indicatorBounds(0.0f, 0.0f, 0.0f, 0.0f);
1333
1334                 if (GetCore().IsIndicatorVisible())
1335                 {
1336                         indicatorBounds = GetCore().GetIndicatorBoundsF();
1337                         if (GetCore().IsIndicatorTranslucent())
1338                         {
1339                                 if (!GetCore().IsHeaderTranslucent())
1340                                 {
1341                                         indicatorBounds.height = 0.0f;
1342                                 }
1343                                 else
1344                                 {
1345                                         if (orientation == _CONTROL_ORIENTATION_LANDSCAPE)
1346                                         {
1347                                                 indicatorBounds.height = 0.0f;
1348                                         }
1349                                 }
1350                         }
1351                 }
1352
1353                 float posY = indicatorBounds.height + titleHeight;
1354
1355                 FloatRectangle bounds(0.0f, posY, GetClientBoundsF().width, GetCore().GetTabHeightF());
1356                 GetCore().SetTabBounds(bounds);
1357         }
1358
1359         if (GetCore().HasFooter())
1360         {
1361                 if (GetCore().GetFooter()->GetVisibleState() && !GetCore().IsFooterTranslucent())
1362                 {
1363                         adjHeight = 0.0f;
1364                 }
1365                 else
1366                 {
1367                         adjHeight = GetCore().GetToolbarHeightF(false);
1368                 }
1369
1370                 if (!(GetCore().GetFormStyle() & FORM_STYLE_FOOTER || GetCore().GetFormStyle() & FORM_STYLE_SOFTKEY_0 || GetCore().GetFormStyle() & FORM_STYLE_SOFTKEY_1
1371                                 || GetCore().GetFormStyle() & FORM_STYLE_OPTIONKEY))
1372                 {
1373                         adjHeight = GetCore().GetToolbarHeightF(false);
1374                 }
1375
1376                 FloatRectangle bounds(0.0f, GetClientBoundsF().y + GetClientBoundsF().height - adjHeight,
1377                                                                                 GetClientBoundsF().width, GetCore().GetToolbarHeightF(false));
1378                 GetCore().SetFooterBounds(bounds);
1379         }
1380 }
1381
1382 _HeaderImpl*
1383 _FormImpl::CreateHeaderN(void)
1384 {
1385         result r = E_SUCCESS;
1386
1387         Header* pHeader = new (std::nothrow) Header;
1388         SysTryReturn(NID_UI_CTRL, pHeader, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
1389
1390         r = pHeader->Construct();
1391         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1392
1393         _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*pHeader);
1394
1395         SetLastResult(E_SUCCESS);
1396
1397         return pHeaderImpl;
1398 }
1399
1400 _FooterImpl*
1401 _FormImpl::CreateFooterN(void)
1402 {
1403         result r = E_SUCCESS;
1404
1405         Footer* pFooter = new (std::nothrow) Footer;
1406         SysTryReturn(NID_UI_CTRL, pFooter, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
1407
1408         r = pFooter->Construct();
1409         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1410
1411         _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*pFooter);
1412
1413         SetLastResult(E_SUCCESS);
1414
1415         return pFooterImpl;
1416 }
1417
1418 // Ki-Dong,Hong.Temp
1419 _TabImpl*
1420 _FormImpl::CreateTabImplN(void)
1421 {
1422         //result r = E_SUCCESS;
1423
1424         //Tab* pTab = new (std::nothrow) Tab;
1425         //SysTryReturn(NID_UI_CTRL, pTab, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
1426
1427         //r = pTab->Construct();
1428         //SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] Unable to consturct tab.");
1429
1430         //return pTab->GetTabImpl();
1431         Tab* pTab = _TabImpl::CreateTabN();
1432         SysTryReturn(NID_UI_CTRL, pTab, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1433
1434         _TabImpl* pTabImpl = _TabImpl::GetInstance(*pTab);
1435
1436         SetLastResult(E_SUCCESS);
1437
1438         return pTabImpl;
1439 }
1440
1441 bool
1442 _FormImpl::DeflateClientRectHeight(int height)
1443 {
1444         return GetCore().DeflateClientRectHeight(height);
1445 }
1446
1447 bool
1448 _FormImpl::DeflateClientRectHeight(float height)
1449 {
1450         return GetCore().DeflateClientRectHeight(height);
1451 }
1452
1453 bool
1454 _FormImpl::RemoveHeader(void)
1455 {
1456         _HeaderImpl* pHeaderImpl = GetHeader();
1457
1458         if (pHeaderImpl)
1459         {
1460                 __pForm->RemoveHeader();
1461                 result r = GetLastResult();
1462                 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1463                 Header* pHeader = pHeaderImpl->GetHeader();
1464
1465                 delete pHeader;
1466         }
1467         else
1468                 return false;
1469
1470         return true;
1471 }
1472
1473 bool
1474 _FormImpl::RemoveFooter(void)
1475 {
1476         _FooterImpl* pFooterImpl = GetFooter();
1477
1478         if (pFooterImpl)
1479         {
1480                 __pForm->RemoveFooter();
1481                 result r = GetLastResult();
1482                 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1483                 Footer* pFooter = pFooterImpl->GetFooter();
1484
1485                 delete pFooter;
1486         }
1487         else
1488         {
1489                 return false;
1490         }
1491
1492         return true;
1493 }
1494
1495 // Ki-Dong,Hong.Temp
1496 bool
1497 _FormImpl::RemoveTabImpl(void)
1498 {
1499         _TabImpl* pTabImpl = GetTabImpl();
1500
1501         if (pTabImpl)
1502         {
1503                 __pForm->RemoveTab();
1504                 result r = GetLastResult();
1505                 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1506                 Tab* pTab = pTabImpl->GetTab();
1507
1508                 pTabImpl->DeleteTab(pTab);
1509         }
1510         else
1511         {
1512                 return false;
1513         }
1514
1515         return true;
1516 }
1517
1518 DataBindingContext*
1519 _FormImpl::GetDataBindingContextN(void) const
1520 {
1521         return _DataBindingContextImpl::GetDataBindingContextN(*this);
1522 }
1523
1524 result
1525 _FormImpl::OnAttaching(const _Control* pParent)
1526 {
1527         result r = E_SUCCESS;
1528         _Frame* pFrame = dynamic_cast<_Frame*>(const_cast<_Control*>((pParent)));
1529         if (FORM_STYLE_INDICATOR & GetCore().GetFormStyle())
1530         {
1531                 SysTryReturnResult(NID_UI_CTRL, pFrame != null, E_INVALID_ARG, "A Form which has FORM_STYLE_INDICATOR style cannot be added to a container except Frame.");
1532         }
1533         r = _ControlImpl::OnAttaching(pParent);
1534         return r;
1535 }
1536
1537 result
1538 _FormImpl::OnAttachedToMainTree(void)
1539 {
1540         result r = E_SUCCESS;
1541   SetFocused();
1542
1543   r = GetCore().AttachedToMainTree();
1544   r = _ContainerImpl::OnAttachedToMainTree();
1545
1546         FloatRectangle indicatorBounds(0.0f, 0.0f, 0.0f, 0.0f);
1547
1548         if (FORM_STYLE_INDICATOR & GetCore().GetFormStyle())
1549         {
1550                 indicatorBounds = GetCore().GetIndicatorBoundsF();
1551                 r = GetLastResult();
1552                 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1553         }
1554
1555         _HeaderImpl* pHeader = GetHeader();
1556         _FooterImpl* pFooter = GetFooter();
1557         _TabImpl* pTabImpl = GetTabImpl();
1558
1559         if (pHeader)
1560         {
1561                 if (GetCore().IsIndicatorTranslucent())
1562                 {
1563                         if (!GetCore().IsHeaderTranslucent())
1564                         {
1565                                 indicatorBounds.height = 0.0f;
1566                         }
1567                         else
1568                         {
1569                                 if (GetCore().GetOrientation() == _CONTROL_ORIENTATION_LANDSCAPE)
1570                                 {
1571                                         indicatorBounds.height = 0.0f;
1572                                 }
1573                         }
1574                 }
1575                 FloatRectangle bounds(0.0f, indicatorBounds.height, GetClientBoundsF().width, GetCore().GetToolbarHeightF(true));
1576                 GetCore().SetHeaderBounds(bounds);
1577         }
1578
1579         float titleHeight = 0.0f;
1580
1581         if (pHeader)
1582         {
1583                 titleHeight = pHeader->GetBoundsF().height;
1584         }
1585
1586         if (pTabImpl)
1587         {
1588                 float posY = indicatorBounds.height + titleHeight;
1589
1590                         FloatRectangle bounds(0.0f, posY, GetClientBoundsF().width, GetCore().GetTabHeightF());
1591                         GetCore().SetTabBounds(bounds);
1592         }
1593
1594         if (pFooter)
1595         {
1596                 float adjHeight = 0.0f;
1597
1598                 if (!(GetCore().GetFooter()->GetVisibleState()) || GetCore().IsFooterTranslucent())
1599                 {
1600                         adjHeight = GetCore().GetToolbarHeightF(false);
1601                 }
1602
1603                 if (!(GetCore().GetFormStyle() & FORM_STYLE_FOOTER || GetCore().GetFormStyle() & FORM_STYLE_SOFTKEY_0 || GetCore().GetFormStyle() & FORM_STYLE_SOFTKEY_1
1604                                 || GetCore().GetFormStyle() & FORM_STYLE_OPTIONKEY))
1605                 {
1606                         adjHeight = GetCore().GetToolbarHeightF(false);
1607                 }
1608
1609                 FloatRectangle clientbounds = GetClientBoundsF();
1610                 FloatRectangle bounds(0.0f, clientbounds.y + clientbounds.height - adjHeight, clientbounds.width, GetCore().GetToolbarHeightF(false));
1611
1612                 GetCore().SetFooterBounds(bounds);
1613         }
1614
1615         UpdateOrientationStatus();
1616
1617         if (__pOriAgent)
1618         {
1619                 __pOriAgent->RequestOrientationEvent();
1620         }
1621
1622         return r;
1623 }
1624
1625 result
1626 _FormImpl::OnDetachingFromMainTree(void)
1627 {
1628         result r = E_SUCCESS;
1629         r = GetCore().DetachingFromMainTree();
1630         r = _ContainerImpl::OnDetachingFromMainTree();
1631
1632         return r;
1633 }
1634
1635 bool
1636 _FormImpl::OnNotifiedN(const _ControlImpl& source, IList* pArgs)
1637 {
1638         String* pString = dynamic_cast <Tizen::Base::String*>(pArgs->GetAt(0));
1639         if (pString)
1640         {
1641                 if (*pString == _REQUEST_ORIENTATION_EVENT)
1642                 {
1643                         if (__pOriAgent)
1644                         {
1645                                 __pOriAgent->FireOrientationEvent();
1646                         }
1647
1648                         pArgs->RemoveAll(true);
1649                         delete pArgs;
1650
1651                         return true;
1652                 }
1653         }
1654
1655         return false;
1656 }
1657
1658 void
1659 _FormImpl::OnFormBackRequested(Tizen::Ui::Controls::_Form& source)
1660 {
1661         if (__pFormBackEventListener)
1662         {
1663                 _FormImpl* pFormImpl = static_cast<_FormImpl*>(source.GetUserData());
1664                 Form* pForm = dynamic_cast <Form*>(&pFormImpl->GetPublic());
1665                 if (pForm)
1666                 {
1667                         __pFormBackEventListener->OnFormBackRequested(*pForm);
1668                 }
1669                 else
1670                 {
1671                         return;
1672                 }
1673         }
1674 }
1675
1676 void
1677 _FormImpl::OnFormMenuRequested(Tizen::Ui::Controls::_Form& source)
1678 {
1679         if (__pFormMenuEventListener)
1680         {
1681                 _FormImpl* pFormImpl = static_cast<_FormImpl*>(source.GetUserData());
1682                 Form* pForm = dynamic_cast <Form*>(&pFormImpl->GetPublic());
1683                 if (pForm)
1684                 {
1685                         __pFormMenuEventListener->OnFormMenuRequested(*pForm);
1686                 }
1687                 else
1688                 {
1689                         return;
1690                 }
1691         }
1692 }
1693
1694 OrientationStatus
1695 _FormImpl::OnFormOrientationStatusRequested(void)
1696 {
1697         _ControlImplManager* pImplManager = _ControlImplManager::GetInstance();
1698         SysAssert(pImplManager);
1699
1700         OrientationStatus status = ORIENTATION_STATUS_PORTRAIT;
1701         int appType = _AppInfo::GetAppType();
1702         if (!(appType & _APP_TYPE_IME_APP))
1703         {
1704                 status = pImplManager->GetOrientationStatus(GetOrientation());
1705         }
1706         return status;
1707 }
1708
1709 bool
1710 _FormImpl::IsOpaque(void) const
1711 {
1712         //return true;
1713         return false;
1714 }
1715
1716 _Softkey
1717 _FormImpl::ConvertSoftkey(Softkey softkey) const
1718 {
1719         _Softkey _softkey;
1720
1721         if (softkey == SOFTKEY_0)
1722         {
1723                 _softkey = _SOFTKEY_0;
1724         }
1725         else if (softkey == SOFTKEY_1)
1726         {
1727                 _softkey = _SOFTKEY_1;
1728         }
1729         else
1730         {
1731                 _softkey = _SOFTKEY_COUNT;
1732         }
1733
1734         return _softkey;
1735 }
1736
1737 result
1738 _FormImpl::SetNotificationTrayOpenEnabled(bool enable)
1739 {
1740         return GetCore().SetNotificationTrayOpenEnabled(enable);
1741 }
1742
1743 bool
1744 _FormImpl::IsNotificationTrayOpenEnabled(void) const
1745 {
1746         return GetCore().IsNotificationTrayOpenEnabled();
1747 }
1748
1749 class _FormMaker
1750         : public _UiBuilderControlMaker
1751 {
1752 public:
1753         _FormMaker(_UiBuilder* uibuilder)
1754                 : _UiBuilderControlMaker(uibuilder){};
1755         virtual ~_FormMaker()
1756         {
1757         };
1758         static _UiBuilderControlMaker* GetInstance(_UiBuilder* uibuilder)
1759         {
1760                 _FormMaker* pFormMaker = new (std::nothrow) _FormMaker(uibuilder);
1761                 return pFormMaker;
1762         };
1763 protected:
1764         virtual Control* Make(_UiBuilderControl* pControl)
1765         {
1766                 _UiBuilderControlLayout* pControlProperty = null;
1767                 result r = E_SUCCESS;
1768                 int style = 0;
1769                 int opacity = 0;
1770                 Tizen::Base::String elementString;
1771                 bool isTitleAlign = false;
1772                 Color color;
1773
1774                 HorizontalAlignment align = ALIGNMENT_CENTER;
1775                 Form* pForm = (Form*) GetContainer();
1776
1777                 // Get control manager
1778                 _ControlManager* pControlManager = _ControlManager::GetInstance();
1779                 if (pControlManager == null)
1780                 {
1781                         SysLog(NID_UI_CTRL, "Unable to get the control manager.n");
1782                         return null;
1783                 }
1784                 FloatDimension screenSize = pControlManager->GetScreenSizeF();
1785
1786                 //Set rect
1787                 (pControl->GetAttribute(UIBUILDER_ATTRIBUTE_PORTRAIT))->SetRect(0.0f, 0.0f, screenSize.width, screenSize.height);
1788                 (pControl->GetAttribute(UIBUILDER_ATTRIBUTE_LANDSCAPE))->SetRect(0.0f, 0.0f, screenSize.height, screenSize.width);
1789
1790                 // Get device orientation
1791                 app_device_orientation_e deviceOrientation = app_get_device_orientation();
1792                 bool isHorizontal = (deviceOrientation == APP_DEVICE_ORIENTATION_90) || (deviceOrientation == APP_DEVICE_ORIENTATION_270);
1793
1794                 if (isHorizontal)
1795                 {
1796                         pControlProperty = pControl->GetAttribute(UIBUILDER_ATTRIBUTE_LANDSCAPE);
1797                 }
1798                 else
1799                 {
1800                         pControlProperty = pControl->GetAttribute(UIBUILDER_ATTRIBUTE_PORTRAIT);
1801                 }
1802
1803                 if (pControlProperty == null)
1804                 {
1805                         SysLogException(NID_UI_CTRL, E_SYSTEM, "[E_SYSTEM] Can't read attributes");
1806                         return null;
1807                 }
1808
1809                 pControlProperty = pControl->GetAttribute(UIBUILDER_ATTRIBUTE_PORTRAIT);
1810                 Tizen::Base::String styleString;
1811                 styleString = pControlProperty->GetStyle();
1812
1813                 if (styleString.Contains(L"FORM_STYLE_TITLE"))
1814                 {
1815                         style |= FORM_STYLE_TITLE;
1816                 }
1817                 if (styleString.Contains(L"FORM_STYLE_SOFTKEY_0"))
1818                 {
1819                         style |= FORM_STYLE_SOFTKEY_0;
1820                 }
1821                 if (styleString.Contains(L"FORM_STYLE_SOFTKEY_1"))
1822                 {
1823                         style |= FORM_STYLE_SOFTKEY_1;
1824                 }
1825                 if (styleString.Contains(L"FORM_STYLE_OPTIONKEY"))
1826                 {
1827                         style |= FORM_STYLE_OPTIONKEY;
1828                 }
1829                 if (styleString.Contains(L"FORM_STYLE_INDICATOR"))
1830                 {
1831                         if (styleString.Contains(L"FORM_STYLE_INDICATOR_AUTO_HIDE"))
1832                         {
1833                                 style |= FORM_STYLE_INDICATOR_AUTO_HIDE;
1834                         }
1835                         else
1836                         {
1837                                 style |= FORM_STYLE_INDICATOR;
1838                         }
1839                 }
1840                 if (styleString.Contains(L"FORM_STYLE_PORTRAIT_INDICATOR"))
1841                 {
1842                         if (styleString.Contains(L"FORM_STYLE_PORTRAIT_INDICATOR_AUTO_HIDE"))
1843                         {
1844                                 style |= FORM_STYLE_PORTRAIT_INDICATOR_AUTO_HIDE;
1845                         }
1846                         else
1847                         {
1848                                 style |= FORM_STYLE_PORTRAIT_INDICATOR;
1849                         }
1850                 }
1851                 if (styleString.Contains(L"FORM_STYLE_LANDSCAPE_INDICATOR_AUTO_HIDE"))
1852                 {
1853                         style |= FORM_STYLE_LANDSCAPE_INDICATOR_AUTO_HIDE;
1854                 }
1855                 if (styleString.Contains(L"FORM_STYLE_TEXT_TAB"))
1856                 {
1857                         style |= FORM_STYLE_TEXT_TAB;
1858                 }
1859                 if (styleString.Contains(L"FORM_STYLE_ICON_TAB"))
1860                 {
1861                         style |= FORM_STYLE_ICON_TAB;
1862                 }
1863                 if (styleString.Contains(L"FORM_STYLE_HEADER"))
1864                 {
1865                         style |= FORM_STYLE_HEADER;
1866                 }
1867                 if (styleString.Contains(L"FORM_STYLE_FOOTER"))
1868                 {
1869                         style |= FORM_STYLE_FOOTER;
1870                 }
1871
1872                 _UiBuilderLayoutType layoutType = UIBUILDER_LAYOUT_NONE;
1873                 __pLayoutMaker->GetLayoutType(pControlProperty, layoutType);
1874                 if (layoutType == UIBUILDER_LAYOUT_NONE)
1875                 {
1876                         // Construct
1877                         r = pForm->Construct(style);
1878                 }
1879                 else
1880                 {
1881                         Layout* pPortraitLayout = null;
1882                         Layout* pLandscapeLayout = null;
1883                         result tempResult = E_SUCCESS;
1884                         tempResult = __pLayoutMaker->GetLayoutN(pControl, pPortraitLayout, pLandscapeLayout);
1885                         if (E_SUCCESS == tempResult)
1886                         {
1887                                 r = pForm->Construct(*pPortraitLayout, *pLandscapeLayout, style);
1888                         }
1889                         else
1890                         {
1891                                 r = tempResult;
1892                         }
1893
1894                         _UiBuilderLayoutType layoutType = UIBUILDER_LAYOUT_NONE;
1895
1896                         if (__pLayoutMaker->GetLayoutType(pControlProperty, layoutType) == false)
1897                         {
1898                                 return null;
1899                         }
1900
1901                         if ( layoutType == UIBUILDER_LAYOUT_GRID)
1902                         {
1903                                 for (int i = 0; i < UIBUILDER_ATTRIBUTE_NUM; i++)
1904                                 {
1905                                         GridLayout* pGridLayout = null;
1906                                         pControlProperty = pControl->GetAttribute(i);
1907
1908                                         if ( i == UIBUILDER_ATTRIBUTE_PORTRAIT)
1909                                         {
1910                                                 pGridLayout = dynamic_cast<GridLayout*>(pPortraitLayout);
1911                                         }
1912                                         else
1913                                         {
1914                                                 pGridLayout = dynamic_cast<GridLayout*>(pLandscapeLayout);
1915                                         }
1916                                         __pLayoutMaker->SetGridLayoutContainerProperty(pGridLayout, pControlProperty);
1917                                 }
1918                         }
1919                         delete pPortraitLayout;
1920                         if (pPortraitLayout != pLandscapeLayout)
1921                         {
1922                                 delete pLandscapeLayout;
1923                         }
1924                 }
1925
1926                 if (r != E_SUCCESS)
1927                 {
1928                         SysLog(NID_UI_CTRL, "Failed to create Form.");
1929                         return null;
1930                 }
1931
1932                 // Set Property
1933                 if (pControl->GetElement(L"titleAlign", elementString))
1934                 {
1935                         if (elementString.Equals(L"ALIGN_CENTER", false))
1936                         {
1937                                 align = ALIGNMENT_CENTER;
1938                         }
1939                         else if (elementString.Equals(L"ALIGN_RIGHT", false))
1940                         {
1941                                 align = ALIGNMENT_RIGHT;
1942                         }
1943                         else
1944                         {
1945                                 align = ALIGNMENT_LEFT;
1946                         }
1947                         isTitleAlign = true;
1948                 }
1949
1950                 if (style & FORM_STYLE_TITLE)
1951                 {
1952                         if (pControl->GetElement(L"title", elementString))
1953                         {
1954                                 if (isTitleAlign)
1955                                 {
1956                                         pForm->SetTitleText(elementString, align);
1957                                 }
1958                                 else
1959                                 {
1960                                         pForm->SetTitleText(elementString);
1961                                 }
1962                         }
1963                         else
1964                         {
1965                                 if (isTitleAlign)
1966                                 {
1967                                         pForm->SetTitleText(L"", align);
1968                                 }
1969                                 else
1970                                 {
1971                                         pForm->SetTitleText(L"");
1972                                 }
1973                         }
1974                 }
1975
1976                 if (pControl->GetElement(L"titleIcon", elementString))
1977                 {
1978                         Bitmap* pBitmap = null;
1979                         pBitmap = LoadBitmapN(elementString);
1980                         if (pBitmap != null)
1981                         {
1982                                 r = pForm->SetTitleIcon(pBitmap);
1983                                 delete pBitmap;
1984                                 if (IsFailed(r))
1985                                 {
1986                                         SysLog(NID_UI_CTRL, "Failed to set TitleIcon.");
1987                                 }
1988                         }
1989                 }
1990
1991                 if (pControl->GetElement(L"softKey0Text", elementString))
1992                 {
1993                         pForm->SetSoftkeyText(SOFTKEY_0, elementString);
1994                 }
1995                 if (pControl->GetElement(L"softKey1Text", elementString))
1996                 {
1997                         pForm->SetSoftkeyText(SOFTKEY_1, elementString);
1998                 }
1999                 if (pControl->GetElement(L"backgroundColorOpacity", elementString) || pControl->GetElement(L"BGColorOpacity", elementString))
2000                 {
2001                         Base::Integer::Parse(elementString, opacity);
2002                 }
2003                 if (pControl->GetElement(L"backgroundColor", elementString) || pControl->GetElement(L"BGColor", elementString))
2004                 {
2005                         ConvertStringToColor32(elementString, opacity, color);
2006                         pForm->SetBackgroundColor(color);
2007                 }
2008                 else
2009                 {
2010                         Color color;
2011                         r = GET_COLOR_CONFIG(FORM::BG_NORMAL,color);
2012                         if (r == E_SUCCESS)
2013                         {
2014                                 pForm->SetBackgroundColor(color);
2015                         }
2016                         else
2017                         {
2018                                 pForm->SetBackgroundColor(0xff000000);
2019                         }
2020                 }
2021
2022                 if (pControl->GetElement(L"softKey0Icon", elementString) || pControl->GetElement(L"softKey0NormalIcon", elementString))
2023                 {
2024                         Bitmap* pNormalBitmap = null;
2025                         Bitmap* pPressedBitmap = null;
2026                         pNormalBitmap = LoadBitmapN(elementString); //__image->DecodeN(path,BITMAP_PIXEL_FORMAT_RGB565);
2027
2028                         if (pNormalBitmap != null)
2029                         {
2030                                 if (pControl->GetElement(L"softKey0PressedIcon", elementString))
2031                                 {
2032                                         pPressedBitmap = LoadBitmapN(elementString);
2033                                 }
2034
2035                                 if (pPressedBitmap != null)
2036                                 {
2037                                         pForm->SetSoftkeyIcon(SOFTKEY_0, *pNormalBitmap, pPressedBitmap);
2038                                         delete pNormalBitmap;
2039                                         delete pPressedBitmap;
2040                                 }
2041                                 else
2042                                 {
2043                                         pForm->SetSoftkeyIcon(SOFTKEY_0, *pNormalBitmap, null);
2044                                         delete pNormalBitmap;
2045                                 }
2046                         }
2047                 }
2048                 if (pControl->GetElement(L"softKey1Icon", elementString) || pControl->GetElement(L"softKey1NormalIcon", elementString))
2049                 {
2050                         Bitmap* pNormalBitmap = null;
2051                         Bitmap* pPressedBitmap = null;
2052                         pNormalBitmap = LoadBitmapN(elementString); //__image->DecodeN(path,BITMAP_PIXEL_FORMAT_RGB565);
2053
2054                         if (pNormalBitmap != null)
2055                         {
2056                                 if (pControl->GetElement(L"softKey1PressedIcon", elementString))
2057                                 {
2058                                         pPressedBitmap = LoadBitmapN(elementString); // __image->DecodeN(path,BITMAP_PIXEL_FORMAT_RGB565);
2059                                 }
2060
2061                                 if (pPressedBitmap != null)
2062                                 {
2063                                         pForm->SetSoftkeyIcon(SOFTKEY_1, *pNormalBitmap, pPressedBitmap);
2064                                         delete pNormalBitmap;
2065                                         delete pPressedBitmap;
2066                                 }
2067                                 else
2068                                 {
2069                                         pForm->SetSoftkeyIcon(SOFTKEY_1, *pNormalBitmap, null);
2070                                         delete pNormalBitmap;
2071                                 }
2072                         }
2073                 }
2074
2075                 if (pControl->GetElement(L"Orientation", elementString) || pControl->GetElement(L"orientation", elementString))
2076                 {
2077                         //ORIENTATION_NONE,
2078                         //ORIENTATION_PORTRAIT,
2079                         //ORIENTATION_LANDSACPE,
2080                         //ORIENTATION_PORTRAIT_REVERSE,
2081                         //ORIENTATION_LANDSACPE_REVERSE,
2082                         //ORIENTATION_AUTO = 6,
2083                         //ORIENTATION_AUTO_FOUR_DIRECTION = 8,
2084
2085                         if (elementString.Equals(L"Automatic:2Dir", false) || elementString.Equals(L"Automatic", false))
2086                         {
2087                                 pForm->SetOrientation(ORIENTATION_AUTOMATIC);
2088                         }
2089                         else if (elementString.Equals(L"Automatic:4Dir", false))
2090                         {
2091                                 pForm->SetOrientation(ORIENTATION_AUTOMATIC_FOUR_DIRECTION);
2092                         }
2093                         else if (elementString.Equals(L"Landscape", false))
2094                         {
2095                                 pForm->SetOrientation(ORIENTATION_LANDSCAPE);
2096                                 SetUiBuilderRotateState(UIBUIDER_SCREEN_HORIZONTAL);
2097                         }
2098                         else if (elementString.Equals(L"Landscape:Reverse", false))
2099                         {
2100                                 pForm->SetOrientation(ORIENTATION_LANDSCAPE_REVERSE);
2101                                 SetUiBuilderRotateState(UIBUIDER_SCREEN_HORIZONTAL);
2102                         }
2103                         else if (elementString.Equals(L"Portrait", false))
2104                         {
2105                                 pForm->SetOrientation(ORIENTATION_PORTRAIT);
2106                                 SetUiBuilderRotateState(UIBUIDER_SCREEN_VERTICAL);
2107                         }
2108                         else if (elementString.Equals(L"Portrait:Reverse", false))
2109                         {
2110                                 pForm->SetOrientation(ORIENTATION_PORTRAIT_REVERSE);
2111                                 SetUiBuilderRotateState(UIBUIDER_SCREEN_VERTICAL);
2112                         }
2113                 }
2114
2115                 if (style & FORM_STYLE_HEADER)
2116                 {
2117                         if (pControl->GetElement(L"translucentHeader", elementString))
2118                         {
2119                                 if (elementString.Equals(L"true", false))
2120                                 {
2121                                         pForm->SetActionBarsTranslucent(FORM_ACTION_BAR_HEADER, true);
2122                                 }
2123                         }
2124                 }
2125
2126                 if (style & FORM_STYLE_FOOTER)
2127                 {
2128                         if (pControl->GetElement(L"translucentFooter", elementString))
2129                         {
2130                                 if (elementString.Equals(L"true", false))
2131                                 {
2132                                         pForm->SetActionBarsTranslucent(FORM_ACTION_BAR_FOOTER, true);
2133                                 }
2134                         }
2135                 }
2136
2137                 if (style & FORM_STYLE_INDICATOR)
2138                 {
2139                         if (pControl->GetElement(L"translucentIndicator", elementString))
2140                         {
2141                                 if (elementString.Equals(L"true", false))
2142                                 {
2143                                         pForm->SetActionBarsTranslucent(FORM_ACTION_BAR_INDICATOR, true);
2144                                 }
2145                         }
2146                 }
2147
2148                 return pForm;
2149         }
2150
2151 };
2152
2153 _FormRegister::_FormRegister()
2154 {
2155         _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
2156         pUiBuilderControlTableManager->RegisterControl(L"Form", _FormMaker::GetInstance);
2157 }
2158 _FormRegister::~_FormRegister()
2159 {
2160         _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
2161         pUiBuilderControlTableManager->UnregisterControl(L"Form");
2162 }
2163 static _FormRegister FormRegisterToUiBuilder;
2164 }}} // Tizen::Ui::Controls