2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0/
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.
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"
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;
60 #define OPTIONKEY SOFTKEY_COUNT
62 namespace Tizen { namespace Ui { namespace Controls
65 const String _REQUEST_ORIENTATION_EVENT = L"RequestOrientationEvent";
68 _FormImpl::FormSizeInfo::GetDefaultMinimumSize(_ControlOrientation orientation) const
71 Dimension dimension(0, 0);
78 _FormImpl::FormSizeInfo::GetDefaultMinimumSizeF(_ControlOrientation orientation) const
81 FloatDimension dimension(0.0f, 0.0f);
88 _FormImpl::GetInstance(const Form& form)
90 return static_cast<const _FormImpl*> (form._pControlImpl);
94 _FormImpl::GetInstance(Form& form)
96 return static_cast<_FormImpl*> (form._pControlImpl);
99 _FormImpl::_FormImpl(Form* pPublic, _Form* pCore, Layout* pPublicPortraitLayout, Layout* pPublicLandscapeLayout)
100 : _ContainerImpl(pPublic, pCore, pPublicPortraitLayout, pPublicLandscapeLayout)
102 , __pFormBackEventListener(null)
104 , __pImeOriAgent(null)
105 , __pLeftSoftkeyActionEvent(null)
106 , __pRightSoftkeyActionEvent(null)
107 , __pOptionMenuActionEvent(null)
111 int appType = _AppInfo::GetAppType();
112 if (appType & _APP_TYPE_IME_APP)
114 __pImeOriAgent = _ImeOrientationAgent::CreateInstanceN(*pPublic);
115 SysTryReturnVoidResult(NID_UI_CTRL, __pImeOriAgent != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
119 __pOriAgent = _OrientationAgent::CreateInstanceN(*pPublic);
120 SysTryReturnVoidResult(NID_UI_CTRL, __pOriAgent != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
124 _FormImpl::~_FormImpl(void)
128 delete __pImeOriAgent;
129 __pImeOriAgent = null;
138 if (__pLeftSoftkeyActionEvent)
140 delete __pLeftSoftkeyActionEvent;
141 __pLeftSoftkeyActionEvent = null;
144 if (__pRightSoftkeyActionEvent)
146 delete __pRightSoftkeyActionEvent;
147 __pRightSoftkeyActionEvent = null;
150 if (__pOptionMenuActionEvent)
152 delete __pOptionMenuActionEvent;
153 __pOptionMenuActionEvent = null;
156 __leftSoftkeyActionList.RemoveAll(false);
157 __rightSoftkeyActionList.RemoveAll(false);
169 _FormImpl::CreateFormImplN(Form* pControl, Layout* pPublicPortraitLayout, Layout* pPublicLandscapeLayout)
171 result r = E_SUCCESS;
172 _VisualElement* pVisualElement = null;
174 _Form* pCore = _Form::CreateFormN();
176 SysTryReturn(NID_UI_CTRL, pCore, null, r, "[%s] Propagating.", GetErrorMessage(r)); // [ToDo] interpret last result.
178 _FormImpl* pImpl = new (std::nothrow) _FormImpl(pControl, pCore, pPublicPortraitLayout, pPublicLandscapeLayout);
180 r = _ControlImpl::CheckConstruction(pCore, pImpl);
181 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
183 const FloatDimension portraitSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF();
184 const FloatDimension landscapeSize = FloatDimension(portraitSize.height, portraitSize.width);
186 _ControlOrientation orientation = pCore->GetOrientation();
188 if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
190 r = pImpl->InitializeBoundsPropertiesF(GET_SIZE_INFO(Form), portraitSize, orientation);
194 r = pImpl->InitializeBoundsPropertiesF(GET_SIZE_INFO(Form), landscapeSize, orientation);
196 SysAssert(r == E_SUCCESS);
198 pCore->SetFormOrientationStatusEventListener(pImpl);
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.
206 SetLastResult(E_SUCCESS);
218 _FormImpl::GetPublicClassName(void) const
220 return "Tizen::Ui::Controls::Form";
224 _FormImpl::GetPublic(void) const
226 return static_cast<const Form&>(_ControlImpl::GetPublic());
230 _FormImpl::GetPublic(void)
232 return static_cast<Form&>(_ControlImpl::GetPublic());
236 _FormImpl::GetCore(void) const
238 return static_cast<const _Form&>(_ControlImpl::GetCore());
242 _FormImpl::GetCore(void)
244 return static_cast<_Form&>(_ControlImpl::GetCore());
248 _FormImpl::GetFocusControl(void)
254 _FormImpl::GetFormStyle(void) const
256 return GetCore().GetFormStyle();
260 _FormImpl::HasIndicator(void) const
262 return GetCore().HasIndicator();
266 _FormImpl::SetFormStyle(unsigned long formStyle)
268 result r = E_SUCCESS;
270 _HeaderImpl* pHeader = GetHeader();
271 _FooterImpl* pFooter = GetFooter();
272 _TabImpl* pTabImpl = GetTabImpl();
274 if (IsAttachedToMainTree())
276 if (FORM_STYLE_INDICATOR & formStyle)
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.");
283 if ((formStyle & FORM_STYLE_INDICATOR) && (formStyle & FORM_STYLE_INDICATOR_AUTO_HIDE))
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.");
290 if (((formStyle & FORM_STYLE_TITLE) || (formStyle & FORM_STYLE_TEXT_TAB) || (formStyle & FORM_STYLE_ICON_TAB)) && (formStyle & FORM_STYLE_HEADER))
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.");
299 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
305 if (((formStyle & FORM_STYLE_SOFTKEY_0) || (formStyle & FORM_STYLE_SOFTKEY_1) || (formStyle & FORM_STYLE_OPTIONKEY)) && (formStyle & FORM_STYLE_FOOTER))
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.");
314 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
319 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
320 SysTryReturnVoidResult(NID_UI_CTRL, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] Unable to get evas.");
322 GetCore().SetFormStyle(formStyle);
324 FloatRectangle indicatorBounds(0.0f, 0.0f, 0.0f, 0.0f);
326 if (FORM_STYLE_INDICATOR & formStyle)
328 GetCore().SetIndicatorShowState(true);
329 indicatorBounds = GetCore().GetIndicatorBoundsF();
331 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
334 else if(FORM_STYLE_INDICATOR_AUTO_HIDE & formStyle)
336 r = GetCore().SetIndicatorShowState(false, true);
337 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
341 r = GetCore().SetIndicatorShowState(false);
342 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
345 if (formStyle & FORM_STYLE_HEADER)
349 pHeader = CreateHeaderN();
350 SysTryReturnVoidResult(NID_UI_CTRL, pHeader != null, r, "[%s] Propagating.", GetErrorMessage(r));
352 GetCore().SetHeader(&pHeader->GetCore());
353 GetCore().AdjustClientBounds();
355 if (GetCore().IsIndicatorTranslucent())
357 if (!GetCore().IsHeaderTranslucent())
359 indicatorBounds.height = 0.0f;
363 if (GetOrientation() == _CONTROL_ORIENTATION_LANDSCAPE)
365 indicatorBounds.height = 0.0f;
370 FloatRectangle bounds(0.0f, indicatorBounds.height, GetClientBoundsF().width, GetCore().GetToolbarHeightF(true));
371 GetCore().SetHeaderBounds(bounds);
373 r = GetCore().AttachSystemChild(pHeader->GetCore());
374 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
376 GetCore().SetFormBackEventListener(this);
379 else if (formStyle & FORM_STYLE_TITLE)
383 pHeader = CreateHeaderN();
384 SysTryReturnVoidResult(NID_UI_CTRL, pHeader != null, r, "[%s] Propagating.", GetErrorMessage(r));
386 GetCore().SetHeader(&pHeader->GetCore());
387 GetCore().AdjustClientBounds();
389 FloatRectangle bounds(0.0f, indicatorBounds.height, GetClientBoundsF().width, GetCore().GetToolbarHeightF(true));
390 GetCore().SetHeaderBounds(bounds);
392 r = GetCore().AttachSystemChild(pHeader->GetCore());
393 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
403 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
407 if (formStyle & FORM_STYLE_TEXT_TAB)
409 float titleHeight = 0.0f;
411 if (formStyle & FORM_STYLE_TITLE)
415 titleHeight = pHeader->GetBoundsF().height;
421 pTabImpl = CreateTabImplN();
422 SysTryReturnVoidResult(NID_UI_CTRL, pTabImpl != null, r, "[%s] Propagating.", GetErrorMessage(r));
424 float posY = indicatorBounds.height + titleHeight;
426 GetCore().SetTab(&pTabImpl->GetCore());
427 GetCore().AdjustClientBounds();
429 FloatRectangle bounds(0.0f, posY, GetClientBoundsF().width, GetCore().GetTabHeightF());
430 GetCore().SetTabBounds(bounds);
432 r = GetCore().AttachSystemChild(pTabImpl->GetCore());
433 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
435 GetCore().SetTabStyle(_TAB_STYLE_TEXT);
437 else if (formStyle & FORM_STYLE_ICON_TAB)
439 float titleHeight = 0.0f;
441 if (formStyle & FORM_STYLE_TITLE)
445 titleHeight = pHeader->GetBoundsF().height;
451 pTabImpl = CreateTabImplN();
452 SysTryReturnVoidResult(NID_UI_CTRL, pTabImpl != null, r, "[%s] Propagating.", GetErrorMessage(r));
454 float posY = indicatorBounds.height + titleHeight;
456 GetCore().SetTab(&pTabImpl->GetCore());
457 GetCore().AdjustClientBounds();
459 FloatRectangle bounds(0.0f, posY, GetClientBoundsF().width, GetCore().GetTabHeightF());
460 GetCore().SetTabBounds(bounds);
462 r = GetCore().AttachSystemChild(pTabImpl->GetCore());
463 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
465 GetCore().SetTabStyle(_TAB_STYLE_ICON);
473 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
477 if (formStyle & FORM_STYLE_FOOTER)
481 pFooter = CreateFooterN();
482 SysTryReturnVoidResult(NID_UI_CTRL, pFooter != null, r, "[%s] Propagating.", GetErrorMessage(r));
484 GetCore().SetFooter(&pFooter->GetCore());
485 GetCore().AdjustClientBounds();
487 FloatRectangle clientbounds = GetClientBoundsF();
488 FloatRectangle bounds(0.0f, clientbounds.y + clientbounds.height, clientbounds.width, GetCore().GetToolbarHeightF(false));
490 GetCore().SetFooterBounds(bounds);
492 r = GetCore().AttachSystemChild(pFooter->GetCore());
493 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
495 GetCore().SetFormBackEventListener(this);
498 else if (formStyle & FORM_STYLE_SOFTKEY_0 || formStyle & FORM_STYLE_SOFTKEY_1 || formStyle & FORM_STYLE_OPTIONKEY)
504 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
507 pFooter = GetFooter();
511 pFooter = CreateFooterN();
512 SysTryReturnVoidResult(NID_UI_CTRL, pFooter != null, r, "[%s] Propagating.", GetErrorMessage(r));
514 GetCore().SetFooter(&pFooter->GetCore());
515 GetCore().AdjustClientBounds();
517 FloatRectangle clientbounds = GetClientBoundsF();
518 FloatRectangle bounds(0.0f, clientbounds.y + clientbounds.height - GetCore().GetToolbarHeightF(false), clientbounds.width, GetCore().GetToolbarHeightF(false));
520 GetCore().SetFooterBounds(bounds);
522 r = GetCore().AttachSystemChild(pFooter->GetCore());
523 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
525 GetCore().CreateSoftkey(formStyle);
527 pFooter->GetCore().AddActionEventListener(*this);
537 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
538 GetCore().AdjustClientBounds();
542 GetCore().AdjustClientBounds();
544 SetLastResult(E_SUCCESS);
550 _FormImpl::GetFooter(void) const
552 _Toolbar* pToolbar = __pForm->GetFooter();
553 if (pToolbar == null)
558 _FooterImpl* pFooterImpl = static_cast<_FooterImpl*>(pToolbar->GetUserData());
564 _FormImpl::GetHeader(void) const
566 _Toolbar* pToolbar = __pForm->GetHeader();
567 if (pToolbar == null)
572 _HeaderImpl* pHeaderImpl = static_cast<_HeaderImpl*>(pToolbar->GetUserData());
579 _FormImpl::GetTabImpl(void) const
581 _Tab* pTab = __pForm->GetTab();
587 _TabImpl* pTabImpl = static_cast<_TabImpl*>(pTab->GetUserData());
593 _FormImpl::GetTitleText(void) const
595 return GetCore().GetTitleText();
599 _FormImpl::GetTitleTextHorizontalAlignment(void) const
601 return GetCore().GetTitleTextHorizontalAlignment();
605 _FormImpl::HasFooter(void) const
607 return GetCore().HasFooter();
611 _FormImpl::HasHeader(void) const
613 return GetCore().HasHeader();
617 _FormImpl::HasTitle(void) const
619 return GetCore().HasTitle();
623 _FormImpl::HasTab(void) const
625 return GetCore().HasTab();
629 _FormImpl::IsIndicatorVisible(void) const
631 return GetCore().IsIndicatorVisible();
635 _FormImpl::IsHeaderVisible(void) const
637 return GetCore().IsHeaderVisible();
641 _FormImpl::IsFooterVisible(void) const
643 return GetCore().IsFooterVisible();
647 _FormImpl::IsIndicatorTranslucent(void) const
649 return GetCore().IsIndicatorTranslucent();
653 _FormImpl::IsHeaderTranslucent(void) const
655 return GetCore().IsHeaderTranslucent();
659 _FormImpl::IsFooterTranslucent(void) const
661 return GetCore().IsFooterTranslucent();
666 _FormImpl::IsTabTranslucent(void) const
668 return GetCore().IsTabTranslucent();
672 _FormImpl::SetActionBarsTranslucent(unsigned long actionBars, bool translucent)
674 return GetCore().SetActionBarsTranslucent(actionBars, translucent);
678 _FormImpl::SetActionBarsVisible(unsigned long actionBars, bool visible)
680 return GetCore().SetActionBarsVisible(actionBars, visible);
684 _FormImpl::SetTitleIcon(const Bitmap* pTitleBitmap)
686 return GetCore().SetTitleIcon(pTitleBitmap);
690 _FormImpl::SetTitleText(const String& title, HorizontalAlignment alignment)
692 return GetCore().SetTitleText(title, alignment);
696 _FormImpl::GetOverlayRegionN(const Rectangle& rect, OverlayRegionType regionType)
698 return GetCore().GetOverlayRegionN(rect, regionType);
702 _FormImpl::GetOverlayRegionN(const FloatRectangle& rect, OverlayRegionType regionType)
704 return GetCore().GetOverlayRegionN(rect, regionType);
708 _FormImpl::OnDraw(void)
712 __pOriAgent->FireOrientationEvent();
715 _ContainerImpl::OnDraw();
719 _FormImpl::OnKeyReleased(const _ControlImpl& source, _KeyCode keyCode)
724 if (GetCore().GetFooter() || GetCore().GetHeader())
726 if (__pFormBackEventListener)
728 Form* pForm = dynamic_cast <Form*>(&GetPublic());
731 __pFormBackEventListener->OnFormBackRequested(*pForm);
753 _FormImpl::OnActionPerformed(const _Control& source, int actionId)
755 if (GetFormStyle() & FORM_STYLE_SOFTKEY_0 || GetFormStyle() & FORM_STYLE_SOFTKEY_1 || GetFormStyle() & FORM_STYLE_OPTIONKEY)
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.");
762 _PublicActionEvent* pSoftkeyActionEvent = null;
764 if (GetCore().GetFooter()->IsButtonSet(LEFT_BUTTON) && GetSoftkeyActionId(SOFTKEY_0) == actionId)
766 for (int i = 0; i < __leftSoftkeyActionList.GetCount(); i++)
768 pSoftkeyActionEvent = dynamic_cast<_PublicActionEvent*>(__leftSoftkeyActionList.GetAt(i));
770 if (pSoftkeyActionEvent)
772 pSoftkeyActionEvent->Fire(*tempArg);
778 if (GetCore().GetFooter()->IsButtonSet(RIGHT_BUTTON) && GetSoftkeyActionId(SOFTKEY_1) == actionId)
780 for (int i = 0; i < __rightSoftkeyActionList.GetCount(); i++)
782 pSoftkeyActionEvent = dynamic_cast<_PublicActionEvent*>(__rightSoftkeyActionList.GetAt(i));
784 if (pSoftkeyActionEvent)
786 pSoftkeyActionEvent->Fire(*tempArg);
792 if (GetCore().GetFooter()->IsButtonSet(MIDDLE_BUTTON) && GetOptionkeyActionId() == actionId)
794 if (__pOptionMenuActionEvent)
796 __pOptionMenuActionEvent->Fire(*tempArg);
808 _FormImpl::GetClientAreaCanvasN(void) const
810 return GetCore().GetClientAreaCanvasN();
814 _FormImpl::TranslateToClientAreaPosition(const Point& position) const
816 return GetCore().TranslateToClientAreaPosition(position);
820 _FormImpl::TranslateToClientAreaPosition(const FloatPoint& position) const
822 return GetCore().TranslateToClientAreaPosition(position);
826 _FormImpl::TranslateFromClientAreaPosition(const Point& clientPosition) const
828 return GetCore().TranslateFromClientAreaPosition(clientPosition);
832 _FormImpl::TranslateFromClientAreaPosition(const FloatPoint& clientPosition) const
834 return GetCore().TranslateFromClientAreaPosition(clientPosition);
838 _FormImpl::SetFormBackEventListener(const IFormBackEventListener* pFormBackEventListener)
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));
848 _FormImpl::AddOrientationEventListener(IOrientationEventListener& listener)
852 __pOriAgent->AddListener(listener);
854 else if (__pImeOriAgent)
856 __pImeOriAgent->AddListener(listener);
861 _FormImpl::AddOptionkeyActionListener(const IActionEventListener& listener)
863 if (HasOptionkey() == false)
868 __pOptionMenuActionEvent = _PublicActionEvent::CreateInstanceN(GetPublic());
870 SysTryReturnVoidResult(NID_UI_CTRL, __pOptionMenuActionEvent != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
872 __pOptionMenuActionEvent->AddListener(listener);
876 _FormImpl::AddSoftkeyActionListener(Softkey softkey, const IActionEventListener& listener)
878 _Softkey _softkey = ConvertSoftkey(softkey);
880 if (GetCore().CheckSoftkey(_softkey) == false)
885 if (softkey == SOFTKEY_0)
887 __pLeftSoftkeyActionEvent = _PublicActionEvent::CreateInstanceN(GetPublic());
889 SysTryReturnVoidResult(NID_UI_CTRL, __pLeftSoftkeyActionEvent != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
891 __pLeftSoftkeyActionEvent->AddListener(listener);
893 __leftSoftkeyActionList.Add(*__pLeftSoftkeyActionEvent);
895 else if (softkey == SOFTKEY_1)
897 __pRightSoftkeyActionEvent = _PublicActionEvent::CreateInstanceN(GetPublic());
899 SysTryReturnVoidResult(NID_UI_CTRL, __pRightSoftkeyActionEvent != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
901 __pRightSoftkeyActionEvent->AddListener(listener);
903 __rightSoftkeyActionList.Add(*__pRightSoftkeyActionEvent);
908 _FormImpl::RemoveOrientationEventListener(IOrientationEventListener& listener)
912 __pOriAgent->RemoveListener(listener);
914 else if (__pImeOriAgent)
916 __pImeOriAgent->RemoveListener(listener);
921 _FormImpl::RemoveOptionkeyActionListener(const IActionEventListener& listener)
923 if (HasOptionkey() == false)
928 if (__pOptionMenuActionEvent)
930 __pOptionMenuActionEvent->RemoveListener(listener);
935 _FormImpl::RemoveSoftkeyActionListener(Softkey softkey, const IActionEventListener& listener)
937 _Softkey _softkey = ConvertSoftkey(softkey);
939 if (GetCore().CheckSoftkey(_softkey) == false)
944 if (softkey == SOFTKEY_0)
946 if (__pLeftSoftkeyActionEvent)
948 __pLeftSoftkeyActionEvent->RemoveListener(listener);
951 else if (softkey == SOFTKEY_1)
953 if (__pRightSoftkeyActionEvent)
955 __pRightSoftkeyActionEvent->RemoveListener(listener);
961 _FormImpl::SetOrientation(Orientation orientation)
965 __pOriAgent->SetMode(orientation);
970 _FormImpl::GetOrientation(void) const
974 return __pOriAgent->GetMode();
977 return ORIENTATION_NONE;
981 _FormImpl::GetOrientationStatus(void) const
985 return __pOriAgent->GetStatus();
987 else if (__pImeOriAgent)
989 return __pImeOriAgent->GetStatus();
992 return ORIENTATION_STATUS_NONE;
996 _FormImpl::UpdateOrientationStatus(bool draw)
1000 __pOriAgent->Update(draw);
1005 _FormImpl::UpdateOrientation(void)
1009 __pOriAgent->UpdateOrientation();
1014 _FormImpl::UpdateOrientation(int angle)
1016 SysLog(NID_UI_CTRL, "[Ime Rotation]");
1020 __pImeOriAgent->UpdateOrientation(angle);
1025 _FormImpl::HasOptionkey(void) const
1027 return GetCore().HasOptionkey();
1031 _FormImpl::HasSoftkey(Softkey softkey) const
1033 _Softkey _softkey = ConvertSoftkey(softkey);
1035 return GetCore().HasSoftkey(_softkey);
1039 _FormImpl::SetSoftkeyEnabled(Softkey softkey, bool enable)
1041 _Softkey _softkey = ConvertSoftkey(softkey);
1043 result r = GetCore().SetSoftkeyEnabled(_softkey, enable);
1044 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
1050 _FormImpl::IsSoftkeyEnabled(Softkey softkey) const
1052 _Softkey _softkey = ConvertSoftkey(softkey);
1054 return GetCore().IsSoftkeyEnabled(_softkey);
1058 _FormImpl::GetSoftkeyActionId(Softkey softkey) const
1060 _Softkey _softkey = ConvertSoftkey(softkey);
1062 return GetCore().GetSoftkeyActionId(_softkey);
1066 _FormImpl::GetOptionkeyActionId(void) const
1068 return GetCore().GetOptionkeyActionId();
1072 _FormImpl::GetSoftkeyText(Softkey softkey) const
1074 _Softkey _softkey = ConvertSoftkey(softkey);
1076 return GetCore().GetSoftkeyText(_softkey);
1080 _FormImpl::SetOptionkeyActionId(int actionId)
1082 result r = GetCore().SetOptionkeyActionId(actionId);
1083 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
1089 _FormImpl::SetSoftkeyActionId(Softkey softkey, int actionId)
1091 _Softkey _softkey = ConvertSoftkey(softkey);
1093 result r = GetCore().SetSoftkeyActionId(_softkey, actionId);
1094 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
1100 _FormImpl::SetSoftkeyText(Softkey softkey, const String& text)
1102 _Softkey _softkey = ConvertSoftkey(softkey);
1104 result r = GetCore().SetSoftkeyText(_softkey, text);
1105 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
1111 _FormImpl::SetSoftkeyIcon(Softkey softkey, const Bitmap& pNormalBitmap, const Bitmap* ppPressedBitmap)
1113 _Softkey _softkey = ConvertSoftkey(softkey);
1115 result r = GetCore().SetSoftkeyIcon(_softkey, pNormalBitmap, ppPressedBitmap);
1116 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
1122 _FormImpl::OnChangeLayout(_ControlOrientation orientation)
1124 FloatDimension portraitSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF();
1125 FloatDimension landscapeSize = FloatDimension(portraitSize.height, portraitSize.width);
1127 // Adjust the position of the partial Frame.
1128 _FrameImpl* pFrameImpl = dynamic_cast<_FrameImpl*>(GetParent());
1131 FrameShowMode frameShowMode = pFrameImpl->GetShowMode();
1133 if ((frameShowMode == FRAME_SHOW_MODE_PARTIAL_SCREEN) || (frameShowMode == FRAME_SHOW_MODE_PARTIAL_SCREEN_FLOATING))
1135 bool movable = pFrameImpl->GetCore().IsMovable();
1136 pFrameImpl->GetCore().SetMovable(true);
1138 FloatPoint prevPoint = pFrameImpl->GetPositionF();
1140 FloatPoint curPoint(0.0f, 0.0f);
1142 if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
1144 if (prevPoint.x < 0.0f)
1146 curPoint.x = portraitSize.height / portraitSize.width * prevPoint.x;
1150 curPoint.x = portraitSize.width / portraitSize.height * prevPoint.x;
1153 if (prevPoint.y < 0.0f)
1155 curPoint.y = portraitSize.width / portraitSize.height * prevPoint.y;
1159 curPoint.y = portraitSize.height / portraitSize.width * prevPoint.y;
1164 if (prevPoint.x < 0.0f)
1166 curPoint.x = portraitSize.width / portraitSize.height * prevPoint.x;
1170 curPoint.x = portraitSize.height / portraitSize.width * prevPoint.x;
1173 if (prevPoint.y < 0.0f)
1175 curPoint.y = portraitSize.height / portraitSize.width * prevPoint.y;
1179 curPoint.y = portraitSize.width / portraitSize.height * prevPoint.y;
1184 pFrameImpl->SetPosition(curPoint);
1186 portraitSize = pFrameImpl->GetSizeF();
1187 landscapeSize = portraitSize;
1189 pFrameImpl->GetCore().SetMovable(movable);
1194 _ContainerImpl::OnChangeLayout(orientation);
1195 SysTryReturnVoidResult(NID_UI_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1197 if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
1199 SetSize(portraitSize);
1203 SetSize(landscapeSize);
1206 float indicatorheight = 0.0f;
1208 GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, GetCore().GetOrientation(), indicatorheight);
1209 if (GetCore().HasIndicator())
1211 _Indicator* pIndicator = GetCore().GetIndicator();
1214 if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
1216 pIndicator->SetBounds(FloatRectangle(0.0f, 0.0f, GetClientBoundsF().width, indicatorheight));
1220 GET_SHAPE_CONFIG(FORM::INDICATOR_MINIMIZE_HEIGHT, GetCore().GetOrientation(), indicatorheight);
1221 pIndicator->SetBounds(FloatRectangle(0.0f, 0.0f, GetClientBoundsF().width, indicatorheight));
1224 pIndicator->OnChangeLayout(orientation);
1225 GetCore().AdjustClientBounds();
1229 float adjHeight = 0.0f;
1231 if (GetCore().HasHeader())
1233 FloatRectangle indicatorBounds(0.0f, 0.0f, 0.0f, 0.0f);
1234 if (GetCore().IsIndicatorVisible())
1236 indicatorBounds = GetCore().GetIndicatorBoundsF();
1237 if (GetCore().IsIndicatorTranslucent())
1239 if (!GetCore().IsHeaderTranslucent())
1241 indicatorBounds.height = 0.0f;
1245 if (orientation == _CONTROL_ORIENTATION_LANDSCAPE)
1247 indicatorBounds.height = 0.0f;
1253 FloatRectangle bounds(0.0f, indicatorBounds.height, GetClientBoundsF().width, GetCore().GetToolbarHeightF(true));
1254 GetCore().SetHeaderBounds(bounds);
1257 if (GetCore().HasTab()) // Ki-Dong,Hong.Temp
1259 float titleHeight = 0.0f;
1261 if (GetCore().GetFormStyle() & FORM_STYLE_TITLE)
1263 if (GetCore().HasHeader())
1265 _HeaderImpl* pHeaderImpl = GetHeader();
1268 titleHeight = pHeaderImpl->GetBoundsF().height;
1273 FloatRectangle indicatorBounds(0.0f, 0.0f, 0.0f, 0.0f);
1275 if (GetCore().IsIndicatorVisible())
1277 indicatorBounds = GetCore().GetIndicatorBoundsF();
1278 if (GetCore().IsIndicatorTranslucent())
1280 if (!GetCore().IsHeaderTranslucent())
1282 indicatorBounds.height = 0.0f;
1286 if (orientation == _CONTROL_ORIENTATION_LANDSCAPE)
1288 indicatorBounds.height = 0.0f;
1294 float posY = indicatorBounds.height + titleHeight;
1296 FloatRectangle bounds(0.0f, posY, GetClientBoundsF().width, GetCore().GetTabHeightF());
1297 GetCore().SetTabBounds(bounds);
1300 if (GetCore().HasFooter())
1302 if (GetCore().GetFooter()->GetVisibleState() && !GetCore().IsFooterTranslucent())
1308 adjHeight = GetCore().GetToolbarHeightF(false);
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))
1314 adjHeight = GetCore().GetToolbarHeightF(false);
1317 FloatRectangle bounds(0.0f, GetClientBoundsF().y + GetClientBoundsF().height - adjHeight,
1318 GetClientBoundsF().width, GetCore().GetToolbarHeightF(false));
1319 GetCore().SetFooterBounds(bounds);
1324 _FormImpl::CreateHeaderN(void)
1326 result r = E_SUCCESS;
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.");
1331 r = pHeader->Construct();
1332 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1334 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*pHeader);
1336 SetLastResult(E_SUCCESS);
1342 _FormImpl::CreateFooterN(void)
1344 result r = E_SUCCESS;
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.");
1349 r = pFooter->Construct();
1350 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1352 _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*pFooter);
1354 SetLastResult(E_SUCCESS);
1359 // Ki-Dong,Hong.Temp
1361 _FormImpl::CreateTabImplN(void)
1363 //result r = E_SUCCESS;
1365 //Tab* pTab = new (std::nothrow) Tab;
1366 //SysTryReturn(NID_UI_CTRL, pTab, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
1368 //r = pTab->Construct();
1369 //SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] Unable to consturct tab.");
1371 //return pTab->GetTabImpl();
1372 Tab* pTab = _TabImpl::CreateTabN();
1373 SysTryReturn(NID_UI_CTRL, pTab, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1375 _TabImpl* pTabImpl = _TabImpl::GetInstance(*pTab);
1377 SetLastResult(E_SUCCESS);
1383 _FormImpl::DeflateClientRectHeight(int height)
1385 return GetCore().DeflateClientRectHeight(height);
1389 _FormImpl::DeflateClientRectHeight(float height)
1391 return GetCore().DeflateClientRectHeight(height);
1395 _FormImpl::RemoveHeader(void)
1397 _HeaderImpl* pHeaderImpl = GetHeader();
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();
1415 _FormImpl::RemoveFooter(void)
1417 _FooterImpl* pFooterImpl = GetFooter();
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();
1436 // Ki-Dong,Hong.Temp
1438 _FormImpl::RemoveTabImpl(void)
1440 _TabImpl* pTabImpl = GetTabImpl();
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();
1449 pTabImpl->DeleteTab(pTab);
1460 _FormImpl::GetDataBindingContextN(void) const
1462 return _DataBindingContextImpl::GetDataBindingContextN(*this);
1466 _FormImpl::OnAttaching(const _Control* pParent)
1468 result r = E_SUCCESS;
1469 _Frame* pFrame = dynamic_cast<_Frame*>(const_cast<_Control*>((pParent)));
1470 if (FORM_STYLE_INDICATOR & GetCore().GetFormStyle())
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.");
1474 r = _ControlImpl::OnAttaching(pParent);
1479 _FormImpl::OnAttachedToMainTree(void)
1481 result r = E_SUCCESS;
1484 r = GetCore().AttachedToMainTree();
1485 r = _ContainerImpl::OnAttachedToMainTree();
1487 FloatRectangle indicatorBounds(0.0f, 0.0f, 0.0f, 0.0f);
1489 if (FORM_STYLE_INDICATOR & GetCore().GetFormStyle())
1491 indicatorBounds = GetCore().GetIndicatorBoundsF();
1492 r = GetLastResult();
1493 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1496 _HeaderImpl* pHeader = GetHeader();
1497 _FooterImpl* pFooter = GetFooter();
1498 _TabImpl* pTabImpl = GetTabImpl();
1502 if (GetCore().IsIndicatorTranslucent())
1504 if (!GetCore().IsHeaderTranslucent())
1506 indicatorBounds.height = 0.0f;
1510 if (GetCore().GetOrientation() == _CONTROL_ORIENTATION_LANDSCAPE)
1512 indicatorBounds.height = 0.0f;
1516 FloatRectangle bounds(0.0f, indicatorBounds.height, GetClientBoundsF().width, GetCore().GetToolbarHeightF(true));
1517 GetCore().SetHeaderBounds(bounds);
1520 float titleHeight = 0.0f;
1524 titleHeight = pHeader->GetBoundsF().height;
1529 float posY = indicatorBounds.height + titleHeight;
1531 FloatRectangle bounds(0.0f, posY, GetClientBoundsF().width, GetCore().GetTabHeightF());
1532 GetCore().SetTabBounds(bounds);
1537 float adjHeight = 0.0f;
1539 if (!(GetCore().GetFooter()->GetVisibleState()) || GetCore().IsFooterTranslucent())
1541 adjHeight = GetCore().GetToolbarHeightF(false);
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))
1547 adjHeight = GetCore().GetToolbarHeightF(false);
1550 FloatRectangle clientbounds = GetClientBoundsF();
1551 FloatRectangle bounds(0.0f, clientbounds.y + clientbounds.height - adjHeight, clientbounds.width, GetCore().GetToolbarHeightF(false));
1553 GetCore().SetFooterBounds(bounds);
1556 UpdateOrientationStatus();
1560 __pOriAgent->RequestOrientationEvent();
1567 _FormImpl::OnDetachingFromMainTree(void)
1569 result r = E_SUCCESS;
1570 r = GetCore().DetachingFromMainTree();
1571 r = _ContainerImpl::OnDetachingFromMainTree();
1577 _FormImpl::OnNotifiedN(const _ControlImpl& source, IList* pArgs)
1579 String* pString = dynamic_cast <Tizen::Base::String*>(pArgs->GetAt(0));
1582 if (*pString == _REQUEST_ORIENTATION_EVENT)
1586 __pOriAgent->FireOrientationEvent();
1589 pArgs->RemoveAll(true);
1600 _FormImpl::OnFormBackRequested(Tizen::Ui::Controls::_Form& source)
1602 if (__pFormBackEventListener)
1604 _FormImpl* pFormImpl = static_cast<_FormImpl*>(source.GetUserData());
1605 Form* pForm = dynamic_cast <Form*>(&pFormImpl->GetPublic());
1608 __pFormBackEventListener->OnFormBackRequested(*pForm);
1618 _FormImpl::OnFormOrientationStatusRequested(void)
1620 _ControlImplManager* pImplManager = _ControlImplManager::GetInstance();
1621 SysAssert(pImplManager);
1623 OrientationStatus status = ORIENTATION_STATUS_PORTRAIT;
1624 int appType = _AppInfo::GetAppType();
1625 if (!(appType & _APP_TYPE_IME_APP))
1627 status = pImplManager->GetOrientationStatus(GetOrientation());
1633 _FormImpl::IsOpaque(void) const
1640 _FormImpl::ConvertSoftkey(Softkey softkey) const
1644 if (softkey == SOFTKEY_0)
1646 _softkey = _SOFTKEY_0;
1648 else if (softkey == SOFTKEY_1)
1650 _softkey = _SOFTKEY_1;
1654 _softkey = _SOFTKEY_COUNT;
1661 _FormImpl::SetNotificationTrayOpenEnabled(bool enable)
1663 return GetCore().SetNotificationTrayOpenEnabled(enable);
1667 _FormImpl::IsNotificationTrayOpenEnabled(void) const
1669 return GetCore().IsNotificationTrayOpenEnabled();
1673 : public _UiBuilderControlMaker
1676 _FormMaker(_UiBuilder* uibuilder)
1677 : _UiBuilderControlMaker(uibuilder){};
1678 virtual ~_FormMaker()
1681 static _UiBuilderControlMaker* GetInstance(_UiBuilder* uibuilder)
1683 _FormMaker* pFormMaker = new (std::nothrow) _FormMaker(uibuilder);
1687 virtual Control* Make(_UiBuilderControl* pControl)
1689 _UiBuilderControlLayout* pControlProperty = null;
1690 result r = E_SUCCESS;
1693 Tizen::Base::String elementString;
1694 bool isTitleAlign = false;
1697 HorizontalAlignment align = ALIGNMENT_CENTER;
1698 Form* pForm = (Form*) GetContainer();
1700 // Get control manager
1701 _ControlManager* pControlManager = _ControlManager::GetInstance();
1702 if (pControlManager == null)
1704 SysLog(NID_UI_CTRL, "Unable to get the control manager.n");
1707 FloatDimension screenSize = pControlManager->GetScreenSizeF();
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);
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);
1719 pControlProperty = pControl->GetAttribute(UIBUILDER_ATTRIBUTE_LANDSCAPE);
1723 pControlProperty = pControl->GetAttribute(UIBUILDER_ATTRIBUTE_PORTRAIT);
1726 if (pControlProperty == null)
1728 SysLogException(NID_UI_CTRL, E_SYSTEM, "[E_SYSTEM] Can't read attributes");
1732 pControlProperty = pControl->GetAttribute(UIBUILDER_ATTRIBUTE_PORTRAIT);
1733 Tizen::Base::String styleString;
1734 styleString = pControlProperty->GetStyle();
1736 if (styleString.Contains(L"FORM_STYLE_TITLE"))
1738 style |= FORM_STYLE_TITLE;
1740 if (styleString.Contains(L"FORM_STYLE_SOFTKEY_0"))
1742 style |= FORM_STYLE_SOFTKEY_0;
1744 if (styleString.Contains(L"FORM_STYLE_SOFTKEY_1"))
1746 style |= FORM_STYLE_SOFTKEY_1;
1748 if (styleString.Contains(L"FORM_STYLE_OPTIONKEY"))
1750 style |= FORM_STYLE_OPTIONKEY;
1752 if (styleString.Contains(L"FORM_STYLE_INDICATOR"))
1754 if (styleString.Contains(L"FORM_STYLE_INDICATOR_AUTO_HIDE"))
1756 style |= FORM_STYLE_INDICATOR_AUTO_HIDE;
1760 style |= FORM_STYLE_INDICATOR;
1763 if (styleString.Contains(L"FORM_STYLE_TEXT_TAB"))
1765 style |= FORM_STYLE_TEXT_TAB;
1767 if (styleString.Contains(L"FORM_STYLE_ICON_TAB"))
1769 style |= FORM_STYLE_ICON_TAB;
1771 if (styleString.Contains(L"FORM_STYLE_HEADER"))
1773 style |= FORM_STYLE_HEADER;
1775 if (styleString.Contains(L"FORM_STYLE_FOOTER"))
1777 style |= FORM_STYLE_FOOTER;
1780 _UiBuilderLayoutType layoutType = UIBUILDER_LAYOUT_NONE;
1781 __pLayoutMaker->GetLayoutType(pControlProperty, layoutType);
1782 if (layoutType == UIBUILDER_LAYOUT_NONE)
1785 r = pForm->Construct(style);
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)
1795 r = pForm->Construct(*pPortraitLayout, *pLandscapeLayout, style);
1802 _UiBuilderLayoutType layoutType = UIBUILDER_LAYOUT_NONE;
1804 if (__pLayoutMaker->GetLayoutType(pControlProperty, layoutType) == false)
1809 if ( layoutType == UIBUILDER_LAYOUT_GRID)
1811 for (int i = 0; i < UIBUILDER_ATTRIBUTE_NUM; i++)
1813 GridLayout* pGridLayout = null;
1814 pControlProperty = pControl->GetAttribute(i);
1816 if ( i == UIBUILDER_ATTRIBUTE_PORTRAIT)
1818 pGridLayout = dynamic_cast<GridLayout*>(pPortraitLayout);
1822 pGridLayout = dynamic_cast<GridLayout*>(pLandscapeLayout);
1824 __pLayoutMaker->SetGridLayoutContainerProperty(pGridLayout, pControlProperty);
1827 delete pPortraitLayout;
1828 if (pPortraitLayout != pLandscapeLayout)
1830 delete pLandscapeLayout;
1836 SysLog(NID_UI_CTRL, "Failed to create Form.");
1841 if (pControl->GetElement(L"titleAlign", elementString))
1843 if (elementString.Equals(L"ALIGN_CENTER", false))
1845 align = ALIGNMENT_CENTER;
1847 else if (elementString.Equals(L"ALIGN_RIGHT", false))
1849 align = ALIGNMENT_RIGHT;
1853 align = ALIGNMENT_LEFT;
1855 isTitleAlign = true;
1858 if (style & FORM_STYLE_TITLE)
1860 if (pControl->GetElement(L"title", elementString))
1864 pForm->SetTitleText(elementString, align);
1868 pForm->SetTitleText(elementString);
1875 pForm->SetTitleText(L"", align);
1879 pForm->SetTitleText(L"");
1884 if (pControl->GetElement(L"titleIcon", elementString))
1886 Bitmap* pBitmap = null;
1887 pBitmap = LoadBitmapN(elementString);
1888 if (pBitmap != null)
1890 r = pForm->SetTitleIcon(pBitmap);
1894 SysLog(NID_UI_CTRL, "Failed to set TitleIcon.");
1899 if (pControl->GetElement(L"softKey0Text", elementString))
1901 pForm->SetSoftkeyText(SOFTKEY_0, elementString);
1903 if (pControl->GetElement(L"softKey1Text", elementString))
1905 pForm->SetSoftkeyText(SOFTKEY_1, elementString);
1907 if (pControl->GetElement(L"backgroundColorOpacity", elementString) || pControl->GetElement(L"BGColorOpacity", elementString))
1909 Base::Integer::Parse(elementString, opacity);
1911 if (pControl->GetElement(L"backgroundColor", elementString) || pControl->GetElement(L"BGColor", elementString))
1913 ConvertStringToColor32(elementString, opacity, color);
1914 pForm->SetBackgroundColor(color);
1919 r = GET_COLOR_CONFIG(FORM::BG_NORMAL,color);
1922 pForm->SetBackgroundColor(color);
1926 pForm->SetBackgroundColor(0xff000000);
1930 if (pControl->GetElement(L"softKey0Icon", elementString) || pControl->GetElement(L"softKey0NormalIcon", elementString))
1932 Bitmap* pNormalBitmap = null;
1933 Bitmap* pPressedBitmap = null;
1934 pNormalBitmap = LoadBitmapN(elementString); //__image->DecodeN(path,BITMAP_PIXEL_FORMAT_RGB565);
1936 if (pNormalBitmap != null)
1938 if (pControl->GetElement(L"softKey0PressedIcon", elementString))
1940 pPressedBitmap = LoadBitmapN(elementString);
1943 if (pPressedBitmap != null)
1945 pForm->SetSoftkeyIcon(SOFTKEY_0, *pNormalBitmap, pPressedBitmap);
1946 delete pNormalBitmap;
1947 delete pPressedBitmap;
1951 pForm->SetSoftkeyIcon(SOFTKEY_0, *pNormalBitmap, null);
1952 delete pNormalBitmap;
1956 if (pControl->GetElement(L"softKey1Icon", elementString) || pControl->GetElement(L"softKey1NormalIcon", elementString))
1958 Bitmap* pNormalBitmap = null;
1959 Bitmap* pPressedBitmap = null;
1960 pNormalBitmap = LoadBitmapN(elementString); //__image->DecodeN(path,BITMAP_PIXEL_FORMAT_RGB565);
1962 if (pNormalBitmap != null)
1964 if (pControl->GetElement(L"softKey1PressedIcon", elementString))
1966 pPressedBitmap = LoadBitmapN(elementString); // __image->DecodeN(path,BITMAP_PIXEL_FORMAT_RGB565);
1969 if (pPressedBitmap != null)
1971 pForm->SetSoftkeyIcon(SOFTKEY_1, *pNormalBitmap, pPressedBitmap);
1972 delete pNormalBitmap;
1973 delete pPressedBitmap;
1977 pForm->SetSoftkeyIcon(SOFTKEY_1, *pNormalBitmap, null);
1978 delete pNormalBitmap;
1983 if (pControl->GetElement(L"Orientation", elementString) || pControl->GetElement(L"orientation", elementString))
1986 //ORIENTATION_PORTRAIT,
1987 //ORIENTATION_LANDSACPE,
1988 //ORIENTATION_PORTRAIT_REVERSE,
1989 //ORIENTATION_LANDSACPE_REVERSE,
1990 //ORIENTATION_AUTO = 6,
1991 //ORIENTATION_AUTO_FOUR_DIRECTION = 8,
1993 if (elementString.Equals(L"Automatic:2Dir", false) || elementString.Equals(L"Automatic", false))
1995 pForm->SetOrientation(ORIENTATION_AUTOMATIC);
1997 else if (elementString.Equals(L"Automatic:4Dir", false))
1999 pForm->SetOrientation(ORIENTATION_AUTOMATIC_FOUR_DIRECTION);
2001 else if (elementString.Equals(L"Landscape", false))
2003 pForm->SetOrientation(ORIENTATION_LANDSCAPE);
2004 SetUiBuilderRotateState(UIBUIDER_SCREEN_HORIZONTAL);
2006 else if (elementString.Equals(L"Landscape:Reverse", false))
2008 pForm->SetOrientation(ORIENTATION_LANDSCAPE_REVERSE);
2009 SetUiBuilderRotateState(UIBUIDER_SCREEN_HORIZONTAL);
2011 else if (elementString.Equals(L"Portrait", false))
2013 pForm->SetOrientation(ORIENTATION_PORTRAIT);
2014 SetUiBuilderRotateState(UIBUIDER_SCREEN_VERTICAL);
2016 else if (elementString.Equals(L"Portrait:Reverse", false))
2018 pForm->SetOrientation(ORIENTATION_PORTRAIT_REVERSE);
2019 SetUiBuilderRotateState(UIBUIDER_SCREEN_VERTICAL);
2023 if (style & FORM_STYLE_HEADER)
2025 if (pControl->GetElement(L"translucentHeader", elementString))
2027 if (elementString.Equals(L"true", false))
2029 pForm->SetActionBarsTranslucent(FORM_ACTION_BAR_HEADER, true);
2034 if (style & FORM_STYLE_FOOTER)
2036 if (pControl->GetElement(L"translucentFooter", elementString))
2038 if (elementString.Equals(L"true", false))
2040 pForm->SetActionBarsTranslucent(FORM_ACTION_BAR_FOOTER, true);
2045 if (style & FORM_STYLE_INDICATOR)
2047 if (pControl->GetElement(L"translucentIndicator", elementString))
2049 if (elementString.Equals(L"true", false))
2051 pForm->SetActionBarsTranslucent(FORM_ACTION_BAR_INDICATOR, true);
2061 _FormRegister::_FormRegister()
2063 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
2064 pUiBuilderControlTableManager->RegisterControl(L"Form", _FormMaker::GetInstance);
2066 _FormRegister::~_FormRegister()
2068 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
2069 pUiBuilderControlTableManager->UnregisterControl(L"Form");
2071 static _FormRegister FormRegisterToUiBuilder;
2072 }}} // Tizen::Ui::Controls