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_TabImpl.h"
48 #include "FUiCtrl_Indicator.h"
50 using namespace Tizen::App;
51 using namespace Tizen::Base;
52 using namespace Tizen::Base::Runtime;
53 using namespace Tizen::Base::Collection;
54 using namespace Tizen::Graphics;
55 using namespace Tizen::Ui;
56 using namespace Tizen::Ui::Animations;
58 #define OPTIONKEY SOFTKEY_COUNT
60 namespace Tizen { namespace Ui { namespace Controls
63 const String _REQUEST_ORIENTATION_EVENT = L"RequestOrientationEvent";
66 _FormImpl::FormSizeInfo::GetDefaultMinimumSize(_ControlOrientation orientation) const
69 Dimension dimension(0, 0);
76 _FormImpl::FormSizeInfo::GetDefaultMinimumSizeF(_ControlOrientation orientation) const
79 FloatDimension dimension(0.0f, 0.0f);
86 _FormImpl::GetInstance(const Form& form)
88 return static_cast<const _FormImpl*> (form._pControlImpl);
92 _FormImpl::GetInstance(Form& form)
94 return static_cast<_FormImpl*> (form._pControlImpl);
97 _FormImpl::_FormImpl(Form* pPublic, _Form* pCore, Layout* pPublicPortraitLayout, Layout* pPublicLandscapeLayout)
98 : _ContainerImpl(pPublic, pCore, pPublicPortraitLayout, pPublicLandscapeLayout)
100 , __pFormBackEventListener(null)
102 , __pLeftSoftkeyActionEvent(null)
103 , __pRightSoftkeyActionEvent(null)
104 , __pOptionMenuActionEvent(null)
108 __pOriAgent = _OrientationAgent::CreateInstanceN(*pPublic);
109 SysTryReturnVoidResult(NID_UI_CTRL, __pOriAgent != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
112 _FormImpl::~_FormImpl(void)
117 if (__pLeftSoftkeyActionEvent)
119 delete __pLeftSoftkeyActionEvent;
120 __pLeftSoftkeyActionEvent = null;
123 if (__pRightSoftkeyActionEvent)
125 delete __pRightSoftkeyActionEvent;
126 __pRightSoftkeyActionEvent = null;
129 if (__pOptionMenuActionEvent)
131 delete __pOptionMenuActionEvent;
132 __pOptionMenuActionEvent = null;
135 __leftSoftkeyActionList.RemoveAll(false);
136 __rightSoftkeyActionList.RemoveAll(false);
148 _FormImpl::CreateFormImplN(Form* pControl, Layout* pPublicPortraitLayout, Layout* pPublicLandscapeLayout)
150 result r = E_SUCCESS;
151 _VisualElement* pVisualElement = null;
153 _Form* pCore = _Form::CreateFormN();
155 SysTryReturn(NID_UI_CTRL, pCore, null, r, "[%s] Propagating.", GetErrorMessage(r)); // [ToDo] interpret last result.
157 _FormImpl* pImpl = new (std::nothrow) _FormImpl(pControl, pCore, pPublicPortraitLayout, pPublicLandscapeLayout);
159 r = _ControlImpl::CheckConstruction(pCore, pImpl);
160 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
162 const FloatDimension portraitSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF();
163 const FloatDimension landscapeSize = FloatDimension(portraitSize.height, portraitSize.width);
165 _ControlOrientation orientation = pCore->GetOrientation();
167 if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
169 r = pImpl->InitializeBoundsPropertiesF(GET_SIZE_INFO(Form), portraitSize, orientation);
173 r = pImpl->InitializeBoundsPropertiesF(GET_SIZE_INFO(Form), landscapeSize, orientation);
175 SysAssert(r == E_SUCCESS);
177 // Make surface opaque.
178 pVisualElement = pCore->GetVisualElement();
179 SysTryCatch(NID_UI_CTRL, pVisualElement, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
180 r = pVisualElement->SetSurfaceOpaque(true);
181 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r)); // [ToDo] interpret last result.
183 SetLastResult(E_SUCCESS);
195 _FormImpl::GetPublicClassName(void) const
197 return "Tizen::Ui::Controls::Form";
201 _FormImpl::GetPublic(void) const
203 return static_cast<const Form&>(_ControlImpl::GetPublic());
207 _FormImpl::GetPublic(void)
209 return static_cast<Form&>(_ControlImpl::GetPublic());
213 _FormImpl::GetCore(void) const
215 return static_cast<const _Form&>(_ControlImpl::GetCore());
219 _FormImpl::GetCore(void)
221 return static_cast<_Form&>(_ControlImpl::GetCore());
225 _FormImpl::GetFocusControl(void)
231 _FormImpl::GetFormStyle(void) const
233 return GetCore().GetFormStyle();
237 _FormImpl::HasIndicator(void) const
239 return GetCore().HasIndicator();
243 _FormImpl::SetFormStyle(unsigned long formStyle)
245 result r = E_SUCCESS;
247 _HeaderImpl* pHeader = GetHeader();
248 _FooterImpl* pFooter = GetFooter();
249 _TabImpl* pTabImpl = GetTabImpl();
251 if (IsAttachedToMainTree())
253 if (FORM_STYLE_INDICATOR & formStyle)
255 _Frame* pFrame = dynamic_cast<_Frame*>(GetCore().GetParent());
256 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_TITLE) || (formStyle & FORM_STYLE_TEXT_TAB) || (formStyle & FORM_STYLE_ICON_TAB)) && (formStyle & FORM_STYLE_HEADER))
263 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.");
270 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
276 if (((formStyle & FORM_STYLE_SOFTKEY_0) || (formStyle & FORM_STYLE_SOFTKEY_1) || (formStyle & FORM_STYLE_OPTIONKEY)) && (formStyle & FORM_STYLE_FOOTER))
278 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.");
285 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
290 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
291 SysTryReturnVoidResult(NID_UI_CTRL, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] Unable to get evas.");
293 GetCore().SetFormStyle(formStyle);
295 FloatRectangle indicatorBounds(0.0f, 0.0f, 0.0f, 0.0f);
297 if (FORM_STYLE_INDICATOR & formStyle)
299 GetCore().SetIndicatorShowState(true);
300 indicatorBounds = GetCore().GetIndicatorBoundsF();
302 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
305 else if(FORM_STYLE_INDICATOR_AUTO_HIDE & formStyle)
307 r = GetCore().SetIndicatorShowState(false, true);
308 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
312 r = GetCore().SetIndicatorShowState(false);
313 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
316 if (formStyle & FORM_STYLE_HEADER)
320 pHeader = CreateHeaderN();
321 SysTryReturnVoidResult(NID_UI_CTRL, pHeader != null, r, "[%s] Propagating.", GetErrorMessage(r));
323 GetCore().SetHeader(&pHeader->GetCore());
324 GetCore().AdjustClientBounds();
326 FloatRectangle bounds(0.0f, indicatorBounds.height, GetClientBoundsF().width, GetCore().GetToolbarHeightF(true));
327 GetCore().SetHeaderBounds(bounds);
329 r = GetCore().AttachSystemChild(pHeader->GetCore());
330 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
332 GetCore().SetFormBackEventListener(this);
335 else if (formStyle & FORM_STYLE_TITLE)
339 pHeader = CreateHeaderN();
340 SysTryReturnVoidResult(NID_UI_CTRL, pHeader != null, r, "[%s] Propagating.", GetErrorMessage(r));
342 GetCore().SetHeader(&pHeader->GetCore());
343 GetCore().AdjustClientBounds();
345 FloatRectangle bounds(0.0f, indicatorBounds.height, GetClientBoundsF().width, GetCore().GetToolbarHeightF(true));
346 GetCore().SetHeaderBounds(bounds);
348 r = GetCore().AttachSystemChild(pHeader->GetCore());
349 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
359 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
363 _Indicator* pIndicator = GetCore().GetIndicator();
364 r = GetCore().AttachSystemChild(*pIndicator);
365 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
367 if (formStyle & FORM_STYLE_TEXT_TAB)
369 float titleHeight = 0.0f;
371 if (formStyle & FORM_STYLE_TITLE)
375 titleHeight = pHeader->GetBoundsF().height;
381 pTabImpl = CreateTabImplN();
382 SysTryReturnVoidResult(NID_UI_CTRL, pTabImpl != null, r, "[%s] Propagating.", GetErrorMessage(r));
384 float posY = indicatorBounds.height + titleHeight;
386 GetCore().SetTab(&pTabImpl->GetCore());
387 GetCore().AdjustClientBounds();
389 FloatRectangle bounds(0.0f, posY, GetClientBoundsF().width, GetCore().GetTabHeightF());
390 GetCore().SetTabBounds(bounds);
392 r = GetCore().AttachSystemChild(pTabImpl->GetCore());
393 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
395 GetCore().SetTabStyle(_TAB_STYLE_TEXT);
397 else if (formStyle & FORM_STYLE_ICON_TAB)
399 float titleHeight = 0.0f;
401 if (formStyle & FORM_STYLE_TITLE)
405 titleHeight = pHeader->GetBoundsF().height;
411 pTabImpl = CreateTabImplN();
412 SysTryReturnVoidResult(NID_UI_CTRL, pTabImpl != null, r, "[%s] Propagating.", GetErrorMessage(r));
414 float posY = indicatorBounds.height + titleHeight;
416 GetCore().SetTab(&pTabImpl->GetCore());
417 GetCore().AdjustClientBounds();
419 FloatRectangle bounds(0.0f, posY, GetClientBoundsF().width, GetCore().GetTabHeightF());
420 GetCore().SetTabBounds(bounds);
422 r = GetCore().AttachSystemChild(pTabImpl->GetCore());
423 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
425 GetCore().SetTabStyle(_TAB_STYLE_ICON);
433 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
437 if (formStyle & FORM_STYLE_FOOTER)
441 pFooter = CreateFooterN();
442 SysTryReturnVoidResult(NID_UI_CTRL, pFooter != null, r, "[%s] Propagating.", GetErrorMessage(r));
444 GetCore().SetFooter(&pFooter->GetCore());
445 GetCore().AdjustClientBounds();
447 FloatRectangle clientbounds = GetClientBoundsF();
448 FloatRectangle bounds(0.0f, clientbounds.y + clientbounds.height, clientbounds.width, GetCore().GetToolbarHeightF(false));
450 GetCore().SetFooterBounds(bounds);
452 r = GetCore().AttachSystemChild(pFooter->GetCore());
453 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
455 GetCore().SetFormBackEventListener(this);
458 else if (formStyle & FORM_STYLE_SOFTKEY_0 || formStyle & FORM_STYLE_SOFTKEY_1 || formStyle & FORM_STYLE_OPTIONKEY)
464 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
467 pFooter = GetFooter();
471 pFooter = CreateFooterN();
472 SysTryReturnVoidResult(NID_UI_CTRL, pFooter != null, r, "[%s] Propagating.", GetErrorMessage(r));
474 GetCore().SetFooter(&pFooter->GetCore());
475 GetCore().AdjustClientBounds();
477 FloatRectangle clientbounds = GetClientBoundsF();
478 FloatRectangle bounds(0.0f, clientbounds.y + clientbounds.height - GetCore().GetToolbarHeightF(false), clientbounds.width, GetCore().GetToolbarHeightF(false));
480 GetCore().SetFooterBounds(bounds);
482 r = GetCore().AttachSystemChild(pFooter->GetCore());
483 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
485 GetCore().CreateSoftkey(formStyle);
487 pFooter->GetCore().AddActionEventListener(*this);
497 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
498 GetCore().AdjustClientBounds();
502 GetCore().AdjustClientBounds();
504 SetLastResult(E_SUCCESS);
510 _FormImpl::GetFooter(void) const
512 _Toolbar* pToolbar = __pForm->GetFooter();
513 if (pToolbar == null)
518 _FooterImpl* pFooterImpl = static_cast<_FooterImpl*>(pToolbar->GetUserData());
524 _FormImpl::GetHeader(void) const
526 _Toolbar* pToolbar = __pForm->GetHeader();
527 if (pToolbar == null)
532 _HeaderImpl* pHeaderImpl = static_cast<_HeaderImpl*>(pToolbar->GetUserData());
539 _FormImpl::GetTabImpl(void) const
541 _Tab* pTab = __pForm->GetTab();
547 _TabImpl* pTabImpl = static_cast<_TabImpl*>(pTab->GetUserData());
553 _FormImpl::GetTitleText(void) const
555 return GetCore().GetTitleText();
559 _FormImpl::GetTitleTextHorizontalAlignment(void) const
561 return GetCore().GetTitleTextHorizontalAlignment();
565 _FormImpl::HasFooter(void) const
567 return GetCore().HasFooter();
571 _FormImpl::HasHeader(void) const
573 return GetCore().HasHeader();
577 _FormImpl::HasTitle(void) const
579 return GetCore().HasTitle();
583 _FormImpl::HasTab(void) const
585 return GetCore().HasTab();
589 _FormImpl::IsIndicatorVisible(void) const
591 return GetCore().IsIndicatorVisible();
595 _FormImpl::IsHeaderVisible(void) const
597 return GetCore().IsHeaderVisible();
601 _FormImpl::IsFooterVisible(void) const
603 return GetCore().IsFooterVisible();
607 _FormImpl::IsIndicatorTranslucent(void) const
609 return GetCore().IsIndicatorTranslucent();
613 _FormImpl::IsHeaderTranslucent(void) const
615 return GetCore().IsHeaderTranslucent();
619 _FormImpl::IsFooterTranslucent(void) const
621 return GetCore().IsFooterTranslucent();
626 _FormImpl::IsTabTranslucent(void) const
628 return GetCore().IsTabTranslucent();
632 _FormImpl::SetActionBarsTranslucent(unsigned long actionBars, bool translucent)
634 return GetCore().SetActionBarsTranslucent(actionBars, translucent);
638 _FormImpl::SetActionBarsVisible(unsigned long actionBars, bool visible)
640 return GetCore().SetActionBarsVisible(actionBars, visible);
644 _FormImpl::SetTitleIcon(const Bitmap* pTitleBitmap)
646 return GetCore().SetTitleIcon(pTitleBitmap);
650 _FormImpl::SetTitleText(const String& title, HorizontalAlignment alignment)
652 return GetCore().SetTitleText(title, alignment);
656 _FormImpl::GetOverlayRegionN(const Rectangle& rect, OverlayRegionType regionType)
658 return GetCore().GetOverlayRegionN(rect, regionType);
662 _FormImpl::GetOverlayRegionN(const FloatRectangle& rect, OverlayRegionType regionType)
664 return GetCore().GetOverlayRegionN(rect, regionType);
668 _FormImpl::OnDraw(void)
670 __pOriAgent->FireOrientationEvent();
672 _ContainerImpl::OnDraw();
676 _FormImpl::OnKeyReleased(const _ControlImpl& source, _KeyCode keyCode)
681 if (GetCore().GetFooter() || GetCore().GetHeader())
683 if (__pFormBackEventListener)
685 Form* pForm = dynamic_cast <Form*>(&GetPublic());
688 __pFormBackEventListener->OnFormBackRequested(*pForm);
710 _FormImpl::OnActionPerformed(const _Control& source, int actionId)
712 if (GetFormStyle() & FORM_STYLE_SOFTKEY_0 || GetFormStyle() & FORM_STYLE_SOFTKEY_1 || GetFormStyle() & FORM_STYLE_OPTIONKEY)
714 Tizen::Base::Runtime::IEventArg* tempArg = null;
715 tempArg = _PublicActionEvent::CreateActionEventArgN(actionId);
716 SysTryReturnVoidResult(NID_UI_CTRL, tempArg , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Unable to create Eventarg.");
719 _PublicActionEvent* pSoftkeyActionEvent = null;
721 if (GetCore().GetFooter()->IsButtonSet(LEFT_BUTTON) && GetSoftkeyActionId(SOFTKEY_0) == actionId)
723 for (int i = 0; i < __leftSoftkeyActionList.GetCount(); i++)
725 pSoftkeyActionEvent = dynamic_cast<_PublicActionEvent*>(__leftSoftkeyActionList.GetAt(i));
727 if (pSoftkeyActionEvent)
729 pSoftkeyActionEvent->Fire(*tempArg);
735 if (GetCore().GetFooter()->IsButtonSet(RIGHT_BUTTON) && GetSoftkeyActionId(SOFTKEY_1) == actionId)
737 for (int i = 0; i < __rightSoftkeyActionList.GetCount(); i++)
739 pSoftkeyActionEvent = dynamic_cast<_PublicActionEvent*>(__rightSoftkeyActionList.GetAt(i));
741 if (pSoftkeyActionEvent)
743 pSoftkeyActionEvent->Fire(*tempArg);
749 if (GetCore().GetFooter()->IsButtonSet(MIDDLE_BUTTON) && GetOptionkeyActionId() == actionId)
751 if (__pOptionMenuActionEvent)
753 __pOptionMenuActionEvent->Fire(*tempArg);
765 _FormImpl::GetClientAreaCanvasN(void) const
767 return GetCore().GetClientAreaCanvasN();
771 _FormImpl::TranslateToClientAreaPosition(const Point& position) const
773 return GetCore().TranslateToClientAreaPosition(position);
777 _FormImpl::TranslateToClientAreaPosition(const FloatPoint& position) const
779 return GetCore().TranslateToClientAreaPosition(position);
783 _FormImpl::TranslateFromClientAreaPosition(const Point& clientPosition) const
785 return GetCore().TranslateFromClientAreaPosition(clientPosition);
789 _FormImpl::TranslateFromClientAreaPosition(const FloatPoint& clientPosition) const
791 return GetCore().TranslateFromClientAreaPosition(clientPosition);
795 _FormImpl::SetFormBackEventListener(const IFormBackEventListener* pFormBackEventListener)
797 SysTryReturnVoidResult(NID_UI_CTRL, GetFooter() || GetHeader(), E_INVALID_STATE, "[E_INVALID_STATE] Footer isn't constructed.");
798 __pFormBackEventListener = const_cast <IFormBackEventListener*>(pFormBackEventListener);
799 GetCore().SetFormBackEventListener(this);
800 result r = GetLastResult();
801 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
805 _FormImpl::AddOrientationEventListener(IOrientationEventListener& listener)
807 __pOriAgent->AddListener(listener);
811 _FormImpl::AddOptionkeyActionListener(const IActionEventListener& listener)
813 if (HasOptionkey() == false)
818 __pOptionMenuActionEvent = _PublicActionEvent::CreateInstanceN(GetPublic());
820 SysTryReturnVoidResult(NID_UI_CTRL, __pOptionMenuActionEvent != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
822 __pOptionMenuActionEvent->AddListener(listener);
826 _FormImpl::AddSoftkeyActionListener(Softkey softkey, const IActionEventListener& listener)
828 _Softkey _softkey = ConvertSoftkey(softkey);
830 if (GetCore().CheckSoftkey(_softkey) == false)
835 if (softkey == SOFTKEY_0)
837 __pLeftSoftkeyActionEvent = _PublicActionEvent::CreateInstanceN(GetPublic());
839 SysTryReturnVoidResult(NID_UI_CTRL, __pLeftSoftkeyActionEvent != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
841 __pLeftSoftkeyActionEvent->AddListener(listener);
843 __leftSoftkeyActionList.Add(*__pLeftSoftkeyActionEvent);
845 else if (softkey == SOFTKEY_1)
847 __pRightSoftkeyActionEvent = _PublicActionEvent::CreateInstanceN(GetPublic());
849 SysTryReturnVoidResult(NID_UI_CTRL, __pRightSoftkeyActionEvent != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
851 __pRightSoftkeyActionEvent->AddListener(listener);
853 __rightSoftkeyActionList.Add(*__pRightSoftkeyActionEvent);
858 _FormImpl::RemoveOrientationEventListener(IOrientationEventListener& listener)
860 __pOriAgent->RemoveListener(listener);
864 _FormImpl::RemoveOptionkeyActionListener(const IActionEventListener& listener)
866 if (HasOptionkey() == false)
871 if (__pOptionMenuActionEvent)
873 __pOptionMenuActionEvent->RemoveListener(listener);
878 _FormImpl::RemoveSoftkeyActionListener(Softkey softkey, const IActionEventListener& listener)
880 _Softkey _softkey = ConvertSoftkey(softkey);
882 if (GetCore().CheckSoftkey(_softkey) == false)
887 if (softkey == SOFTKEY_0)
889 if (__pLeftSoftkeyActionEvent)
891 __pLeftSoftkeyActionEvent->RemoveListener(listener);
894 else if (softkey == SOFTKEY_1)
896 if (__pRightSoftkeyActionEvent)
898 __pRightSoftkeyActionEvent->RemoveListener(listener);
904 _FormImpl::SetOrientation(Orientation orientation)
906 __pOriAgent->SetMode(orientation);
910 _FormImpl::GetOrientation(void) const
912 return __pOriAgent->GetMode();
916 _FormImpl::GetOrientationStatus(void) const
918 return __pOriAgent->GetStatus();
922 _FormImpl::UpdateOrientationStatus(bool draw)
924 __pOriAgent->Update(draw);
927 #if defined(WINDOW_BASE_ROTATE)
929 _FormImpl::UpdateOrientation(void)
931 __pOriAgent->UpdateOrientation();
936 _FormImpl::HasOptionkey(void) const
938 return GetCore().HasOptionkey();
942 _FormImpl::HasSoftkey(Softkey softkey) const
944 _Softkey _softkey = ConvertSoftkey(softkey);
946 return GetCore().HasSoftkey(_softkey);
950 _FormImpl::SetSoftkeyEnabled(Softkey softkey, bool enable)
952 _Softkey _softkey = ConvertSoftkey(softkey);
954 result r = GetCore().SetSoftkeyEnabled(_softkey, enable);
955 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
961 _FormImpl::IsSoftkeyEnabled(Softkey softkey) const
963 _Softkey _softkey = ConvertSoftkey(softkey);
965 return GetCore().IsSoftkeyEnabled(_softkey);
969 _FormImpl::GetSoftkeyActionId(Softkey softkey) const
971 _Softkey _softkey = ConvertSoftkey(softkey);
973 return GetCore().GetSoftkeyActionId(_softkey);
977 _FormImpl::GetOptionkeyActionId(void) const
979 return GetCore().GetOptionkeyActionId();
983 _FormImpl::GetSoftkeyText(Softkey softkey) const
985 _Softkey _softkey = ConvertSoftkey(softkey);
987 return GetCore().GetSoftkeyText(_softkey);
991 _FormImpl::SetOptionkeyActionId(int actionId)
993 result r = GetCore().SetOptionkeyActionId(actionId);
994 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
1000 _FormImpl::SetSoftkeyActionId(Softkey softkey, int actionId)
1002 _Softkey _softkey = ConvertSoftkey(softkey);
1004 result r = GetCore().SetSoftkeyActionId(_softkey, actionId);
1005 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
1011 _FormImpl::SetSoftkeyText(Softkey softkey, const String& text)
1013 _Softkey _softkey = ConvertSoftkey(softkey);
1015 result r = GetCore().SetSoftkeyText(_softkey, text);
1016 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
1022 _FormImpl::SetSoftkeyIcon(Softkey softkey, const Bitmap& pNormalBitmap, const Bitmap* ppPressedBitmap)
1024 _Softkey _softkey = ConvertSoftkey(softkey);
1026 result r = GetCore().SetSoftkeyIcon(_softkey, pNormalBitmap, ppPressedBitmap);
1027 SysTryLog(NID_UI_CTRL, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
1033 _FormImpl::OnChangeLayout(_ControlOrientation orientation)
1035 const FloatDimension portraitSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF();
1036 const FloatDimension landscapeSize = FloatDimension(portraitSize.height, portraitSize.width);
1039 _ContainerImpl::OnChangeLayout(orientation);
1040 SysTryReturnVoidResult(NID_UI_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1042 if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
1044 SetSize(portraitSize);
1048 SetSize(landscapeSize);
1051 float indicatorheight = 0.0f;
1053 GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, GetCore().GetOrientation(), indicatorheight);
1054 if (GetCore().HasIndicator())
1056 _Indicator* pIndicator = GetCore().GetIndicator();
1059 if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
1061 pIndicator->SetBounds(FloatRectangle(0.0f, 0.0f, GetClientBoundsF().width, indicatorheight));
1065 GET_SHAPE_CONFIG(FORM::INDICATOR_MINIMIZE_HEIGHT, GetCore().GetOrientation(), indicatorheight);
1066 pIndicator->SetBounds(FloatRectangle(0.0f, 0.0f, GetClientBoundsF().width, indicatorheight));
1069 GetCore().AdjustClientBounds();
1073 float adjHeight = 0.0f;
1075 if (GetCore().HasHeader())
1077 FloatRectangle indicatorBounds(0.0f, 0.0f, 0.0f, 0.0f);
1078 if (GetCore().IsIndicatorVisible())
1080 indicatorBounds = GetCore().GetIndicatorBoundsF();
1083 FloatRectangle bounds(0.0f, indicatorBounds.height, GetClientBoundsF().width, GetCore().GetToolbarHeightF(true));
1084 GetCore().SetHeaderBounds(bounds);
1087 if (GetCore().HasTab()) // Ki-Dong,Hong.Temp
1089 float titleHeight = 0.0f;
1091 if (GetCore().GetFormStyle() & FORM_STYLE_TITLE)
1093 if (GetCore().HasHeader())
1095 _HeaderImpl* pHeaderImpl = GetHeader();
1098 titleHeight = pHeaderImpl->GetBoundsF().height;
1103 FloatRectangle indicatorBounds(0.0f, 0.0f, 0.0f, 0.0f);
1105 if (GetCore().IsIndicatorVisible())
1107 indicatorBounds = GetCore().GetIndicatorBoundsF();
1110 float posY = indicatorBounds.height + titleHeight;
1112 FloatRectangle bounds(0.0f, posY, GetClientBoundsF().width, GetCore().GetTabHeightF());
1113 GetCore().SetTabBounds(bounds);
1116 if (GetCore().HasFooter())
1118 if (GetCore().GetFooter()->GetVisibleState() && !GetCore().IsFooterTranslucent())
1124 adjHeight = GetCore().GetToolbarHeightF(false);
1127 if (!(GetCore().GetFormStyle() & FORM_STYLE_FOOTER || GetCore().GetFormStyle() & FORM_STYLE_SOFTKEY_0 || GetCore().GetFormStyle() & FORM_STYLE_SOFTKEY_1
1128 || GetCore().GetFormStyle() & FORM_STYLE_OPTIONKEY))
1130 adjHeight = GetCore().GetToolbarHeightF(false);
1133 FloatRectangle bounds(0.0f, GetClientBoundsF().y + GetClientBoundsF().height - adjHeight,
1134 GetClientBoundsF().width, GetCore().GetToolbarHeightF(false));
1135 GetCore().SetFooterBounds(bounds);
1140 _FormImpl::CreateHeaderN(void)
1142 result r = E_SUCCESS;
1144 Header* pHeader = new (std::nothrow) Header;
1145 SysTryReturn(NID_UI_CTRL, pHeader, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
1147 r = pHeader->Construct();
1148 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1150 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*pHeader);
1152 SetLastResult(E_SUCCESS);
1158 _FormImpl::CreateFooterN(void)
1160 result r = E_SUCCESS;
1162 Footer* pFooter = new (std::nothrow) Footer;
1163 SysTryReturn(NID_UI_CTRL, pFooter, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
1165 r = pFooter->Construct();
1166 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
1168 _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*pFooter);
1170 SetLastResult(E_SUCCESS);
1175 // Ki-Dong,Hong.Temp
1177 _FormImpl::CreateTabImplN(void)
1179 //result r = E_SUCCESS;
1181 //Tab* pTab = new (std::nothrow) Tab;
1182 //SysTryReturn(NID_UI_CTRL, pTab, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
1184 //r = pTab->Construct();
1185 //SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, E_SYSTEM, "[E_SYSTEM] Unable to consturct tab.");
1187 //return pTab->GetTabImpl();
1188 Tab* pTab = _TabImpl::CreateTabN();
1189 SysTryReturn(NID_UI_CTRL, pTab, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1191 _TabImpl* pTabImpl = _TabImpl::GetInstance(*pTab);
1193 SetLastResult(E_SUCCESS);
1199 _FormImpl::DeflateClientRectHeight(int height)
1201 return GetCore().DeflateClientRectHeight(height);
1205 _FormImpl::DeflateClientRectHeight(float height)
1207 return GetCore().DeflateClientRectHeight(height);
1211 _FormImpl::RemoveHeader(void)
1213 _HeaderImpl* pHeaderImpl = GetHeader();
1217 __pForm->RemoveHeader();
1218 result r = GetLastResult();
1219 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1220 Header* pHeader = pHeaderImpl->GetHeader();
1231 _FormImpl::RemoveFooter(void)
1233 _FooterImpl* pFooterImpl = GetFooter();
1237 __pForm->RemoveFooter();
1238 result r = GetLastResult();
1239 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1240 Footer* pFooter = pFooterImpl->GetFooter();
1252 // Ki-Dong,Hong.Temp
1254 _FormImpl::RemoveTabImpl(void)
1256 _TabImpl* pTabImpl = GetTabImpl();
1260 __pForm->RemoveTab();
1261 result r = GetLastResult();
1262 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1263 Tab* pTab = pTabImpl->GetTab();
1265 pTabImpl->DeleteTab(pTab);
1276 _FormImpl::GetDataBindingContextN(void) const
1278 return _DataBindingContextImpl::GetDataBindingContextN(*this);
1282 _FormImpl::OnAttaching(const _Control* pParent)
1284 result r = E_SUCCESS;
1285 _Frame* pFrame = dynamic_cast<_Frame*>(const_cast<_Control*>((pParent)));
1286 if (FORM_STYLE_INDICATOR & GetCore().GetFormStyle())
1288 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.");
1290 r = _ControlImpl::OnAttaching(pParent);
1295 _FormImpl::OnAttachedToMainTree(void)
1297 result r = E_SUCCESS;
1300 r = GetCore().AttachedToMainTree();
1301 r = _ContainerImpl::OnAttachedToMainTree();
1303 FloatRectangle indicatorBounds(0.0f, 0.0f, 0.0f, 0.0f);
1305 if (FORM_STYLE_INDICATOR & GetCore().GetFormStyle())
1307 indicatorBounds = GetCore().GetIndicatorBoundsF();
1308 r = GetLastResult();
1309 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1312 _HeaderImpl* pHeader = GetHeader();
1313 _FooterImpl* pFooter = GetFooter();
1314 _TabImpl* pTabImpl = GetTabImpl();
1318 FloatRectangle bounds(0.0f, indicatorBounds.height, GetClientBoundsF().width, GetCore().GetToolbarHeightF(true));
1319 GetCore().SetHeaderBounds(bounds);
1322 float titleHeight = 0.0f;
1326 titleHeight = pHeader->GetBoundsF().height;
1331 float posY = indicatorBounds.height + titleHeight;
1333 FloatRectangle bounds(0.0f, posY, GetClientBoundsF().width, GetCore().GetTabHeightF());
1334 GetCore().SetTabBounds(bounds);
1339 float adjHeight = 0.0f;
1341 if (!(GetCore().GetFooter()->GetVisibleState()) || GetCore().IsFooterTranslucent())
1343 adjHeight = GetCore().GetToolbarHeightF(false);
1346 if (!(GetCore().GetFormStyle() & FORM_STYLE_FOOTER || GetCore().GetFormStyle() & FORM_STYLE_SOFTKEY_0 || GetCore().GetFormStyle() & FORM_STYLE_SOFTKEY_1
1347 || GetCore().GetFormStyle() & FORM_STYLE_OPTIONKEY))
1349 adjHeight = GetCore().GetToolbarHeightF(false);
1352 FloatRectangle clientbounds = GetClientBoundsF();
1353 FloatRectangle bounds(0.0f, clientbounds.y + clientbounds.height - adjHeight, clientbounds.width, GetCore().GetToolbarHeightF(false));
1355 GetCore().SetFooterBounds(bounds);
1358 UpdateOrientationStatus();
1360 __pOriAgent->RequestOrientationEvent();
1366 _FormImpl::OnDetachingFromMainTree(void)
1368 result r = E_SUCCESS;
1369 r = GetCore().DetachingFromMainTree();
1370 r = _ContainerImpl::OnDetachingFromMainTree();
1376 _FormImpl::OnNotifiedN(const _ControlImpl& source, IList* pArgs)
1378 String* pString = dynamic_cast <Tizen::Base::String*>(pArgs->GetAt(0));
1381 if (*pString == _REQUEST_ORIENTATION_EVENT)
1383 __pOriAgent->FireOrientationEvent();
1385 pArgs->RemoveAll(true);
1396 _FormImpl::OnFormBackRequested(Tizen::Ui::Controls::_Form& source)
1398 if (__pFormBackEventListener)
1400 _FormImpl* pFormImpl = static_cast<_FormImpl*>(source.GetUserData());
1401 Form* pForm = dynamic_cast <Form*>(&pFormImpl->GetPublic());
1404 __pFormBackEventListener->OnFormBackRequested(*pForm);
1414 _FormImpl::IsOpaque(void) const
1421 _FormImpl::ConvertSoftkey(Softkey softkey) const
1425 if (softkey == SOFTKEY_0)
1427 _softkey = _SOFTKEY_0;
1429 else if (softkey == SOFTKEY_1)
1431 _softkey = _SOFTKEY_1;
1435 _softkey = _SOFTKEY_COUNT;
1442 _FormImpl::SetNotificationTrayOpenEnabled(bool enable)
1444 return GetCore().SetNotificationTrayOpenEnabled(enable);
1448 _FormImpl::IsNotificationTrayOpenEnabled(void) const
1450 return GetCore().IsNotificationTrayOpenEnabled();
1454 : public _UiBuilderControlMaker
1457 _FormMaker(_UiBuilder* uibuilder)
1458 : _UiBuilderControlMaker(uibuilder){};
1459 virtual ~_FormMaker()
1462 static _UiBuilderControlMaker* GetInstance(_UiBuilder* uibuilder)
1464 _FormMaker* pFormMaker = new (std::nothrow) _FormMaker(uibuilder);
1468 virtual Control* Make(_UiBuilderControl* pControl)
1470 _UiBuilderControlLayout* pControlProperty = null;
1471 result r = E_SUCCESS;
1474 Tizen::Base::String elementString;
1475 bool isTitleAlign = false;
1478 HorizontalAlignment align = ALIGNMENT_CENTER;
1479 Form* pForm = (Form*) GetContainer();
1481 // Get control manager
1482 _ControlManager* pControlManager = _ControlManager::GetInstance();
1483 if (pControlManager == null)
1485 SysLog(NID_UI_CTRL, "Unable to get the control manager.n");
1488 FloatDimension screenSize = pControlManager->GetScreenSizeF();
1491 (pControl->GetAttribute(UIBUILDER_ATTRIBUTE_PORTRAIT))->SetRect(0.0f, 0.0f, screenSize.width, screenSize.height);
1492 (pControl->GetAttribute(UIBUILDER_ATTRIBUTE_LANDSCAPE))->SetRect(0.0f, 0.0f, screenSize.height, screenSize.width);
1494 // Get device orientation
1495 app_device_orientation_e deviceOrientation = app_get_device_orientation();
1496 bool isHorizontal = (deviceOrientation == APP_DEVICE_ORIENTATION_90) || (deviceOrientation == APP_DEVICE_ORIENTATION_270);
1500 pControlProperty = pControl->GetAttribute(UIBUILDER_ATTRIBUTE_LANDSCAPE);
1504 pControlProperty = pControl->GetAttribute(UIBUILDER_ATTRIBUTE_PORTRAIT);
1507 if (pControlProperty == null)
1509 SysLogException(NID_UI_CTRL, E_SYSTEM, "[E_SYSTEM] Can't read attributes");
1513 pControlProperty = pControl->GetAttribute(UIBUILDER_ATTRIBUTE_PORTRAIT);
1514 Tizen::Base::String styleString;
1515 styleString = pControlProperty->GetStyle();
1517 if (styleString.Contains(L"FORM_STYLE_TITLE"))
1519 style |= FORM_STYLE_TITLE;
1521 if (styleString.Contains(L"FORM_STYLE_SOFTKEY_0"))
1523 style |= FORM_STYLE_SOFTKEY_0;
1525 if (styleString.Contains(L"FORM_STYLE_SOFTKEY_1"))
1527 style |= FORM_STYLE_SOFTKEY_1;
1529 if (styleString.Contains(L"FORM_STYLE_OPTIONKEY"))
1531 style |= FORM_STYLE_OPTIONKEY;
1533 if (styleString.Contains(L"FORM_STYLE_INDICATOR"))
1535 style |= FORM_STYLE_INDICATOR;
1537 if (styleString.Contains(L"FORM_STYLE_TEXT_TAB"))
1539 style |= FORM_STYLE_TEXT_TAB;
1541 if (styleString.Contains(L"FORM_STYLE_ICON_TAB"))
1543 style |= FORM_STYLE_ICON_TAB;
1545 if (styleString.Contains(L"FORM_STYLE_HEADER"))
1547 style |= FORM_STYLE_HEADER;
1549 if (styleString.Contains(L"FORM_STYLE_FOOTER"))
1551 style |= FORM_STYLE_FOOTER;
1554 _UiBuilderLayoutType layoutType = UIBUILDER_LAYOUT_NONE;
1555 __pLayoutMaker->GetLayoutType(pControlProperty, layoutType);
1556 if (layoutType == UIBUILDER_LAYOUT_NONE)
1559 r = pForm->Construct(style);
1563 Layout* pPortraitLayout = null;
1564 Layout* pLandscapeLayout = null;
1565 result tempResult = E_SUCCESS;
1566 tempResult = __pLayoutMaker->GetLayoutN(pControl, pPortraitLayout, pLandscapeLayout);
1567 if (E_SUCCESS == tempResult)
1569 r = pForm->Construct(*pPortraitLayout, *pLandscapeLayout, style);
1576 _UiBuilderLayoutType layoutType = UIBUILDER_LAYOUT_NONE;
1578 if (__pLayoutMaker->GetLayoutType(pControlProperty, layoutType) == false)
1583 if ( layoutType == UIBUILDER_LAYOUT_GRID)
1585 for (int i = 0; i < UIBUILDER_ATTRIBUTE_NUM; i++)
1587 GridLayout* pGridLayout = null;
1588 pControlProperty = pControl->GetAttribute(i);
1590 if ( i == UIBUILDER_ATTRIBUTE_PORTRAIT)
1592 pGridLayout = dynamic_cast<GridLayout*>(pPortraitLayout);
1596 pGridLayout = dynamic_cast<GridLayout*>(pLandscapeLayout);
1598 __pLayoutMaker->SetGridLayoutContainerProperty(pGridLayout, pControlProperty);
1601 delete pPortraitLayout;
1602 if (pPortraitLayout != pLandscapeLayout)
1604 delete pLandscapeLayout;
1610 SysLog(NID_UI_CTRL, "Failed to create Form.");
1615 if (pControl->GetElement(L"titleAlign", elementString))
1617 if (elementString.Equals(L"ALIGN_CENTER", false))
1619 align = ALIGNMENT_CENTER;
1621 else if (elementString.Equals(L"ALIGN_RIGHT", false))
1623 align = ALIGNMENT_RIGHT;
1627 align = ALIGNMENT_LEFT;
1629 isTitleAlign = true;
1632 if (style & FORM_STYLE_TITLE)
1634 if (pControl->GetElement(L"title", elementString))
1638 pForm->SetTitleText(elementString, align);
1642 pForm->SetTitleText(elementString);
1649 pForm->SetTitleText(L"", align);
1653 pForm->SetTitleText(L"");
1658 if (pControl->GetElement(L"titleIcon", elementString))
1660 Bitmap* pBitmap = null;
1661 pBitmap = LoadBitmapN(elementString);
1662 if (pBitmap != null)
1664 r = pForm->SetTitleIcon(pBitmap);
1668 SysLog(NID_UI_CTRL, "Failed to set TitleIcon.");
1673 if (pControl->GetElement(L"softKey0Text", elementString))
1675 pForm->SetSoftkeyText(SOFTKEY_0, elementString);
1677 if (pControl->GetElement(L"softKey1Text", elementString))
1679 pForm->SetSoftkeyText(SOFTKEY_1, elementString);
1681 if (pControl->GetElement(L"backgroundColorOpacity", elementString) || pControl->GetElement(L"BGColorOpacity", elementString))
1683 Base::Integer::Parse(elementString, opacity);
1685 if (pControl->GetElement(L"backgroundColor", elementString) || pControl->GetElement(L"BGColor", elementString))
1687 ConvertStringToColor32(elementString, opacity, color);
1688 pForm->SetBackgroundColor(color);
1693 r = GET_COLOR_CONFIG(FORM::BG_NORMAL,color);
1696 pForm->SetBackgroundColor(color);
1700 pForm->SetBackgroundColor(0xff000000);
1704 if (pControl->GetElement(L"softKey0Icon", elementString) || pControl->GetElement(L"softKey0NormalIcon", elementString))
1706 Bitmap* pNormalBitmap = null;
1707 Bitmap* pPressedBitmap = null;
1708 pNormalBitmap = LoadBitmapN(elementString); //__image->DecodeN(path,BITMAP_PIXEL_FORMAT_RGB565);
1710 if (pNormalBitmap != null)
1712 if (pControl->GetElement(L"softKey0PressedIcon", elementString))
1714 pPressedBitmap = LoadBitmapN(elementString);
1717 if (pPressedBitmap != null)
1719 pForm->SetSoftkeyIcon(SOFTKEY_0, *pNormalBitmap, pPressedBitmap);
1720 delete pNormalBitmap;
1721 delete pPressedBitmap;
1725 pForm->SetSoftkeyIcon(SOFTKEY_0, *pNormalBitmap, null);
1726 delete pNormalBitmap;
1730 if (pControl->GetElement(L"softKey1Icon", elementString) || pControl->GetElement(L"softKey1NormalIcon", elementString))
1732 Bitmap* pNormalBitmap = null;
1733 Bitmap* pPressedBitmap = null;
1734 pNormalBitmap = LoadBitmapN(elementString); //__image->DecodeN(path,BITMAP_PIXEL_FORMAT_RGB565);
1736 if (pNormalBitmap != null)
1738 if (pControl->GetElement(L"softKey1PressedIcon", elementString))
1740 pPressedBitmap = LoadBitmapN(elementString); // __image->DecodeN(path,BITMAP_PIXEL_FORMAT_RGB565);
1743 if (pPressedBitmap != null)
1745 pForm->SetSoftkeyIcon(SOFTKEY_1, *pNormalBitmap, pPressedBitmap);
1746 delete pNormalBitmap;
1747 delete pPressedBitmap;
1751 pForm->SetSoftkeyIcon(SOFTKEY_1, *pNormalBitmap, null);
1752 delete pNormalBitmap;
1757 if (pControl->GetElement(L"Orientation", elementString) || pControl->GetElement(L"orientation", elementString))
1760 //ORIENTATION_PORTRAIT,
1761 //ORIENTATION_LANDSACPE,
1762 //ORIENTATION_PORTRAIT_REVERSE,
1763 //ORIENTATION_LANDSACPE_REVERSE,
1764 //ORIENTATION_AUTO = 6,
1765 //ORIENTATION_AUTO_FOUR_DIRECTION = 8,
1767 if (elementString.Equals(L"Automatic:2Dir", false) || elementString.Equals(L"Automatic", false))
1769 pForm->SetOrientation(ORIENTATION_AUTOMATIC);
1771 else if (elementString.Equals(L"Automatic:4Dir", false))
1773 pForm->SetOrientation(ORIENTATION_AUTOMATIC_FOUR_DIRECTION);
1775 else if (elementString.Equals(L"Landscape", false))
1777 pForm->SetOrientation(ORIENTATION_LANDSCAPE);
1778 SetUiBuilderRotateState(UIBUIDER_SCREEN_HORIZONTAL);
1780 else if (elementString.Equals(L"Landscape:Reverse", false))
1782 pForm->SetOrientation(ORIENTATION_LANDSCAPE_REVERSE);
1783 SetUiBuilderRotateState(UIBUIDER_SCREEN_HORIZONTAL);
1785 else if (elementString.Equals(L"Portrait", false))
1787 pForm->SetOrientation(ORIENTATION_PORTRAIT);
1788 SetUiBuilderRotateState(UIBUIDER_SCREEN_VERTICAL);
1790 else if (elementString.Equals(L"Portrait:Reverse", false))
1792 pForm->SetOrientation(ORIENTATION_PORTRAIT_REVERSE);
1793 SetUiBuilderRotateState(UIBUIDER_SCREEN_VERTICAL);
1797 if (style & FORM_STYLE_HEADER)
1799 if (pControl->GetElement(L"translucentHeader", elementString))
1801 if (elementString.Equals(L"true", false))
1803 pForm->SetActionBarsTranslucent(FORM_ACTION_BAR_HEADER, true);
1808 if (style & FORM_STYLE_FOOTER)
1810 if (pControl->GetElement(L"translucentFooter", elementString))
1812 if (elementString.Equals(L"true", false))
1814 pForm->SetActionBarsTranslucent(FORM_ACTION_BAR_FOOTER, true);
1819 if (style & FORM_STYLE_INDICATOR)
1821 if (pControl->GetElement(L"translucentIndicator", elementString))
1823 if (elementString.Equals(L"true", false))
1825 pForm->SetActionBarsTranslucent(FORM_ACTION_BAR_INDICATOR, true);
1835 _FormRegister::_FormRegister()
1837 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
1838 pUiBuilderControlTableManager->RegisterControl(L"Form", _FormMaker::GetInstance);
1840 _FormRegister::~_FormRegister()
1842 _UiBuilderControlTableManager* pUiBuilderControlTableManager = _UiBuilderControlTableManager::GetInstance();
1843 pUiBuilderControlTableManager->UnregisterControl(L"Form");
1845 static _FormRegister FormRegisterToUiBuilder;
1846 }}} // Tizen::Ui::Controls