2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
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 // Make surface opaque.
199 pVisualElement = pCore->GetVisualElement();
200 SysTryCatch(NID_UI_CTRL, pVisualElement, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
201 r = pVisualElement->SetSurfaceOpaque(true);
202 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r)); // [ToDo] interpret last result.
204 SetLastResult(E_SUCCESS);
216 _FormImpl::GetPublicClassName(void) const
218 return "Tizen::Ui::Controls::Form";
222 _FormImpl::GetPublic(void) const
224 return static_cast<const Form&>(_ControlImpl::GetPublic());
228 _FormImpl::GetPublic(void)
230 return static_cast<Form&>(_ControlImpl::GetPublic());
234 _FormImpl::GetCore(void) const
236 return static_cast<const _Form&>(_ControlImpl::GetCore());
240 _FormImpl::GetCore(void)
242 return static_cast<_Form&>(_ControlImpl::GetCore());
246 _FormImpl::GetFocusControl(void)
252 _FormImpl::GetFormStyle(void) const
254 return GetCore().GetFormStyle();
258 _FormImpl::HasIndicator(void) const
260 return GetCore().HasIndicator();
264 _FormImpl::SetFormStyle(unsigned long formStyle)
266 result r = E_SUCCESS;
268 _HeaderImpl* pHeader = GetHeader();
269 _FooterImpl* pFooter = GetFooter();
270 _TabImpl* pTabImpl = GetTabImpl();
272 if (IsAttachedToMainTree())
274 if (FORM_STYLE_INDICATOR & formStyle)
276 _Frame* pFrame = dynamic_cast<_Frame*>(GetCore().GetParent());
277 SysTryReturnVoidResult(NID_UI_CTRL, pFrame != null, E_INVALID_ARG, "A Form which has FORM_STYLE_INDICATOR style cannot be added to a container except Frame.");
281 if ((formStyle & FORM_STYLE_INDICATOR) && (formStyle & FORM_STYLE_INDICATOR_AUTO_HIDE))
283 SysLogException(NID_UI_CTRL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid form style. FORM_STYLE_INDICATOR and FORM_STYLE_INDICATOR_AUTO_HIDE can't use each other.");
288 if (((formStyle & FORM_STYLE_TITLE) || (formStyle & FORM_STYLE_TEXT_TAB) || (formStyle & FORM_STYLE_ICON_TAB)) && (formStyle & FORM_STYLE_HEADER))
290 SysLogException(NID_UI_CTRL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid form style. FORM_STYLE_TITLE, FORM_STYLE_TEXT_TAB or FORM_STYLE_ICON_TAB and FORM_STYLE_HEADER can't use each other.");
297 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
303 if (((formStyle & FORM_STYLE_SOFTKEY_0) || (formStyle & FORM_STYLE_SOFTKEY_1) || (formStyle & FORM_STYLE_OPTIONKEY)) && (formStyle & FORM_STYLE_FOOTER))
305 SysLogException(NID_UI_CTRL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid form style. FORM_STYLE_SOFTKEY0, FORM_STYLE_SOFTKEY_1 or FORM_STYLE_OPTIONKEY and FORM_STYLE_FOOTER can't use each other.");
312 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
317 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
318 SysTryReturnVoidResult(NID_UI_CTRL, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] Unable to get evas.");
320 GetCore().SetFormStyle(formStyle);
322 FloatRectangle indicatorBounds(0.0f, 0.0f, 0.0f, 0.0f);
324 if (FORM_STYLE_INDICATOR & formStyle)
326 GetCore().SetIndicatorShowState(true);
327 indicatorBounds = GetCore().GetIndicatorBoundsF();
329 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
332 else if(FORM_STYLE_INDICATOR_AUTO_HIDE & formStyle)
334 r = GetCore().SetIndicatorShowState(false, true);
335 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
339 r = GetCore().SetIndicatorShowState(false);
340 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
343 if (formStyle & FORM_STYLE_HEADER)
347 pHeader = CreateHeaderN();
348 SysTryReturnVoidResult(NID_UI_CTRL, pHeader != null, r, "[%s] Propagating.", GetErrorMessage(r));
350 GetCore().SetHeader(&pHeader->GetCore());
351 GetCore().AdjustClientBounds();
353 if (GetCore().IsIndicatorTranslucent())
355 if (!GetCore().IsHeaderTranslucent())
357 indicatorBounds.height = 0.0f;
361 if (GetOrientation() == _CONTROL_ORIENTATION_LANDSCAPE)
363 indicatorBounds.height = 0.0f;
368 FloatRectangle bounds(0.0f, indicatorBounds.height, GetClientBoundsF().width, GetCore().GetToolbarHeightF(true));
369 GetCore().SetHeaderBounds(bounds);
371 r = GetCore().AttachSystemChild(pHeader->GetCore());
372 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
374 GetCore().SetFormBackEventListener(this);
377 else if (formStyle & FORM_STYLE_TITLE)
381 pHeader = CreateHeaderN();
382 SysTryReturnVoidResult(NID_UI_CTRL, pHeader != null, r, "[%s] Propagating.", GetErrorMessage(r));
384 GetCore().SetHeader(&pHeader->GetCore());
385 GetCore().AdjustClientBounds();
387 FloatRectangle bounds(0.0f, indicatorBounds.height, GetClientBoundsF().width, GetCore().GetToolbarHeightF(true));
388 GetCore().SetHeaderBounds(bounds);
390 r = GetCore().AttachSystemChild(pHeader->GetCore());
391 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
401 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
405 if (formStyle & FORM_STYLE_TEXT_TAB)
407 float titleHeight = 0.0f;
409 if (formStyle & FORM_STYLE_TITLE)
413 titleHeight = pHeader->GetBoundsF().height;
419 pTabImpl = CreateTabImplN();
420 SysTryReturnVoidResult(NID_UI_CTRL, pTabImpl != null, r, "[%s] Propagating.", GetErrorMessage(r));
422 float posY = indicatorBounds.height + titleHeight;
424 GetCore().SetTab(&pTabImpl->GetCore());
425 GetCore().AdjustClientBounds();
427 FloatRectangle bounds(0.0f, posY, GetClientBoundsF().width, GetCore().GetTabHeightF());
428 GetCore().SetTabBounds(bounds);
430 r = GetCore().AttachSystemChild(pTabImpl->GetCore());
431 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
433 GetCore().SetTabStyle(_TAB_STYLE_TEXT);
435 else if (formStyle & FORM_STYLE_ICON_TAB)
437 float titleHeight = 0.0f;
439 if (formStyle & FORM_STYLE_TITLE)
443 titleHeight = pHeader->GetBoundsF().height;
449 pTabImpl = CreateTabImplN();
450 SysTryReturnVoidResult(NID_UI_CTRL, pTabImpl != null, r, "[%s] Propagating.", GetErrorMessage(r));
452 float posY = indicatorBounds.height + titleHeight;
454 GetCore().SetTab(&pTabImpl->GetCore());
455 GetCore().AdjustClientBounds();
457 FloatRectangle bounds(0.0f, posY, GetClientBoundsF().width, GetCore().GetTabHeightF());
458 GetCore().SetTabBounds(bounds);
460 r = GetCore().AttachSystemChild(pTabImpl->GetCore());
461 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
463 GetCore().SetTabStyle(_TAB_STYLE_ICON);
471 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
475 if (formStyle & FORM_STYLE_FOOTER)
479 pFooter = CreateFooterN();
480 SysTryReturnVoidResult(NID_UI_CTRL, pFooter != null, r, "[%s] Propagating.", GetErrorMessage(r));
482 GetCore().SetFooter(&pFooter->GetCore());
483 GetCore().AdjustClientBounds();
485 FloatRectangle clientbounds = GetClientBoundsF();
486 FloatRectangle bounds(0.0f, clientbounds.y + clientbounds.height, clientbounds.width, GetCore().GetToolbarHeightF(false));
488 GetCore().SetFooterBounds(bounds);
490 r = GetCore().AttachSystemChild(pFooter->GetCore());
491 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
493 GetCore().SetFormBackEventListener(this);
496 else if (formStyle & FORM_STYLE_SOFTKEY_0 || formStyle & FORM_STYLE_SOFTKEY_1 || formStyle & FORM_STYLE_OPTIONKEY)
502 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
505 pFooter = GetFooter();
509 pFooter = CreateFooterN();
510 SysTryReturnVoidResult(NID_UI_CTRL, pFooter != null, r, "[%s] Propagating.", GetErrorMessage(r));
512 GetCore().SetFooter(&pFooter->GetCore());
513 GetCore().AdjustClientBounds();
515 FloatRectangle clientbounds = GetClientBoundsF();
516 FloatRectangle bounds(0.0f, clientbounds.y + clientbounds.height - GetCore().GetToolbarHeightF(false), clientbounds.width, GetCore().GetToolbarHeightF(false));
518 GetCore().SetFooterBounds(bounds);
520 r = GetCore().AttachSystemChild(pFooter->GetCore());
521 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
523 GetCore().CreateSoftkey(formStyle);
525 pFooter->GetCore().AddActionEventListener(*this);
535 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
536 GetCore().AdjustClientBounds();
540 GetCore().AdjustClientBounds();
542 SetLastResult(E_SUCCESS);
548 _FormImpl::GetFooter(void) const
550 _Toolbar* pToolbar = __pForm->GetFooter();
551 if (pToolbar == null)
556 _FooterImpl* pFooterImpl = static_cast<_FooterImpl*>(pToolbar->GetUserData());
562 _FormImpl::GetHeader(void) const
564 _Toolbar* pToolbar = __pForm->GetHeader();
565 if (pToolbar == null)
570 _HeaderImpl* pHeaderImpl = static_cast<_HeaderImpl*>(pToolbar->GetUserData());
577 _FormImpl::GetTabImpl(void) const
579 _Tab* pTab = __pForm->GetTab();
585 _TabImpl* pTabImpl = static_cast<_TabImpl*>(pTab->GetUserData());
591 _FormImpl::GetTitleText(void) const
593 return GetCore().GetTitleText();
597 _FormImpl::GetTitleTextHorizontalAlignment(void) const
599 return GetCore().GetTitleTextHorizontalAlignment();
603 _FormImpl::HasFooter(void) const
605 return GetCore().HasFooter();
609 _FormImpl::HasHeader(void) const
611 return GetCore().HasHeader();
615 _FormImpl::HasTitle(void) const
617 return GetCore().HasTitle();
621 _FormImpl::HasTab(void) const
623 return GetCore().HasTab();
627 _FormImpl::IsIndicatorVisible(void) const
629 return GetCore().IsIndicatorVisible();
633 _FormImpl::IsHeaderVisible(void) const
635 return GetCore().IsHeaderVisible();
639 _FormImpl::IsFooterVisible(void) const
641 return GetCore().IsFooterVisible();
645 _FormImpl::IsIndicatorTranslucent(void) const
647 return GetCore().IsIndicatorTranslucent();
651 _FormImpl::IsHeaderTranslucent(void) const
653 return GetCore().IsHeaderTranslucent();
657 _FormImpl::IsFooterTranslucent(void) const
659 return GetCore().IsFooterTranslucent();
664 _FormImpl::IsTabTranslucent(void) const
666 return GetCore().IsTabTranslucent();
670 _FormImpl::SetActionBarsTranslucent(unsigned long actionBars, bool translucent)
672 return GetCore().SetActionBarsTranslucent(actionBars, translucent);
676 _FormImpl::SetActionBarsVisible(unsigned long actionBars, bool visible)
678 return GetCore().SetActionBarsVisible(actionBars, visible);
682 _FormImpl::SetTitleIcon(const Bitmap* pTitleBitmap)
684 return GetCore().SetTitleIcon(pTitleBitmap);
688 _FormImpl::SetTitleText(const String& title, HorizontalAlignment alignment)
690 return GetCore().SetTitleText(title, alignment);
694 _FormImpl::GetOverlayRegionN(const Rectangle& rect, OverlayRegionType regionType)
696 return GetCore().GetOverlayRegionN(rect, regionType);
700 _FormImpl::GetOverlayRegionN(const FloatRectangle& rect, OverlayRegionType regionType)
702 return GetCore().GetOverlayRegionN(rect, regionType);
706 _FormImpl::OnDraw(void)
710 __pOriAgent->FireOrientationEvent();
713 _ContainerImpl::OnDraw();
717 _FormImpl::OnKeyReleased(const _ControlImpl& source, _KeyCode keyCode)
722 if (GetCore().GetFooter() || GetCore().GetHeader())
724 if (__pFormBackEventListener)
726 Form* pForm = dynamic_cast <Form*>(&GetPublic());
729 __pFormBackEventListener->OnFormBackRequested(*pForm);
751 _FormImpl::OnActionPerformed(const _Control& source, int actionId)
753 if (GetFormStyle() & FORM_STYLE_SOFTKEY_0 || GetFormStyle() & FORM_STYLE_SOFTKEY_1 || GetFormStyle() & FORM_STYLE_OPTIONKEY)
755 Tizen::Base::Runtime::IEventArg* tempArg = null;
756 tempArg = _PublicActionEvent::CreateActionEventArgN(actionId);
757 SysTryReturnVoidResult(NID_UI_CTRL, tempArg , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Unable to create Eventarg.");
760 _PublicActionEvent* pSoftkeyActionEvent = null;
762 if (GetCore().GetFooter()->IsButtonSet(LEFT_BUTTON) && GetSoftkeyActionId(SOFTKEY_0) == actionId)
764 for (int i = 0; i < __leftSoftkeyActionList.GetCount(); i++)
766 pSoftkeyActionEvent = dynamic_cast<_PublicActionEvent*>(__leftSoftkeyActionList.GetAt(i));
768 if (pSoftkeyActionEvent)
770 pSoftkeyActionEvent->Fire(*tempArg);
776 if (GetCore().GetFooter()->IsButtonSet(RIGHT_BUTTON) && GetSoftkeyActionId(SOFTKEY_1) == actionId)
778 for (int i = 0; i < __rightSoftkeyActionList.GetCount(); i++)
780 pSoftkeyActionEvent = dynamic_cast<_PublicActionEvent*>(__rightSoftkeyActionList.GetAt(i));
782 if (pSoftkeyActionEvent)
784 pSoftkeyActionEvent->Fire(*tempArg);
790 if (GetCore().GetFooter()->IsButtonSet(MIDDLE_BUTTON) && GetOptionkeyActionId() == actionId)
792 if (__pOptionMenuActionEvent)
794 __pOptionMenuActionEvent->Fire(*tempArg);
806 _FormImpl::GetClientAreaCanvasN(void) const
808 return GetCore().GetClientAreaCanvasN();
812 _FormImpl::TranslateToClientAreaPosition(const Point& position) const
814 return GetCore().TranslateToClientAreaPosition(position);
818 _FormImpl::TranslateToClientAreaPosition(const FloatPoint& position) const
820 return GetCore().TranslateToClientAreaPosition(position);
824 _FormImpl::TranslateFromClientAreaPosition(const Point& clientPosition) const
826 return GetCore().TranslateFromClientAreaPosition(clientPosition);
830 _FormImpl::TranslateFromClientAreaPosition(const FloatPoint& clientPosition) const
832 return GetCore().TranslateFromClientAreaPosition(clientPosition);
836 _FormImpl::SetFormBackEventListener(const IFormBackEventListener* pFormBackEventListener)
838 SysTryReturnVoidResult(NID_UI_CTRL, GetFooter() || GetHeader(), E_INVALID_STATE, "[E_INVALID_STATE] Footer isn't constructed.");
839 __pFormBackEventListener = const_cast <IFormBackEventListener*>(pFormBackEventListener);
840 GetCore().SetFormBackEventListener(this);
841 result r = GetLastResult();
842 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
846 _FormImpl::AddOrientationEventListener(IOrientationEventListener& listener)
850 __pOriAgent->AddListener(listener);
852 else if (__pImeOriAgent)
854 __pImeOriAgent->AddListener(listener);
859 _FormImpl::AddOptionkeyActionListener(const IActionEventListener& listener)
861 if (HasOptionkey() == false)
866 __pOptionMenuActionEvent = _PublicActionEvent::CreateInstanceN(GetPublic());
868 SysTryReturnVoidResult(NID_UI_CTRL, __pOptionMenuActionEvent != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
870 __pOptionMenuActionEvent->AddListener(listener);
874 _FormImpl::AddSoftkeyActionListener(Softkey softkey, const IActionEventListener& listener)
876 _Softkey _softkey = ConvertSoftkey(softkey);
878 if (GetCore().CheckSoftkey(_softkey) == false)
883 if (softkey == SOFTKEY_0)
885 __pLeftSoftkeyActionEvent = _PublicActionEvent::CreateInstanceN(GetPublic());
887 SysTryReturnVoidResult(NID_UI_CTRL, __pLeftSoftkeyActionEvent != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
889 __pLeftSoftkeyActionEvent->AddListener(listener);
891 __leftSoftkeyActionList.Add(*__pLeftSoftkeyActionEvent);
893 else if (softkey == SOFTKEY_1)
895 __pRightSoftkeyActionEvent = _PublicActionEvent::CreateInstanceN(GetPublic());
897 SysTryReturnVoidResult(NID_UI_CTRL, __pRightSoftkeyActionEvent != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
899 __pRightSoftkeyActionEvent->AddListener(listener);
901 __rightSoftkeyActionList.Add(*__pRightSoftkeyActionEvent);
906 _FormImpl::RemoveOrientationEventListener(IOrientationEventListener& listener)
910 __pOriAgent->RemoveListener(listener);
912 else if (__pImeOriAgent)
914 __pImeOriAgent->RemoveListener(listener);
919 _FormImpl::RemoveOptionkeyActionListener(const IActionEventListener& listener)
921 if (HasOptionkey() == false)
926 if (__pOptionMenuActionEvent)
928 __pOptionMenuActionEvent->RemoveListener(listener);
933 _FormImpl::RemoveSoftkeyActionListener(Softkey softkey, const IActionEventListener& listener)
935 _Softkey _softkey = ConvertSoftkey(softkey);
937 if (GetCore().CheckSoftkey(_softkey) == false)
942 if (softkey == SOFTKEY_0)
944 if (__pLeftSoftkeyActionEvent)
946 __pLeftSoftkeyActionEvent->RemoveListener(listener);
949 else if (softkey == SOFTKEY_1)
951 if (__pRightSoftkeyActionEvent)
953 __pRightSoftkeyActionEvent->RemoveListener(listener);
959 _FormImpl::SetOrientation(Orientation orientation)
963 __pOriAgent->SetMode(orientation);
968 _FormImpl::GetOrientation(void) const
972 return __pOriAgent->GetMode();
975 return ORIENTATION_NONE;
979 _FormImpl::GetOrientationStatus(void) const
983 return __pOriAgent->GetStatus();
986 return ORIENTATION_STATUS_NONE;
990 _FormImpl::UpdateOrientationStatus(bool draw)
994 __pOriAgent->Update(draw);
998 #if defined(WINDOW_BASE_ROTATE)
1000 _FormImpl::UpdateOrientation(void)
1004 __pOriAgent->UpdateOrientation();
1010 _FormImpl::UpdateOrientation(int angle)
1012 SysLog(NID_UI_CTRL, "[Ime Rotation]");
1016 __pImeOriAgent->UpdateOrientation(angle);
1021 _FormImpl::HasOptionkey(void) const
1023 return GetCore().HasOptionkey();
1027 _FormImpl::HasSoftkey(Softkey softkey) const
1029 _Softkey _softkey = ConvertSoftkey(softkey);
1031 return GetCore().HasSoftkey(_softkey);
1035 _FormImpl::SetSoftkeyEnabled(Softkey softkey, bool enable)
1037 _Softkey _softkey = ConvertSoftkey(softkey);
1039 result r = GetCore().SetSoftkeyEnabled(_softkey, enable);
1040 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
1046 _FormImpl::IsSoftkeyEnabled(Softkey softkey) const
1048 _Softkey _softkey = ConvertSoftkey(softkey);
1050 return GetCore().IsSoftkeyEnabled(_softkey);
1054 _FormImpl::GetSoftkeyActionId(Softkey softkey) const
1056 _Softkey _softkey = ConvertSoftkey(softkey);
1058 return GetCore().GetSoftkeyActionId(_softkey);
1062 _FormImpl::GetOptionkeyActionId(void) const
1064 return GetCore().GetOptionkeyActionId();
1068 _FormImpl::GetSoftkeyText(Softkey softkey) const
1070 _Softkey _softkey = ConvertSoftkey(softkey);
1072 return GetCore().GetSoftkeyText(_softkey);
1076 _FormImpl::SetOptionkeyActionId(int actionId)
1078 result r = GetCore().SetOptionkeyActionId(actionId);
1079 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
1085 _FormImpl::SetSoftkeyActionId(Softkey softkey, int actionId)
1087 _Softkey _softkey = ConvertSoftkey(softkey);
1089 result r = GetCore().SetSoftkeyActionId(_softkey, actionId);
1090 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
1096 _FormImpl::SetSoftkeyText(Softkey softkey, const String& text)
1098 _Softkey _softkey = ConvertSoftkey(softkey);
1100 result r = GetCore().SetSoftkeyText(_softkey, text);
1101 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
1107 _FormImpl::SetSoftkeyIcon(Softkey softkey, const Bitmap& pNormalBitmap, const Bitmap* ppPressedBitmap)
1109 _Softkey _softkey = ConvertSoftkey(softkey);
1111 result r = GetCore().SetSoftkeyIcon(_softkey, pNormalBitmap, ppPressedBitmap);
1112 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
1118 _FormImpl::OnChangeLayout(_ControlOrientation orientation)
1120 const FloatDimension portraitSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF();
1121 const FloatDimension landscapeSize = FloatDimension(portraitSize.height, portraitSize.width);
1123 // Adjust the position of the partial Frame.
1124 _FrameImpl* pFrameImpl = dynamic_cast<_FrameImpl*>(GetParent());
1127 FrameShowMode frameShowMode = pFrameImpl->GetShowMode();
1129 if ((frameShowMode == FRAME_SHOW_MODE_PARTIAL_SCREEN) || (frameShowMode == FRAME_SHOW_MODE_PARTIAL_SCREEN_FLOATING))
1131 bool movable = pFrameImpl->GetCore().IsMovable();
1132 pFrameImpl->GetCore().SetMovable(true);
1134 FloatPoint prevPoint = pFrameImpl->GetPositionF();
1135 FloatPoint curPoint(0.0f, 0.0f);
1137 if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
1139 curPoint.x = portraitSize.width / portraitSize.height * prevPoint.x;
1140 curPoint.y = portraitSize.height / portraitSize.width * prevPoint.y;
1144 curPoint.x = portraitSize.height / portraitSize.width * prevPoint.x;
1145 curPoint.y = portraitSize.width / portraitSize.height * prevPoint.y;
1148 pFrameImpl->SetPosition(curPoint);
1150 pFrameImpl->GetCore().SetMovable(movable);
1155 _ContainerImpl::OnChangeLayout(orientation);
1156 SysTryReturnVoidResult(NID_UI_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1158 if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
1160 SetSize(portraitSize);
1164 SetSize(landscapeSize);
1167 float indicatorheight = 0.0f;
1169 GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, GetCore().GetOrientation(), indicatorheight);
1170 if (GetCore().HasIndicator())
1172 _Indicator* pIndicator = GetCore().GetIndicator();
1175 if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
1177 pIndicator->SetBounds(FloatRectangle(0.0f, 0.0f, GetClientBoundsF().width, indicatorheight));
1181 GET_SHAPE_CONFIG(FORM::INDICATOR_MINIMIZE_HEIGHT, GetCore().GetOrientation(), indicatorheight);
1182 pIndicator->SetBounds(FloatRectangle(0.0f, 0.0f, GetClientBoundsF().width, indicatorheight));
1185 GetCore().AdjustClientBounds();
1189 float adjHeight = 0.0f;
1191 if (GetCore().HasHeader())
1193 FloatRectangle indicatorBounds(0.0f, 0.0f, 0.0f, 0.0f);
1194 if (GetCore().IsIndicatorVisible())
1196 indicatorBounds = GetCore().GetIndicatorBoundsF();
1197 if (GetCore().IsIndicatorTranslucent())
1199 if (!GetCore().IsHeaderTranslucent())
1201 indicatorBounds.height = 0.0f;
1205 if (orientation == _CONTROL_ORIENTATION_LANDSCAPE)
1207 indicatorBounds.height = 0.0f;
1213 FloatRectangle bounds(0.0f, indicatorBounds.height, GetClientBoundsF().width, GetCore().GetToolbarHeightF(true));
1214 GetCore().SetHeaderBounds(bounds);
1217 if (GetCore().HasTab()) // Ki-Dong,Hong.Temp
1219 float titleHeight = 0.0f;
1221 if (GetCore().GetFormStyle() & FORM_STYLE_TITLE)
1223 if (GetCore().HasHeader())
1225 _HeaderImpl* pHeaderImpl = GetHeader();
1228 titleHeight = pHeaderImpl->GetBoundsF().height;
1233 FloatRectangle indicatorBounds(0.0f, 0.0f, 0.0f, 0.0f);
1235 if (GetCore().IsIndicatorVisible())
1237 indicatorBounds = GetCore().GetIndicatorBoundsF();
1240 float posY = indicatorBounds.height + titleHeight;
1242 FloatRectangle bounds(0.0f, posY, GetClientBoundsF().width, GetCore().GetTabHeightF());
1243 GetCore().SetTabBounds(bounds);
1246 if (GetCore().HasFooter())
1248 if (GetCore().GetFooter()->GetVisibleState() && !GetCore().IsFooterTranslucent())
1254 adjHeight = GetCore().GetToolbarHeightF(false);
1257 if (!(GetCore().GetFormStyle() & FORM_STYLE_FOOTER || GetCore().GetFormStyle() & FORM_STYLE_SOFTKEY_0 || GetCore().GetFormStyle() & FORM_STYLE_SOFTKEY_1
1258 || GetCore().GetFormStyle() & FORM_STYLE_OPTIONKEY))
1260 adjHeight = GetCore().GetToolbarHeightF(false);
1263 FloatRectangle bounds(0.0f, GetClientBoundsF().y + GetClientBoundsF().height - adjHeight,
1264 GetClientBoundsF().width, GetCore().GetToolbarHeightF(false));
1265 GetCore().SetFooterBounds(bounds);
1270 _FormImpl::CreateHeaderN(void)
1272 result r = E_SUCCESS;
1274 Header* pHeader = new (std::nothrow) Header;
1275 SysTryReturn(NID_UI_CTRL, pHeader, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
1277 r = pHeader->Construct();
1278 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1280 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*pHeader);
1282 SetLastResult(E_SUCCESS);
1288 _FormImpl::CreateFooterN(void)
1290 result r = E_SUCCESS;
1292 Footer* pFooter = new (std::nothrow) Footer;
1293 SysTryReturn(NID_UI_CTRL, pFooter, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
1295 r = pFooter->Construct();
1296 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1298 _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*pFooter);
1300 SetLastResult(E_SUCCESS);
1305 // Ki-Dong,Hong.Temp
1307 _FormImpl::CreateTabImplN(void)
1309 //result r = E_SUCCESS;
1311 //Tab* pTab = new (std::nothrow) Tab;
1312 //SysTryReturn(NID_UI_CTRL, pTab, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
1314 //r = pTab->Construct();
1315 //SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] Unable to consturct tab.");
1317 //return pTab->GetTabImpl();
1318 Tab* pTab = _TabImpl::CreateTabN();
1319 SysTryReturn(NID_UI_CTRL, pTab, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1321 _TabImpl* pTabImpl = _TabImpl::GetInstance(*pTab);
1323 SetLastResult(E_SUCCESS);
1329 _FormImpl::DeflateClientRectHeight(int height)
1331 return GetCore().DeflateClientRectHeight(height);
1335 _FormImpl::DeflateClientRectHeight(float height)
1337 return GetCore().DeflateClientRectHeight(height);
1341 _FormImpl::RemoveHeader(void)
1343 _HeaderImpl* pHeaderImpl = GetHeader();
1347 __pForm->RemoveHeader();
1348 result r = GetLastResult();
1349 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1350 Header* pHeader = pHeaderImpl->GetHeader();
1361 _FormImpl::RemoveFooter(void)
1363 _FooterImpl* pFooterImpl = GetFooter();
1367 __pForm->RemoveFooter();
1368 result r = GetLastResult();
1369 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1370 Footer* pFooter = pFooterImpl->GetFooter();
1382 // Ki-Dong,Hong.Temp
1384 _FormImpl::RemoveTabImpl(void)
1386 _TabImpl* pTabImpl = GetTabImpl();
1390 __pForm->RemoveTab();
1391 result r = GetLastResult();
1392 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1393 Tab* pTab = pTabImpl->GetTab();
1395 pTabImpl->DeleteTab(pTab);
1406 _FormImpl::GetDataBindingContextN(void) const
1408 return _DataBindingContextImpl::GetDataBindingContextN(*this);
1412 _FormImpl::OnAttaching(const _Control* pParent)
1414 result r = E_SUCCESS;
1415 _Frame* pFrame = dynamic_cast<_Frame*>(const_cast<_Control*>((pParent)));
1416 if (FORM_STYLE_INDICATOR & GetCore().GetFormStyle())
1418 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.");
1420 r = _ControlImpl::OnAttaching(pParent);
1425 _FormImpl::OnAttachedToMainTree(void)
1427 result r = E_SUCCESS;
1430 r = GetCore().AttachedToMainTree();
1431 r = _ContainerImpl::OnAttachedToMainTree();
1433 FloatRectangle indicatorBounds(0.0f, 0.0f, 0.0f, 0.0f);
1435 if (FORM_STYLE_INDICATOR & GetCore().GetFormStyle())
1437 indicatorBounds = GetCore().GetIndicatorBoundsF();
1438 r = GetLastResult();
1439 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1442 _HeaderImpl* pHeader = GetHeader();
1443 _FooterImpl* pFooter = GetFooter();
1444 _TabImpl* pTabImpl = GetTabImpl();
1448 if (GetCore().IsIndicatorTranslucent())
1450 if (!GetCore().IsHeaderTranslucent())
1452 indicatorBounds.height = 0.0f;
1456 if (GetCore().GetOrientation() == _CONTROL_ORIENTATION_LANDSCAPE)
1458 indicatorBounds.height = 0.0f;
1462 FloatRectangle bounds(0.0f, indicatorBounds.height, GetClientBoundsF().width, GetCore().GetToolbarHeightF(true));
1463 GetCore().SetHeaderBounds(bounds);
1466 float titleHeight = 0.0f;
1470 titleHeight = pHeader->GetBoundsF().height;
1475 float posY = indicatorBounds.height + titleHeight;
1477 FloatRectangle bounds(0.0f, posY, GetClientBoundsF().width, GetCore().GetTabHeightF());
1478 GetCore().SetTabBounds(bounds);
1483 float adjHeight = 0.0f;
1485 if (!(GetCore().GetFooter()->GetVisibleState()) || GetCore().IsFooterTranslucent())
1487 adjHeight = GetCore().GetToolbarHeightF(false);
1490 if (!(GetCore().GetFormStyle() & FORM_STYLE_FOOTER || GetCore().GetFormStyle() & FORM_STYLE_SOFTKEY_0 || GetCore().GetFormStyle() & FORM_STYLE_SOFTKEY_1
1491 || GetCore().GetFormStyle() & FORM_STYLE_OPTIONKEY))
1493 adjHeight = GetCore().GetToolbarHeightF(false);
1496 FloatRectangle clientbounds = GetClientBoundsF();
1497 FloatRectangle bounds(0.0f, clientbounds.y + clientbounds.height - adjHeight, clientbounds.width, GetCore().GetToolbarHeightF(false));
1499 GetCore().SetFooterBounds(bounds);
1502 UpdateOrientationStatus();
1506 __pOriAgent->RequestOrientationEvent();
1513 _FormImpl::OnDetachingFromMainTree(void)
1515 result r = E_SUCCESS;
1516 r = GetCore().DetachingFromMainTree();
1517 r = _ContainerImpl::OnDetachingFromMainTree();
1523 _FormImpl::OnNotifiedN(const _ControlImpl& source, IList* pArgs)
1525 String* pString = dynamic_cast <Tizen::Base::String*>(pArgs->GetAt(0));
1528 if (*pString == _REQUEST_ORIENTATION_EVENT)
1532 __pOriAgent->FireOrientationEvent();
1535 pArgs->RemoveAll(true);
1546 _FormImpl::OnFormBackRequested(Tizen::Ui::Controls::_Form& source)
1548 if (__pFormBackEventListener)
1550 _FormImpl* pFormImpl = static_cast<_FormImpl*>(source.GetUserData());
1551 Form* pForm = dynamic_cast <Form*>(&pFormImpl->GetPublic());
1554 __pFormBackEventListener->OnFormBackRequested(*pForm);
1564 _FormImpl::IsOpaque(void) const
1571 _FormImpl::ConvertSoftkey(Softkey softkey) const
1575 if (softkey == SOFTKEY_0)
1577 _softkey = _SOFTKEY_0;
1579 else if (softkey == SOFTKEY_1)
1581 _softkey = _SOFTKEY_1;
1585 _softkey = _SOFTKEY_COUNT;
1592 _FormImpl::SetNotificationTrayOpenEnabled(bool enable)
1594 return GetCore().SetNotificationTrayOpenEnabled(enable);
1598 _FormImpl::IsNotificationTrayOpenEnabled(void) const
1600 return GetCore().IsNotificationTrayOpenEnabled();
1604 : public _UiBuilderControlMaker
1607 _FormMaker(_UiBuilder* uibuilder)
1608 : _UiBuilderControlMaker(uibuilder){};
1609 virtual ~_FormMaker()
1612 static _UiBuilderControlMaker* GetInstance(_UiBuilder* uibuilder)
1614 _FormMaker* pFormMaker = new (std::nothrow) _FormMaker(uibuilder);
1618 virtual Control* Make(_UiBuilderControl* pControl)
1620 _UiBuilderControlLayout* pControlProperty = null;
1621 result r = E_SUCCESS;
1624 Tizen::Base::String elementString;
1625 bool isTitleAlign = false;
1628 HorizontalAlignment align = ALIGNMENT_CENTER;
1629 Form* pForm = (Form*) GetContainer();
1631 // Get control manager
1632 _ControlManager* pControlManager = _ControlManager::GetInstance();
1633 if (pControlManager == null)
1635 SysLog(NID_UI_CTRL, "Unable to get the control manager.n");
1638 FloatDimension screenSize = pControlManager->GetScreenSizeF();
1641 (pControl->GetAttribute(UIBUILDER_ATTRIBUTE_PORTRAIT))->SetRect(0.0f, 0.0f, screenSize.width, screenSize.height);
1642 (pControl->GetAttribute(UIBUILDER_ATTRIBUTE_LANDSCAPE))->SetRect(0.0f, 0.0f, screenSize.height, screenSize.width);
1644 // Get device orientation
1645 app_device_orientation_e deviceOrientation = app_get_device_orientation();
1646 bool isHorizontal = (deviceOrientation == APP_DEVICE_ORIENTATION_90) || (deviceOrientation == APP_DEVICE_ORIENTATION_270);
1650 pControlProperty = pControl->GetAttribute(UIBUILDER_ATTRIBUTE_LANDSCAPE);
1654 pControlProperty = pControl->GetAttribute(UIBUILDER_ATTRIBUTE_PORTRAIT);
1657 if (pControlProperty == null)
1659 SysLogException(NID_UI_CTRL, E_SYSTEM, "[E_SYSTEM] Can't read attributes");
1663 pControlProperty = pControl->GetAttribute(UIBUILDER_ATTRIBUTE_PORTRAIT);
1664 Tizen::Base::String styleString;
1665 styleString = pControlProperty->GetStyle();
1667 if (styleString.Contains(L"FORM_STYLE_TITLE"))
1669 style |= FORM_STYLE_TITLE;
1671 if (styleString.Contains(L"FORM_STYLE_SOFTKEY_0"))
1673 style |= FORM_STYLE_SOFTKEY_0;
1675 if (styleString.Contains(L"FORM_STYLE_SOFTKEY_1"))
1677 style |= FORM_STYLE_SOFTKEY_1;
1679 if (styleString.Contains(L"FORM_STYLE_OPTIONKEY"))
1681 style |= FORM_STYLE_OPTIONKEY;
1683 if (styleString.Contains(L"FORM_STYLE_INDICATOR"))
1685 if (styleString.Contains(L"FORM_STYLE_INDICATOR_AUTO_HIDE"))
1687 style |= FORM_STYLE_INDICATOR_AUTO_HIDE;
1691 style |= FORM_STYLE_INDICATOR;
1694 if (styleString.Contains(L"FORM_STYLE_TEXT_TAB"))
1696 style |= FORM_STYLE_TEXT_TAB;
1698 if (styleString.Contains(L"FORM_STYLE_ICON_TAB"))
1700 style |= FORM_STYLE_ICON_TAB;
1702 if (styleString.Contains(L"FORM_STYLE_HEADER"))
1704 style |= FORM_STYLE_HEADER;
1706 if (styleString.Contains(L"FORM_STYLE_FOOTER"))
1708 style |= FORM_STYLE_FOOTER;
1711 _UiBuilderLayoutType layoutType = UIBUILDER_LAYOUT_NONE;
1712 __pLayoutMaker->GetLayoutType(pControlProperty, layoutType);
1713 if (layoutType == UIBUILDER_LAYOUT_NONE)
1716 r = pForm->Construct(style);
1720 Layout* pPortraitLayout = null;
1721 Layout* pLandscapeLayout = null;
1722 result tempResult = E_SUCCESS;
1723 tempResult = __pLayoutMaker->GetLayoutN(pControl, pPortraitLayout, pLandscapeLayout);
1724 if (E_SUCCESS == tempResult)
1726 r = pForm->Construct(*pPortraitLayout, *pLandscapeLayout, style);
1733 _UiBuilderLayoutType layoutType = UIBUILDER_LAYOUT_NONE;
1735 if (__pLayoutMaker->GetLayoutType(pControlProperty, layoutType) == false)
1740 if ( layoutType == UIBUILDER_LAYOUT_GRID)
1742 for (int i = 0; i < UIBUILDER_ATTRIBUTE_NUM; i++)
1744 GridLayout* pGridLayout = null;
1745 pControlProperty = pControl->GetAttribute(i);
1747 if ( i == UIBUILDER_ATTRIBUTE_PORTRAIT)
1749 pGridLayout = dynamic_cast<GridLayout*>(pPortraitLayout);
1753 pGridLayout = dynamic_cast<GridLayout*>(pLandscapeLayout);
1755 __pLayoutMaker->SetGridLayoutContainerProperty(pGridLayout, pControlProperty);
1758 delete pPortraitLayout;
1759 if (pPortraitLayout != pLandscapeLayout)
1761 delete pLandscapeLayout;
1767 SysLog(NID_UI_CTRL, "Failed to create Form.");
1772 if (pControl->GetElement(L"titleAlign", elementString))
1774 if (elementString.Equals(L"ALIGN_CENTER", false))
1776 align = ALIGNMENT_CENTER;
1778 else if (elementString.Equals(L"ALIGN_RIGHT", false))
1780 align = ALIGNMENT_RIGHT;
1784 align = ALIGNMENT_LEFT;
1786 isTitleAlign = true;
1789 if (style & FORM_STYLE_TITLE)
1791 if (pControl->GetElement(L"title", elementString))
1795 pForm->SetTitleText(elementString, align);
1799 pForm->SetTitleText(elementString);
1806 pForm->SetTitleText(L"", align);
1810 pForm->SetTitleText(L"");
1815 if (pControl->GetElement(L"titleIcon", elementString))
1817 Bitmap* pBitmap = null;
1818 pBitmap = LoadBitmapN(elementString);
1819 if (pBitmap != null)
1821 r = pForm->SetTitleIcon(pBitmap);
1825 SysLog(NID_UI_CTRL, "Failed to set TitleIcon.");
1830 if (pControl->GetElement(L"softKey0Text", elementString))
1832 pForm->SetSoftkeyText(SOFTKEY_0, elementString);
1834 if (pControl->GetElement(L"softKey1Text", elementString))
1836 pForm->SetSoftkeyText(SOFTKEY_1, elementString);
1838 if (pControl->GetElement(L"backgroundColorOpacity", elementString) || pControl->GetElement(L"BGColorOpacity", elementString))
1840 Base::Integer::Parse(elementString, opacity);
1842 if (pControl->GetElement(L"backgroundColor", elementString) || pControl->GetElement(L"BGColor", elementString))
1844 ConvertStringToColor32(elementString, opacity, color);
1845 pForm->SetBackgroundColor(color);
1850 r = GET_COLOR_CONFIG(FORM::BG_NORMAL,color);
1853 pForm->SetBackgroundColor(color);
1857 pForm->SetBackgroundColor(0xff000000);
1861 if (pControl->GetElement(L"softKey0Icon", elementString) || pControl->GetElement(L"softKey0NormalIcon", elementString))
1863 Bitmap* pNormalBitmap = null;
1864 Bitmap* pPressedBitmap = null;
1865 pNormalBitmap = LoadBitmapN(elementString); //__image->DecodeN(path,BITMAP_PIXEL_FORMAT_RGB565);
1867 if (pNormalBitmap != null)
1869 if (pControl->GetElement(L"softKey0PressedIcon", elementString))
1871 pPressedBitmap = LoadBitmapN(elementString);
1874 if (pPressedBitmap != null)
1876 pForm->SetSoftkeyIcon(SOFTKEY_0, *pNormalBitmap, pPressedBitmap);
1877 delete pNormalBitmap;
1878 delete pPressedBitmap;
1882 pForm->SetSoftkeyIcon(SOFTKEY_0, *pNormalBitmap, null);
1883 delete pNormalBitmap;
1887 if (pControl->GetElement(L"softKey1Icon", elementString) || pControl->GetElement(L"softKey1NormalIcon", elementString))
1889 Bitmap* pNormalBitmap = null;
1890 Bitmap* pPressedBitmap = null;
1891 pNormalBitmap = LoadBitmapN(elementString); //__image->DecodeN(path,BITMAP_PIXEL_FORMAT_RGB565);
1893 if (pNormalBitmap != null)
1895 if (pControl->GetElement(L"softKey1PressedIcon", elementString))
1897 pPressedBitmap = LoadBitmapN(elementString); // __image->DecodeN(path,BITMAP_PIXEL_FORMAT_RGB565);
1900 if (pPressedBitmap != null)
1902 pForm->SetSoftkeyIcon(SOFTKEY_1, *pNormalBitmap, pPressedBitmap);
1903 delete pNormalBitmap;
1904 delete pPressedBitmap;
1908 pForm->SetSoftkeyIcon(SOFTKEY_1, *pNormalBitmap, null);
1909 delete pNormalBitmap;
1914 if (pControl->GetElement(L"Orientation", elementString) || pControl->GetElement(L"orientation", elementString))
1917 //ORIENTATION_PORTRAIT,
1918 //ORIENTATION_LANDSACPE,
1919 //ORIENTATION_PORTRAIT_REVERSE,
1920 //ORIENTATION_LANDSACPE_REVERSE,
1921 //ORIENTATION_AUTO = 6,
1922 //ORIENTATION_AUTO_FOUR_DIRECTION = 8,
1924 if (elementString.Equals(L"Automatic:2Dir", false) || elementString.Equals(L"Automatic", false))
1926 pForm->SetOrientation(ORIENTATION_AUTOMATIC);
1928 else if (elementString.Equals(L"Automatic:4Dir", false))
1930 pForm->SetOrientation(ORIENTATION_AUTOMATIC_FOUR_DIRECTION);
1932 else if (elementString.Equals(L"Landscape", false))
1934 pForm->SetOrientation(ORIENTATION_LANDSCAPE);
1935 SetUiBuilderRotateState(UIBUIDER_SCREEN_HORIZONTAL);
1937 else if (elementString.Equals(L"Landscape:Reverse", false))
1939 pForm->SetOrientation(ORIENTATION_LANDSCAPE_REVERSE);
1940 SetUiBuilderRotateState(UIBUIDER_SCREEN_HORIZONTAL);
1942 else if (elementString.Equals(L"Portrait", false))
1944 pForm->SetOrientation(ORIENTATION_PORTRAIT);
1945 SetUiBuilderRotateState(UIBUIDER_SCREEN_VERTICAL);
1947 else if (elementString.Equals(L"Portrait:Reverse", false))
1949 pForm->SetOrientation(ORIENTATION_PORTRAIT_REVERSE);
1950 SetUiBuilderRotateState(UIBUIDER_SCREEN_VERTICAL);
1954 if (style & FORM_STYLE_HEADER)
1956 if (pControl->GetElement(L"translucentHeader", elementString))
1958 if (elementString.Equals(L"true", false))
1960 pForm->SetActionBarsTranslucent(FORM_ACTION_BAR_HEADER, true);
1965 if (style & FORM_STYLE_FOOTER)
1967 if (pControl->GetElement(L"translucentFooter", elementString))
1969 if (elementString.Equals(L"true", false))
1971 pForm->SetActionBarsTranslucent(FORM_ACTION_BAR_FOOTER, true);
1976 if (style & FORM_STYLE_INDICATOR)
1978 if (pControl->GetElement(L"translucentIndicator", elementString))
1980 if (elementString.Equals(L"true", false))
1982 pForm->SetActionBarsTranslucent(FORM_ACTION_BAR_INDICATOR, true);
1992 _FormRegister::_FormRegister()
1994 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
1995 pUiBuilderControlTableManager->RegisterControl(L"Form", _FormMaker::GetInstance);
1997 _FormRegister::~_FormRegister()
1999 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
2000 pUiBuilderControlTableManager->UnregisterControl(L"Form");
2002 static _FormRegister FormRegisterToUiBuilder;
2003 }}} // Tizen::Ui::Controls