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_UiBuilder.h"
37 #include "FUi_CoordinateSystemUtils.h"
38 #include "FUi_DataBindingContextImpl.h"
39 #include "FUi_ResourceSizeInfo.h"
40 #include "FUi_ResourceManager.h"
41 #include "FUiAnim_VisualElement.h"
42 #include "FUiCtrl_FormImpl.h"
43 #include "FUiCtrl_HeaderImpl.h"
44 #include "FUiCtrl_FooterImpl.h"
45 #include "FUiCtrl_Form.h"
46 #include "FUiCtrl_Frame.h"
47 #include "FUiCtrl_FrameImpl.h"
48 #include "FUiCtrl_TabImpl.h"
49 #include "FUiCtrl_Indicator.h"
51 using namespace Tizen::App;
52 using namespace Tizen::Base;
53 using namespace Tizen::Base::Runtime;
54 using namespace Tizen::Base::Collection;
55 using namespace Tizen::Graphics;
56 using namespace Tizen::Ui;
57 using namespace Tizen::Ui::Animations;
59 #define OPTIONKEY SOFTKEY_COUNT
61 namespace Tizen { namespace Ui { namespace Controls
64 const String _REQUEST_ORIENTATION_EVENT = L"RequestOrientationEvent";
67 _FormImpl::FormSizeInfo::GetDefaultMinimumSize(_ControlOrientation orientation) const
70 Dimension dimension(0, 0);
77 _FormImpl::FormSizeInfo::GetDefaultMinimumSizeF(_ControlOrientation orientation) const
80 FloatDimension dimension(0.0f, 0.0f);
87 _FormImpl::GetInstance(const Form& form)
89 return static_cast<const _FormImpl*> (form._pControlImpl);
93 _FormImpl::GetInstance(Form& form)
95 return static_cast<_FormImpl*> (form._pControlImpl);
98 _FormImpl::_FormImpl(Form* pPublic, _Form* pCore, Layout* pPublicPortraitLayout, Layout* pPublicLandscapeLayout)
99 : _ContainerImpl(pPublic, pCore, pPublicPortraitLayout, pPublicLandscapeLayout)
101 , __pFormBackEventListener(null)
103 , __pLeftSoftkeyActionEvent(null)
104 , __pRightSoftkeyActionEvent(null)
105 , __pOptionMenuActionEvent(null)
109 __pOriAgent = _OrientationAgent::CreateInstanceN(*pPublic);
110 SysTryReturnVoidResult(NID_UI_CTRL, __pOriAgent != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
113 _FormImpl::~_FormImpl(void)
118 if (__pLeftSoftkeyActionEvent)
120 delete __pLeftSoftkeyActionEvent;
121 __pLeftSoftkeyActionEvent = null;
124 if (__pRightSoftkeyActionEvent)
126 delete __pRightSoftkeyActionEvent;
127 __pRightSoftkeyActionEvent = null;
130 if (__pOptionMenuActionEvent)
132 delete __pOptionMenuActionEvent;
133 __pOptionMenuActionEvent = null;
136 __leftSoftkeyActionList.RemoveAll(false);
137 __rightSoftkeyActionList.RemoveAll(false);
149 _FormImpl::CreateFormImplN(Form* pControl, Layout* pPublicPortraitLayout, Layout* pPublicLandscapeLayout)
151 result r = E_SUCCESS;
152 _VisualElement* pVisualElement = null;
154 _Form* pCore = _Form::CreateFormN();
156 SysTryReturn(NID_UI_CTRL, pCore, null, r, "[%s] Propagating.", GetErrorMessage(r)); // [ToDo] interpret last result.
158 _FormImpl* pImpl = new (std::nothrow) _FormImpl(pControl, pCore, pPublicPortraitLayout, pPublicLandscapeLayout);
160 r = _ControlImpl::CheckConstruction(pCore, pImpl);
161 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
163 const FloatDimension portraitSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF();
164 const FloatDimension landscapeSize = FloatDimension(portraitSize.height, portraitSize.width);
166 _ControlOrientation orientation = pCore->GetOrientation();
168 if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
170 r = pImpl->InitializeBoundsPropertiesF(GET_SIZE_INFO(Form), portraitSize, orientation);
174 r = pImpl->InitializeBoundsPropertiesF(GET_SIZE_INFO(Form), landscapeSize, orientation);
176 SysAssert(r == E_SUCCESS);
178 // Make surface opaque.
179 pVisualElement = pCore->GetVisualElement();
180 SysTryCatch(NID_UI_CTRL, pVisualElement, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
181 r = pVisualElement->SetSurfaceOpaque(true);
182 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r)); // [ToDo] interpret last result.
184 SetLastResult(E_SUCCESS);
196 _FormImpl::GetPublicClassName(void) const
198 return "Tizen::Ui::Controls::Form";
202 _FormImpl::GetPublic(void) const
204 return static_cast<const Form&>(_ControlImpl::GetPublic());
208 _FormImpl::GetPublic(void)
210 return static_cast<Form&>(_ControlImpl::GetPublic());
214 _FormImpl::GetCore(void) const
216 return static_cast<const _Form&>(_ControlImpl::GetCore());
220 _FormImpl::GetCore(void)
222 return static_cast<_Form&>(_ControlImpl::GetCore());
226 _FormImpl::GetFocusControl(void)
232 _FormImpl::GetFormStyle(void) const
234 return GetCore().GetFormStyle();
238 _FormImpl::HasIndicator(void) const
240 return GetCore().HasIndicator();
244 _FormImpl::SetFormStyle(unsigned long formStyle)
246 result r = E_SUCCESS;
248 _HeaderImpl* pHeader = GetHeader();
249 _FooterImpl* pFooter = GetFooter();
250 _TabImpl* pTabImpl = GetTabImpl();
252 if (IsAttachedToMainTree())
254 if (FORM_STYLE_INDICATOR & formStyle)
256 _Frame* pFrame = dynamic_cast<_Frame*>(GetCore().GetParent());
257 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.");
261 if ((formStyle & FORM_STYLE_INDICATOR) && (formStyle & FORM_STYLE_INDICATOR_AUTO_HIDE))
263 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.");
268 if (((formStyle & FORM_STYLE_TITLE) || (formStyle & FORM_STYLE_TEXT_TAB) || (formStyle & FORM_STYLE_ICON_TAB)) && (formStyle & FORM_STYLE_HEADER))
270 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.");
277 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
283 if (((formStyle & FORM_STYLE_SOFTKEY_0) || (formStyle & FORM_STYLE_SOFTKEY_1) || (formStyle & FORM_STYLE_OPTIONKEY)) && (formStyle & FORM_STYLE_FOOTER))
285 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.");
292 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
297 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
298 SysTryReturnVoidResult(NID_UI_CTRL, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] Unable to get evas.");
300 GetCore().SetFormStyle(formStyle);
302 FloatRectangle indicatorBounds(0.0f, 0.0f, 0.0f, 0.0f);
304 if (FORM_STYLE_INDICATOR & formStyle)
306 GetCore().SetIndicatorShowState(true);
307 indicatorBounds = GetCore().GetIndicatorBoundsF();
309 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
312 else if(FORM_STYLE_INDICATOR_AUTO_HIDE & formStyle)
314 r = GetCore().SetIndicatorShowState(false, true);
315 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
319 r = GetCore().SetIndicatorShowState(false);
320 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
323 if (formStyle & FORM_STYLE_HEADER)
327 pHeader = CreateHeaderN();
328 SysTryReturnVoidResult(NID_UI_CTRL, pHeader != null, r, "[%s] Propagating.", GetErrorMessage(r));
330 GetCore().SetHeader(&pHeader->GetCore());
331 GetCore().AdjustClientBounds();
333 FloatRectangle bounds(0.0f, indicatorBounds.height, GetClientBoundsF().width, GetCore().GetToolbarHeightF(true));
334 GetCore().SetHeaderBounds(bounds);
336 r = GetCore().AttachSystemChild(pHeader->GetCore());
337 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
339 GetCore().SetFormBackEventListener(this);
342 else if (formStyle & FORM_STYLE_TITLE)
346 pHeader = CreateHeaderN();
347 SysTryReturnVoidResult(NID_UI_CTRL, pHeader != null, r, "[%s] Propagating.", GetErrorMessage(r));
349 GetCore().SetHeader(&pHeader->GetCore());
350 GetCore().AdjustClientBounds();
352 FloatRectangle bounds(0.0f, indicatorBounds.height, GetClientBoundsF().width, GetCore().GetToolbarHeightF(true));
353 GetCore().SetHeaderBounds(bounds);
355 r = GetCore().AttachSystemChild(pHeader->GetCore());
356 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
366 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
370 _Indicator* pIndicator = GetCore().GetIndicator();
371 if (pIndicator && !pIndicator->IsAttachedToMainTree())
373 r = GetCore().AttachSystemChild(*pIndicator);
374 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
377 if (formStyle & FORM_STYLE_TEXT_TAB)
379 float titleHeight = 0.0f;
381 if (formStyle & FORM_STYLE_TITLE)
385 titleHeight = pHeader->GetBoundsF().height;
391 pTabImpl = CreateTabImplN();
392 SysTryReturnVoidResult(NID_UI_CTRL, pTabImpl != null, r, "[%s] Propagating.", GetErrorMessage(r));
394 float posY = indicatorBounds.height + titleHeight;
396 GetCore().SetTab(&pTabImpl->GetCore());
397 GetCore().AdjustClientBounds();
399 FloatRectangle bounds(0.0f, posY, GetClientBoundsF().width, GetCore().GetTabHeightF());
400 GetCore().SetTabBounds(bounds);
402 r = GetCore().AttachSystemChild(pTabImpl->GetCore());
403 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
405 GetCore().SetTabStyle(_TAB_STYLE_TEXT);
407 else if (formStyle & FORM_STYLE_ICON_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_ICON);
443 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
447 if (formStyle & FORM_STYLE_FOOTER)
451 pFooter = CreateFooterN();
452 SysTryReturnVoidResult(NID_UI_CTRL, pFooter != null, r, "[%s] Propagating.", GetErrorMessage(r));
454 GetCore().SetFooter(&pFooter->GetCore());
455 GetCore().AdjustClientBounds();
457 FloatRectangle clientbounds = GetClientBoundsF();
458 FloatRectangle bounds(0.0f, clientbounds.y + clientbounds.height, clientbounds.width, GetCore().GetToolbarHeightF(false));
460 GetCore().SetFooterBounds(bounds);
462 r = GetCore().AttachSystemChild(pFooter->GetCore());
463 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
465 GetCore().SetFormBackEventListener(this);
468 else if (formStyle & FORM_STYLE_SOFTKEY_0 || formStyle & FORM_STYLE_SOFTKEY_1 || formStyle & FORM_STYLE_OPTIONKEY)
474 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
477 pFooter = GetFooter();
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 - GetCore().GetToolbarHeightF(false), 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().CreateSoftkey(formStyle);
497 pFooter->GetCore().AddActionEventListener(*this);
507 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
508 GetCore().AdjustClientBounds();
512 GetCore().AdjustClientBounds();
514 SetLastResult(E_SUCCESS);
520 _FormImpl::GetFooter(void) const
522 _Toolbar* pToolbar = __pForm->GetFooter();
523 if (pToolbar == null)
528 _FooterImpl* pFooterImpl = static_cast<_FooterImpl*>(pToolbar->GetUserData());
534 _FormImpl::GetHeader(void) const
536 _Toolbar* pToolbar = __pForm->GetHeader();
537 if (pToolbar == null)
542 _HeaderImpl* pHeaderImpl = static_cast<_HeaderImpl*>(pToolbar->GetUserData());
549 _FormImpl::GetTabImpl(void) const
551 _Tab* pTab = __pForm->GetTab();
557 _TabImpl* pTabImpl = static_cast<_TabImpl*>(pTab->GetUserData());
563 _FormImpl::GetTitleText(void) const
565 return GetCore().GetTitleText();
569 _FormImpl::GetTitleTextHorizontalAlignment(void) const
571 return GetCore().GetTitleTextHorizontalAlignment();
575 _FormImpl::HasFooter(void) const
577 return GetCore().HasFooter();
581 _FormImpl::HasHeader(void) const
583 return GetCore().HasHeader();
587 _FormImpl::HasTitle(void) const
589 return GetCore().HasTitle();
593 _FormImpl::HasTab(void) const
595 return GetCore().HasTab();
599 _FormImpl::IsIndicatorVisible(void) const
601 return GetCore().IsIndicatorVisible();
605 _FormImpl::IsHeaderVisible(void) const
607 return GetCore().IsHeaderVisible();
611 _FormImpl::IsFooterVisible(void) const
613 return GetCore().IsFooterVisible();
617 _FormImpl::IsIndicatorTranslucent(void) const
619 return GetCore().IsIndicatorTranslucent();
623 _FormImpl::IsHeaderTranslucent(void) const
625 return GetCore().IsHeaderTranslucent();
629 _FormImpl::IsFooterTranslucent(void) const
631 return GetCore().IsFooterTranslucent();
636 _FormImpl::IsTabTranslucent(void) const
638 return GetCore().IsTabTranslucent();
642 _FormImpl::SetActionBarsTranslucent(unsigned long actionBars, bool translucent)
644 return GetCore().SetActionBarsTranslucent(actionBars, translucent);
648 _FormImpl::SetActionBarsVisible(unsigned long actionBars, bool visible)
650 return GetCore().SetActionBarsVisible(actionBars, visible);
654 _FormImpl::SetTitleIcon(const Bitmap* pTitleBitmap)
656 return GetCore().SetTitleIcon(pTitleBitmap);
660 _FormImpl::SetTitleText(const String& title, HorizontalAlignment alignment)
662 return GetCore().SetTitleText(title, alignment);
666 _FormImpl::GetOverlayRegionN(const Rectangle& rect, OverlayRegionType regionType)
668 return GetCore().GetOverlayRegionN(rect, regionType);
672 _FormImpl::GetOverlayRegionN(const FloatRectangle& rect, OverlayRegionType regionType)
674 return GetCore().GetOverlayRegionN(rect, regionType);
678 _FormImpl::OnDraw(void)
680 __pOriAgent->FireOrientationEvent();
682 _ContainerImpl::OnDraw();
686 _FormImpl::OnKeyReleased(const _ControlImpl& source, _KeyCode keyCode)
691 if (GetCore().GetFooter() || GetCore().GetHeader())
693 if (__pFormBackEventListener)
695 Form* pForm = dynamic_cast <Form*>(&GetPublic());
698 __pFormBackEventListener->OnFormBackRequested(*pForm);
720 _FormImpl::OnActionPerformed(const _Control& source, int actionId)
722 if (GetFormStyle() & FORM_STYLE_SOFTKEY_0 || GetFormStyle() & FORM_STYLE_SOFTKEY_1 || GetFormStyle() & FORM_STYLE_OPTIONKEY)
724 Tizen::Base::Runtime::IEventArg* tempArg = null;
725 tempArg = _PublicActionEvent::CreateActionEventArgN(actionId);
726 SysTryReturnVoidResult(NID_UI_CTRL, tempArg , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Unable to create Eventarg.");
729 _PublicActionEvent* pSoftkeyActionEvent = null;
731 if (GetCore().GetFooter()->IsButtonSet(LEFT_BUTTON) && GetSoftkeyActionId(SOFTKEY_0) == actionId)
733 for (int i = 0; i < __leftSoftkeyActionList.GetCount(); i++)
735 pSoftkeyActionEvent = dynamic_cast<_PublicActionEvent*>(__leftSoftkeyActionList.GetAt(i));
737 if (pSoftkeyActionEvent)
739 pSoftkeyActionEvent->Fire(*tempArg);
745 if (GetCore().GetFooter()->IsButtonSet(RIGHT_BUTTON) && GetSoftkeyActionId(SOFTKEY_1) == actionId)
747 for (int i = 0; i < __rightSoftkeyActionList.GetCount(); i++)
749 pSoftkeyActionEvent = dynamic_cast<_PublicActionEvent*>(__rightSoftkeyActionList.GetAt(i));
751 if (pSoftkeyActionEvent)
753 pSoftkeyActionEvent->Fire(*tempArg);
759 if (GetCore().GetFooter()->IsButtonSet(MIDDLE_BUTTON) && GetOptionkeyActionId() == actionId)
761 if (__pOptionMenuActionEvent)
763 __pOptionMenuActionEvent->Fire(*tempArg);
775 _FormImpl::GetClientAreaCanvasN(void) const
777 return GetCore().GetClientAreaCanvasN();
781 _FormImpl::TranslateToClientAreaPosition(const Point& position) const
783 return GetCore().TranslateToClientAreaPosition(position);
787 _FormImpl::TranslateToClientAreaPosition(const FloatPoint& position) const
789 return GetCore().TranslateToClientAreaPosition(position);
793 _FormImpl::TranslateFromClientAreaPosition(const Point& clientPosition) const
795 return GetCore().TranslateFromClientAreaPosition(clientPosition);
799 _FormImpl::TranslateFromClientAreaPosition(const FloatPoint& clientPosition) const
801 return GetCore().TranslateFromClientAreaPosition(clientPosition);
805 _FormImpl::SetFormBackEventListener(const IFormBackEventListener* pFormBackEventListener)
807 SysTryReturnVoidResult(NID_UI_CTRL, GetFooter() || GetHeader(), E_INVALID_STATE, "[E_INVALID_STATE] Footer isn't constructed.");
808 __pFormBackEventListener = const_cast <IFormBackEventListener*>(pFormBackEventListener);
809 GetCore().SetFormBackEventListener(this);
810 result r = GetLastResult();
811 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
815 _FormImpl::AddOrientationEventListener(IOrientationEventListener& listener)
817 __pOriAgent->AddListener(listener);
821 _FormImpl::AddOptionkeyActionListener(const IActionEventListener& listener)
823 if (HasOptionkey() == false)
828 __pOptionMenuActionEvent = _PublicActionEvent::CreateInstanceN(GetPublic());
830 SysTryReturnVoidResult(NID_UI_CTRL, __pOptionMenuActionEvent != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
832 __pOptionMenuActionEvent->AddListener(listener);
836 _FormImpl::AddSoftkeyActionListener(Softkey softkey, const IActionEventListener& listener)
838 _Softkey _softkey = ConvertSoftkey(softkey);
840 if (GetCore().CheckSoftkey(_softkey) == false)
845 if (softkey == SOFTKEY_0)
847 __pLeftSoftkeyActionEvent = _PublicActionEvent::CreateInstanceN(GetPublic());
849 SysTryReturnVoidResult(NID_UI_CTRL, __pLeftSoftkeyActionEvent != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
851 __pLeftSoftkeyActionEvent->AddListener(listener);
853 __leftSoftkeyActionList.Add(*__pLeftSoftkeyActionEvent);
855 else if (softkey == SOFTKEY_1)
857 __pRightSoftkeyActionEvent = _PublicActionEvent::CreateInstanceN(GetPublic());
859 SysTryReturnVoidResult(NID_UI_CTRL, __pRightSoftkeyActionEvent != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
861 __pRightSoftkeyActionEvent->AddListener(listener);
863 __rightSoftkeyActionList.Add(*__pRightSoftkeyActionEvent);
868 _FormImpl::RemoveOrientationEventListener(IOrientationEventListener& listener)
870 __pOriAgent->RemoveListener(listener);
874 _FormImpl::RemoveOptionkeyActionListener(const IActionEventListener& listener)
876 if (HasOptionkey() == false)
881 if (__pOptionMenuActionEvent)
883 __pOptionMenuActionEvent->RemoveListener(listener);
888 _FormImpl::RemoveSoftkeyActionListener(Softkey softkey, const IActionEventListener& listener)
890 _Softkey _softkey = ConvertSoftkey(softkey);
892 if (GetCore().CheckSoftkey(_softkey) == false)
897 if (softkey == SOFTKEY_0)
899 if (__pLeftSoftkeyActionEvent)
901 __pLeftSoftkeyActionEvent->RemoveListener(listener);
904 else if (softkey == SOFTKEY_1)
906 if (__pRightSoftkeyActionEvent)
908 __pRightSoftkeyActionEvent->RemoveListener(listener);
914 _FormImpl::SetOrientation(Orientation orientation)
916 __pOriAgent->SetMode(orientation);
920 _FormImpl::GetOrientation(void) const
922 return __pOriAgent->GetMode();
926 _FormImpl::GetOrientationStatus(void) const
928 return __pOriAgent->GetStatus();
932 _FormImpl::UpdateOrientationStatus(bool draw)
934 __pOriAgent->Update(draw);
937 #if defined(WINDOW_BASE_ROTATE)
939 _FormImpl::UpdateOrientation(void)
941 __pOriAgent->UpdateOrientation();
946 _FormImpl::HasOptionkey(void) const
948 return GetCore().HasOptionkey();
952 _FormImpl::HasSoftkey(Softkey softkey) const
954 _Softkey _softkey = ConvertSoftkey(softkey);
956 return GetCore().HasSoftkey(_softkey);
960 _FormImpl::SetSoftkeyEnabled(Softkey softkey, bool enable)
962 _Softkey _softkey = ConvertSoftkey(softkey);
964 result r = GetCore().SetSoftkeyEnabled(_softkey, enable);
965 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
971 _FormImpl::IsSoftkeyEnabled(Softkey softkey) const
973 _Softkey _softkey = ConvertSoftkey(softkey);
975 return GetCore().IsSoftkeyEnabled(_softkey);
979 _FormImpl::GetSoftkeyActionId(Softkey softkey) const
981 _Softkey _softkey = ConvertSoftkey(softkey);
983 return GetCore().GetSoftkeyActionId(_softkey);
987 _FormImpl::GetOptionkeyActionId(void) const
989 return GetCore().GetOptionkeyActionId();
993 _FormImpl::GetSoftkeyText(Softkey softkey) const
995 _Softkey _softkey = ConvertSoftkey(softkey);
997 return GetCore().GetSoftkeyText(_softkey);
1001 _FormImpl::SetOptionkeyActionId(int actionId)
1003 result r = GetCore().SetOptionkeyActionId(actionId);
1004 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
1010 _FormImpl::SetSoftkeyActionId(Softkey softkey, int actionId)
1012 _Softkey _softkey = ConvertSoftkey(softkey);
1014 result r = GetCore().SetSoftkeyActionId(_softkey, actionId);
1015 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
1021 _FormImpl::SetSoftkeyText(Softkey softkey, const String& text)
1023 _Softkey _softkey = ConvertSoftkey(softkey);
1025 result r = GetCore().SetSoftkeyText(_softkey, text);
1026 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
1032 _FormImpl::SetSoftkeyIcon(Softkey softkey, const Bitmap& pNormalBitmap, const Bitmap* ppPressedBitmap)
1034 _Softkey _softkey = ConvertSoftkey(softkey);
1036 result r = GetCore().SetSoftkeyIcon(_softkey, pNormalBitmap, ppPressedBitmap);
1037 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
1043 _FormImpl::OnChangeLayout(_ControlOrientation orientation)
1045 const FloatDimension portraitSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF();
1046 const FloatDimension landscapeSize = FloatDimension(portraitSize.height, portraitSize.width);
1048 // Adjust the position of the partial Frame.
1049 _FrameImpl* pFrameImpl = dynamic_cast<_FrameImpl*>(GetParent());
1052 FrameShowMode frameShowMode = pFrameImpl->GetShowMode();
1054 if ((frameShowMode == FRAME_SHOW_MODE_PARTIAL_SCREEN) || (frameShowMode == FRAME_SHOW_MODE_PARTIAL_SCREEN_FLOATING))
1056 bool movable = pFrameImpl->GetCore().IsMovable();
1057 pFrameImpl->GetCore().SetMovable(true);
1059 FloatPoint prevPoint = pFrameImpl->GetPositionF();
1060 FloatPoint curPoint(0.0f, 0.0f);
1062 if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
1064 curPoint.x = portraitSize.width / portraitSize.height * prevPoint.x;
1065 curPoint.y = portraitSize.height / portraitSize.width * prevPoint.y;
1069 curPoint.x = portraitSize.height / portraitSize.width * prevPoint.x;
1070 curPoint.y = portraitSize.width / portraitSize.height * prevPoint.y;
1073 pFrameImpl->SetPosition(curPoint);
1075 pFrameImpl->GetCore().SetMovable(movable);
1080 _ContainerImpl::OnChangeLayout(orientation);
1081 SysTryReturnVoidResult(NID_UI_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1083 if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
1085 SetSize(portraitSize);
1089 SetSize(landscapeSize);
1092 float indicatorheight = 0.0f;
1094 GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, GetCore().GetOrientation(), indicatorheight);
1095 if (GetCore().HasIndicator())
1097 _Indicator* pIndicator = GetCore().GetIndicator();
1100 if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
1102 pIndicator->SetBounds(FloatRectangle(0.0f, 0.0f, GetClientBoundsF().width, indicatorheight));
1106 GET_SHAPE_CONFIG(FORM::INDICATOR_MINIMIZE_HEIGHT, GetCore().GetOrientation(), indicatorheight);
1107 pIndicator->SetBounds(FloatRectangle(0.0f, 0.0f, GetClientBoundsF().width, indicatorheight));
1110 GetCore().AdjustClientBounds();
1114 float adjHeight = 0.0f;
1116 if (GetCore().HasHeader())
1118 FloatRectangle indicatorBounds(0.0f, 0.0f, 0.0f, 0.0f);
1119 if (GetCore().IsIndicatorVisible())
1121 indicatorBounds = GetCore().GetIndicatorBoundsF();
1124 FloatRectangle bounds(0.0f, indicatorBounds.height, GetClientBoundsF().width, GetCore().GetToolbarHeightF(true));
1125 GetCore().SetHeaderBounds(bounds);
1128 if (GetCore().HasTab()) // Ki-Dong,Hong.Temp
1130 float titleHeight = 0.0f;
1132 if (GetCore().GetFormStyle() & FORM_STYLE_TITLE)
1134 if (GetCore().HasHeader())
1136 _HeaderImpl* pHeaderImpl = GetHeader();
1139 titleHeight = pHeaderImpl->GetBoundsF().height;
1144 FloatRectangle indicatorBounds(0.0f, 0.0f, 0.0f, 0.0f);
1146 if (GetCore().IsIndicatorVisible())
1148 indicatorBounds = GetCore().GetIndicatorBoundsF();
1151 float posY = indicatorBounds.height + titleHeight;
1153 FloatRectangle bounds(0.0f, posY, GetClientBoundsF().width, GetCore().GetTabHeightF());
1154 GetCore().SetTabBounds(bounds);
1157 if (GetCore().HasFooter())
1159 if (GetCore().GetFooter()->GetVisibleState() && !GetCore().IsFooterTranslucent())
1165 adjHeight = GetCore().GetToolbarHeightF(false);
1168 if (!(GetCore().GetFormStyle() & FORM_STYLE_FOOTER || GetCore().GetFormStyle() & FORM_STYLE_SOFTKEY_0 || GetCore().GetFormStyle() & FORM_STYLE_SOFTKEY_1
1169 || GetCore().GetFormStyle() & FORM_STYLE_OPTIONKEY))
1171 adjHeight = GetCore().GetToolbarHeightF(false);
1174 FloatRectangle bounds(0.0f, GetClientBoundsF().y + GetClientBoundsF().height - adjHeight,
1175 GetClientBoundsF().width, GetCore().GetToolbarHeightF(false));
1176 GetCore().SetFooterBounds(bounds);
1181 _FormImpl::CreateHeaderN(void)
1183 result r = E_SUCCESS;
1185 Header* pHeader = new (std::nothrow) Header;
1186 SysTryReturn(NID_UI_CTRL, pHeader, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
1188 r = pHeader->Construct();
1189 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1191 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*pHeader);
1193 SetLastResult(E_SUCCESS);
1199 _FormImpl::CreateFooterN(void)
1201 result r = E_SUCCESS;
1203 Footer* pFooter = new (std::nothrow) Footer;
1204 SysTryReturn(NID_UI_CTRL, pFooter, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
1206 r = pFooter->Construct();
1207 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1209 _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*pFooter);
1211 SetLastResult(E_SUCCESS);
1216 // Ki-Dong,Hong.Temp
1218 _FormImpl::CreateTabImplN(void)
1220 //result r = E_SUCCESS;
1222 //Tab* pTab = new (std::nothrow) Tab;
1223 //SysTryReturn(NID_UI_CTRL, pTab, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
1225 //r = pTab->Construct();
1226 //SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] Unable to consturct tab.");
1228 //return pTab->GetTabImpl();
1229 Tab* pTab = _TabImpl::CreateTabN();
1230 SysTryReturn(NID_UI_CTRL, pTab, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1232 _TabImpl* pTabImpl = _TabImpl::GetInstance(*pTab);
1234 SetLastResult(E_SUCCESS);
1240 _FormImpl::DeflateClientRectHeight(int height)
1242 return GetCore().DeflateClientRectHeight(height);
1246 _FormImpl::DeflateClientRectHeight(float height)
1248 return GetCore().DeflateClientRectHeight(height);
1252 _FormImpl::RemoveHeader(void)
1254 _HeaderImpl* pHeaderImpl = GetHeader();
1258 __pForm->RemoveHeader();
1259 result r = GetLastResult();
1260 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1261 Header* pHeader = pHeaderImpl->GetHeader();
1272 _FormImpl::RemoveFooter(void)
1274 _FooterImpl* pFooterImpl = GetFooter();
1278 __pForm->RemoveFooter();
1279 result r = GetLastResult();
1280 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1281 Footer* pFooter = pFooterImpl->GetFooter();
1293 // Ki-Dong,Hong.Temp
1295 _FormImpl::RemoveTabImpl(void)
1297 _TabImpl* pTabImpl = GetTabImpl();
1301 __pForm->RemoveTab();
1302 result r = GetLastResult();
1303 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1304 Tab* pTab = pTabImpl->GetTab();
1306 pTabImpl->DeleteTab(pTab);
1317 _FormImpl::GetDataBindingContextN(void) const
1319 return _DataBindingContextImpl::GetDataBindingContextN(*this);
1323 _FormImpl::OnAttaching(const _Control* pParent)
1325 result r = E_SUCCESS;
1326 _Frame* pFrame = dynamic_cast<_Frame*>(const_cast<_Control*>((pParent)));
1327 if (FORM_STYLE_INDICATOR & GetCore().GetFormStyle())
1329 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.");
1331 r = _ControlImpl::OnAttaching(pParent);
1336 _FormImpl::OnAttachedToMainTree(void)
1338 result r = E_SUCCESS;
1341 r = GetCore().AttachedToMainTree();
1342 r = _ContainerImpl::OnAttachedToMainTree();
1344 FloatRectangle indicatorBounds(0.0f, 0.0f, 0.0f, 0.0f);
1346 if (FORM_STYLE_INDICATOR & GetCore().GetFormStyle())
1348 indicatorBounds = GetCore().GetIndicatorBoundsF();
1349 r = GetLastResult();
1350 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1353 _HeaderImpl* pHeader = GetHeader();
1354 _FooterImpl* pFooter = GetFooter();
1355 _TabImpl* pTabImpl = GetTabImpl();
1359 FloatRectangle bounds(0.0f, indicatorBounds.height, GetClientBoundsF().width, GetCore().GetToolbarHeightF(true));
1360 GetCore().SetHeaderBounds(bounds);
1363 float titleHeight = 0.0f;
1367 titleHeight = pHeader->GetBoundsF().height;
1372 float posY = indicatorBounds.height + titleHeight;
1374 FloatRectangle bounds(0.0f, posY, GetClientBoundsF().width, GetCore().GetTabHeightF());
1375 GetCore().SetTabBounds(bounds);
1380 float adjHeight = 0.0f;
1382 if (!(GetCore().GetFooter()->GetVisibleState()) || GetCore().IsFooterTranslucent())
1384 adjHeight = GetCore().GetToolbarHeightF(false);
1387 if (!(GetCore().GetFormStyle() & FORM_STYLE_FOOTER || GetCore().GetFormStyle() & FORM_STYLE_SOFTKEY_0 || GetCore().GetFormStyle() & FORM_STYLE_SOFTKEY_1
1388 || GetCore().GetFormStyle() & FORM_STYLE_OPTIONKEY))
1390 adjHeight = GetCore().GetToolbarHeightF(false);
1393 FloatRectangle clientbounds = GetClientBoundsF();
1394 FloatRectangle bounds(0.0f, clientbounds.y + clientbounds.height - adjHeight, clientbounds.width, GetCore().GetToolbarHeightF(false));
1396 GetCore().SetFooterBounds(bounds);
1399 UpdateOrientationStatus();
1401 __pOriAgent->RequestOrientationEvent();
1407 _FormImpl::OnDetachingFromMainTree(void)
1409 result r = E_SUCCESS;
1410 r = GetCore().DetachingFromMainTree();
1411 r = _ContainerImpl::OnDetachingFromMainTree();
1417 _FormImpl::OnNotifiedN(const _ControlImpl& source, IList* pArgs)
1419 String* pString = dynamic_cast <Tizen::Base::String*>(pArgs->GetAt(0));
1422 if (*pString == _REQUEST_ORIENTATION_EVENT)
1424 __pOriAgent->FireOrientationEvent();
1426 pArgs->RemoveAll(true);
1437 _FormImpl::OnFormBackRequested(Tizen::Ui::Controls::_Form& source)
1439 if (__pFormBackEventListener)
1441 _FormImpl* pFormImpl = static_cast<_FormImpl*>(source.GetUserData());
1442 Form* pForm = dynamic_cast <Form*>(&pFormImpl->GetPublic());
1445 __pFormBackEventListener->OnFormBackRequested(*pForm);
1455 _FormImpl::IsOpaque(void) const
1462 _FormImpl::ConvertSoftkey(Softkey softkey) const
1466 if (softkey == SOFTKEY_0)
1468 _softkey = _SOFTKEY_0;
1470 else if (softkey == SOFTKEY_1)
1472 _softkey = _SOFTKEY_1;
1476 _softkey = _SOFTKEY_COUNT;
1483 _FormImpl::SetNotificationTrayOpenEnabled(bool enable)
1485 return GetCore().SetNotificationTrayOpenEnabled(enable);
1489 _FormImpl::IsNotificationTrayOpenEnabled(void) const
1491 return GetCore().IsNotificationTrayOpenEnabled();
1495 : public _UiBuilderControlMaker
1498 _FormMaker(_UiBuilder* uibuilder)
1499 : _UiBuilderControlMaker(uibuilder){};
1500 virtual ~_FormMaker()
1503 static _UiBuilderControlMaker* GetInstance(_UiBuilder* uibuilder)
1505 _FormMaker* pFormMaker = new (std::nothrow) _FormMaker(uibuilder);
1509 virtual Control* Make(_UiBuilderControl* pControl)
1511 _UiBuilderControlLayout* pControlProperty = null;
1512 result r = E_SUCCESS;
1515 Tizen::Base::String elementString;
1516 bool isTitleAlign = false;
1519 HorizontalAlignment align = ALIGNMENT_CENTER;
1520 Form* pForm = (Form*) GetContainer();
1522 // Get control manager
1523 _ControlManager* pControlManager = _ControlManager::GetInstance();
1524 if (pControlManager == null)
1526 SysLog(NID_UI_CTRL, "Unable to get the control manager.n");
1529 FloatDimension screenSize = pControlManager->GetScreenSizeF();
1532 (pControl->GetAttribute(UIBUILDER_ATTRIBUTE_PORTRAIT))->SetRect(0.0f, 0.0f, screenSize.width, screenSize.height);
1533 (pControl->GetAttribute(UIBUILDER_ATTRIBUTE_LANDSCAPE))->SetRect(0.0f, 0.0f, screenSize.height, screenSize.width);
1535 // Get device orientation
1536 app_device_orientation_e deviceOrientation = app_get_device_orientation();
1537 bool isHorizontal = (deviceOrientation == APP_DEVICE_ORIENTATION_90) || (deviceOrientation == APP_DEVICE_ORIENTATION_270);
1541 pControlProperty = pControl->GetAttribute(UIBUILDER_ATTRIBUTE_LANDSCAPE);
1545 pControlProperty = pControl->GetAttribute(UIBUILDER_ATTRIBUTE_PORTRAIT);
1548 if (pControlProperty == null)
1550 SysLogException(NID_UI_CTRL, E_SYSTEM, "[E_SYSTEM] Can't read attributes");
1554 pControlProperty = pControl->GetAttribute(UIBUILDER_ATTRIBUTE_PORTRAIT);
1555 Tizen::Base::String styleString;
1556 styleString = pControlProperty->GetStyle();
1558 if (styleString.Contains(L"FORM_STYLE_TITLE"))
1560 style |= FORM_STYLE_TITLE;
1562 if (styleString.Contains(L"FORM_STYLE_SOFTKEY_0"))
1564 style |= FORM_STYLE_SOFTKEY_0;
1566 if (styleString.Contains(L"FORM_STYLE_SOFTKEY_1"))
1568 style |= FORM_STYLE_SOFTKEY_1;
1570 if (styleString.Contains(L"FORM_STYLE_OPTIONKEY"))
1572 style |= FORM_STYLE_OPTIONKEY;
1574 if (styleString.Contains(L"FORM_STYLE_INDICATOR"))
1576 style |= FORM_STYLE_INDICATOR;
1578 if (styleString.Contains(L"FORM_STYLE_TEXT_TAB"))
1580 style |= FORM_STYLE_TEXT_TAB;
1582 if (styleString.Contains(L"FORM_STYLE_ICON_TAB"))
1584 style |= FORM_STYLE_ICON_TAB;
1586 if (styleString.Contains(L"FORM_STYLE_HEADER"))
1588 style |= FORM_STYLE_HEADER;
1590 if (styleString.Contains(L"FORM_STYLE_FOOTER"))
1592 style |= FORM_STYLE_FOOTER;
1595 _UiBuilderLayoutType layoutType = UIBUILDER_LAYOUT_NONE;
1596 __pLayoutMaker->GetLayoutType(pControlProperty, layoutType);
1597 if (layoutType == UIBUILDER_LAYOUT_NONE)
1600 r = pForm->Construct(style);
1604 Layout* pPortraitLayout = null;
1605 Layout* pLandscapeLayout = null;
1606 result tempResult = E_SUCCESS;
1607 tempResult = __pLayoutMaker->GetLayoutN(pControl, pPortraitLayout, pLandscapeLayout);
1608 if (E_SUCCESS == tempResult)
1610 r = pForm->Construct(*pPortraitLayout, *pLandscapeLayout, style);
1617 _UiBuilderLayoutType layoutType = UIBUILDER_LAYOUT_NONE;
1619 if (__pLayoutMaker->GetLayoutType(pControlProperty, layoutType) == false)
1624 if ( layoutType == UIBUILDER_LAYOUT_GRID)
1626 for (int i = 0; i < UIBUILDER_ATTRIBUTE_NUM; i++)
1628 GridLayout* pGridLayout = null;
1629 pControlProperty = pControl->GetAttribute(i);
1631 if ( i == UIBUILDER_ATTRIBUTE_PORTRAIT)
1633 pGridLayout = dynamic_cast<GridLayout*>(pPortraitLayout);
1637 pGridLayout = dynamic_cast<GridLayout*>(pLandscapeLayout);
1639 __pLayoutMaker->SetGridLayoutContainerProperty(pGridLayout, pControlProperty);
1642 delete pPortraitLayout;
1643 if (pPortraitLayout != pLandscapeLayout)
1645 delete pLandscapeLayout;
1651 SysLog(NID_UI_CTRL, "Failed to create Form.");
1656 if (pControl->GetElement(L"titleAlign", elementString))
1658 if (elementString.Equals(L"ALIGN_CENTER", false))
1660 align = ALIGNMENT_CENTER;
1662 else if (elementString.Equals(L"ALIGN_RIGHT", false))
1664 align = ALIGNMENT_RIGHT;
1668 align = ALIGNMENT_LEFT;
1670 isTitleAlign = true;
1673 if (style & FORM_STYLE_TITLE)
1675 if (pControl->GetElement(L"title", elementString))
1679 pForm->SetTitleText(elementString, align);
1683 pForm->SetTitleText(elementString);
1690 pForm->SetTitleText(L"", align);
1694 pForm->SetTitleText(L"");
1699 if (pControl->GetElement(L"titleIcon", elementString))
1701 Bitmap* pBitmap = null;
1702 pBitmap = LoadBitmapN(elementString);
1703 if (pBitmap != null)
1705 r = pForm->SetTitleIcon(pBitmap);
1709 SysLog(NID_UI_CTRL, "Failed to set TitleIcon.");
1714 if (pControl->GetElement(L"softKey0Text", elementString))
1716 pForm->SetSoftkeyText(SOFTKEY_0, elementString);
1718 if (pControl->GetElement(L"softKey1Text", elementString))
1720 pForm->SetSoftkeyText(SOFTKEY_1, elementString);
1722 if (pControl->GetElement(L"backgroundColorOpacity", elementString) || pControl->GetElement(L"BGColorOpacity", elementString))
1724 Base::Integer::Parse(elementString, opacity);
1726 if (pControl->GetElement(L"backgroundColor", elementString) || pControl->GetElement(L"BGColor", elementString))
1728 ConvertStringToColor32(elementString, opacity, color);
1729 pForm->SetBackgroundColor(color);
1734 r = GET_COLOR_CONFIG(FORM::BG_NORMAL,color);
1737 pForm->SetBackgroundColor(color);
1741 pForm->SetBackgroundColor(0xff000000);
1745 if (pControl->GetElement(L"softKey0Icon", elementString) || pControl->GetElement(L"softKey0NormalIcon", elementString))
1747 Bitmap* pNormalBitmap = null;
1748 Bitmap* pPressedBitmap = null;
1749 pNormalBitmap = LoadBitmapN(elementString); //__image->DecodeN(path,BITMAP_PIXEL_FORMAT_RGB565);
1751 if (pNormalBitmap != null)
1753 if (pControl->GetElement(L"softKey0PressedIcon", elementString))
1755 pPressedBitmap = LoadBitmapN(elementString);
1758 if (pPressedBitmap != null)
1760 pForm->SetSoftkeyIcon(SOFTKEY_0, *pNormalBitmap, pPressedBitmap);
1761 delete pNormalBitmap;
1762 delete pPressedBitmap;
1766 pForm->SetSoftkeyIcon(SOFTKEY_0, *pNormalBitmap, null);
1767 delete pNormalBitmap;
1771 if (pControl->GetElement(L"softKey1Icon", elementString) || pControl->GetElement(L"softKey1NormalIcon", elementString))
1773 Bitmap* pNormalBitmap = null;
1774 Bitmap* pPressedBitmap = null;
1775 pNormalBitmap = LoadBitmapN(elementString); //__image->DecodeN(path,BITMAP_PIXEL_FORMAT_RGB565);
1777 if (pNormalBitmap != null)
1779 if (pControl->GetElement(L"softKey1PressedIcon", elementString))
1781 pPressedBitmap = LoadBitmapN(elementString); // __image->DecodeN(path,BITMAP_PIXEL_FORMAT_RGB565);
1784 if (pPressedBitmap != null)
1786 pForm->SetSoftkeyIcon(SOFTKEY_1, *pNormalBitmap, pPressedBitmap);
1787 delete pNormalBitmap;
1788 delete pPressedBitmap;
1792 pForm->SetSoftkeyIcon(SOFTKEY_1, *pNormalBitmap, null);
1793 delete pNormalBitmap;
1798 if (pControl->GetElement(L"Orientation", elementString) || pControl->GetElement(L"orientation", elementString))
1801 //ORIENTATION_PORTRAIT,
1802 //ORIENTATION_LANDSACPE,
1803 //ORIENTATION_PORTRAIT_REVERSE,
1804 //ORIENTATION_LANDSACPE_REVERSE,
1805 //ORIENTATION_AUTO = 6,
1806 //ORIENTATION_AUTO_FOUR_DIRECTION = 8,
1808 if (elementString.Equals(L"Automatic:2Dir", false) || elementString.Equals(L"Automatic", false))
1810 pForm->SetOrientation(ORIENTATION_AUTOMATIC);
1812 else if (elementString.Equals(L"Automatic:4Dir", false))
1814 pForm->SetOrientation(ORIENTATION_AUTOMATIC_FOUR_DIRECTION);
1816 else if (elementString.Equals(L"Landscape", false))
1818 pForm->SetOrientation(ORIENTATION_LANDSCAPE);
1819 SetUiBuilderRotateState(UIBUIDER_SCREEN_HORIZONTAL);
1821 else if (elementString.Equals(L"Landscape:Reverse", false))
1823 pForm->SetOrientation(ORIENTATION_LANDSCAPE_REVERSE);
1824 SetUiBuilderRotateState(UIBUIDER_SCREEN_HORIZONTAL);
1826 else if (elementString.Equals(L"Portrait", false))
1828 pForm->SetOrientation(ORIENTATION_PORTRAIT);
1829 SetUiBuilderRotateState(UIBUIDER_SCREEN_VERTICAL);
1831 else if (elementString.Equals(L"Portrait:Reverse", false))
1833 pForm->SetOrientation(ORIENTATION_PORTRAIT_REVERSE);
1834 SetUiBuilderRotateState(UIBUIDER_SCREEN_VERTICAL);
1838 if (style & FORM_STYLE_HEADER)
1840 if (pControl->GetElement(L"translucentHeader", elementString))
1842 if (elementString.Equals(L"true", false))
1844 pForm->SetActionBarsTranslucent(FORM_ACTION_BAR_HEADER, true);
1849 if (style & FORM_STYLE_FOOTER)
1851 if (pControl->GetElement(L"translucentFooter", elementString))
1853 if (elementString.Equals(L"true", false))
1855 pForm->SetActionBarsTranslucent(FORM_ACTION_BAR_FOOTER, true);
1860 if (style & FORM_STYLE_INDICATOR)
1862 if (pControl->GetElement(L"translucentIndicator", elementString))
1864 if (elementString.Equals(L"true", false))
1866 pForm->SetActionBarsTranslucent(FORM_ACTION_BAR_INDICATOR, true);
1876 _FormRegister::_FormRegister()
1878 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
1879 pUiBuilderControlTableManager->RegisterControl(L"Form", _FormMaker::GetInstance);
1881 _FormRegister::~_FormRegister()
1883 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
1884 pUiBuilderControlTableManager->UnregisterControl(L"Form");
1886 static _FormRegister FormRegisterToUiBuilder;
1887 }}} // Tizen::Ui::Controls