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