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.
18 * @file FUiCtrl_Form.cpp
19 * @brief This is the implementation file for the _Form class.
23 #include <unique_ptr.h>
24 #include <FBaseErrorDefine.h>
25 #include <FBaseInteger.h>
26 #include <FBaseSysLog.h>
27 #include <FBaseColArrayListT.h>
28 #include <FGrpFloatRectangle.h>
29 #include <FBase_Log.h>
30 #include <FGrp_BitmapImpl.h>
31 #include "FUi_ResourceManager.h"
32 #include "FUi_EcoreEvasMgr.h"
33 #include "FUi_EcoreEvas.h"
34 #include "FUi_CoordinateSystemUtils.h"
35 #include "FUi_DataBindingContext.h"
36 #include "FUi_AccessibilityContainer.h"
37 #include "FUi_AccessibilityManager.h"
38 #include "FUiCtrl_Form.h"
39 #include "FUiCtrl_Frame.h"
40 #include "FUiCtrl_FormPresenter.h"
41 #include "FUiCtrl_Toolbar.h"
42 #include "FUiCtrl_Tab.h"
43 #include "FUiCtrl_ActionEvent.h"
44 #include "FUiCtrl_OverlayRegionImpl.h"
45 #include "FUiCtrl_OverlayPanelImpl.h"
46 #include "FUiCtrl_IFormBackEventListener.h"
47 #include "FUiCtrl_Indicator.h"
48 #include "FUi_SystemUtilImpl.h"
51 using namespace Tizen::Ui::Animations;
52 using namespace Tizen::Ui;
53 using namespace Tizen::Base; // Rotation
54 using namespace Tizen::Base::Runtime;
55 using namespace Tizen::Base::Collection;
56 using namespace Tizen::Graphics;
58 namespace Tizen { namespace Ui { namespace Controls
62 : __pFormPresenter(null)
63 , __pFormBackEventListener(null)
65 , __pActionEvent(null)
70 , __transparentIndicator(false)
71 , __transparentHeader(false)
72 , __transparentFooter(false)
73 , __transparentTab(false)
74 , __indicatorShowState(false)
76 , __deflatedHeight(0.0f)
77 , __overlayRegionCount(0)
78 , __ppOverlayerRegionImplArray(null)
79 , __softkeyCount(SOFTKEY_COUNT + 1)
80 , __updatedSoftkeyCount(0)
81 , __keypadShowstate(false)
84 result r = GET_COLOR_CONFIG(FORM::BG_NORMAL,color);
87 SetBackgroundColor(color);
91 SetBackgroundColor(0xff000000);
94 _FormPresenter* pPresenter = new (std::nothrow) _FormPresenter(*this);
95 SysTryReturnVoidResult(NID_UI_CTRL, pPresenter, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
97 SetPresenter(*pPresenter);
99 for (int i = 0; i < __softkeyCount; i++)
101 __actionId[_SOFTKEY_0 + i] = 0;
102 __softkeyText[_SOFTKEY_0 + i] = String();
103 __showSoftkey[_SOFTKEY_0 + i] = false;
104 __enableSoftkey[_SOFTKEY_0 + i] = false;
107 for (int j = 0; j < SOFTKEY_COUNT+1; j++)
109 __pSoftkeyNormalBitmap[_SOFTKEY_0 + j] = null;
110 __pSoftkeyPressedBitmap[_SOFTKEY_0 + j] = null;
113 for (int j = 0; j < SOFTKEY_COUNT+1; j++)
115 __pSoftkeyNormalEffectBitmap[_SOFTKEY_0 + j] = null;
116 __pSoftkeyPressedEffectBitmap[_SOFTKEY_0 + j] = null;
119 for (int k = 0; k < SOFTKEY_COUNT + 1; k++)
121 __pSoftkeyNormalIcon[_SOFTKEY_0 + k] = null;
122 __pSoftkeyPressedIcon[_SOFTKEY_0 + k] = null;
125 //create data binding context
126 _DataBindingContext* pContext = new (std::nothrow) _DataBindingContext(*this);
128 SysTryCatch(NID_UI_CTRL, pContext && GetLastResult() == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
129 SetDataBindingContext(pContext);
132 GetAccessibilityContainer()->Activate(true);
141 delete __pFormPresenter;
142 __pFormPresenter = null;
146 delete __pActionEvent;
147 __pActionEvent = null;
150 for (int i = 0; i < SOFTKEY_COUNT+1 ; i++)
152 if (__pSoftkeyNormalBitmap[i])
154 delete __pSoftkeyNormalBitmap[i];
155 __pSoftkeyNormalBitmap[i] = null;
159 for (int i = 0; i < SOFTKEY_COUNT+1 ; i++)
161 if (__pSoftkeyPressedBitmap[i])
163 delete __pSoftkeyPressedBitmap[i];
164 __pSoftkeyPressedBitmap[i] = null;
168 for (int i = 0; i < SOFTKEY_COUNT+1 ; i++)
170 if (__pSoftkeyNormalEffectBitmap[i])
172 delete __pSoftkeyNormalEffectBitmap[i];
173 __pSoftkeyNormalEffectBitmap[i] = null;
177 for (int i = 0; i < SOFTKEY_COUNT+1 ; i++)
179 if (__pSoftkeyPressedEffectBitmap[i])
181 delete __pSoftkeyPressedEffectBitmap[i];
182 __pSoftkeyPressedEffectBitmap[i] = null;
186 for (int i = 0; i < SOFTKEY_COUNT+1; i++)
188 if (__pSoftkeyNormalIcon[i])
190 delete __pSoftkeyNormalIcon[i];
191 __pSoftkeyNormalIcon[i] = null;
194 if (__pSoftkeyPressedIcon[i])
196 delete __pSoftkeyPressedIcon[i];
197 __pSoftkeyPressedIcon[i] = null;
201 if (__ppOverlayerRegionImplArray != null)
203 int maxCount = OverlayRegion::GetMaxCount();
205 for (int i = 0; i < maxCount; i++)
207 if (__ppOverlayerRegionImplArray[i])
209 OverlayRegion* _pOverlayRegion = __ppOverlayerRegionImplArray[i]->GetOverlayRegion();
210 delete _pOverlayRegion;
214 delete[] __ppOverlayerRegionImplArray;
227 _Form::CreateFormN(void)
231 pForm = new (std::nothrow) _Form;
232 SysTryReturn(NID_UI_CTRL, pForm, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
233 SysTryCatch(NID_UI_CTRL, GetLastResult() == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
235 pForm->AcquireHandle();
237 SetLastResult(E_SUCCESS);
248 _Form::SetPresenter(const _FormPresenter& formPresenter)
250 __pFormPresenter = const_cast <_FormPresenter*>(&formPresenter);
258 if (__pFormPresenter)
260 __pFormPresenter->Draw();
263 if (__formStyle & FORM_STYLE_SOFTKEY_0 || __formStyle & FORM_STYLE_SOFTKEY_1 || __formStyle & FORM_STYLE_OPTIONKEY)
267 UpdateSoftkey(__formStyle);
270 if(unlikely((_AccessibilityManager::IsActivated())))
272 _AccessibilityManager::GetInstance()->RequestAutoReading(_ACCESSIBILITY_AUTO_READING_MODE_FIRST_ITEM);
278 _Form::SetFormBackEventListener(_IFormBackEventListener* pFormBackEventListener)
280 SysTryReturnVoidResult(NID_UI_CTRL, __pFooter || __pHeader, E_INVALID_STATE, "[E_INVALID_STATE] Footer and Header aren't constructed.");
281 __pFormBackEventListener = pFormBackEventListener;
284 __pFooter->SetBackEventListener(*this, ID_BACK_BUTTON);
288 __pHeader->SetBackEventListener(*this, ID_BACK_BUTTON);
291 SetLastResult(E_SUCCESS);
295 _Form::GetFormStyle(void) const
301 _Form::GetFooter(void) const
307 _Form::GetHeader(void) const
313 _Form::GetTab(void) const
319 _Form::GetIndicator(void) const
325 _Form::GetTitleText(void) const
327 if (__pHeader && (__formStyle & FORM_STYLE_TITLE))
329 return __pHeader->GetTitleText();
338 _Form::GetTitleTextHorizontalAlignment(void) const
340 if (__pHeader && (__formStyle & FORM_STYLE_TITLE))
342 return __pHeader->GetTitleTextHorizontalAlignment();
346 SysLog(NID_UI_CTRL, "[E_SYSTEM] The title is not valid.");
347 return ALIGNMENT_LEFT;
352 _Form::GetOverlayRegionN(const Rectangle& rect, OverlayRegionType regionType)
354 _OverlayRegionImpl* pOverlayRegionImpl = null;
355 OverlayRegion* pOverlayRegion = null;
356 Color bgColor(0, 0, 0, 0);
359 _OverlayPanel* pOverlayPanel = null;
361 bool modified = false;
365 maxCount = OverlayRegion::GetMaxCount();
366 SysTryReturn(NID_UI_CTRL, maxCount > 0, null, E_SYSTEM, "[E_SYSTEM] maxCount [%d] is invalid", maxCount);
368 if (__ppOverlayerRegionImplArray == null)
370 __ppOverlayerRegionImplArray = new (std::nothrow) _OverlayRegionImpl*[maxCount];
371 SysTryReturn(NID_UI_CTRL, __ppOverlayerRegionImplArray != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Can not allocate memory for the OverlayRegionList.");
373 for (int i = 0; i < maxCount; i++)
375 __ppOverlayerRegionImplArray[i] = null;
377 __overlayRegionCount = 0;
380 Rectangle clientRect(GetClientBounds());
381 Point overlayPosition(clientRect.x + rect.x, clientRect.y + rect.y);
382 Rectangle overlayRect(overlayPosition.x, overlayPosition.y, rect.width, rect.height);
384 Rectangle userPhyRect = _CoordinateSystemUtils::Transform(rect);
385 Rectangle devBounds = _CoordinateSystemUtils::Transform(overlayRect);
387 SysLog(NID_UI_CTRL, "rect [%d, %d, %d, %d] ", rect.x, rect.y, rect.width, rect.height);
388 SysLog(NID_UI_CTRL, "userPhyRect [%d, %d, %d, %d] ", userPhyRect.x, userPhyRect.y, userPhyRect.width, userPhyRect.height);
389 SysLog(NID_UI_CTRL, "overlayRect [%d, %d, %d, %d]", overlayPosition.x, overlayPosition.y, rect.width, rect.height);
390 SysLog(NID_UI_CTRL, "devBounds [%d, %d, %d, %d]", devBounds.x, devBounds.y, devBounds.width, devBounds.height);
392 // 1. width , height unit check
393 if (_OverlayRegionImpl::IsValidOverlayRect(overlayRect, devBounds, _CoordinateSystemUtils::Transform(clientRect), modified) != E_SUCCESS)
395 SysTryReturn(NID_UI_CTRL, 0, null, E_INVALID_ARG, "[E_INVALID_ARG] IsValidOverlayRect is failed!");
400 SysLog(NID_UI_CTRL, "devBounds modified [%d, %d, %d, %d]", devBounds.x, devBounds.y, devBounds.width, devBounds.height);
403 // 2. check for using OverlayPanel simutaneously
404 for (idx = 0 ; idx < GetChildCount() ; idx++)
406 pOverlayPanel = dynamic_cast <_OverlayPanel*>(GetChild(idx));
407 SysTryReturn(NID_UI_CTRL, pOverlayPanel == null, null, E_SYSTEM, "[E_SYSTEM] Using OverlayRegion mixed with OverlayPanel is not supported!");
410 // 3. find the empty slot idx
411 for (idx = 0; idx < maxCount; idx++)
413 if (__ppOverlayerRegionImplArray[idx] == null)
419 SysTryReturn(NID_UI_CTRL, idx < maxCount, null, E_SYSTEM, "[E_SYSTEM] already used permitted maximum number of OverlayRegion!");
421 // 4. make OverlayRegion object
422 pOverlayRegionImpl = new (std::nothrow) _OverlayRegionImpl();
423 SysTryReturn(NID_UI_CTRL, pOverlayRegionImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] failed to make the OverlayRegionImpl instance!");
425 FloatRectangle overlayRectF = _CoordinateSystemUtils::InverseTransform(_CoordinateSystemUtils::ConvertToFloat(devBounds));
426 r = pOverlayRegionImpl->Construct(this, regionType, _CoordinateSystemUtils::ConvertToFloat(rect), overlayRectF, devBounds);
429 delete pOverlayRegionImpl;
430 SysTryReturn(NID_UI_CTRL, 0, null, r, "[%s] Propagating.", GetErrorMessage(r));
433 pOverlayRegion = pOverlayRegionImpl->CreateOverlayRegionN();
434 if (pOverlayRegion == null)
436 delete pOverlayRegionImpl;
437 SysTryReturn(NID_UI_CTRL, 0, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
440 __ppOverlayerRegionImplArray[idx] = pOverlayRegionImpl;
441 pOverlayRegionImpl->SetFormArrayIndex(idx);
443 __overlayRegionCount++;
445 SetLastResult(E_SUCCESS);
447 return pOverlayRegion;
451 _Form::GetOverlayRegionN(const FloatRectangle& rect, OverlayRegionType regionType)
453 _OverlayRegionImpl* pOverlayRegionImpl = null;
454 OverlayRegion* pOverlayRegion = null;
455 Color bgColor(0, 0, 0, 0);
458 _OverlayPanel* pOverlayPanel = null;
460 bool modified = false;
464 maxCount = OverlayRegion::GetMaxCount();
465 SysTryReturn(NID_UI_CTRL, maxCount > 0, null, E_SYSTEM, "[E_SYSTEM] maxCount [%d] is invalid", maxCount);
467 if (__ppOverlayerRegionImplArray == null)
469 __ppOverlayerRegionImplArray = new (std::nothrow) _OverlayRegionImpl*[maxCount];
470 SysTryReturn(NID_UI_CTRL, __ppOverlayerRegionImplArray != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Can not allocate memory for the OverlayRegionList.");
472 for (int i = 0; i < maxCount; i++)
474 __ppOverlayerRegionImplArray[i] = null;
476 __overlayRegionCount = 0;
479 FloatRectangle clientRectF(GetClientBoundsF());
480 FloatPoint overlayPositionF(clientRectF.x + rect.x, clientRectF.y + rect.y);
481 FloatRectangle overlayRectF(overlayPositionF.x, overlayPositionF.y, rect.width, rect.height);
483 FloatRectangle devPhyBoundsF = _CoordinateSystemUtils::Transform(overlayRectF);
484 Rectangle devPhyBounds = _CoordinateSystemUtils::ConvertToInteger(devPhyBoundsF);
487 SysLog(NID_UI_CTRL, "user rect [%.3f, %.3f, %.3f, %.3f] ", rect.x, rect.y, rect.width, rect.height);
488 //adjustedlogical user float
489 SysLog(NID_UI_CTRL, "overlayRectF [%.3f, %.3f, %.3f, %.3f]", overlayRectF.x, overlayRectF.y, overlayRectF.width, overlayRectF.height);
490 //adjusted logical -> adjusted physical float
491 SysLog(NID_UI_CTRL, "devPhyBoundsF [%.3f, %.3f, %.3f, %.3f]", devPhyBoundsF.x, devPhyBoundsF.y, devPhyBoundsF.width, devPhyBoundsF.height);
492 //adjusted physical float -> physical integer
493 SysLog(NID_UI_CTRL, "devPhyBounds [%d, %.3d, %.3d, %.3d]", devPhyBounds.x, devPhyBounds.y, devPhyBounds.width, devPhyBounds.height);
495 Rectangle overlayLgcRect = _CoordinateSystemUtils::ConvertToInteger(overlayRectF);
496 Rectangle basePhyBounds = _CoordinateSystemUtils::ConvertToInteger(_CoordinateSystemUtils::Transform(clientRectF));
498 // 1. width , height unit check
499 if (_OverlayRegionImpl::IsValidOverlayRect(overlayLgcRect, devPhyBounds, basePhyBounds, modified) != E_SUCCESS)
501 SysTryReturn(NID_UI_CTRL, 0, null, E_INVALID_ARG, "[E_INVALID_ARG] IsValidOverlayRect is failed!");
506 SysLog(NID_UI_CTRL, "devBounds modified [%d, %d, %d, %d]", devPhyBounds.x, devPhyBounds.y, devPhyBounds.width, devPhyBounds.height);
509 // 2. check for using OverlayPanel simutaneously
510 for (idx = 0 ; idx < GetChildCount() ; idx++)
512 pOverlayPanel = dynamic_cast <_OverlayPanel*>(GetChild(idx));
513 SysTryReturn(NID_UI_CTRL, pOverlayPanel == null, null, E_SYSTEM, "[E_SYSTEM] Using OverlayRegion mixed with OverlayPanel is not supported!");
516 // 3. find the empty slot idx
517 for (idx = 0; idx < maxCount; idx++)
519 if (__ppOverlayerRegionImplArray[idx] == null)
525 SysTryReturn(NID_UI_CTRL, idx < maxCount, null, E_SYSTEM, "[E_SYSTEM] already used permitted maximum number of OverlayRegion!");
527 // 4. make OverlayRegion object
528 pOverlayRegionImpl = new (std::nothrow) _OverlayRegionImpl();
529 SysTryReturn(NID_UI_CTRL, pOverlayRegionImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] failed to make the OverlayRegionImpl instance!");
531 overlayRectF = _CoordinateSystemUtils::InverseTransform(_CoordinateSystemUtils::ConvertToFloat(devPhyBounds));
532 r = pOverlayRegionImpl->Construct(this, regionType, rect, overlayRectF, devPhyBounds);
535 delete pOverlayRegionImpl;
536 SysTryReturn(NID_UI_CTRL, 0, null, r, "[%s] Propagating.", GetErrorMessage(r));
539 pOverlayRegion = pOverlayRegionImpl->CreateOverlayRegionN();
540 if (pOverlayRegion == null)
542 delete pOverlayRegionImpl;
543 SysTryReturn(NID_UI_CTRL, 0, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
546 __ppOverlayerRegionImplArray[idx] = pOverlayRegionImpl;
547 pOverlayRegionImpl->SetFormArrayIndex(idx);
549 __overlayRegionCount++;
551 SetLastResult(E_SUCCESS);
553 return pOverlayRegion;
557 _Form::GetOverlayRegionCount(void) const
559 return __overlayRegionCount;
563 _Form::MoveOverlayRegion(bool top)
565 if (__ppOverlayerRegionImplArray == null)
569 for (int i = 0; i < OverlayRegion::GetMaxCount(); i++)
571 if (__ppOverlayerRegionImplArray[i] != null)
575 __ppOverlayerRegionImplArray[i]->GoForeground();
579 __ppOverlayerRegionImplArray[i]->GoBackground();
586 _Form::CreateSoftkey(unsigned long formStyle)
588 Bitmap* pTempBitmap = null;
589 FloatDimension softkeyDimension(0.0f, 0.0f);
590 FloatDimension softkeyDisplayDimension(0.0f, 0.0f);
591 FloatDimension optionkeyDimension(0.0f, 0.0f);
592 float softkeyTextSize = 0.0;
593 float leftSoftkeyLeftMargin = 0.0f;
594 float rightSoftkeyLeftMargin = 0.0f;
595 float softkeyTopMargin = 0.0f;
596 Color softkeyNormalBackgroundColor;
597 Color softkeyPressedBackgroundColor;
598 Color softkeyNormalTextColor;
599 Color softkeyPressedTextColor;
600 Color softkeyNormalIconColor;
601 Color softkeyPressedIconColor;
603 GET_DIMENSION_CONFIG(FOOTER::SOFTKEY_RECT, GetOrientation(), softkeyDimension);
604 GET_DIMENSION_CONFIG(FOOTER::SOFTKEY_DISPLAY_RECT_WITH_TEXT, GetOrientation(), softkeyDisplayDimension);
605 GET_DIMENSION_CONFIG(FOOTER::OPTIONKEY_RECT, GetOrientation(), optionkeyDimension);
606 GET_SHAPE_CONFIG(FOOTER::SOFTKEY_TEXT_SIZE, GetOrientation(), softkeyTextSize);
607 GET_SHAPE_CONFIG(FOOTER::SOFTKEY_0_LEFT_MARGIN, GetOrientation(), leftSoftkeyLeftMargin);
608 GET_SHAPE_CONFIG(FOOTER::SOFTKEY_1_LEFT_MARGIN, GetOrientation(), rightSoftkeyLeftMargin);
609 GET_SHAPE_CONFIG(FOOTER::SOFTKEY_TOP_MARGIN, GetOrientation(), softkeyTopMargin);
610 GET_COLOR_CONFIG(FOOTER::SOFTKEY_BG_NORMAL, softkeyNormalBackgroundColor);
611 GET_COLOR_CONFIG(FOOTER::SOFTKEY_BG_PRESSED, softkeyPressedBackgroundColor);
612 GET_COLOR_CONFIG(FOOTER::SOFTKEY_TEXT_NORMAL, softkeyNormalTextColor);
613 GET_COLOR_CONFIG(FOOTER::SOFTKEY_TEXT_PRESSED, softkeyPressedTextColor);
614 GET_COLOR_CONFIG(FOOTER::SOFTKEY_ICON_NORMAL, softkeyNormalIconColor);
615 GET_COLOR_CONFIG(FOOTER::SOFTKEY_ICON_PRESSED, softkeyPressedIconColor);
617 result r = E_SUCCESS;
619 if (__pFooter != null)
621 __pFooter->SetStyle(TOOLBAR_SOFTKEY);
624 if (formStyle & FORM_STYLE_SOFTKEY_0)
626 r = GET_BITMAP_CONFIG_N(FOOTER::SOFTKEY_LEFT_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
627 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
628 if (__pSoftkeyNormalBitmap[_SOFTKEY_0])
630 delete __pSoftkeyNormalBitmap[_SOFTKEY_0];
631 __pSoftkeyNormalBitmap[_SOFTKEY_0] = null;
633 __pSoftkeyNormalBitmap[_SOFTKEY_0] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyNormalBackgroundColor);
636 r = GET_BITMAP_CONFIG_N(FOOTER::SOFTKEY_LEFT_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
637 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
638 if (__pSoftkeyPressedBitmap[_SOFTKEY_0])
640 delete __pSoftkeyPressedBitmap[_SOFTKEY_0];
641 __pSoftkeyPressedBitmap[_SOFTKEY_0] = null;
643 __pSoftkeyPressedBitmap[_SOFTKEY_0] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyPressedBackgroundColor);
646 r = GET_BITMAP_CONFIG_N(FOOTER::SOFTKEY_LEFT_BG_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
647 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
648 if (__pSoftkeyNormalEffectBitmap[_SOFTKEY_0])
650 delete __pSoftkeyNormalEffectBitmap[_SOFTKEY_0];
651 __pSoftkeyNormalEffectBitmap[_SOFTKEY_0] = null;
653 __pSoftkeyNormalEffectBitmap[_SOFTKEY_0] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyNormalBackgroundColor);
656 r = GET_BITMAP_CONFIG_N(FOOTER::SOFTKEY_LEFT_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
657 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
658 if (__pSoftkeyPressedEffectBitmap[_SOFTKEY_0])
660 delete __pSoftkeyPressedEffectBitmap[_SOFTKEY_0];
661 __pSoftkeyPressedEffectBitmap[_SOFTKEY_0] = null;
663 __pSoftkeyPressedEffectBitmap[_SOFTKEY_0] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyPressedBackgroundColor);
666 r = GET_BITMAP_CONFIG_N(FOOTER::SOFTKEY_ICON_ADD_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
667 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
669 if (__pSoftkeyNormalIcon[_SOFTKEY_0])
671 delete __pSoftkeyNormalIcon[_SOFTKEY_0];
672 __pSoftkeyNormalIcon[_SOFTKEY_0] = null;
674 __pSoftkeyNormalIcon[_SOFTKEY_0] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyNormalIconColor);
676 if (__pSoftkeyPressedIcon[_SOFTKEY_0])
678 delete __pSoftkeyPressedIcon[_SOFTKEY_0];
679 __pSoftkeyPressedIcon[_SOFTKEY_0] = null;
681 __pSoftkeyPressedIcon[_SOFTKEY_0] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyPressedIconColor);
685 _Button* pButton = _Button::CreateButtonN();
689 pButton->SetSize(softkeyDimension);
690 pButton->SetTextSize(softkeyTextSize);
691 pButton->SetUserDefinedTextArea(FloatRectangle(leftSoftkeyLeftMargin, softkeyTopMargin, softkeyDisplayDimension.width, softkeyDisplayDimension.height));
692 pButton->SetTextColor(_BUTTON_STATUS_NORMAL, softkeyNormalTextColor);
693 pButton->SetTextColor(_BUTTON_STATUS_PRESSED, softkeyPressedTextColor);
694 __pFooter->SetButton(LEFT_BUTTON, pButton);
698 if (formStyle & FORM_STYLE_SOFTKEY_1)
700 r = GET_BITMAP_CONFIG_N(FOOTER::SOFTKEY_RIGHT_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
701 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
702 if (__pSoftkeyNormalBitmap[_SOFTKEY_1])
704 delete __pSoftkeyNormalBitmap[_SOFTKEY_1];
705 __pSoftkeyNormalBitmap[_SOFTKEY_1] = null;
707 __pSoftkeyNormalBitmap[_SOFTKEY_1] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyNormalBackgroundColor);
710 r = GET_BITMAP_CONFIG_N(FOOTER::SOFTKEY_RIGHT_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
711 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
712 if (__pSoftkeyPressedBitmap[_SOFTKEY_1])
714 delete __pSoftkeyPressedBitmap[_SOFTKEY_1];
715 __pSoftkeyPressedBitmap[_SOFTKEY_1] = null;
717 __pSoftkeyPressedBitmap[_SOFTKEY_1] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyPressedBackgroundColor);
720 r = GET_BITMAP_CONFIG_N(FOOTER::SOFTKEY_RIGHT_BG_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
721 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
722 if (__pSoftkeyNormalEffectBitmap[_SOFTKEY_1])
724 delete __pSoftkeyNormalEffectBitmap[_SOFTKEY_1];
725 __pSoftkeyNormalEffectBitmap[_SOFTKEY_1] = null;
727 __pSoftkeyNormalEffectBitmap[_SOFTKEY_1] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyNormalBackgroundColor);
730 r = GET_BITMAP_CONFIG_N(FOOTER::SOFTKEY_RIGHT_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
731 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
732 if (__pSoftkeyPressedEffectBitmap[_SOFTKEY_1])
734 delete __pSoftkeyPressedEffectBitmap[_SOFTKEY_1];
735 __pSoftkeyPressedEffectBitmap[_SOFTKEY_1] = null;
737 __pSoftkeyPressedEffectBitmap[_SOFTKEY_1] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyPressedBackgroundColor);
740 r = GET_BITMAP_CONFIG_N(FOOTER::SOFTKEY_ICON_ZOOM_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
741 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
743 if (__pSoftkeyNormalIcon[_SOFTKEY_1])
745 delete __pSoftkeyNormalIcon[_SOFTKEY_1];
746 __pSoftkeyNormalIcon[_SOFTKEY_1] = null;
748 __pSoftkeyNormalIcon[_SOFTKEY_1] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyNormalIconColor);
750 if (__pSoftkeyPressedIcon[_SOFTKEY_1])
752 delete __pSoftkeyPressedIcon[_SOFTKEY_1];
753 __pSoftkeyPressedIcon[_SOFTKEY_1] = null;
755 __pSoftkeyPressedIcon[_SOFTKEY_1] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyPressedIconColor);
759 _Button* pButton = _Button::CreateButtonN();
762 pButton->SetSize(softkeyDimension);
763 pButton->SetTextSize(softkeyTextSize);
764 pButton->SetUserDefinedTextArea(FloatRectangle(rightSoftkeyLeftMargin, softkeyTopMargin, softkeyDisplayDimension.width, softkeyDisplayDimension.height));
765 pButton->SetTextColor(_BUTTON_STATUS_NORMAL, softkeyNormalTextColor);
766 pButton->SetTextColor(_BUTTON_STATUS_PRESSED, softkeyPressedTextColor);
767 __pFooter->SetButton(RIGHT_BUTTON, pButton);
771 if (formStyle & FORM_STYLE_OPTIONKEY)
773 r = GET_BITMAP_CONFIG_N(FOOTER::OPTIONKEY_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
774 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
775 if (__pSoftkeyNormalBitmap[SOFTKEY_COUNT])
777 delete __pSoftkeyNormalBitmap[SOFTKEY_COUNT];
778 __pSoftkeyNormalBitmap[SOFTKEY_COUNT] = null;
780 __pSoftkeyNormalBitmap[SOFTKEY_COUNT] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyNormalBackgroundColor);
783 r = GET_BITMAP_CONFIG_N(FOOTER::OPTIONKEY_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
784 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
785 if (__pSoftkeyPressedBitmap[SOFTKEY_COUNT])
787 delete __pSoftkeyPressedBitmap[SOFTKEY_COUNT];
788 __pSoftkeyPressedBitmap[SOFTKEY_COUNT] = null;
790 __pSoftkeyPressedBitmap[SOFTKEY_COUNT] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyPressedBackgroundColor);
793 r = GET_BITMAP_CONFIG_N(FOOTER::OPTIONKEY_BG_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
794 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
795 if (__pSoftkeyNormalEffectBitmap[SOFTKEY_COUNT])
797 delete __pSoftkeyNormalEffectBitmap[SOFTKEY_COUNT];
798 __pSoftkeyNormalEffectBitmap[SOFTKEY_COUNT] = null;
800 __pSoftkeyNormalEffectBitmap[SOFTKEY_COUNT] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyNormalBackgroundColor);
803 r = GET_BITMAP_CONFIG_N(FOOTER::OPTIONKEY_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
804 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
805 if (__pSoftkeyPressedEffectBitmap[SOFTKEY_COUNT])
807 delete __pSoftkeyPressedEffectBitmap[SOFTKEY_COUNT];
808 __pSoftkeyPressedEffectBitmap[SOFTKEY_COUNT] = null;
810 __pSoftkeyPressedEffectBitmap[SOFTKEY_COUNT] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyPressedBackgroundColor);
813 r = GET_BITMAP_CONFIG_N(FOOTER::OPTIONKEY_HANDLE_MORE_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
814 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
816 if (__pSoftkeyNormalIcon[SOFTKEY_COUNT])
818 delete __pSoftkeyNormalIcon[SOFTKEY_COUNT];
819 __pSoftkeyNormalIcon[SOFTKEY_COUNT] = null;
821 __pSoftkeyNormalIcon[SOFTKEY_COUNT] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyNormalIconColor);
824 r = GET_BITMAP_CONFIG_N(FOOTER::OPTIONKEY_HANDLE_MORE_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
825 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
827 if (__pSoftkeyPressedIcon[SOFTKEY_COUNT])
829 delete __pSoftkeyPressedIcon[SOFTKEY_COUNT];
830 __pSoftkeyPressedIcon[SOFTKEY_COUNT] = null;
832 __pSoftkeyPressedIcon[SOFTKEY_COUNT] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyPressedIconColor);
835 _Button* pButton = _Button::CreateButtonN();
838 pButton->SetSize(optionkeyDimension);
839 pButton->SetTextColor(_BUTTON_STATUS_NORMAL, softkeyNormalTextColor);
840 pButton->SetTextColor(_BUTTON_STATUS_PRESSED, softkeyPressedTextColor);
841 __pFooter->SetButton(MIDDLE_BUTTON, pButton);
847 _Form::UpdateSoftkey(unsigned long formStyle)
849 float softkeyIconGap = 3.0f;
851 if (__formStyle & FORM_STYLE_SOFTKEY_0)// && __updatedSoftkeyCount % 2 == 0)
853 if (__pFooter->GetButton(LEFT_BUTTON))
855 __pFooter->GetButton(LEFT_BUTTON)->SetActionId(__actionId[_SOFTKEY_0]);
857 if (__pSoftkeyNormalBitmap[_SOFTKEY_0])
859 __pFooter->GetButton(LEFT_BUTTON)->SetBackgroundBitmap(_BUTTON_STATUS_NORMAL, *__pSoftkeyNormalBitmap[_SOFTKEY_0]);
862 if (__pSoftkeyNormalEffectBitmap[_SOFTKEY_0])
864 __pFooter->GetButton(LEFT_BUTTON)->SetBackgroundEffectBitmap(_BUTTON_STATUS_NORMAL, *__pSoftkeyNormalEffectBitmap[_SOFTKEY_0]);
867 if (__pSoftkeyPressedBitmap[_SOFTKEY_0])
869 __pFooter->GetButton(LEFT_BUTTON)->SetBackgroundBitmap(_BUTTON_STATUS_PRESSED, *__pSoftkeyPressedBitmap[_SOFTKEY_0]);
872 if (__pSoftkeyPressedEffectBitmap[_SOFTKEY_0])
874 __pFooter->GetButton(LEFT_BUTTON)->SetBackgroundEffectBitmap(_BUTTON_STATUS_PRESSED, *__pSoftkeyPressedEffectBitmap[_SOFTKEY_0]);
877 if (__softkeyText[_SOFTKEY_0] != String())
879 __pFooter->GetButton(LEFT_BUTTON)->SetText(__softkeyText[_SOFTKEY_0]);
881 __pFooter->RearrangeItems();
885 if (__pSoftkeyNormalIcon[_SOFTKEY_0])
887 __pFooter->GetButton(LEFT_BUTTON)->SetBitmap(_BUTTON_STATUS_NORMAL,
888 FloatPoint((__pFooter->GetButton(LEFT_BUTTON)->GetSizeF().width - __pSoftkeyNormalIcon[_SOFTKEY_0]->GetWidthF()) / 2,
889 (__pFooter->GetButton(LEFT_BUTTON)->GetSizeF().height - __pSoftkeyNormalIcon[_SOFTKEY_0]->GetHeightF()) / 2 + softkeyIconGap), *__pSoftkeyNormalIcon[_SOFTKEY_0]);
892 if (__pSoftkeyPressedIcon[_SOFTKEY_0])
894 __pFooter->GetButton(LEFT_BUTTON)->SetBitmap(_BUTTON_STATUS_PRESSED,
895 FloatPoint((__pFooter->GetButton(LEFT_BUTTON)->GetSizeF().width - __pSoftkeyPressedIcon[_SOFTKEY_0]->GetWidthF()) / 2,
896 (__pFooter->GetButton(LEFT_BUTTON)->GetSizeF().height - __pSoftkeyPressedIcon[_SOFTKEY_0]->GetHeightF()) / 2 + softkeyIconGap), *__pSoftkeyPressedIcon[_SOFTKEY_0]);
902 if (__formStyle & FORM_STYLE_SOFTKEY_1)// && __updatedSoftkeyCount % 2 == 0)
904 if (__pFooter->GetButton(RIGHT_BUTTON))
906 __pFooter->GetButton(RIGHT_BUTTON)->SetActionId(__actionId[_SOFTKEY_1]);
908 if (__pSoftkeyNormalBitmap[_SOFTKEY_1])
910 __pFooter->GetButton(RIGHT_BUTTON)->SetBackgroundBitmap(_BUTTON_STATUS_NORMAL, *__pSoftkeyNormalBitmap[_SOFTKEY_1]);
913 if (__pSoftkeyNormalEffectBitmap[_SOFTKEY_1])
915 __pFooter->GetButton(RIGHT_BUTTON)->SetBackgroundEffectBitmap(_BUTTON_STATUS_NORMAL, *__pSoftkeyNormalEffectBitmap[_SOFTKEY_1]);
918 if (__pSoftkeyPressedBitmap[_SOFTKEY_1])
920 __pFooter->GetButton(RIGHT_BUTTON)->SetBackgroundBitmap(_BUTTON_STATUS_PRESSED, *__pSoftkeyPressedBitmap[_SOFTKEY_1]);
923 if (__pSoftkeyPressedEffectBitmap[_SOFTKEY_1])
925 __pFooter->GetButton(RIGHT_BUTTON)->SetBackgroundEffectBitmap(_BUTTON_STATUS_PRESSED, *__pSoftkeyPressedEffectBitmap[_SOFTKEY_1]);
928 if (__softkeyText[_SOFTKEY_1] != String())
930 __pFooter->GetButton(RIGHT_BUTTON)->SetText(__softkeyText[_SOFTKEY_1]);
932 __pFooter->RearrangeItems();
936 if (__pSoftkeyNormalIcon[_SOFTKEY_1])
938 __pFooter->GetButton(RIGHT_BUTTON)->SetBitmap(_BUTTON_STATUS_NORMAL,
939 FloatPoint((__pFooter->GetButton(RIGHT_BUTTON)->GetSizeF().width - __pSoftkeyNormalIcon[_SOFTKEY_1]->GetWidthF()) / 2,
940 (__pFooter->GetButton(RIGHT_BUTTON)->GetSizeF().height - __pSoftkeyNormalIcon[_SOFTKEY_1]->GetHeightF()) / 2 + softkeyIconGap), *__pSoftkeyNormalIcon[_SOFTKEY_1]);
943 if (__pSoftkeyPressedIcon[_SOFTKEY_1])
945 __pFooter->GetButton(RIGHT_BUTTON)->SetBitmap(_BUTTON_STATUS_PRESSED,
946 FloatPoint((__pFooter->GetButton(RIGHT_BUTTON)->GetSizeF().width - __pSoftkeyPressedIcon[_SOFTKEY_1]->GetWidthF()) / 2,
947 (__pFooter->GetButton(RIGHT_BUTTON)->GetSizeF().height - __pSoftkeyPressedIcon[_SOFTKEY_1]->GetHeightF()) / 2 + softkeyIconGap), *__pSoftkeyPressedIcon[_SOFTKEY_1]);
953 if (__formStyle & FORM_STYLE_OPTIONKEY)// && __updatedSoftkeyCount % 2 == 0)
955 if (__pFooter->GetButton(MIDDLE_BUTTON))
957 __pFooter->GetButton(MIDDLE_BUTTON)->SetActionId(__actionId[SOFTKEY_COUNT]);
959 if (__pSoftkeyNormalBitmap[SOFTKEY_COUNT])
961 __pFooter->GetButton(MIDDLE_BUTTON)->SetBackgroundBitmap(_BUTTON_STATUS_NORMAL, *__pSoftkeyNormalBitmap[SOFTKEY_COUNT]);
964 if (__pSoftkeyPressedBitmap[SOFTKEY_COUNT])
966 __pFooter->GetButton(MIDDLE_BUTTON)->SetBackgroundBitmap(_BUTTON_STATUS_PRESSED, *__pSoftkeyPressedBitmap[SOFTKEY_COUNT]);
969 if (__pSoftkeyNormalEffectBitmap[SOFTKEY_COUNT])
971 __pFooter->GetButton(MIDDLE_BUTTON)->SetBackgroundEffectBitmap(_BUTTON_STATUS_NORMAL, *__pSoftkeyNormalEffectBitmap[SOFTKEY_COUNT]);
974 if (__pSoftkeyPressedEffectBitmap[SOFTKEY_COUNT])
976 __pFooter->GetButton(MIDDLE_BUTTON)->SetBackgroundEffectBitmap(_BUTTON_STATUS_PRESSED, *__pSoftkeyPressedEffectBitmap[SOFTKEY_COUNT]);
979 if (__pSoftkeyNormalIcon[SOFTKEY_COUNT])
981 __pFooter->GetButton(MIDDLE_BUTTON)->SetBitmap(_BUTTON_STATUS_NORMAL, FloatPoint(0.0f, 0.0f), *__pSoftkeyNormalIcon[SOFTKEY_COUNT]);
984 if (__pSoftkeyPressedIcon[SOFTKEY_COUNT])
986 __pFooter->GetButton(MIDDLE_BUTTON)->SetBitmap(_BUTTON_STATUS_PRESSED, FloatPoint(0.0f, 0.0f), *__pSoftkeyPressedIcon[SOFTKEY_COUNT]);
991 //__updatedSoftkeyCount++;
995 _Form::GetDescription(void) const
997 String description = _Control::GetDescription();
999 String descriptionTemp(L"");
1001 descriptionTemp.Format(LOG_LEN_MAX, L"_Form: style(%d) transparent(%d %d %d %d) deflated(%d) deflatedHeight(%d) overlayRegionCount(%d) softkeyCount(%d) updatedSoftkeyCount(%d)",
1002 __formStyle, __transparentIndicator, __transparentHeader, __transparentFooter, __transparentTab, __deflated, __deflatedHeight,
1003 __overlayRegionCount, __softkeyCount, __updatedSoftkeyCount);
1005 description.Append(descriptionTemp);
1011 _Form::GetClientAreaCanvasN(void) const
1013 Canvas* pCanvas = GetCanvasN(GetClientBounds());
1014 if ((pCanvas == null) || (GetLastResult() != E_SUCCESS))
1016 SysLog(NID_UI_CTRL, "[%s] Propagated.", GetErrorMessage(GetLastResult()));
1025 _Form::GetSoftkeyActionId(_Softkey softkey) const
1027 if (CheckSoftkey(softkey) == false)
1032 return __actionId[softkey];
1036 _Form::GetOptionkeyActionId(void) const
1038 if (HasOptionkey() == false)
1043 return __actionId[SOFTKEY_COUNT];
1047 _Form::GetSoftkeyText(_Softkey softkey) const
1049 if (CheckSoftkey(softkey) == false)
1054 return __softkeyText[softkey];
1058 _Form::SetFormStyle(unsigned long formStyle)
1060 result r = E_SUCCESS;
1062 __formStyle = formStyle;
1066 __pIndicator = CreateIndicatorN();
1067 SysTryReturnVoidResult(NID_UI_CTRL, __pIndicator != null, r, "[%s] Propagating.", GetErrorMessage(r));
1069 float indicatorwidth = GetClientBoundsF().width;
1070 float indicatorheight = 0.0f;
1072 GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, GetOrientation(), indicatorheight);
1074 __pIndicator->SetBounds(FloatRectangle(0.0f, 0.0f, indicatorwidth, indicatorheight));
1076 r = GetLastResult();
1077 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1082 _Form::SetActionBarsTranslucent(unsigned long actionBars, bool translucent)
1086 ((actionBars & FORM_ACTION_BAR_INDICATOR) || (actionBars & FORM_ACTION_BAR_HEADER) ||
1087 (actionBars & FORM_ACTION_BAR_FOOTER) || (actionBars & FORM_ACTION_BAR_TAB)),
1088 E_INVALID_OPERATION, E_INVALID_OPERATION,
1089 ("[E_INVALID_OPERATION] The current state of the instance prohibits the execution of the specified operation."));
1091 if ((!(__formStyle & FORM_STYLE_INDICATOR) && (actionBars & FORM_ACTION_BAR_INDICATOR))
1092 || (!(__formStyle & FORM_STYLE_HEADER) && (actionBars & FORM_ACTION_BAR_HEADER))
1093 || (!(__formStyle & FORM_STYLE_FOOTER) && (actionBars & FORM_ACTION_BAR_FOOTER))
1094 || (!(__formStyle & FORM_STYLE_TEXT_TAB) && (actionBars & FORM_ACTION_BAR_TAB)))
1097 "[E_INVALID_OPERATION] The current state of the instance prohibits the execution of the specified operation.");
1098 return E_INVALID_OPERATION;
1101 result r = E_SUCCESS;
1103 Color bgColor(0, 0, 0, 0);
1104 if (actionBars & FORM_ACTION_BAR_INDICATOR)
1108 r = SetIndicatorOpacity(_INDICATOR_OPACITY_TRANSLUCENT);
1112 r = SetIndicatorOpacity(_INDICATOR_OPACITY_OPAQUE);
1114 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1117 if (actionBars & FORM_ACTION_BAR_HEADER)
1119 if (IsHeaderTranslucent() != translucent)
1123 __pHeader->SetTransparent(translucent);
1124 __transparentHeader = translucent;
1129 if (IsHeaderVisible())
1131 if (IsIndicatorTranslucent() != IsHeaderTranslucent())
1133 if (IsIndicatorTranslucent())
1135 r = SetIndicatorOpacity(_INDICATOR_OPACITY_OPAQUE);
1136 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1141 if (actionBars & FORM_ACTION_BAR_FOOTER)
1143 if (IsFooterTranslucent() != translucent)
1147 __pFooter->SetTransparent(translucent);
1148 __transparentFooter = translucent;
1153 AdjustClientBounds();
1159 _Form::SetActionBarsVisible(unsigned long actionBars, bool visible)
1163 ((actionBars & FORM_ACTION_BAR_INDICATOR) || (actionBars & FORM_ACTION_BAR_HEADER) ||
1164 (actionBars & FORM_ACTION_BAR_FOOTER)),
1165 E_INVALID_OPERATION,
1166 E_INVALID_OPERATION,
1167 ("[E_INVALID_OPERATION] The current state of the instance prohibits the execution of the specified operation. "));
1169 if ((!(__formStyle & FORM_STYLE_INDICATOR) && (actionBars & FORM_ACTION_BAR_INDICATOR))
1170 || (!(__formStyle & FORM_STYLE_HEADER) && (actionBars & FORM_ACTION_BAR_HEADER))
1171 || (!(__formStyle & FORM_STYLE_FOOTER) && (actionBars & FORM_ACTION_BAR_FOOTER)))
1173 SysLog(NID_UI_CTRL, "[E_INVALID_OPERATION] The current state of the instance prohibits the execution of the specified operation.");
1174 return E_INVALID_OPERATION;
1177 FloatRectangle bounds = GetBoundsF();
1180 if (actionBars & FORM_ACTION_BAR_INDICATOR)
1182 SetIndicatorShowState(visible);
1185 if (actionBars & FORM_ACTION_BAR_HEADER)
1187 if (IsHeaderVisible() != visible)
1191 if (visible == true)
1193 float adjHeight = 0.0f;
1194 if (IsIndicatorVisible())
1196 FloatRectangle indicatorBounds = GetIndicatorBoundsF();
1197 adjHeight = indicatorBounds.height;
1199 FloatRectangle bounds = __pHeader->GetBoundsF();
1200 bounds.y = adjHeight;
1202 SetHeaderBounds(bounds);
1204 __pHeader->SetVisibleState(visible);
1209 if (actionBars & FORM_ACTION_BAR_FOOTER)
1213 __pFooter->SetVisibleState(visible);
1217 AdjustClientBounds();
1223 _Form::SetTitleIcon(const Bitmap* pTitleBitmap)
1225 SysTryReturn(NID_UI_CTRL, (__formStyle & FORM_STYLE_TITLE), E_INVALID_OPERATION,
1226 E_INVALID_OPERATION, "[E_INVALID_OPERATION] This API is only for FORM_STYLE_TITLE.");
1228 SysTryReturn(NID_UI_CTRL, __pHeader, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] The title is not valid.");
1230 result r = __pHeader->SetTitleIcon(*pTitleBitmap);
1231 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1237 _Form::SetTitleText(const String& title, HorizontalAlignment alignment)
1239 SysTryReturn(NID_UI_CTRL, (__formStyle & FORM_STYLE_TITLE), E_INVALID_OPERATION,
1240 E_INVALID_OPERATION, "[E_INVALID_OPERATION] This API is only for FORM_STYLE_TITLE.");
1242 SysTryReturn(NID_UI_CTRL, __pHeader, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] The title is not valid.");
1244 result r = __pHeader->SetTitleText(title, alignment);
1245 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1251 _Form::SetSoftkeyEnabled(_Softkey softkey, bool enable)
1253 result r = E_SYSTEM;
1255 if (CheckSoftkey(softkey) == false)
1260 __enableSoftkey[softkey] = enable;
1268 _Form::SetOptionkeyActionId(int actionId)
1270 result r = E_SYSTEM;
1272 if (HasOptionkey() == false)
1277 __actionId[SOFTKEY_COUNT] = actionId;
1285 _Form::SetSoftkeyActionId(_Softkey softkey, int actionId)
1287 result r = E_SYSTEM;
1289 if (CheckSoftkey(softkey) == false)
1294 __actionId[softkey] = actionId;
1302 _Form::SetSoftkeyText(_Softkey softkey, const String& text)
1304 result r = E_SYSTEM;
1306 if (CheckSoftkey(softkey) == false)
1311 __softkeyText[softkey] = text;
1319 _Form::SetSoftkeyIcon(_Softkey softkey, const Bitmap& normalBitmap, const Bitmap* pPressedBitmap)
1321 result r = E_SYSTEM;
1323 if (CheckSoftkey(softkey) == false)
1328 float softkey_icon_size = 0.0f;
1330 GET_SHAPE_CONFIG(FOOTER::SOFTKEY_ICON_SIZE, GetOrientation(), softkey_icon_size);
1332 Bitmap* pClonedNormalBitmap = _BitmapImpl::CloneN(normalBitmap);
1334 if (pClonedNormalBitmap)
1336 if (__pSoftkeyNormalIcon[softkey] != null)
1338 delete __pSoftkeyNormalIcon[softkey];
1341 __pSoftkeyNormalIcon[softkey] = pClonedNormalBitmap;
1343 __pSoftkeyNormalIcon[softkey]->Scale(FloatDimension(softkey_icon_size, softkey_icon_size));
1348 if (pPressedBitmap != null)
1350 Bitmap* pClonedPressedBitmap = _BitmapImpl::CloneN(*pPressedBitmap);
1352 if (pClonedPressedBitmap)
1354 if (__pSoftkeyPressedIcon[softkey] != null)
1356 delete __pSoftkeyPressedIcon[softkey];
1359 __pSoftkeyPressedIcon[softkey] = pClonedPressedBitmap;
1361 __pSoftkeyPressedIcon[softkey]->Scale(FloatDimension(softkey_icon_size, softkey_icon_size));
1371 _Form::HasFooter(void) const
1384 _Form::HasHeader(void) const
1397 _Form::HasIndicator(void) const
1399 if (__pIndicator && (GetFormStyle() & FORM_STYLE_INDICATOR))
1410 _Form::HasTitle(void) const
1412 if (__pHeader && (__formStyle & FORM_STYLE_TITLE))
1423 _Form::HasTab(void) const
1425 if ((__pTab && (__formStyle & FORM_STYLE_TEXT_TAB))
1426 || (__pTab && (__formStyle & FORM_STYLE_ICON_TAB)))
1437 _Form::IsIndicatorVisible(void) const
1439 _Control* pParent = GetParent();
1440 _Frame* pFrame = dynamic_cast<_Frame*>(pParent);
1442 bool visible = true;
1444 if (pFrame && IsAttachedToMainTree())
1446 visible = __pIndicator->GetIndicatorShowState();
1447 SysTryReturn(NID_UI_CTRL, GetLastResult() == E_SUCCESS, false, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1451 visible = __indicatorShowState;
1458 _Form::IsHeaderVisible(void) const
1462 return __pHeader->IsVisible();
1466 SysLog(NID_UI_CTRL, "[E_SYSTEM] The header is not valid.");
1472 _Form::IsFooterVisible(void) const
1476 return __pFooter->IsVisible();
1480 SysLog(NID_UI_CTRL, "[E_SYSTEM] The footer is not valid.");
1486 _Form::IsIndicatorTranslucent(void) const
1488 _Control* pParent = GetParent();
1489 _Frame* pFrame = dynamic_cast<_Frame*>(pParent);
1491 _IndicatorOpacity opacity = _INDICATOR_OPACITY_UNKNOWN;
1493 bool transparent = false;
1495 if (pFrame && IsAttachedToMainTree())
1497 FrameShowMode mode = pFrame->GetShowMode();
1498 if (mode == FRAME_SHOW_MODE_FULL_SCREEN)
1500 opacity = __pIndicator->GetIndicatorOpacity();
1501 SysTryReturn(NID_UI_CTRL, GetLastResult() == E_SUCCESS, false, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1503 if (opacity == _INDICATOR_OPACITY_TRANSLUCENT)
1507 else if (opacity == _INDICATOR_OPACITY_OPAQUE)
1509 transparent = false;
1515 transparent = __transparentIndicator;
1522 _Form::IsHeaderTranslucent(void) const
1524 return __transparentHeader;
1528 _Form::IsFooterTranslucent(void) const
1530 return __transparentFooter;
1534 _Form::IsTabTranslucent(void) const
1536 return __transparentTab;
1540 _Form::HasOptionkey(void) const
1542 if (GetFormStyle() & FORM_STYLE_OPTIONKEY)
1553 _Form::HasSoftkey(_Softkey softkey) const
1555 unsigned long __formStyle = FORM_STYLE_NORMAL;
1557 if (softkey == _SOFTKEY_0)
1559 __formStyle = FORM_STYLE_SOFTKEY_0;
1561 else if (softkey == _SOFTKEY_1)
1563 __formStyle = FORM_STYLE_SOFTKEY_1;
1570 if (GetFormStyle() & __formStyle)
1581 _Form::IsSoftkeyEnabled(_Softkey softkey) const
1583 if (CheckSoftkey(softkey) == false)
1588 return __enableSoftkey[softkey];
1592 _Form::CheckSoftkey(_Softkey softkey) const
1596 if (HasSoftkey(softkey) == false)
1601 if (softkey >= _SOFTKEY_COUNT)
1610 _Form::IsOrientationRoot(void) const
1616 _Form::TranslateToClientAreaPosition(const Point& position) const
1618 Rectangle clientArea = GetClientBounds();
1619 return Point(position.x - clientArea.x, position.y - clientArea.y);
1623 _Form::TranslateToClientAreaPosition(const FloatPoint& position) const
1625 FloatRectangle clientArea = GetClientBoundsF();
1626 return FloatPoint(position.x - clientArea.x, position.y - clientArea.y);
1630 _Form::TranslateFromClientAreaPosition(const Point& clientPosition) const
1632 Rectangle clientArea = GetClientBounds();
1633 return Point(clientPosition.x + clientArea.x, clientPosition.y + clientArea.y);
1637 _Form::TranslateFromClientAreaPosition(const FloatPoint& clientPosition) const
1639 FloatRectangle clientArea = GetClientBoundsF();
1640 return FloatPoint(clientPosition.x + clientArea.x, clientPosition.y + clientArea.y);
1644 _Form::DeflateClientRectHeight(int height)
1655 __deflatedHeight = _CoordinateSystemUtils::ConvertToFloat(height);
1657 AdjustClientBounds();
1661 float adjHeight = 0.0f;
1663 if (!(__pFooter->GetVisibleState()) || IsFooterTranslucent())
1665 adjHeight = GetToolbarHeightF(false);
1668 FloatRectangle bounds(0.0f, GetClientBoundsF().y + GetClientBoundsF().height-adjHeight,
1669 GetClientBoundsF().width, GetToolbarHeightF(false));
1670 SetFooterBounds(bounds);
1677 _Form::DeflateClientRectHeight(float height)
1688 __deflatedHeight = height;
1690 AdjustClientBounds();
1694 float adjHeight = 0.0f;
1696 if (!(__pFooter->GetVisibleState()) || IsFooterTranslucent())
1698 adjHeight = GetToolbarHeightF(false);
1701 FloatRectangle bounds(0.0f, GetClientBoundsF().y + GetClientBoundsF().height-adjHeight,
1702 GetClientBoundsF().width, GetToolbarHeightF(false));
1703 SetFooterBounds(bounds);
1710 _Form::CreateHeaderN(void)
1712 _Toolbar* __pHeader = _Toolbar::CreateToolbarN(true);
1713 SysTryReturn(NID_UI_CTRL, __pHeader, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1719 _Form::CreateFooterN(void)
1721 _Toolbar* __pFooter = _Toolbar::CreateToolbarN(false);
1722 SysTryReturn(NID_UI_CTRL, __pFooter, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1728 _Form::CreateTabN(void)
1730 _Tab* __pTab = _Tab::CreateTabN();
1731 SysTryReturn(NID_UI_CTRL, __pTab, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1737 _Form::CreateIndicatorN(void)
1739 _Indicator* pIndicator = new (std::nothrow) _Indicator;
1740 SysTryReturn(NID_UI_CTRL, pIndicator, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1746 _Form::GetToolbarHeight(bool header) const
1748 int toolbarHeight = 0;
1750 if (header && (__formStyle & FORM_STYLE_HEADER))
1754 toolbarHeight = __pHeader->GetBounds().height;
1757 else if (header && (__formStyle & FORM_STYLE_TITLE))
1759 GET_SHAPE_CONFIG(HEADER::HEIGHT, GetOrientation(), toolbarHeight);
1761 else if (__formStyle & FORM_STYLE_SOFTKEY_0 || __formStyle & FORM_STYLE_SOFTKEY_1 || __formStyle & FORM_STYLE_OPTIONKEY)
1763 GET_SHAPE_CONFIG(FOOTER::SOFTKEY_HEIGHT, GetOrientation(), toolbarHeight);
1769 toolbarHeight = __pFooter->GetBounds().height;
1772 //GET_SHAPE_CONFIG(L"FOOTER_HEIGHT", GetOrientation(), toolbarHeight);
1775 return toolbarHeight;
1779 _Form::GetToolbarHeightF(bool header) const
1781 FloatDimension toolbarSize(0.0f, 0.0f);
1783 if (header && (__formStyle & FORM_STYLE_HEADER))
1787 toolbarSize.height = __pHeader->GetBoundsF().height;
1790 else if (header && (__formStyle & FORM_STYLE_TITLE))
1792 GET_SHAPE_CONFIG(HEADER::HEIGHT, GetOrientation(), toolbarSize.height);
1794 else if (__formStyle & FORM_STYLE_SOFTKEY_0 || __formStyle & FORM_STYLE_SOFTKEY_1 || __formStyle & FORM_STYLE_OPTIONKEY)
1796 GET_SHAPE_CONFIG(FOOTER::SOFTKEY_HEIGHT, GetOrientation(), toolbarSize.height);
1802 toolbarSize.height = __pFooter->GetBoundsF().height;
1806 toolbarSize = TranslateSize(toolbarSize);
1808 return toolbarSize.height;
1812 _Form::GetTabHeight(void) const
1816 if ((__formStyle & FORM_STYLE_TEXT_TAB) || (__formStyle & FORM_STYLE_ICON_TAB))
1818 GET_SHAPE_CONFIG(TAB::HEIGHT, GetOrientation(), height);
1825 _Form::GetTabHeightF(void) const
1827 FloatDimension tabSize(0.0f, 0.0f);
1829 if ((__formStyle & FORM_STYLE_TEXT_TAB) || (__formStyle & FORM_STYLE_ICON_TAB))
1831 GET_SHAPE_CONFIG(TAB::HEIGHT, GetOrientation(), tabSize.height);
1834 tabSize = TranslateSize(tabSize);
1836 return tabSize.height;
1840 _Form::RemoveHeader(void)
1842 result r = E_SUCCESS;
1845 r = DetachSystemChild(*__pHeader);
1846 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1849 AdjustClientBounds();
1860 _Form::RemoveFooter(void)
1862 result r = E_SUCCESS;
1865 r = DetachSystemChild(*__pFooter);
1866 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1869 AdjustClientBounds();
1880 _Form::RemoveTab(void)
1882 result r = E_SUCCESS;
1885 r = DetachSystemChild(*__pTab);
1886 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1889 AdjustClientBounds();
1900 _Form::RemoveIndicator(void)
1902 result r = E_SUCCESS;
1905 r = DetachSystemChild(*__pIndicator);
1906 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1907 __pIndicator = null;
1918 _Form::SetHeaderBounds(Rectangle& bounds)
1920 SysTryReturn(NID_UI_CTRL, __pHeader, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] Header isn't constructed.");
1922 bool movable = __pHeader->IsMovable();
1923 bool resizable = __pHeader->IsResizable();
1925 __pHeader->SetMovable(true);
1926 __pHeader->SetResizable(true);
1928 result r = E_SUCCESS;
1929 r = __pHeader->SetBounds(_CoordinateSystemUtils::ConvertToFloat(bounds));
1930 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1932 __pHeader->SetMovable(movable);
1933 __pHeader->SetResizable(resizable);
1935 AdjustClientBounds();
1941 _Form::SetHeaderBounds(FloatRectangle& bounds)
1943 SysTryReturn(NID_UI_CTRL, __pHeader, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] Header isn't constructed.");
1945 bool movable = __pHeader->IsMovable();
1946 bool resizable = __pHeader->IsResizable();
1948 __pHeader->SetMovable(true);
1949 __pHeader->SetResizable(true);
1951 result r = E_SUCCESS;
1952 r = __pHeader->SetBounds(bounds);
1953 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1955 __pHeader->SetMovable(movable);
1956 __pHeader->SetResizable(resizable);
1958 AdjustClientBounds();
1964 _Form::SetFooterBounds(Rectangle& bounds)
1966 SysTryReturn(NID_UI_CTRL, __pFooter, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] Footer isn't constructed.");
1968 bool movable = __pFooter->IsMovable();
1969 bool resizable = __pFooter->IsResizable();
1971 __pFooter->SetMovable(true);
1972 __pFooter->SetResizable(true);
1974 result r = E_SUCCESS;
1975 r = __pFooter->SetBounds(_CoordinateSystemUtils::ConvertToFloat(bounds));
1976 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1978 __pFooter->SetMovable(movable);
1979 __pFooter->SetResizable(resizable);
1981 AdjustClientBounds();
1987 _Form::SetFooterBounds(FloatRectangle& bounds)
1989 SysTryReturn(NID_UI_CTRL, __pFooter, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] Footer isn't constructed.");
1991 bool movable = __pFooter->IsMovable();
1992 bool resizable = __pFooter->IsResizable();
1994 __pFooter->SetMovable(true);
1995 __pFooter->SetResizable(true);
1997 result r = E_SUCCESS;
1998 r = __pFooter->SetBounds(bounds);
1999 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2001 __pFooter->SetMovable(movable);
2002 __pFooter->SetResizable(resizable);
2004 AdjustClientBounds();
2010 _Form::SetTabBounds(Rectangle& bounds)
2012 SysTryReturn(NID_UI_CTRL, __pTab, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] Tab isn't constructed.");
2014 bool movable = __pTab->IsMovable();
2015 bool resizable = __pTab->IsResizable();
2017 __pTab->SetMovable(true);
2018 __pTab->SetResizable(true);
2020 result r = E_SUCCESS;
2021 r = __pTab->SetBounds(_CoordinateSystemUtils::ConvertToFloat(bounds));
2022 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2024 __pTab->SetMovable(movable);
2025 __pTab->SetResizable(resizable);
2027 AdjustClientBounds();
2033 _Form::SetTabBounds(FloatRectangle& bounds)
2035 SysTryReturn(NID_UI_CTRL, __pTab, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] Tab isn't constructed.");
2037 bool movable = __pTab->IsMovable();
2038 bool resizable = __pTab->IsResizable();
2040 __pTab->SetMovable(true);
2041 __pTab->SetResizable(true);
2043 result r = E_SUCCESS;
2044 r = __pTab->SetBounds(bounds);
2045 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2047 __pTab->SetMovable(movable);
2048 __pTab->SetResizable(resizable);
2050 AdjustClientBounds();
2056 _Form::AddActionEventListener(_IActionEventListener& listener)
2058 if (__pActionEvent == null)
2060 __pActionEvent = _ActionEvent::CreateInstanceN(*this);
2062 SysTryReturn(NID_UI_CTRL, __pActionEvent, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] System error occurred.")
2065 result r = __pActionEvent->AddListener(listener);
2066 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2072 _Form::AddOptionkeyActionListener(_IActionEventListener& listener)
2074 if (HasOptionkey() == false)
2081 _Form::AddSoftkeyActionListener(_Softkey softkey, _IActionEventListener& listener)
2083 if (CheckSoftkey(softkey) == false)
2090 _Form::RemoveActionEventListener(_IActionEventListener& listener)
2092 SysTryReturn(NID_UI_CTRL, __pActionEvent, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] This instance isn't constructed.")
2093 // Todo : check fail case of RemoveListener
2094 result r = __pActionEvent->RemoveListener(listener);
2095 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2101 _Form::RemoveOptionkeyActionListener(_IActionEventListener& listener)
2103 if (HasOptionkey() == false)
2110 _Form::RemoveSoftkeyActionListener(_Softkey softkey, _IActionEventListener& listener)
2112 if (CheckSoftkey(softkey) == false)
2119 _Form::OnActionPerformed(const _Control& source, int actionId)
2123 case ID_BACK_BUTTON:
2124 if (__keypadShowstate)
2126 _SystemUtilImpl::GenerateKeyEvent(KEY_EVENT_TYPE_PRESSED, _KEY_STOP);
2127 _SystemUtilImpl::GenerateKeyEvent(KEY_EVENT_TYPE_RELEASED, _KEY_STOP);
2131 if (__pFormBackEventListener)
2133 __pFormBackEventListener->OnFormBackRequested(*this);
2144 _Form::OnChildVisibleStateChanged(const _Control& child)
2146 if (IsHeaderVisible())
2148 float adjHeight = 0.0f;
2149 if (IsIndicatorVisible())
2151 FloatRectangle indicatorBounds = GetIndicatorBoundsF();
2152 adjHeight = indicatorBounds.height;
2154 FloatRectangle bounds = __pHeader->GetBoundsF();
2155 bounds.y = adjHeight;
2156 SetHeaderBounds(bounds);
2159 AdjustClientBounds();
2163 _Form::GetIndicatorBounds(void) const
2165 _Control* pParent = GetParent();
2166 _Frame* pFrame = dynamic_cast<_Frame*>(pParent);
2170 FrameShowMode mode = pFrame->GetShowMode();
2171 if (mode != FRAME_SHOW_MODE_FULL_SCREEN)
2173 return Rectangle(0, 0, 0, 0);
2177 int indicatorwidth = GetClientBounds().width;
2178 int indicatorheight = 0;
2180 if (GetOrientation() == _CONTROL_ORIENTATION_PORTRAIT)
2182 GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, GetOrientation(), indicatorheight);
2186 GET_SHAPE_CONFIG(FORM::INDICATOR_MINIMIZE_HEIGHT, GetOrientation(), indicatorheight);
2189 Rectangle rect (0, 0, indicatorwidth, indicatorheight);
2191 SetLastResult(E_SUCCESS);
2197 _Form::GetIndicatorBoundsF(void) const
2199 _Control* pParent = GetParent();
2200 _Frame* pFrame = dynamic_cast<_Frame*>(pParent);
2204 FrameShowMode mode = pFrame->GetShowMode();
2205 if (mode != FRAME_SHOW_MODE_FULL_SCREEN)
2207 return FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f);
2211 float indicatorwidth = GetClientBoundsF().width;
2212 float indicatorheight = 0.0f;
2214 if (GetOrientation() == _CONTROL_ORIENTATION_PORTRAIT)
2216 GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, GetOrientation(), indicatorheight);
2220 GET_SHAPE_CONFIG(FORM::INDICATOR_MINIMIZE_HEIGHT, GetOrientation(), indicatorheight);
2223 FloatRectangle rect (0.0f, 0.0f, indicatorwidth, indicatorheight);
2225 SetLastResult(E_SUCCESS);
2231 _Form::SetHeader(_Toolbar* pToolbar)
2233 __pHeader = pToolbar;
2237 _Form::SetFooter(_Toolbar* pToolbar)
2239 __pFooter = pToolbar;
2243 _Form::SetTab(_Tab* pTab)
2249 _Form::SetTabStyle(int style)
2251 __pTab->SetStyle(style);
2255 _Form::SetIndicatorShowState(bool state, bool hide)
2257 result r = E_SUCCESS;
2259 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
2260 SysTryReturn(NID_UI_CTRL, pEcoreEvas, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Unable to get evas");
2262 _Control* pParent = GetParent();
2265 pParent = const_cast<_Control*>(pEcoreEvas->GetFrame());
2267 _Frame* pFrame = dynamic_cast<_Frame*>(pParent);
2269 if (pFrame && IsAttachedToMainTree())
2271 FrameShowMode mode = pFrame->GetShowMode();
2272 if (mode == FRAME_SHOW_MODE_FULL_SCREEN)
2274 r = __pIndicator->SetIndicatorShowState(state, hide);
2275 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2279 r = __pIndicator->SetIndicatorShowState(false);
2283 else if (!pFrame && IsAttachedToMainTree())
2285 r = __pIndicator->SetIndicatorShowState(false);
2288 __indicatorShowState = state;
2294 _Form::SetIndicatorOpacity(_IndicatorOpacity opacity)
2296 result r = E_SUCCESS;
2298 _Control* pParent = GetParent();
2299 _Frame* pFrame = dynamic_cast<_Frame*>(pParent);
2301 if (pFrame && IsAttachedToMainTree())
2303 FrameShowMode mode = pFrame->GetShowMode();
2304 if (mode == FRAME_SHOW_MODE_FULL_SCREEN)
2306 r = __pIndicator->SetIndicatorOpacity(opacity);
2307 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2311 if (opacity == _INDICATOR_OPACITY_TRANSLUCENT)
2313 __transparentIndicator = true;
2315 else if (opacity == _INDICATOR_OPACITY_OPAQUE)
2317 __transparentIndicator = false;
2324 _Form::AddIndicatorObject(void)
2326 result r = E_SUCCESS;
2330 r = __pIndicator->AddIndicatorObject(this);
2337 _Form::DeleteIndicatorObject(void)
2339 result r = E_SUCCESS;
2342 r = __pIndicator->DeleteIndicatorObject();
2349 _Form::SetKeypadShowState(bool state)
2351 __keypadShowstate = state;
2356 __pHeader->SetHideButton(true);
2360 __pFooter->SetHideButton(true);
2367 __pHeader->SetHideButton(false);
2371 __pFooter->SetHideButton(false);
2378 _Form::AttachedToMainTree(void)
2380 _Frame* pFrame = dynamic_cast<_Frame*>(GetParent());
2383 FrameShowMode mode = pFrame->GetShowMode();
2384 if (mode != FRAME_SHOW_MODE_FULL_SCREEN)
2386 SetBounds(FloatRectangle(0.0f, 0.0f, pFrame->GetBoundsF().width, pFrame->GetBoundsF().height));
2390 result r = E_SUCCESS;
2392 if (FORM_STYLE_INDICATOR & GetFormStyle())
2394 AddIndicatorObject();
2396 if (__indicatorShowState != IsIndicatorVisible())
2398 SetIndicatorShowState(__indicatorShowState);
2401 if (__transparentIndicator != IsIndicatorTranslucent())
2403 if (__transparentIndicator == true)
2405 SetIndicatorOpacity(_INDICATOR_OPACITY_TRANSLUCENT);
2409 SetIndicatorOpacity(_INDICATOR_OPACITY_OPAQUE);
2413 r = GetLastResult();
2414 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
2416 else if (FORM_STYLE_INDICATOR_AUTO_HIDE & GetFormStyle())
2418 SetIndicatorShowState(__indicatorShowState, true);
2422 r = SetIndicatorShowState(false);
2423 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
2430 _Form::DetachingFromMainTree(void)
2432 result r = E_SUCCESS;
2433 r = DeleteIndicatorObject();
2438 _Form::AdjustClientBounds(void)
2440 result r = E_SUCCESS;
2442 FloatDimension size = GetSizeF();
2443 FloatRectangle clientBounds(0.0f, 0.0f, size.width, size.height);
2447 clientBounds.height -= __deflatedHeight;
2450 FloatRectangle indicatorBounds = GetIndicatorBoundsF();
2452 _Control* pParent = GetParent();
2453 _Frame* pFrame = dynamic_cast<_Frame*>(pParent);
2456 FrameShowMode mode = pFrame->GetShowMode();
2457 if (mode == FRAME_SHOW_MODE_FULL_SCREEN)
2459 if (FORM_STYLE_INDICATOR & __formStyle)
2461 if (IsIndicatorVisible() && !IsIndicatorTranslucent())
2463 clientBounds.y += indicatorBounds.height;
2464 clientBounds.height -= indicatorBounds.height;
2471 if (FORM_STYLE_INDICATOR & __formStyle)
2473 if (IsIndicatorVisible() && !IsIndicatorTranslucent())
2475 clientBounds.y += indicatorBounds.height;
2476 clientBounds.height -= indicatorBounds.height;
2483 if (__pHeader->GetVisibleState() && !IsHeaderTranslucent())
2485 clientBounds.y += GetToolbarHeightF(true);
2486 clientBounds.height -= GetToolbarHeightF(true);
2492 if (__pTab->GetVisibleState()) //&& !IsHeaderTranslucent())
2494 clientBounds.y += GetTabHeightF();
2495 clientBounds.height -= GetTabHeightF();
2501 if (FORM_STYLE_FOOTER & __formStyle || FORM_STYLE_SOFTKEY_0 & __formStyle || FORM_STYLE_SOFTKEY_1 & __formStyle
2502 || FORM_STYLE_OPTIONKEY & __formStyle)
2504 if (__pFooter->GetVisibleState() && !IsFooterTranslucent())
2506 clientBounds.height -= GetToolbarHeightF(false);
2511 SetClientBounds(clientBounds);
2517 _Form::OnBoundsChanged(void)
2519 FloatRectangle toolbarBounds;
2520 FloatRectangle indicatorFloatBounds(0.0f, 0.0f, 0.0f, 0.0f);
2522 float indicatorheight = 0.0f;
2524 GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, GetOrientation(), indicatorheight);
2527 __pIndicator->SetBounds(FloatRectangle(0.0f, 0.0f, GetClientBoundsF().width, indicatorheight));
2529 AdjustClientBounds();
2533 if (IsIndicatorVisible())
2535 indicatorFloatBounds = GetIndicatorBoundsF();
2538 toolbarBounds = GetHeader()->GetBoundsF();
2539 toolbarBounds.width = GetSizeF().width;
2541 FloatRectangle bounds(toolbarBounds.x, indicatorFloatBounds.height, toolbarBounds.width, toolbarBounds.height);
2542 SetHeaderBounds(bounds);
2547 toolbarBounds = GetFooter()->GetBoundsF();
2548 toolbarBounds.width = GetSizeF().width;
2549 toolbarBounds.y = GetSizeF().height - toolbarBounds.height;
2550 SetFooterBounds(toolbarBounds);
2555 toolbarBounds = GetTab()->GetBoundsF();
2556 toolbarBounds.width = GetSizeF().width;
2557 SetTabBounds(toolbarBounds);
2560 AdjustClientBounds();
2564 _Form::TranslateSize(FloatDimension size ) const
2566 FloatDimension returnSize(0.0f, 0.0f);
2567 returnSize = CoordinateSystem::AlignToDevice(size);
2573 _Form::SetNotificationTrayOpenEnabled(bool enable)
2575 SysTryReturnResult(NID_UI_CTRL, (__formStyle & FORM_STYLE_INDICATOR || __formStyle & FORM_STYLE_INDICATOR_AUTO_HIDE), E_INVALID_OPERATION, "[E_INVALID_OPERATION] The style of form is invalid.");
2579 __pIndicator->SetNotificationTrayOpenEnabled(enable);
2585 _Form::IsNotificationTrayOpenEnabled(void) const
2587 SysTryReturnResult(NID_UI_CTRL, (__formStyle & FORM_STYLE_INDICATOR || __formStyle & FORM_STYLE_INDICATOR_AUTO_HIDE), E_INVALID_OPERATION, "[E_INVALID_OPERATION] The style of form is invalid.");
2591 __pIndicator->IsNotificationTrayOpenEnabled();
2597 _Form::MakeFocusList(const _Control* pControl, IListT<_Control*>* pFocusControlList) const
2599 int childCount = pControl->GetChildCount();
2600 for(int i = 0; i < childCount; i++)
2602 _Control* pChildControl = pControl->GetChild(i);
2603 Rectangle rect = pChildControl->GetAbsoluteBounds();
2604 unique_ptr<IEnumeratorT<_Control*> > pEnum (pFocusControlList->GetEnumeratorN());
2606 while (pEnum->MoveNext() == E_SUCCESS)
2608 _Control* pEnumeratorControl = null;
2609 pEnum->GetCurrent(pEnumeratorControl);
2610 if (pEnumeratorControl != null)
2612 Rectangle enumeratorRect = pEnumeratorControl->GetAbsoluteBounds();
2613 if(enumeratorRect.y > rect.y)
2617 else if (enumeratorRect.y == rect.y)
2619 if(enumeratorRect.x > rect.x)
2628 pFocusControlList->InsertAt(pChildControl, index);
2633 _Form::MakeChildContainerFocusList(_Control* pControl, int startIndex) const
2635 unique_ptr<IListT<_Control*> > pTempList (new (std::nothrow) ArrayListT<_Control*>);
2636 SysTryReturnVoidResult(NID_UI_CTRL, pTempList, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
2637 MakeFocusList(pControl, pTempList.get());
2639 unique_ptr<IEnumeratorT<_Control*> > pTempEnum(pTempList->GetEnumeratorN());
2640 int index = ++startIndex;
2641 while (pTempEnum->MoveNext() == E_SUCCESS)
2643 _Control* pEnumeratorControl = null;
2644 pTempEnum->GetCurrent(pEnumeratorControl);
2645 __pFocusControlList->InsertAt(pEnumeratorControl, index);
2651 _Form::GetFocusList(void) const
2653 if(!__pFocusControlList)
2655 __pFocusControlList.reset(new (std::nothrow) ArrayListT<_Control*>);
2656 SysTryReturn(NID_UI, __pFocusControlList, null, E_SYSTEM, "[E_OUT_OF_MEMORY] Memory is insufficient.");
2657 MakeFocusList(this, __pFocusControlList.get());
2659 unique_ptr<IEnumeratorT<_Control*> > pEnum(__pFocusControlList->GetEnumeratorN());
2661 int nextContainerIndex = -1;
2662 while ( pEnum->MoveNext() == E_SUCCESS)
2664 _Control* pEnumeratorControl = null;
2665 pEnum->GetCurrent(pEnumeratorControl);
2666 _ContainerImpl* pTempContainerImpl = dynamic_cast<_ContainerImpl*>(static_cast <_ControlImpl* >(pEnumeratorControl->GetUserData()));
2668 if (pTempContainerImpl != null && (nextContainerIndex < i))
2670 if (pEnumeratorControl->IsChildControlFocusManage() == false)
2672 MakeChildContainerFocusList(pEnumeratorControl, i);
2673 nextContainerIndex = i;
2674 pEnum.reset(__pFocusControlList->GetEnumeratorN());
2680 __pFocusControlList->InsertAt(dynamic_cast<_Control*> (const_cast<_Form*>(this)), 0);
2683 return __pFocusControlList.get();
2687 _Form::UpdateClientBounds(const FloatDimension& size)
2689 FloatRectangle clientBounds(0.0f, 0.0f, size.width, size.height);
2693 clientBounds.height -= __deflatedHeight;
2696 FloatRectangle indicatorBounds = GetIndicatorBoundsF();
2698 _Control* pParent = GetParent();
2699 _Frame* pFrame = dynamic_cast<_Frame*>(pParent);
2702 FrameShowMode mode = pFrame->GetShowMode();
2703 if (mode == FRAME_SHOW_MODE_FULL_SCREEN)
2705 if (FORM_STYLE_INDICATOR & __formStyle)
2707 if (IsIndicatorVisible() && !IsIndicatorTranslucent())
2709 clientBounds.y += indicatorBounds.height;
2710 clientBounds.height -= indicatorBounds.height;
2717 if (FORM_STYLE_INDICATOR & __formStyle)
2719 if (IsIndicatorVisible() && !IsIndicatorTranslucent())
2721 clientBounds.y += indicatorBounds.height;
2722 clientBounds.height -= indicatorBounds.height;
2729 if (__pHeader->GetVisibleState() && !IsHeaderTranslucent())
2731 clientBounds.y += GetToolbarHeightF(true);
2732 clientBounds.height -= GetToolbarHeightF(true);
2738 if (__pTab->GetVisibleState()) //&& !IsHeaderTranslucent())
2740 clientBounds.y += GetTabHeightF();
2741 clientBounds.height -= GetTabHeightF();
2747 if (FORM_STYLE_FOOTER & __formStyle || FORM_STYLE_SOFTKEY_0 & __formStyle || FORM_STYLE_SOFTKEY_1 & __formStyle
2748 || FORM_STYLE_OPTIONKEY & __formStyle)
2750 if (__pFooter->GetVisibleState() && !IsFooterTranslucent())
2752 clientBounds.height -= GetToolbarHeightF(false);
2757 SetClientBounds(clientBounds);
2760 }}} // Tizen::Ui::Controls