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)
103 , __pFormMenuEventListener(null)
105 , __pImeOriAgent(null)
106 , __pLeftSoftkeyActionEvent(null)
107 , __pRightSoftkeyActionEvent(null)
108 , __pOptionMenuActionEvent(null)
112 int appType = _AppInfo::GetAppType();
113 if (appType & _APP_TYPE_IME_APP)
115 __pImeOriAgent = _ImeOrientationAgent::CreateInstanceN(*pPublic);
116 SysTryReturnVoidResult(NID_UI_CTRL, __pImeOriAgent != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
120 __pOriAgent = _OrientationAgent::CreateInstanceN(*pPublic);
121 SysTryReturnVoidResult(NID_UI_CTRL, __pOriAgent != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
125 _FormImpl::~_FormImpl(void)
129 delete __pImeOriAgent;
130 __pImeOriAgent = null;
139 if (__pLeftSoftkeyActionEvent)
141 delete __pLeftSoftkeyActionEvent;
142 __pLeftSoftkeyActionEvent = null;
145 if (__pRightSoftkeyActionEvent)
147 delete __pRightSoftkeyActionEvent;
148 __pRightSoftkeyActionEvent = null;
151 if (__pOptionMenuActionEvent)
153 delete __pOptionMenuActionEvent;
154 __pOptionMenuActionEvent = null;
157 __leftSoftkeyActionList.RemoveAll(false);
158 __rightSoftkeyActionList.RemoveAll(false);
170 _FormImpl::CreateFormImplN(Form* pControl, Layout* pPublicPortraitLayout, Layout* pPublicLandscapeLayout)
172 result r = E_SUCCESS;
173 _VisualElement* pVisualElement = null;
175 _Form* pCore = _Form::CreateFormN();
177 SysTryReturn(NID_UI_CTRL, pCore, null, r, "[%s] Propagating.", GetErrorMessage(r)); // [ToDo] interpret last result.
179 _FormImpl* pImpl = new (std::nothrow) _FormImpl(pControl, pCore, pPublicPortraitLayout, pPublicLandscapeLayout);
181 r = _ControlImpl::CheckConstruction(pCore, pImpl);
182 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
184 const FloatDimension portraitSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF();
185 const FloatDimension landscapeSize = FloatDimension(portraitSize.height, portraitSize.width);
187 _ControlOrientation orientation = pCore->GetOrientation();
189 if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
191 r = pImpl->InitializeBoundsPropertiesF(GET_SIZE_INFO(Form), portraitSize, orientation);
195 r = pImpl->InitializeBoundsPropertiesF(GET_SIZE_INFO(Form), landscapeSize, orientation);
197 SysAssert(r == E_SUCCESS);
199 pCore->SetFormOrientationStatusEventListener(pImpl);
201 // Make surface opaque.
202 pVisualElement = pCore->GetVisualElement();
203 SysTryCatch(NID_UI_CTRL, pVisualElement, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
204 r = pVisualElement->SetSurfaceOpaque(true);
205 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r)); // [ToDo] interpret last result.
207 SetLastResult(E_SUCCESS);
219 _FormImpl::GetPublicClassName(void) const
221 return "Tizen::Ui::Controls::Form";
225 _FormImpl::GetPublic(void) const
227 return static_cast<const Form&>(_ControlImpl::GetPublic());
231 _FormImpl::GetPublic(void)
233 return static_cast<Form&>(_ControlImpl::GetPublic());
237 _FormImpl::GetCore(void) const
239 return static_cast<const _Form&>(_ControlImpl::GetCore());
243 _FormImpl::GetCore(void)
245 return static_cast<_Form&>(_ControlImpl::GetCore());
249 _FormImpl::GetFocusControl(void)
255 _FormImpl::GetFormStyle(void) const
257 return GetCore().GetFormStyle();
261 _FormImpl::HasIndicator(void) const
263 return GetCore().HasIndicator();
267 _FormImpl::SetFormStyle(unsigned long formStyle)
269 result r = E_SUCCESS;
271 _HeaderImpl* pHeader = GetHeader();
272 _FooterImpl* pFooter = GetFooter();
273 _TabImpl* pTabImpl = GetTabImpl();
275 if (IsAttachedToMainTree())
277 if (FORM_STYLE_INDICATOR & formStyle)
279 _Frame* pFrame = dynamic_cast<_Frame*>(GetCore().GetParent());
280 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.");
284 if ((formStyle & FORM_STYLE_INDICATOR) && (formStyle & FORM_STYLE_INDICATOR_AUTO_HIDE))
286 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.");
291 if (((formStyle & FORM_STYLE_TITLE) || (formStyle & FORM_STYLE_TEXT_TAB) || (formStyle & FORM_STYLE_ICON_TAB)) && (formStyle & FORM_STYLE_HEADER))
293 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.");
300 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
306 if (((formStyle & FORM_STYLE_SOFTKEY_0) || (formStyle & FORM_STYLE_SOFTKEY_1) || (formStyle & FORM_STYLE_OPTIONKEY)) && (formStyle & FORM_STYLE_FOOTER))
308 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.");
315 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
320 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
321 SysTryReturnVoidResult(NID_UI_CTRL, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] Unable to get evas.");
323 GetCore().SetFormStyle(formStyle);
325 FloatRectangle indicatorBounds(0.0f, 0.0f, 0.0f, 0.0f);
327 if (FORM_STYLE_INDICATOR & formStyle)
329 GetCore().SetIndicatorShowState(true);
330 indicatorBounds = GetCore().GetIndicatorBoundsF();
332 if (FORM_STYLE_LANDSCAPE_INDICATOR_AUTO_HIDE & formStyle)
334 GetCore().SetIndicatorAutoHide(false, true);
338 GetCore().SetIndicatorAutoHide(false, false);
341 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
346 if ((FORM_STYLE_INDICATOR_AUTO_HIDE & formStyle) && (FORM_STYLE_LANDSCAPE_INDICATOR_AUTO_HIDE & formStyle))
348 r = GetCore().SetIndicatorShowState(true);
349 GetCore().SetIndicatorAutoHide(true, true);
350 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
354 if (FORM_STYLE_INDICATOR_AUTO_HIDE & formStyle)
356 r = GetCore().SetIndicatorShowState(true);
357 GetCore().SetIndicatorAutoHide(true, false);
358 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
360 else if(FORM_STYLE_LANDSCAPE_INDICATOR_AUTO_HIDE & formStyle)
362 r = GetCore().SetIndicatorShowState(true);
363 GetCore().SetIndicatorAutoHide(false, true);
364 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
368 r = GetCore().SetIndicatorShowState(false);
369 GetCore().SetIndicatorAutoHide(false, false);
370 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
375 if (formStyle & FORM_STYLE_HEADER)
379 pHeader = CreateHeaderN();
380 SysTryReturnVoidResult(NID_UI_CTRL, pHeader != null, r, "[%s] Propagating.", GetErrorMessage(r));
382 GetCore().SetHeader(&pHeader->GetCore());
383 GetCore().AdjustClientBounds();
385 if (GetCore().IsIndicatorTranslucent())
387 if (!GetCore().IsHeaderTranslucent())
389 indicatorBounds.height = 0.0f;
393 if (GetOrientation() == _CONTROL_ORIENTATION_LANDSCAPE)
395 indicatorBounds.height = 0.0f;
400 FloatRectangle bounds(0.0f, indicatorBounds.height, GetClientBoundsF().width, GetCore().GetToolbarHeightF(true));
401 GetCore().SetHeaderBounds(bounds);
403 r = GetCore().AttachSystemChild(pHeader->GetCore());
404 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
406 GetCore().SetFormBackEventListener(this);
409 else if (formStyle & FORM_STYLE_TITLE)
413 pHeader = CreateHeaderN();
414 SysTryReturnVoidResult(NID_UI_CTRL, pHeader != null, r, "[%s] Propagating.", GetErrorMessage(r));
416 GetCore().SetHeader(&pHeader->GetCore());
417 GetCore().AdjustClientBounds();
419 FloatRectangle bounds(0.0f, indicatorBounds.height, GetClientBoundsF().width, GetCore().GetToolbarHeightF(true));
420 GetCore().SetHeaderBounds(bounds);
422 r = GetCore().AttachSystemChild(pHeader->GetCore());
423 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
433 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
437 if (formStyle & FORM_STYLE_TEXT_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_TEXT);
467 else if (formStyle & FORM_STYLE_ICON_TAB)
469 float titleHeight = 0.0f;
471 if (formStyle & FORM_STYLE_TITLE)
475 titleHeight = pHeader->GetBoundsF().height;
481 pTabImpl = CreateTabImplN();
482 SysTryReturnVoidResult(NID_UI_CTRL, pTabImpl != null, r, "[%s] Propagating.", GetErrorMessage(r));
484 float posY = indicatorBounds.height + titleHeight;
486 GetCore().SetTab(&pTabImpl->GetCore());
487 GetCore().AdjustClientBounds();
489 FloatRectangle bounds(0.0f, posY, GetClientBoundsF().width, GetCore().GetTabHeightF());
490 GetCore().SetTabBounds(bounds);
492 r = GetCore().AttachSystemChild(pTabImpl->GetCore());
493 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
495 GetCore().SetTabStyle(_TAB_STYLE_ICON);
503 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
507 if (formStyle & FORM_STYLE_FOOTER)
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, 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().SetFormBackEventListener(this);
526 GetCore().SetFormMenuEventListener(this);
529 else if (formStyle & FORM_STYLE_SOFTKEY_0 || formStyle & FORM_STYLE_SOFTKEY_1 || formStyle & FORM_STYLE_OPTIONKEY)
535 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
538 pFooter = GetFooter();
542 pFooter = CreateFooterN();
543 SysTryReturnVoidResult(NID_UI_CTRL, pFooter != null, r, "[%s] Propagating.", GetErrorMessage(r));
545 GetCore().SetFooter(&pFooter->GetCore());
546 GetCore().AdjustClientBounds();
548 FloatRectangle clientbounds = GetClientBoundsF();
549 FloatRectangle bounds(0.0f, clientbounds.y + clientbounds.height - GetCore().GetToolbarHeightF(false), clientbounds.width, GetCore().GetToolbarHeightF(false));
551 GetCore().SetFooterBounds(bounds);
553 r = GetCore().AttachSystemChild(pFooter->GetCore());
554 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
556 GetCore().CreateSoftkey(formStyle);
558 pFooter->GetCore().AddActionEventListener(*this);
568 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
569 GetCore().AdjustClientBounds();
573 GetCore().AdjustClientBounds();
575 SetLastResult(E_SUCCESS);
581 _FormImpl::GetFooter(void) const
583 _Toolbar* pToolbar = __pForm->GetFooter();
584 if (pToolbar == null)
589 _FooterImpl* pFooterImpl = static_cast<_FooterImpl*>(pToolbar->GetUserData());
595 _FormImpl::GetHeader(void) const
597 _Toolbar* pToolbar = __pForm->GetHeader();
598 if (pToolbar == null)
603 _HeaderImpl* pHeaderImpl = static_cast<_HeaderImpl*>(pToolbar->GetUserData());
610 _FormImpl::GetTabImpl(void) const
612 _Tab* pTab = __pForm->GetTab();
618 _TabImpl* pTabImpl = static_cast<_TabImpl*>(pTab->GetUserData());
624 _FormImpl::GetTitleText(void) const
626 return GetCore().GetTitleText();
630 _FormImpl::GetTitleTextHorizontalAlignment(void) const
632 return GetCore().GetTitleTextHorizontalAlignment();
636 _FormImpl::HasFooter(void) const
638 return GetCore().HasFooter();
642 _FormImpl::HasHeader(void) const
644 return GetCore().HasHeader();
648 _FormImpl::HasTitle(void) const
650 return GetCore().HasTitle();
654 _FormImpl::HasTab(void) const
656 return GetCore().HasTab();
660 _FormImpl::IsIndicatorVisible(void) const
662 return GetCore().IsIndicatorVisible();
666 _FormImpl::IsHeaderVisible(void) const
668 return GetCore().IsHeaderVisible();
672 _FormImpl::IsFooterVisible(void) const
674 return GetCore().IsFooterVisible();
678 _FormImpl::IsIndicatorTranslucent(void) const
680 return GetCore().IsIndicatorTranslucent();
684 _FormImpl::IsHeaderTranslucent(void) const
686 return GetCore().IsHeaderTranslucent();
690 _FormImpl::IsFooterTranslucent(void) const
692 return GetCore().IsFooterTranslucent();
697 _FormImpl::IsTabTranslucent(void) const
699 return GetCore().IsTabTranslucent();
703 _FormImpl::SetActionBarsTranslucent(unsigned long actionBars, bool translucent)
705 return GetCore().SetActionBarsTranslucent(actionBars, translucent);
709 _FormImpl::SetActionBarsVisible(unsigned long actionBars, bool visible)
711 return GetCore().SetActionBarsVisible(actionBars, visible);
715 _FormImpl::SetTitleIcon(const Bitmap* pTitleBitmap)
717 return GetCore().SetTitleIcon(pTitleBitmap);
721 _FormImpl::SetTitleText(const String& title, HorizontalAlignment alignment)
723 return GetCore().SetTitleText(title, alignment);
727 _FormImpl::GetOverlayRegionN(const Rectangle& rect, OverlayRegionType regionType)
729 return GetCore().GetOverlayRegionN(rect, regionType);
733 _FormImpl::GetOverlayRegionN(const FloatRectangle& rect, OverlayRegionType regionType)
735 return GetCore().GetOverlayRegionN(rect, regionType);
739 _FormImpl::OnDraw(void)
743 __pOriAgent->FireOrientationEvent();
746 _ContainerImpl::OnDraw();
750 _FormImpl::OnKeyReleased(const _ControlImpl& source, _KeyCode keyCode)
755 if (GetCore().GetFooter() || GetCore().GetHeader())
757 if (__pFormBackEventListener)
759 Form* pForm = dynamic_cast <Form*>(&GetPublic());
762 __pFormBackEventListener->OnFormBackRequested(*pForm);
784 _FormImpl::OnActionPerformed(const _Control& source, int actionId)
786 if (GetFormStyle() & FORM_STYLE_SOFTKEY_0 || GetFormStyle() & FORM_STYLE_SOFTKEY_1 || GetFormStyle() & FORM_STYLE_OPTIONKEY)
788 Tizen::Base::Runtime::IEventArg* tempArg = null;
789 tempArg = _PublicActionEvent::CreateActionEventArgN(actionId);
790 SysTryReturnVoidResult(NID_UI_CTRL, tempArg , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Unable to create Eventarg.");
793 _PublicActionEvent* pSoftkeyActionEvent = null;
795 if (GetCore().GetFooter()->IsButtonSet(LEFT_BUTTON) && GetSoftkeyActionId(SOFTKEY_0) == actionId)
797 for (int i = 0; i < __leftSoftkeyActionList.GetCount(); i++)
799 pSoftkeyActionEvent = dynamic_cast<_PublicActionEvent*>(__leftSoftkeyActionList.GetAt(i));
801 if (pSoftkeyActionEvent)
803 pSoftkeyActionEvent->Fire(*tempArg);
809 if (GetCore().GetFooter()->IsButtonSet(RIGHT_BUTTON) && GetSoftkeyActionId(SOFTKEY_1) == actionId)
811 for (int i = 0; i < __rightSoftkeyActionList.GetCount(); i++)
813 pSoftkeyActionEvent = dynamic_cast<_PublicActionEvent*>(__rightSoftkeyActionList.GetAt(i));
815 if (pSoftkeyActionEvent)
817 pSoftkeyActionEvent->Fire(*tempArg);
823 if (GetCore().GetFooter()->IsButtonSet(MIDDLE_BUTTON) && GetOptionkeyActionId() == actionId)
825 if (__pOptionMenuActionEvent)
827 __pOptionMenuActionEvent->Fire(*tempArg);
839 _FormImpl::GetClientAreaCanvasN(void) const
841 return GetCore().GetClientAreaCanvasN();
845 _FormImpl::TranslateToClientAreaPosition(const Point& position) const
847 return GetCore().TranslateToClientAreaPosition(position);
851 _FormImpl::TranslateToClientAreaPosition(const FloatPoint& position) const
853 return GetCore().TranslateToClientAreaPosition(position);
857 _FormImpl::TranslateFromClientAreaPosition(const Point& clientPosition) const
859 return GetCore().TranslateFromClientAreaPosition(clientPosition);
863 _FormImpl::TranslateFromClientAreaPosition(const FloatPoint& clientPosition) const
865 return GetCore().TranslateFromClientAreaPosition(clientPosition);
869 _FormImpl::SetFormBackEventListener(const IFormBackEventListener* pFormBackEventListener)
871 bool isBackButton = false;
873 Tizen::System::SystemInfo::GetValue(L"http://tizen.org/feature/input.keys.back", isBackButton);
877 SysTryReturnVoidResult(NID_UI_CTRL, GetFooter() || GetHeader(), E_INVALID_STATE, "[E_INVALID_STATE] Footer isn't constructed.");
880 __pFormBackEventListener = const_cast <IFormBackEventListener*>(pFormBackEventListener);
881 GetCore().SetFormBackEventListener(this);
882 result r = GetLastResult();
883 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
887 _FormImpl::SetFormMenuEventListener(const IFormMenuEventListener* pFormMenuEventListener)
889 bool isMenuButton = false;
891 Tizen::System::SystemInfo::GetValue(L"http://tizen.org/feature/input.keys.menu", isMenuButton);
895 SysTryReturnVoidResult(NID_UI_CTRL, GetFooter() || GetHeader(), E_INVALID_STATE, "[E_INVALID_STATE] Footer isn't constructed.");
897 __pFormMenuEventListener = const_cast <IFormMenuEventListener*>(pFormMenuEventListener);
898 GetCore().SetFormMenuEventListener(this);
899 result r = GetLastResult();
900 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
904 _FormImpl::AddOrientationEventListener(IOrientationEventListener& listener)
908 __pOriAgent->AddListener(listener);
910 else if (__pImeOriAgent)
912 __pImeOriAgent->AddListener(listener);
917 _FormImpl::AddOptionkeyActionListener(const IActionEventListener& listener)
919 if (HasOptionkey() == false)
924 __pOptionMenuActionEvent = _PublicActionEvent::CreateInstanceN(GetPublic());
926 SysTryReturnVoidResult(NID_UI_CTRL, __pOptionMenuActionEvent != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
928 __pOptionMenuActionEvent->AddListener(listener);
932 _FormImpl::AddSoftkeyActionListener(Softkey softkey, const IActionEventListener& listener)
934 _Softkey _softkey = ConvertSoftkey(softkey);
936 if (GetCore().CheckSoftkey(_softkey) == false)
941 if (softkey == SOFTKEY_0)
943 __pLeftSoftkeyActionEvent = _PublicActionEvent::CreateInstanceN(GetPublic());
945 SysTryReturnVoidResult(NID_UI_CTRL, __pLeftSoftkeyActionEvent != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
947 __pLeftSoftkeyActionEvent->AddListener(listener);
949 __leftSoftkeyActionList.Add(*__pLeftSoftkeyActionEvent);
951 else if (softkey == SOFTKEY_1)
953 __pRightSoftkeyActionEvent = _PublicActionEvent::CreateInstanceN(GetPublic());
955 SysTryReturnVoidResult(NID_UI_CTRL, __pRightSoftkeyActionEvent != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
957 __pRightSoftkeyActionEvent->AddListener(listener);
959 __rightSoftkeyActionList.Add(*__pRightSoftkeyActionEvent);
964 _FormImpl::RemoveOrientationEventListener(IOrientationEventListener& listener)
968 __pOriAgent->RemoveListener(listener);
970 else if (__pImeOriAgent)
972 __pImeOriAgent->RemoveListener(listener);
977 _FormImpl::RemoveOptionkeyActionListener(const IActionEventListener& listener)
979 if (HasOptionkey() == false)
984 if (__pOptionMenuActionEvent)
986 __pOptionMenuActionEvent->RemoveListener(listener);
991 _FormImpl::RemoveSoftkeyActionListener(Softkey softkey, const IActionEventListener& listener)
993 _Softkey _softkey = ConvertSoftkey(softkey);
995 if (GetCore().CheckSoftkey(_softkey) == false)
1000 if (softkey == SOFTKEY_0)
1002 if (__pLeftSoftkeyActionEvent)
1004 __pLeftSoftkeyActionEvent->RemoveListener(listener);
1007 else if (softkey == SOFTKEY_1)
1009 if (__pRightSoftkeyActionEvent)
1011 __pRightSoftkeyActionEvent->RemoveListener(listener);
1017 _FormImpl::SetOrientation(Orientation orientation)
1021 __pOriAgent->SetMode(orientation);
1026 _FormImpl::GetOrientation(void) const
1030 return __pOriAgent->GetMode();
1033 return ORIENTATION_NONE;
1037 _FormImpl::GetOrientationStatus(void) const
1041 return __pOriAgent->GetStatus();
1043 else if (__pImeOriAgent)
1045 return __pImeOriAgent->GetStatus();
1048 return ORIENTATION_STATUS_NONE;
1052 _FormImpl::UpdateOrientationStatus(bool draw)
1056 __pOriAgent->Update(draw);
1061 _FormImpl::UpdateOrientation(void)
1065 __pOriAgent->UpdateOrientation();
1070 _FormImpl::UpdateOrientation(int angle)
1072 SysLog(NID_UI_CTRL, "[Ime Rotation]");
1076 __pImeOriAgent->UpdateOrientation(angle);
1081 _FormImpl::HasOptionkey(void) const
1083 return GetCore().HasOptionkey();
1087 _FormImpl::HasSoftkey(Softkey softkey) const
1089 _Softkey _softkey = ConvertSoftkey(softkey);
1091 return GetCore().HasSoftkey(_softkey);
1095 _FormImpl::SetSoftkeyEnabled(Softkey softkey, bool enable)
1097 _Softkey _softkey = ConvertSoftkey(softkey);
1099 result r = GetCore().SetSoftkeyEnabled(_softkey, enable);
1100 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
1106 _FormImpl::IsSoftkeyEnabled(Softkey softkey) const
1108 _Softkey _softkey = ConvertSoftkey(softkey);
1110 return GetCore().IsSoftkeyEnabled(_softkey);
1114 _FormImpl::GetSoftkeyActionId(Softkey softkey) const
1116 _Softkey _softkey = ConvertSoftkey(softkey);
1118 return GetCore().GetSoftkeyActionId(_softkey);
1122 _FormImpl::GetOptionkeyActionId(void) const
1124 return GetCore().GetOptionkeyActionId();
1128 _FormImpl::GetSoftkeyText(Softkey softkey) const
1130 _Softkey _softkey = ConvertSoftkey(softkey);
1132 return GetCore().GetSoftkeyText(_softkey);
1136 _FormImpl::SetOptionkeyActionId(int actionId)
1138 result r = GetCore().SetOptionkeyActionId(actionId);
1139 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
1145 _FormImpl::SetSoftkeyActionId(Softkey softkey, int actionId)
1147 _Softkey _softkey = ConvertSoftkey(softkey);
1149 result r = GetCore().SetSoftkeyActionId(_softkey, actionId);
1150 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
1156 _FormImpl::SetSoftkeyText(Softkey softkey, const String& text)
1158 _Softkey _softkey = ConvertSoftkey(softkey);
1160 result r = GetCore().SetSoftkeyText(_softkey, text);
1161 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
1167 _FormImpl::SetSoftkeyIcon(Softkey softkey, const Bitmap& pNormalBitmap, const Bitmap* ppPressedBitmap)
1169 _Softkey _softkey = ConvertSoftkey(softkey);
1171 result r = GetCore().SetSoftkeyIcon(_softkey, pNormalBitmap, ppPressedBitmap);
1172 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
1178 _FormImpl::OnChangeLayout(_ControlOrientation orientation)
1180 FloatDimension portraitSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF();
1181 FloatDimension landscapeSize = FloatDimension(portraitSize.height, portraitSize.width);
1183 _FrameImpl* pFrameImpl = dynamic_cast<_FrameImpl*>(GetParent());
1186 FrameShowMode frameShowMode = pFrameImpl->GetShowMode();
1188 if ((frameShowMode == FRAME_SHOW_MODE_PARTIAL_SCREEN) || (frameShowMode == FRAME_SHOW_MODE_PARTIAL_SCREEN_FLOATING))
1190 bool movable = pFrameImpl->GetCore().IsMovable();
1191 pFrameImpl->GetCore().SetMovable(true);
1193 FloatPoint prevPoint = pFrameImpl->GetPositionF();
1194 FloatPoint curPoint(prevPoint.x, prevPoint.y);
1195 float ratio = portraitSize.width / portraitSize.height;
1196 if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
1198 if (prevPoint.x > 0.0f)
1200 curPoint.x = prevPoint.x * ratio;
1203 if (prevPoint.y > 0.0f)
1205 curPoint.y = prevPoint.y / ratio;
1210 if (prevPoint.x > 0.0f)
1212 curPoint.x = prevPoint.x / ratio;
1215 if (prevPoint.y > 0.0f)
1217 curPoint.y = prevPoint.y * ratio;
1221 pFrameImpl->SetPosition(curPoint);
1222 portraitSize = pFrameImpl->GetSizeF();
1223 landscapeSize = portraitSize;
1224 pFrameImpl->GetCore().SetMovable(movable);
1229 _ContainerImpl::OnChangeLayout(orientation);
1230 SysTryReturnVoidResult(NID_UI_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1232 if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
1234 SetSize(portraitSize);
1238 SetSize(landscapeSize);
1241 float indicatorheight = 0.0f;
1243 GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, GetCore().GetOrientation(), indicatorheight);
1244 _Indicator* pIndicator = GetCore().GetIndicator();
1245 if (GetCore().HasIndicator())
1249 if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
1251 pIndicator->SetBounds(FloatRectangle(0.0f, 0.0f, GetClientBoundsF().width, indicatorheight));
1252 if ((FORM_STYLE_INDICATOR & GetFormStyle()) || (FORM_STYLE_INDICATOR_AUTO_HIDE & GetFormStyle()))
1254 GetCore().SetIndicatorShowState(true);
1258 GetCore().SetIndicatorShowState(false);
1263 if (FORM_STYLE_LANDSCAPE_INDICATOR_AUTO_HIDE & GetFormStyle())
1265 GetCore().SetIndicatorShowState(true);
1269 GetCore().AdjustClientBounds();
1273 GetCore().SetIndicatorShowState(false);
1277 pIndicator->OnChangeLayout(orientation);
1281 float adjHeight = 0.0f;
1283 if (GetCore().HasHeader())
1285 FloatRectangle indicatorBounds(0.0f, 0.0f, 0.0f, 0.0f);
1286 if (GetCore().IsIndicatorVisible())
1288 indicatorBounds = GetCore().GetIndicatorBoundsF();
1289 if (GetCore().IsIndicatorTranslucent())
1291 if (!GetCore().IsHeaderTranslucent())
1293 indicatorBounds.height = 0.0f;
1297 if (orientation == _CONTROL_ORIENTATION_LANDSCAPE)
1299 indicatorBounds.height = 0.0f;
1305 FloatRectangle bounds(0.0f, indicatorBounds.height, GetClientBoundsF().width, GetCore().GetToolbarHeightF(true));
1306 GetCore().SetHeaderBounds(bounds);
1309 if (GetCore().HasTab()) // Ki-Dong,Hong.Temp
1311 float titleHeight = 0.0f;
1313 if (GetCore().GetFormStyle() & FORM_STYLE_TITLE)
1315 if (GetCore().HasHeader())
1317 _HeaderImpl* pHeaderImpl = GetHeader();
1320 titleHeight = pHeaderImpl->GetBoundsF().height;
1325 FloatRectangle indicatorBounds(0.0f, 0.0f, 0.0f, 0.0f);
1327 if (GetCore().IsIndicatorVisible())
1329 indicatorBounds = GetCore().GetIndicatorBoundsF();
1330 if (GetCore().IsIndicatorTranslucent())
1332 if (!GetCore().IsHeaderTranslucent())
1334 indicatorBounds.height = 0.0f;
1338 if (orientation == _CONTROL_ORIENTATION_LANDSCAPE)
1340 indicatorBounds.height = 0.0f;
1346 float posY = indicatorBounds.height + titleHeight;
1348 FloatRectangle bounds(0.0f, posY, GetClientBoundsF().width, GetCore().GetTabHeightF());
1349 GetCore().SetTabBounds(bounds);
1352 if (GetCore().HasFooter())
1354 if (GetCore().GetFooter()->GetVisibleState() && !GetCore().IsFooterTranslucent())
1360 adjHeight = GetCore().GetToolbarHeightF(false);
1363 if (!(GetCore().GetFormStyle() & FORM_STYLE_FOOTER || GetCore().GetFormStyle() & FORM_STYLE_SOFTKEY_0 || GetCore().GetFormStyle() & FORM_STYLE_SOFTKEY_1
1364 || GetCore().GetFormStyle() & FORM_STYLE_OPTIONKEY))
1366 adjHeight = GetCore().GetToolbarHeightF(false);
1369 FloatRectangle bounds(0.0f, GetClientBoundsF().y + GetClientBoundsF().height - adjHeight,
1370 GetClientBoundsF().width, GetCore().GetToolbarHeightF(false));
1371 GetCore().SetFooterBounds(bounds);
1376 _FormImpl::CreateHeaderN(void)
1378 result r = E_SUCCESS;
1380 Header* pHeader = new (std::nothrow) Header;
1381 SysTryReturn(NID_UI_CTRL, pHeader, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
1383 r = pHeader->Construct();
1384 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1386 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*pHeader);
1388 SetLastResult(E_SUCCESS);
1394 _FormImpl::CreateFooterN(void)
1396 result r = E_SUCCESS;
1398 Footer* pFooter = new (std::nothrow) Footer;
1399 SysTryReturn(NID_UI_CTRL, pFooter, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
1401 r = pFooter->Construct();
1402 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1404 _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*pFooter);
1406 SetLastResult(E_SUCCESS);
1411 // Ki-Dong,Hong.Temp
1413 _FormImpl::CreateTabImplN(void)
1415 //result r = E_SUCCESS;
1417 //Tab* pTab = new (std::nothrow) Tab;
1418 //SysTryReturn(NID_UI_CTRL, pTab, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
1420 //r = pTab->Construct();
1421 //SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] Unable to consturct tab.");
1423 //return pTab->GetTabImpl();
1424 Tab* pTab = _TabImpl::CreateTabN();
1425 SysTryReturn(NID_UI_CTRL, pTab, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1427 _TabImpl* pTabImpl = _TabImpl::GetInstance(*pTab);
1429 SetLastResult(E_SUCCESS);
1435 _FormImpl::DeflateClientRectHeight(int height)
1437 return GetCore().DeflateClientRectHeight(height);
1441 _FormImpl::DeflateClientRectHeight(float height)
1443 return GetCore().DeflateClientRectHeight(height);
1447 _FormImpl::RemoveHeader(void)
1449 _HeaderImpl* pHeaderImpl = GetHeader();
1453 __pForm->RemoveHeader();
1454 result r = GetLastResult();
1455 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1456 Header* pHeader = pHeaderImpl->GetHeader();
1467 _FormImpl::RemoveFooter(void)
1469 _FooterImpl* pFooterImpl = GetFooter();
1473 __pForm->RemoveFooter();
1474 result r = GetLastResult();
1475 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1476 Footer* pFooter = pFooterImpl->GetFooter();
1488 // Ki-Dong,Hong.Temp
1490 _FormImpl::RemoveTabImpl(void)
1492 _TabImpl* pTabImpl = GetTabImpl();
1496 __pForm->RemoveTab();
1497 result r = GetLastResult();
1498 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1499 Tab* pTab = pTabImpl->GetTab();
1501 pTabImpl->DeleteTab(pTab);
1512 _FormImpl::GetDataBindingContextN(void) const
1514 return _DataBindingContextImpl::GetDataBindingContextN(*this);
1518 _FormImpl::OnAttaching(const _Control* pParent)
1520 result r = E_SUCCESS;
1521 _Frame* pFrame = dynamic_cast<_Frame*>(const_cast<_Control*>((pParent)));
1522 if (FORM_STYLE_INDICATOR & GetCore().GetFormStyle())
1524 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.");
1526 r = _ControlImpl::OnAttaching(pParent);
1531 _FormImpl::OnAttachedToMainTree(void)
1533 result r = E_SUCCESS;
1536 r = GetCore().AttachedToMainTree();
1537 r = _ContainerImpl::OnAttachedToMainTree();
1539 FloatRectangle indicatorBounds(0.0f, 0.0f, 0.0f, 0.0f);
1541 if (FORM_STYLE_INDICATOR & GetCore().GetFormStyle())
1543 indicatorBounds = GetCore().GetIndicatorBoundsF();
1544 r = GetLastResult();
1545 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1548 _HeaderImpl* pHeader = GetHeader();
1549 _FooterImpl* pFooter = GetFooter();
1550 _TabImpl* pTabImpl = GetTabImpl();
1554 if (GetCore().IsIndicatorTranslucent())
1556 if (!GetCore().IsHeaderTranslucent())
1558 indicatorBounds.height = 0.0f;
1562 if (GetCore().GetOrientation() == _CONTROL_ORIENTATION_LANDSCAPE)
1564 indicatorBounds.height = 0.0f;
1568 FloatRectangle bounds(0.0f, indicatorBounds.height, GetClientBoundsF().width, GetCore().GetToolbarHeightF(true));
1569 GetCore().SetHeaderBounds(bounds);
1572 float titleHeight = 0.0f;
1576 titleHeight = pHeader->GetBoundsF().height;
1581 float posY = indicatorBounds.height + titleHeight;
1583 FloatRectangle bounds(0.0f, posY, GetClientBoundsF().width, GetCore().GetTabHeightF());
1584 GetCore().SetTabBounds(bounds);
1589 float adjHeight = 0.0f;
1591 if (!(GetCore().GetFooter()->GetVisibleState()) || GetCore().IsFooterTranslucent())
1593 adjHeight = GetCore().GetToolbarHeightF(false);
1596 if (!(GetCore().GetFormStyle() & FORM_STYLE_FOOTER || GetCore().GetFormStyle() & FORM_STYLE_SOFTKEY_0 || GetCore().GetFormStyle() & FORM_STYLE_SOFTKEY_1
1597 || GetCore().GetFormStyle() & FORM_STYLE_OPTIONKEY))
1599 adjHeight = GetCore().GetToolbarHeightF(false);
1602 FloatRectangle clientbounds = GetClientBoundsF();
1603 FloatRectangle bounds(0.0f, clientbounds.y + clientbounds.height - adjHeight, clientbounds.width, GetCore().GetToolbarHeightF(false));
1605 GetCore().SetFooterBounds(bounds);
1608 UpdateOrientationStatus();
1612 __pOriAgent->RequestOrientationEvent();
1619 _FormImpl::OnDetachingFromMainTree(void)
1621 result r = E_SUCCESS;
1622 r = GetCore().DetachingFromMainTree();
1623 r = _ContainerImpl::OnDetachingFromMainTree();
1629 _FormImpl::OnNotifiedN(const _ControlImpl& source, IList* pArgs)
1631 String* pString = dynamic_cast <Tizen::Base::String*>(pArgs->GetAt(0));
1634 if (*pString == _REQUEST_ORIENTATION_EVENT)
1638 __pOriAgent->FireOrientationEvent();
1641 pArgs->RemoveAll(true);
1652 _FormImpl::OnFormBackRequested(Tizen::Ui::Controls::_Form& source)
1654 if (__pFormBackEventListener)
1656 _FormImpl* pFormImpl = static_cast<_FormImpl*>(source.GetUserData());
1657 Form* pForm = dynamic_cast <Form*>(&pFormImpl->GetPublic());
1660 __pFormBackEventListener->OnFormBackRequested(*pForm);
1670 _FormImpl::OnFormMenuRequested(Tizen::Ui::Controls::_Form& source)
1672 if (__pFormMenuEventListener)
1674 _FormImpl* pFormImpl = static_cast<_FormImpl*>(source.GetUserData());
1675 Form* pForm = dynamic_cast <Form*>(&pFormImpl->GetPublic());
1678 __pFormMenuEventListener->OnFormMenuRequested(*pForm);
1688 _FormImpl::OnFormOrientationStatusRequested(void)
1690 _ControlImplManager* pImplManager = _ControlImplManager::GetInstance();
1691 SysAssert(pImplManager);
1693 OrientationStatus status = ORIENTATION_STATUS_PORTRAIT;
1694 int appType = _AppInfo::GetAppType();
1695 if (!(appType & _APP_TYPE_IME_APP))
1697 status = pImplManager->GetOrientationStatus(GetOrientation());
1703 _FormImpl::IsOpaque(void) const
1710 _FormImpl::ConvertSoftkey(Softkey softkey) const
1714 if (softkey == SOFTKEY_0)
1716 _softkey = _SOFTKEY_0;
1718 else if (softkey == SOFTKEY_1)
1720 _softkey = _SOFTKEY_1;
1724 _softkey = _SOFTKEY_COUNT;
1731 _FormImpl::SetNotificationTrayOpenEnabled(bool enable)
1733 return GetCore().SetNotificationTrayOpenEnabled(enable);
1737 _FormImpl::IsNotificationTrayOpenEnabled(void) const
1739 return GetCore().IsNotificationTrayOpenEnabled();
1743 : public _UiBuilderControlMaker
1746 _FormMaker(_UiBuilder* uibuilder)
1747 : _UiBuilderControlMaker(uibuilder){};
1748 virtual ~_FormMaker()
1751 static _UiBuilderControlMaker* GetInstance(_UiBuilder* uibuilder)
1753 _FormMaker* pFormMaker = new (std::nothrow) _FormMaker(uibuilder);
1757 virtual Control* Make(_UiBuilderControl* pControl)
1759 _UiBuilderControlLayout* pControlProperty = null;
1760 result r = E_SUCCESS;
1763 Tizen::Base::String elementString;
1764 bool isTitleAlign = false;
1767 HorizontalAlignment align = ALIGNMENT_CENTER;
1768 Form* pForm = (Form*) GetContainer();
1770 // Get control manager
1771 _ControlManager* pControlManager = _ControlManager::GetInstance();
1772 if (pControlManager == null)
1774 SysLog(NID_UI_CTRL, "Unable to get the control manager.n");
1777 FloatDimension screenSize = pControlManager->GetScreenSizeF();
1780 (pControl->GetAttribute(UIBUILDER_ATTRIBUTE_PORTRAIT))->SetRect(0.0f, 0.0f, screenSize.width, screenSize.height);
1781 (pControl->GetAttribute(UIBUILDER_ATTRIBUTE_LANDSCAPE))->SetRect(0.0f, 0.0f, screenSize.height, screenSize.width);
1783 // Get device orientation
1784 app_device_orientation_e deviceOrientation = app_get_device_orientation();
1785 bool isHorizontal = (deviceOrientation == APP_DEVICE_ORIENTATION_90) || (deviceOrientation == APP_DEVICE_ORIENTATION_270);
1789 pControlProperty = pControl->GetAttribute(UIBUILDER_ATTRIBUTE_LANDSCAPE);
1793 pControlProperty = pControl->GetAttribute(UIBUILDER_ATTRIBUTE_PORTRAIT);
1796 if (pControlProperty == null)
1798 SysLogException(NID_UI_CTRL, E_SYSTEM, "[E_SYSTEM] Can't read attributes");
1802 pControlProperty = pControl->GetAttribute(UIBUILDER_ATTRIBUTE_PORTRAIT);
1803 Tizen::Base::String styleString;
1804 styleString = pControlProperty->GetStyle();
1806 if (styleString.Contains(L"FORM_STYLE_TITLE"))
1808 style |= FORM_STYLE_TITLE;
1810 if (styleString.Contains(L"FORM_STYLE_SOFTKEY_0"))
1812 style |= FORM_STYLE_SOFTKEY_0;
1814 if (styleString.Contains(L"FORM_STYLE_SOFTKEY_1"))
1816 style |= FORM_STYLE_SOFTKEY_1;
1818 if (styleString.Contains(L"FORM_STYLE_OPTIONKEY"))
1820 style |= FORM_STYLE_OPTIONKEY;
1822 if (styleString.Contains(L"FORM_STYLE_INDICATOR"))
1824 if (styleString.Contains(L"FORM_STYLE_INDICATOR_AUTO_HIDE"))
1826 style |= FORM_STYLE_INDICATOR_AUTO_HIDE;
1830 style |= FORM_STYLE_INDICATOR;
1833 if (styleString.Contains(L"FORM_STYLE_PORTRAIT_INDICATOR"))
1835 if (styleString.Contains(L"FORM_STYLE_PORTRAIT_INDICATOR_AUTO_HIDE"))
1837 style |= FORM_STYLE_PORTRAIT_INDICATOR_AUTO_HIDE;
1841 style |= FORM_STYLE_PORTRAIT_INDICATOR;
1844 if (styleString.Contains(L"FORM_STYLE_LANDSCAPE_INDICATOR_AUTO_HIDE"))
1846 style |= FORM_STYLE_LANDSCAPE_INDICATOR_AUTO_HIDE;
1848 if (styleString.Contains(L"FORM_STYLE_TEXT_TAB"))
1850 style |= FORM_STYLE_TEXT_TAB;
1852 if (styleString.Contains(L"FORM_STYLE_ICON_TAB"))
1854 style |= FORM_STYLE_ICON_TAB;
1856 if (styleString.Contains(L"FORM_STYLE_HEADER"))
1858 style |= FORM_STYLE_HEADER;
1860 if (styleString.Contains(L"FORM_STYLE_FOOTER"))
1862 style |= FORM_STYLE_FOOTER;
1865 _UiBuilderLayoutType layoutType = UIBUILDER_LAYOUT_NONE;
1866 __pLayoutMaker->GetLayoutType(pControlProperty, layoutType);
1867 if (layoutType == UIBUILDER_LAYOUT_NONE)
1870 r = pForm->Construct(style);
1874 Layout* pPortraitLayout = null;
1875 Layout* pLandscapeLayout = null;
1876 result tempResult = E_SUCCESS;
1877 tempResult = __pLayoutMaker->GetLayoutN(pControl, pPortraitLayout, pLandscapeLayout);
1878 if (E_SUCCESS == tempResult)
1880 r = pForm->Construct(*pPortraitLayout, *pLandscapeLayout, style);
1887 _UiBuilderLayoutType layoutType = UIBUILDER_LAYOUT_NONE;
1889 if (__pLayoutMaker->GetLayoutType(pControlProperty, layoutType) == false)
1894 if ( layoutType == UIBUILDER_LAYOUT_GRID)
1896 for (int i = 0; i < UIBUILDER_ATTRIBUTE_NUM; i++)
1898 GridLayout* pGridLayout = null;
1899 pControlProperty = pControl->GetAttribute(i);
1901 if ( i == UIBUILDER_ATTRIBUTE_PORTRAIT)
1903 pGridLayout = dynamic_cast<GridLayout*>(pPortraitLayout);
1907 pGridLayout = dynamic_cast<GridLayout*>(pLandscapeLayout);
1909 __pLayoutMaker->SetGridLayoutContainerProperty(pGridLayout, pControlProperty);
1912 delete pPortraitLayout;
1913 if (pPortraitLayout != pLandscapeLayout)
1915 delete pLandscapeLayout;
1921 SysLog(NID_UI_CTRL, "Failed to create Form.");
1926 if (pControl->GetElement(L"titleAlign", elementString))
1928 if (elementString.Equals(L"ALIGN_CENTER", false))
1930 align = ALIGNMENT_CENTER;
1932 else if (elementString.Equals(L"ALIGN_RIGHT", false))
1934 align = ALIGNMENT_RIGHT;
1938 align = ALIGNMENT_LEFT;
1940 isTitleAlign = true;
1943 if (style & FORM_STYLE_TITLE)
1945 if (pControl->GetElement(L"title", elementString))
1949 pForm->SetTitleText(elementString, align);
1953 pForm->SetTitleText(elementString);
1960 pForm->SetTitleText(L"", align);
1964 pForm->SetTitleText(L"");
1969 if (pControl->GetElement(L"titleIcon", elementString))
1971 Bitmap* pBitmap = null;
1972 pBitmap = LoadBitmapN(elementString);
1973 if (pBitmap != null)
1975 r = pForm->SetTitleIcon(pBitmap);
1979 SysLog(NID_UI_CTRL, "Failed to set TitleIcon.");
1984 if (pControl->GetElement(L"softKey0Text", elementString))
1986 pForm->SetSoftkeyText(SOFTKEY_0, elementString);
1988 if (pControl->GetElement(L"softKey1Text", elementString))
1990 pForm->SetSoftkeyText(SOFTKEY_1, elementString);
1992 if (pControl->GetElement(L"backgroundColorOpacity", elementString) || pControl->GetElement(L"BGColorOpacity", elementString))
1994 Base::Integer::Parse(elementString, opacity);
1996 if (pControl->GetElement(L"backgroundColor", elementString) || pControl->GetElement(L"BGColor", elementString))
1998 ConvertStringToColor32(elementString, opacity, color);
1999 pForm->SetBackgroundColor(color);
2004 r = GET_COLOR_CONFIG(FORM::BG_NORMAL,color);
2007 pForm->SetBackgroundColor(color);
2011 pForm->SetBackgroundColor(0xff000000);
2015 if (pControl->GetElement(L"softKey0Icon", elementString) || pControl->GetElement(L"softKey0NormalIcon", elementString))
2017 Bitmap* pNormalBitmap = null;
2018 Bitmap* pPressedBitmap = null;
2019 pNormalBitmap = LoadBitmapN(elementString); //__image->DecodeN(path,BITMAP_PIXEL_FORMAT_RGB565);
2021 if (pNormalBitmap != null)
2023 if (pControl->GetElement(L"softKey0PressedIcon", elementString))
2025 pPressedBitmap = LoadBitmapN(elementString);
2028 if (pPressedBitmap != null)
2030 pForm->SetSoftkeyIcon(SOFTKEY_0, *pNormalBitmap, pPressedBitmap);
2031 delete pNormalBitmap;
2032 delete pPressedBitmap;
2036 pForm->SetSoftkeyIcon(SOFTKEY_0, *pNormalBitmap, null);
2037 delete pNormalBitmap;
2041 if (pControl->GetElement(L"softKey1Icon", elementString) || pControl->GetElement(L"softKey1NormalIcon", elementString))
2043 Bitmap* pNormalBitmap = null;
2044 Bitmap* pPressedBitmap = null;
2045 pNormalBitmap = LoadBitmapN(elementString); //__image->DecodeN(path,BITMAP_PIXEL_FORMAT_RGB565);
2047 if (pNormalBitmap != null)
2049 if (pControl->GetElement(L"softKey1PressedIcon", elementString))
2051 pPressedBitmap = LoadBitmapN(elementString); // __image->DecodeN(path,BITMAP_PIXEL_FORMAT_RGB565);
2054 if (pPressedBitmap != null)
2056 pForm->SetSoftkeyIcon(SOFTKEY_1, *pNormalBitmap, pPressedBitmap);
2057 delete pNormalBitmap;
2058 delete pPressedBitmap;
2062 pForm->SetSoftkeyIcon(SOFTKEY_1, *pNormalBitmap, null);
2063 delete pNormalBitmap;
2068 if (pControl->GetElement(L"Orientation", elementString) || pControl->GetElement(L"orientation", elementString))
2071 //ORIENTATION_PORTRAIT,
2072 //ORIENTATION_LANDSACPE,
2073 //ORIENTATION_PORTRAIT_REVERSE,
2074 //ORIENTATION_LANDSACPE_REVERSE,
2075 //ORIENTATION_AUTO = 6,
2076 //ORIENTATION_AUTO_FOUR_DIRECTION = 8,
2078 if (elementString.Equals(L"Automatic:2Dir", false) || elementString.Equals(L"Automatic", false))
2080 pForm->SetOrientation(ORIENTATION_AUTOMATIC);
2082 else if (elementString.Equals(L"Automatic:4Dir", false))
2084 pForm->SetOrientation(ORIENTATION_AUTOMATIC_FOUR_DIRECTION);
2086 else if (elementString.Equals(L"Landscape", false))
2088 pForm->SetOrientation(ORIENTATION_LANDSCAPE);
2089 SetUiBuilderRotateState(UIBUIDER_SCREEN_HORIZONTAL);
2091 else if (elementString.Equals(L"Landscape:Reverse", false))
2093 pForm->SetOrientation(ORIENTATION_LANDSCAPE_REVERSE);
2094 SetUiBuilderRotateState(UIBUIDER_SCREEN_HORIZONTAL);
2096 else if (elementString.Equals(L"Portrait", false))
2098 pForm->SetOrientation(ORIENTATION_PORTRAIT);
2099 SetUiBuilderRotateState(UIBUIDER_SCREEN_VERTICAL);
2101 else if (elementString.Equals(L"Portrait:Reverse", false))
2103 pForm->SetOrientation(ORIENTATION_PORTRAIT_REVERSE);
2104 SetUiBuilderRotateState(UIBUIDER_SCREEN_VERTICAL);
2108 if (style & FORM_STYLE_HEADER)
2110 if (pControl->GetElement(L"translucentHeader", elementString))
2112 if (elementString.Equals(L"true", false))
2114 pForm->SetActionBarsTranslucent(FORM_ACTION_BAR_HEADER, true);
2119 if (style & FORM_STYLE_FOOTER)
2121 if (pControl->GetElement(L"translucentFooter", elementString))
2123 if (elementString.Equals(L"true", false))
2125 pForm->SetActionBarsTranslucent(FORM_ACTION_BAR_FOOTER, true);
2130 if (style & FORM_STYLE_INDICATOR)
2132 if (pControl->GetElement(L"translucentIndicator", elementString))
2134 if (elementString.Equals(L"true", false))
2136 pForm->SetActionBarsTranslucent(FORM_ACTION_BAR_INDICATOR, true);
2146 _FormRegister::_FormRegister()
2148 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
2149 pUiBuilderControlTableManager->RegisterControl(L"Form", _FormMaker::GetInstance);
2151 _FormRegister::~_FormRegister()
2153 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
2154 pUiBuilderControlTableManager->UnregisterControl(L"Form");
2156 static _FormRegister FormRegisterToUiBuilder;
2157 }}} // Tizen::Ui::Controls