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