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 <FBaseErrorDefine.h>
24 #include <FBaseInteger.h>
25 #include <FBaseSysLog.h>
26 #include <FGrpFloatRectangle.h>
27 #include <FBase_Log.h>
28 #include <FGrp_BitmapImpl.h>
29 #include "FUi_ResourceManager.h"
30 #include "FUi_EcoreEvasMgr.h"
31 #include "FUi_EcoreEvas.h"
32 #include "FUi_CoordinateSystemUtils.h"
33 #include "FUi_DataBindingContext.h"
34 #include "FUi_AccessibilityContainer.h"
35 #include "FUi_AccessibilityManager.h"
36 #include "FUiCtrl_Form.h"
37 #include "FUiCtrl_Frame.h"
38 #include "FUiCtrl_FormPresenter.h"
39 #include "FUiCtrl_Toolbar.h"
40 #include "FUiCtrl_Tab.h"
41 #include "FUiCtrl_ActionEvent.h"
42 #include "FUiCtrl_OverlayRegionImpl.h"
43 #include "FUiCtrl_OverlayPanelImpl.h"
44 #include "FUiCtrl_IFormBackEventListener.h"
45 #include "FUiCtrl_Indicator.h"
47 using namespace Tizen::Ui::Animations;
48 using namespace Tizen::Ui;
49 using namespace Tizen::Base; // Rotation
50 using namespace Tizen::Base::Runtime;
51 using namespace Tizen::Graphics;
53 namespace Tizen { namespace Ui { namespace Controls
57 : __pFormPresenter(null)
58 , __pFormBackEventListener(null)
60 , __pActionEvent(null)
65 , __transparentIndicator(false)
66 , __transparentHeader(false)
67 , __transparentFooter(false)
68 , __transparentTab(false)
69 , __indicatorShowState(false)
72 , __overlayRegionCount(0)
73 , __ppOverlayerRegionImplArray(null)
74 , __softkeyCount(SOFTKEY_COUNT + 1)
75 , __updatedSoftkeyCount(0)
78 result r = GET_COLOR_CONFIG(FORM::BG_NORMAL,color);
81 SetBackgroundColor(color);
85 SetBackgroundColor(0xff000000);
88 _FormPresenter* pPresenter = new (std::nothrow) _FormPresenter(*this);
89 SysTryReturnVoidResult(NID_UI_CTRL, pPresenter, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
91 SetPresenter(*pPresenter);
93 for (int i = 0; i < __softkeyCount; i++)
95 __actionId[_SOFTKEY_0 + i] = 0;
96 __softkeyText[_SOFTKEY_0 + i] = String();
97 __showSoftkey[_SOFTKEY_0 + i] = false;
98 __enableSoftkey[_SOFTKEY_0 + i] = false;
101 for (int j = 0; j < SOFTKEY_COUNT+1; j++)
103 __pSoftkeyNormalBitmap[_SOFTKEY_0 + j] = null;
104 __pSoftkeyPressedBitmap[_SOFTKEY_0 + j] = null;
107 for (int j = 0; j < SOFTKEY_COUNT+1; j++)
109 __pSoftkeyNormalEffectBitmap[_SOFTKEY_0 + j] = null;
110 __pSoftkeyPressedEffectBitmap[_SOFTKEY_0 + j] = null;
113 for (int k = 0; k < SOFTKEY_COUNT; k++)
115 __pSoftkeyNormalIcon[_SOFTKEY_0 + k] = null;
116 __pSoftkeyPressedIcon[_SOFTKEY_0 + k] = null;
119 //create data binding context
120 _DataBindingContext* pContext = new (std::nothrow) _DataBindingContext(*this);
122 SysTryCatch(NID_UI_CTRL, pContext && GetLastResult() == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
123 SetDataBindingContext(pContext);
126 GetAccessibilityContainer()->Activate(true);
135 delete __pFormPresenter;
136 __pFormPresenter = null;
140 delete __pActionEvent;
141 __pActionEvent = null;
144 for (int i = 0; i < SOFTKEY_COUNT+1 ; i++)
146 if (__pSoftkeyNormalBitmap[i])
148 delete __pSoftkeyNormalBitmap[i];
149 __pSoftkeyNormalBitmap[i] = null;
153 for (int i = 0; i < SOFTKEY_COUNT+1 ; i++)
155 if (__pSoftkeyPressedBitmap[i])
157 delete __pSoftkeyPressedBitmap[i];
158 __pSoftkeyPressedBitmap[i] = null;
162 for (int i = 0; i < SOFTKEY_COUNT+1 ; i++)
164 if (__pSoftkeyNormalEffectBitmap[i])
166 delete __pSoftkeyNormalEffectBitmap[i];
167 __pSoftkeyNormalEffectBitmap[i] = null;
171 for (int i = 0; i < SOFTKEY_COUNT+1 ; i++)
173 if (__pSoftkeyPressedEffectBitmap[i])
175 delete __pSoftkeyPressedEffectBitmap[i];
176 __pSoftkeyPressedEffectBitmap[i] = null;
180 for (int i = 0; i < SOFTKEY_COUNT ; i++)
182 if (__pSoftkeyNormalIcon[i])
184 delete __pSoftkeyNormalIcon[i];
185 __pSoftkeyNormalIcon[i] = null;
188 if (__pSoftkeyPressedIcon[i])
190 delete __pSoftkeyPressedIcon[i];
191 __pSoftkeyPressedIcon[i] = null;
195 if (__ppOverlayerRegionImplArray != null)
197 int maxCount = OverlayRegion::GetMaxCount();
199 for (int i = 0; i < maxCount; i++)
201 if (__ppOverlayerRegionImplArray[i])
203 OverlayRegion* _pOverlayRegion = __ppOverlayerRegionImplArray[i]->GetOverlayRegion();
204 delete _pOverlayRegion;
208 delete[] __ppOverlayerRegionImplArray;
221 _Form::CreateFormN(void)
225 pForm = new (std::nothrow) _Form;
226 SysTryReturn(NID_UI_CTRL, pForm, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
227 SysTryCatch(NID_UI_CTRL, GetLastResult() == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
229 pForm->SetTouchMoveAllowance(TOUCH_MOVE_ALLOWANCE_INSENSITIVE);
231 pForm->AcquireHandle();
233 SetLastResult(E_SUCCESS);
244 _Form::SetPresenter(const _FormPresenter& formPresenter)
246 __pFormPresenter = const_cast <_FormPresenter*>(&formPresenter);
254 if (__pFormPresenter)
256 __pFormPresenter->Draw();
259 if (__formStyle & FORM_STYLE_SOFTKEY_0 || __formStyle & FORM_STYLE_SOFTKEY_1 || __formStyle & FORM_STYLE_OPTIONKEY)
263 UpdateSoftkey(__formStyle);
266 if(unlikely((_AccessibilityManager::IsActivated())))
268 _AccessibilityManager::GetInstance()->RequestAutoReading();
274 _Form::SetFormBackEventListener(_IFormBackEventListener* pFormBackEventListener)
276 SysTryReturnVoidResult(NID_UI_CTRL, __pFooter || __pHeader, E_INVALID_STATE, "[E_INVALID_STATE] Footer and Header aren't constructed.");
277 __pFormBackEventListener = pFormBackEventListener;
280 __pFooter->SetBackEventListener(*this, ID_BACK_BUTTON);
284 __pHeader->SetBackEventListener(*this, ID_BACK_BUTTON);
287 SetLastResult(E_SUCCESS);
291 _Form::GetFormStyle(void) const
297 _Form::GetFooter(void) const
303 _Form::GetHeader(void) const
309 _Form::GetTab(void) const
315 _Form::GetIndicator(void) const
321 _Form::GetTitleText(void) const
323 if (__pHeader && (__formStyle & FORM_STYLE_TITLE))
325 return __pHeader->GetTitleText();
334 _Form::GetTitleTextHorizontalAlignment(void) const
336 if (__pHeader && (__formStyle & FORM_STYLE_TITLE))
338 return __pHeader->GetTitleTextHorizontalAlignment();
342 SysLog(NID_UI_CTRL, "[E_SYSTEM] The title is not valid.");
343 return ALIGNMENT_LEFT;
348 _Form::GetOverlayRegionN(const Rectangle& rect, OverlayRegionType regionType)
350 _OverlayRegionImpl* pOverlayRegionImpl = null;
351 OverlayRegion* pOverlayRegion = null;
352 Color bgColor(0, 0, 0, 0);
355 _OverlayPanel* pOverlayPanel = null;
357 bool modified = false;
361 maxCount = OverlayRegion::GetMaxCount();
362 SysTryReturn(NID_UI_CTRL, maxCount > 0, null, E_SYSTEM, "[E_SYSTEM] maxCount [%d] is invalid", maxCount);
364 if (__ppOverlayerRegionImplArray == null)
366 __ppOverlayerRegionImplArray = new (std::nothrow) _OverlayRegionImpl*[maxCount];
367 SysTryReturn(NID_UI_CTRL, __ppOverlayerRegionImplArray != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Can not allocate memory for the OverlayRegionList.");
369 for (int i = 0; i < maxCount; i++)
371 __ppOverlayerRegionImplArray[i] = null;
373 __overlayRegionCount = 0;
376 Rectangle clientRect(GetClientBounds());
377 Point overlayPosition(clientRect.x + rect.x, clientRect.y + rect.y);
378 Rectangle overlayRect(overlayPosition.x, overlayPosition.y, rect.width, rect.height);
380 Rectangle userPhyRect = _CoordinateSystemUtils::Transform(rect);
381 Rectangle devBounds = _CoordinateSystemUtils::Transform(overlayRect);
383 SysLog(NID_UI_CTRL, "rect [%d, %d, %d, %d] ", rect.x, rect.y, rect.width, rect.height);
384 SysLog(NID_UI_CTRL, "userPhyRect [%d, %d, %d, %d] ", userPhyRect.x, userPhyRect.y, userPhyRect.width, userPhyRect.height);
385 SysLog(NID_UI_CTRL, "overlayRect [%d, %d, %d, %d]", overlayPosition.x, overlayPosition.y, rect.width, rect.height);
386 SysLog(NID_UI_CTRL, "devBounds [%d, %d, %d, %d]", devBounds.x, devBounds.y, devBounds.width, devBounds.height);
388 // 1. width , height unit check
389 if (_OverlayRegionImpl::IsValidOverlayRect(overlayRect, devBounds, _CoordinateSystemUtils::Transform(clientRect), modified) != E_SUCCESS)
391 SysTryReturn(NID_UI_CTRL, 0, null, E_INVALID_ARG, "[E_INVALID_ARG] IsValidOverlayRect is failed!");
396 SysLog(NID_UI_CTRL, "devBounds modified [%d, %d, %d, %d]", devBounds.x, devBounds.y, devBounds.width, devBounds.height);
399 // 2. check for using OverlayPanel simutaneously
400 for (idx = 0 ; idx < GetChildCount() ; idx++)
402 pOverlayPanel = dynamic_cast <_OverlayPanel*>(GetChild(idx));
403 SysTryReturn(NID_UI_CTRL, pOverlayPanel == null, null, E_SYSTEM, "[E_SYSTEM] Using OverlayRegion mixed with OverlayPanel is not supported!");
406 // 3. find the empty slot idx
407 for (idx = 0; idx < maxCount; idx++)
409 if (__ppOverlayerRegionImplArray[idx] == null)
415 SysTryReturn(NID_UI_CTRL, idx < maxCount, null, E_SYSTEM, "[E_SYSTEM] already used permitted maximum number of OverlayRegion!");
417 // 4. make OverlayRegion object
418 pOverlayRegionImpl = new (std::nothrow) _OverlayRegionImpl();
419 SysTryReturn(NID_UI_CTRL, pOverlayRegionImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] failed to make the OverlayRegionImpl instance!");
421 r = pOverlayRegionImpl->Construct(this, regionType, overlayPosition, rect, devBounds);
424 delete pOverlayRegionImpl;
425 SysTryReturn(NID_UI_CTRL, 0, null, r, "[%s] Propagating.", GetErrorMessage(r));
428 pOverlayRegion = pOverlayRegionImpl->CreateOverlayRegionN();
429 if (pOverlayRegion == null)
431 delete pOverlayRegionImpl;
432 SysTryReturn(NID_UI_CTRL, 0, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
435 __ppOverlayerRegionImplArray[idx] = pOverlayRegionImpl;
436 pOverlayRegionImpl->SetFormArrayIndex(idx);
438 __overlayRegionCount++;
440 SetLastResult(E_SUCCESS);
442 return pOverlayRegion;
446 _Form::GetOverlayRegionCount(void) const
448 return __overlayRegionCount;
452 _Form::MoveOverlayRegion(bool top)
454 if (__ppOverlayerRegionImplArray == null)
458 for (int i = 0; i < OverlayRegion::GetMaxCount(); i++)
460 if (__ppOverlayerRegionImplArray[i] != null)
464 __ppOverlayerRegionImplArray[i]->GoForeground();
468 __ppOverlayerRegionImplArray[i]->GoBackground();
475 _Form::CreateSoftkey(unsigned long formStyle)
477 Bitmap* pTempBitmap = null;
478 Dimension softkeyDimension(0, 0);
479 Dimension softkeyDisplayDimension(0, 0);
480 Dimension optionkeyDimension(0, 0);
481 int softkeyTextSize = 0;
482 int leftSoftkeyLeftMargin = 0;
483 int rightSoftkeyLeftMargin = 0;
484 int softkeyTopMargin = 0;
485 Color softkeyNormalBackgroundColor;
486 Color softkeyPressedBackgroundColor;
487 Color softkeyNormalTextColor;
488 Color softkeyPressedTextColor;
489 Color softkeyNormalIconColor;
490 Color softkeyPressedIconColor;
492 GET_DIMENSION_CONFIG(FOOTER::SOFTKEY_RECT, GetOrientation(), softkeyDimension);
493 GET_DIMENSION_CONFIG(FOOTER::SOFTKEY_DISPLAY_RECT_WITH_TEXT, GetOrientation(), softkeyDisplayDimension);
494 GET_DIMENSION_CONFIG(FOOTER::OPTIONKEY_RECT, GetOrientation(), optionkeyDimension);
495 GET_SHAPE_CONFIG(FOOTER::SOFTKEY_TEXT_SIZE, GetOrientation(), softkeyTextSize);
496 GET_SHAPE_CONFIG(FOOTER::SOFTKEY_0_LEFT_MARGIN, GetOrientation(), leftSoftkeyLeftMargin);
497 GET_SHAPE_CONFIG(FOOTER::SOFTKEY_1_LEFT_MARGIN, GetOrientation(), rightSoftkeyLeftMargin);
498 GET_SHAPE_CONFIG(FOOTER::SOFTKEY_TOP_MARGIN, GetOrientation(), softkeyTopMargin);
499 GET_COLOR_CONFIG(FOOTER::SOFTKEY_BG_NORMAL, softkeyNormalBackgroundColor);
500 GET_COLOR_CONFIG(FOOTER::SOFTKEY_BG_PRESSED, softkeyPressedBackgroundColor);
501 GET_COLOR_CONFIG(FOOTER::SOFTKEY_TEXT_NORMAL, softkeyNormalTextColor);
502 GET_COLOR_CONFIG(FOOTER::SOFTKEY_TEXT_PRESSED, softkeyPressedTextColor);
503 GET_COLOR_CONFIG(FOOTER::SOFTKEY_ICON_NORMAL, softkeyNormalIconColor);
504 GET_COLOR_CONFIG(FOOTER::SOFTKEY_ICON_PRESSED, softkeyPressedIconColor);
506 result r = E_SUCCESS;
508 if (__pFooter != null)
510 __pFooter->SetStyle(TOOLBAR_SOFTKEY);
513 if (formStyle & FORM_STYLE_SOFTKEY_0)
515 r = GET_BITMAP_CONFIG_N(FOOTER::SOFTKEY_LEFT_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
516 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
517 if (__pSoftkeyNormalBitmap[_SOFTKEY_0])
519 delete __pSoftkeyNormalBitmap[_SOFTKEY_0];
520 __pSoftkeyNormalBitmap[_SOFTKEY_0] = null;
522 __pSoftkeyNormalBitmap[_SOFTKEY_0] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyNormalBackgroundColor);
525 r = GET_BITMAP_CONFIG_N(FOOTER::SOFTKEY_LEFT_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
526 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
527 if (__pSoftkeyPressedBitmap[_SOFTKEY_0])
529 delete __pSoftkeyPressedBitmap[_SOFTKEY_0];
530 __pSoftkeyPressedBitmap[_SOFTKEY_0] = null;
532 __pSoftkeyPressedBitmap[_SOFTKEY_0] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyPressedBackgroundColor);
535 r = GET_BITMAP_CONFIG_N(FOOTER::SOFTKEY_LEFT_BG_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
536 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
537 if (__pSoftkeyNormalEffectBitmap[_SOFTKEY_0])
539 delete __pSoftkeyNormalEffectBitmap[_SOFTKEY_0];
540 __pSoftkeyNormalEffectBitmap[_SOFTKEY_0] = null;
542 __pSoftkeyNormalEffectBitmap[_SOFTKEY_0] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyNormalBackgroundColor);
545 r = GET_BITMAP_CONFIG_N(FOOTER::SOFTKEY_LEFT_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
546 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
547 if (__pSoftkeyPressedEffectBitmap[_SOFTKEY_0])
549 delete __pSoftkeyPressedEffectBitmap[_SOFTKEY_0];
550 __pSoftkeyPressedEffectBitmap[_SOFTKEY_0] = null;
552 __pSoftkeyPressedEffectBitmap[_SOFTKEY_0] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyPressedBackgroundColor);
555 r = GET_BITMAP_CONFIG_N(FOOTER::SOFTKEY_ICON_ADD_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
556 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
558 if (__pSoftkeyNormalIcon[_SOFTKEY_0])
560 delete __pSoftkeyNormalIcon[_SOFTKEY_0];
561 __pSoftkeyNormalIcon[_SOFTKEY_0] = null;
563 __pSoftkeyNormalIcon[_SOFTKEY_0] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyNormalIconColor);
565 if (__pSoftkeyPressedIcon[_SOFTKEY_0])
567 delete __pSoftkeyPressedIcon[_SOFTKEY_0];
568 __pSoftkeyPressedIcon[_SOFTKEY_0] = null;
570 __pSoftkeyPressedIcon[_SOFTKEY_0] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyPressedIconColor);
574 _Button* pButton = _Button::CreateButtonN();
578 pButton->SetSize(softkeyDimension);
579 pButton->SetTextSize(softkeyTextSize);
580 pButton->SetUserDefinedTextArea(Rectangle(leftSoftkeyLeftMargin, softkeyTopMargin, softkeyDisplayDimension.width, softkeyDisplayDimension.height));
581 pButton->SetTextColor(_BUTTON_STATUS_NORMAL, softkeyNormalTextColor);
582 pButton->SetTextColor(_BUTTON_STATUS_PRESSED, softkeyPressedTextColor);
583 __pFooter->SetButton(LEFT_BUTTON, pButton);
587 if (formStyle & FORM_STYLE_SOFTKEY_1)
589 r = GET_BITMAP_CONFIG_N(FOOTER::SOFTKEY_RIGHT_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
590 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
591 if (__pSoftkeyNormalBitmap[_SOFTKEY_1])
593 delete __pSoftkeyNormalBitmap[_SOFTKEY_1];
594 __pSoftkeyNormalBitmap[_SOFTKEY_1] = null;
596 __pSoftkeyNormalBitmap[_SOFTKEY_1] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyNormalBackgroundColor);
599 r = GET_BITMAP_CONFIG_N(FOOTER::SOFTKEY_RIGHT_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
600 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
601 if (__pSoftkeyPressedBitmap[_SOFTKEY_1])
603 delete __pSoftkeyPressedBitmap[_SOFTKEY_1];
604 __pSoftkeyPressedBitmap[_SOFTKEY_1] = null;
606 __pSoftkeyPressedBitmap[_SOFTKEY_1] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyPressedBackgroundColor);
609 r = GET_BITMAP_CONFIG_N(FOOTER::SOFTKEY_RIGHT_BG_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
610 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
611 if (__pSoftkeyNormalEffectBitmap[_SOFTKEY_1])
613 delete __pSoftkeyNormalEffectBitmap[_SOFTKEY_1];
614 __pSoftkeyNormalEffectBitmap[_SOFTKEY_1] = null;
616 __pSoftkeyNormalEffectBitmap[_SOFTKEY_1] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyNormalBackgroundColor);
619 r = GET_BITMAP_CONFIG_N(FOOTER::SOFTKEY_RIGHT_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
620 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
621 if (__pSoftkeyPressedEffectBitmap[_SOFTKEY_1])
623 delete __pSoftkeyPressedEffectBitmap[_SOFTKEY_1];
624 __pSoftkeyPressedEffectBitmap[_SOFTKEY_1] = null;
626 __pSoftkeyPressedEffectBitmap[_SOFTKEY_1] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyPressedBackgroundColor);
629 r = GET_BITMAP_CONFIG_N(FOOTER::SOFTKEY_ICON_ZOOM_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
630 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
632 if (__pSoftkeyNormalIcon[_SOFTKEY_1])
634 delete __pSoftkeyNormalIcon[_SOFTKEY_1];
635 __pSoftkeyNormalIcon[_SOFTKEY_1] = null;
637 __pSoftkeyNormalIcon[_SOFTKEY_1] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyNormalIconColor);
639 if (__pSoftkeyPressedIcon[_SOFTKEY_1])
641 delete __pSoftkeyPressedIcon[_SOFTKEY_1];
642 __pSoftkeyPressedIcon[_SOFTKEY_1] = null;
644 __pSoftkeyPressedIcon[_SOFTKEY_1] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyPressedIconColor);
648 _Button* pButton = _Button::CreateButtonN();
651 pButton->SetSize(softkeyDimension);
652 pButton->SetTextSize(softkeyTextSize);
653 pButton->SetUserDefinedTextArea(Rectangle(rightSoftkeyLeftMargin, softkeyTopMargin, softkeyDisplayDimension.width, softkeyDisplayDimension.height));
654 pButton->SetTextColor(_BUTTON_STATUS_NORMAL, softkeyNormalTextColor);
655 pButton->SetTextColor(_BUTTON_STATUS_PRESSED, softkeyPressedTextColor);
656 __pFooter->SetButton(RIGHT_BUTTON, pButton);
660 if (formStyle & FORM_STYLE_OPTIONKEY)
662 r = GET_BITMAP_CONFIG_N(FOOTER::OPTIONKEY_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
663 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
664 if (__pSoftkeyNormalBitmap[SOFTKEY_COUNT])
666 delete __pSoftkeyNormalBitmap[SOFTKEY_COUNT];
667 __pSoftkeyNormalBitmap[SOFTKEY_COUNT] = null;
669 __pSoftkeyNormalBitmap[SOFTKEY_COUNT] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyNormalBackgroundColor);
672 r = GET_BITMAP_CONFIG_N(FOOTER::OPTIONKEY_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
673 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
674 if (__pSoftkeyPressedBitmap[SOFTKEY_COUNT])
676 delete __pSoftkeyPressedBitmap[SOFTKEY_COUNT];
677 __pSoftkeyPressedBitmap[SOFTKEY_COUNT] = null;
679 __pSoftkeyPressedBitmap[SOFTKEY_COUNT] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyPressedBackgroundColor);
682 r = GET_BITMAP_CONFIG_N(FOOTER::OPTIONKEY_BG_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
683 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
684 if (__pSoftkeyNormalEffectBitmap[SOFTKEY_COUNT])
686 delete __pSoftkeyNormalEffectBitmap[SOFTKEY_COUNT];
687 __pSoftkeyNormalEffectBitmap[SOFTKEY_COUNT] = null;
689 __pSoftkeyNormalEffectBitmap[SOFTKEY_COUNT] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyNormalBackgroundColor);
692 r = GET_BITMAP_CONFIG_N(FOOTER::OPTIONKEY_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
693 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
694 if (__pSoftkeyPressedEffectBitmap[SOFTKEY_COUNT])
696 delete __pSoftkeyPressedEffectBitmap[SOFTKEY_COUNT];
697 __pSoftkeyPressedEffectBitmap[SOFTKEY_COUNT] = null;
699 __pSoftkeyPressedEffectBitmap[SOFTKEY_COUNT] = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), softkeyPressedBackgroundColor);
702 _Button* pButton = _Button::CreateButtonN();
705 pButton->SetSize(optionkeyDimension);
706 pButton->SetTextColor(_BUTTON_STATUS_NORMAL, softkeyNormalTextColor);
707 pButton->SetTextColor(_BUTTON_STATUS_PRESSED, softkeyPressedTextColor);
708 __pFooter->SetButton(MIDDLE_BUTTON, pButton);
714 _Form::UpdateSoftkey(unsigned long formStyle)
716 int softkeyIconGap = 3;
718 if (__formStyle & FORM_STYLE_SOFTKEY_0)// && __updatedSoftkeyCount % 2 == 0)
720 if (__pFooter->GetButton(LEFT_BUTTON))
722 __pFooter->GetButton(LEFT_BUTTON)->SetActionId(__actionId[_SOFTKEY_0]);
724 if (__pSoftkeyNormalBitmap[_SOFTKEY_0])
726 __pFooter->GetButton(LEFT_BUTTON)->SetBackgroundBitmap(_BUTTON_STATUS_NORMAL, *__pSoftkeyNormalBitmap[_SOFTKEY_0]);
729 if (__pSoftkeyNormalEffectBitmap[_SOFTKEY_0])
731 __pFooter->GetButton(LEFT_BUTTON)->SetBackgroundEffectBitmap(_BUTTON_STATUS_NORMAL, *__pSoftkeyNormalEffectBitmap[_SOFTKEY_0]);
734 if (__pSoftkeyPressedBitmap[_SOFTKEY_0])
736 __pFooter->GetButton(LEFT_BUTTON)->SetBackgroundBitmap(_BUTTON_STATUS_PRESSED, *__pSoftkeyPressedBitmap[_SOFTKEY_0]);
739 if (__pSoftkeyPressedEffectBitmap[_SOFTKEY_0])
741 __pFooter->GetButton(LEFT_BUTTON)->SetBackgroundEffectBitmap(_BUTTON_STATUS_PRESSED, *__pSoftkeyPressedEffectBitmap[_SOFTKEY_0]);
744 if (__softkeyText[_SOFTKEY_0] != String())
746 __pFooter->GetButton(LEFT_BUTTON)->SetText(__softkeyText[_SOFTKEY_0]);
748 __pFooter->RearrangeItems();
752 if (__pSoftkeyNormalIcon[_SOFTKEY_0])
754 __pFooter->GetButton(LEFT_BUTTON)->SetBitmap(_BUTTON_STATUS_NORMAL,
755 Point((__pFooter->GetButton(LEFT_BUTTON)->GetSize().width - __pSoftkeyNormalIcon[_SOFTKEY_0]->GetWidth()) / 2,
756 (__pFooter->GetButton(LEFT_BUTTON)->GetSize().height - __pSoftkeyNormalIcon[_SOFTKEY_0]->GetHeight()) / 2 + softkeyIconGap), *__pSoftkeyNormalIcon[_SOFTKEY_0]);
759 if (__pSoftkeyPressedIcon[_SOFTKEY_0])
761 __pFooter->GetButton(LEFT_BUTTON)->SetBitmap(_BUTTON_STATUS_PRESSED,
762 Point((__pFooter->GetButton(LEFT_BUTTON)->GetSize().width - __pSoftkeyPressedIcon[_SOFTKEY_0]->GetWidth()) / 2,
763 (__pFooter->GetButton(LEFT_BUTTON)->GetSize().height - __pSoftkeyPressedIcon[_SOFTKEY_0]->GetHeight()) / 2 + softkeyIconGap), *__pSoftkeyPressedIcon[_SOFTKEY_0]);
769 if (__formStyle & FORM_STYLE_SOFTKEY_1)// && __updatedSoftkeyCount % 2 == 0)
771 if (__pFooter->GetButton(RIGHT_BUTTON))
773 __pFooter->GetButton(RIGHT_BUTTON)->SetActionId(__actionId[_SOFTKEY_1]);
775 if (__pSoftkeyNormalBitmap[_SOFTKEY_1])
777 __pFooter->GetButton(RIGHT_BUTTON)->SetBackgroundBitmap(_BUTTON_STATUS_NORMAL, *__pSoftkeyNormalBitmap[_SOFTKEY_1]);
780 if (__pSoftkeyNormalEffectBitmap[_SOFTKEY_1])
782 __pFooter->GetButton(RIGHT_BUTTON)->SetBackgroundEffectBitmap(_BUTTON_STATUS_NORMAL, *__pSoftkeyNormalEffectBitmap[_SOFTKEY_1]);
785 if (__pSoftkeyPressedBitmap[_SOFTKEY_1])
787 __pFooter->GetButton(RIGHT_BUTTON)->SetBackgroundBitmap(_BUTTON_STATUS_PRESSED, *__pSoftkeyPressedBitmap[_SOFTKEY_1]);
790 if (__pSoftkeyPressedEffectBitmap[_SOFTKEY_1])
792 __pFooter->GetButton(RIGHT_BUTTON)->SetBackgroundEffectBitmap(_BUTTON_STATUS_PRESSED, *__pSoftkeyPressedEffectBitmap[_SOFTKEY_1]);
795 if (__softkeyText[_SOFTKEY_1] != String())
797 __pFooter->GetButton(RIGHT_BUTTON)->SetText(__softkeyText[_SOFTKEY_1]);
799 __pFooter->RearrangeItems();
803 if (__pSoftkeyNormalIcon[_SOFTKEY_1])
805 __pFooter->GetButton(RIGHT_BUTTON)->SetBitmap(_BUTTON_STATUS_NORMAL,
806 Point((__pFooter->GetButton(RIGHT_BUTTON)->GetSize().width - __pSoftkeyNormalIcon[_SOFTKEY_1]->GetWidth()) / 2,
807 (__pFooter->GetButton(RIGHT_BUTTON)->GetSize().height - __pSoftkeyNormalIcon[_SOFTKEY_1]->GetHeight()) / 2 + softkeyIconGap), *__pSoftkeyNormalIcon[_SOFTKEY_1]);
810 if (__pSoftkeyPressedIcon[_SOFTKEY_1])
812 __pFooter->GetButton(RIGHT_BUTTON)->SetBitmap(_BUTTON_STATUS_PRESSED,
813 Point((__pFooter->GetButton(RIGHT_BUTTON)->GetSize().width - __pSoftkeyPressedIcon[_SOFTKEY_1]->GetWidth()) / 2,
814 (__pFooter->GetButton(RIGHT_BUTTON)->GetSize().height - __pSoftkeyPressedIcon[_SOFTKEY_1]->GetHeight()) / 2 + softkeyIconGap), *__pSoftkeyPressedIcon[_SOFTKEY_1]);
820 if (__formStyle & FORM_STYLE_OPTIONKEY)// && __updatedSoftkeyCount % 2 == 0)
822 if (__pFooter->GetButton(MIDDLE_BUTTON))
824 __pFooter->GetButton(MIDDLE_BUTTON)->SetActionId(__actionId[SOFTKEY_COUNT]);
826 if (__pSoftkeyNormalBitmap[SOFTKEY_COUNT])
828 __pFooter->GetButton(MIDDLE_BUTTON)->SetBackgroundBitmap(_BUTTON_STATUS_NORMAL, *__pSoftkeyNormalBitmap[SOFTKEY_COUNT]);
831 if (__pSoftkeyPressedBitmap[SOFTKEY_COUNT])
833 __pFooter->GetButton(MIDDLE_BUTTON)->SetBackgroundBitmap(_BUTTON_STATUS_PRESSED, *__pSoftkeyPressedBitmap[SOFTKEY_COUNT]);
836 if (__pSoftkeyNormalEffectBitmap[SOFTKEY_COUNT])
838 __pFooter->GetButton(MIDDLE_BUTTON)->SetBackgroundEffectBitmap(_BUTTON_STATUS_NORMAL, *__pSoftkeyNormalEffectBitmap[SOFTKEY_COUNT]);
841 if (__pSoftkeyPressedEffectBitmap[SOFTKEY_COUNT])
843 __pFooter->GetButton(MIDDLE_BUTTON)->SetBackgroundEffectBitmap(_BUTTON_STATUS_PRESSED, *__pSoftkeyPressedEffectBitmap[SOFTKEY_COUNT]);
848 //__updatedSoftkeyCount++;
852 _Form::GetDescription(void) const
854 String description = _Control::GetDescription();
856 String descriptionTemp(L"");
858 descriptionTemp.Format(LOG_LEN_MAX, L"_Form: style(%d) transparent(%d %d %d %d) deflated(%d) deflatedHeight(%d) overlayRegionCount(%d) softkeyCount(%d) updatedSoftkeyCount(%d)",
859 __formStyle, __transparentIndicator, __transparentHeader, __transparentFooter, __transparentTab, __deflated, __deflatedHeight,
860 __overlayRegionCount, __softkeyCount, __updatedSoftkeyCount);
862 description.Append(descriptionTemp);
868 _Form::GetClientAreaCanvasN(void) const
870 Canvas* pCanvas = GetCanvasN(GetClientBounds());
871 if ((pCanvas == null) || (GetLastResult() != E_SUCCESS))
873 SysLog(NID_UI_CTRL, "[%s] Propagated.", GetErrorMessage(GetLastResult()));
882 _Form::GetSoftkeyActionId(_Softkey softkey) const
884 if (CheckSoftkey(softkey) == false)
889 return __actionId[softkey];
893 _Form::GetOptionkeyActionId(void) const
895 if (HasOptionkey() == false)
900 return __actionId[SOFTKEY_COUNT];
904 _Form::GetSoftkeyText(_Softkey softkey) const
906 if (CheckSoftkey(softkey) == false)
911 return __softkeyText[softkey];
915 _Form::SetFormStyle(unsigned long formStyle)
917 result r = E_SUCCESS;
919 __formStyle = formStyle;
923 __pIndicator = CreateIndicatorN();
924 SysTryReturnVoidResult(NID_UI_CTRL, __pIndicator != null, r, "[%s] Propagating.", GetErrorMessage(r));
926 int indicatorwidth = GetClientBounds().width;
927 int indicatorheight = 0;
929 GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, GetOrientation(), indicatorheight);
931 __pIndicator->SetBounds(Rectangle(0, 0, indicatorwidth, indicatorheight));
932 r = AttachSystemChild(*__pIndicator);
933 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
936 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
941 _Form::SetActionBarsTranslucent(unsigned long actionBars, bool translucent)
945 ((actionBars & FORM_ACTION_BAR_INDICATOR) || (actionBars & FORM_ACTION_BAR_HEADER) ||
946 (actionBars & FORM_ACTION_BAR_FOOTER) || (actionBars & FORM_ACTION_BAR_TAB)),
947 E_INVALID_OPERATION, E_INVALID_OPERATION,
948 ("[E_INVALID_OPERATION] The current state of the instance prohibits the execution of the specified operation."));
950 if ((!(__formStyle & FORM_STYLE_INDICATOR) && (actionBars & FORM_ACTION_BAR_INDICATOR))
951 || (!(__formStyle & FORM_STYLE_HEADER) && (actionBars & FORM_ACTION_BAR_HEADER))
952 || (!(__formStyle & FORM_STYLE_FOOTER) && (actionBars & FORM_ACTION_BAR_FOOTER))
953 || (!(__formStyle & FORM_STYLE_TEXT_TAB) && (actionBars & FORM_ACTION_BAR_TAB)))
956 "[E_INVALID_OPERATION] The current state of the instance prohibits the execution of the specified operation.");
957 return E_INVALID_OPERATION;
960 result r = E_SUCCESS;
962 Color bgColor(0, 0, 0, 0);
963 if (actionBars & FORM_ACTION_BAR_INDICATOR)
967 r = SetIndicatorOpacity(_INDICATOR_OPACITY_TRANSLUCENT);
971 r = SetIndicatorOpacity(_INDICATOR_OPACITY_OPAQUE);
973 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
976 if (actionBars & FORM_ACTION_BAR_HEADER)
978 if (IsHeaderTranslucent() != translucent)
982 __pHeader->SetTransparent(translucent);
983 __transparentHeader = translucent;
988 if (IsIndicatorTranslucent() != IsHeaderTranslucent())
990 if (IsIndicatorTranslucent())
992 r = SetIndicatorOpacity(_INDICATOR_OPACITY_OPAQUE);
993 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
997 if (actionBars & FORM_ACTION_BAR_FOOTER)
999 if (IsFooterTranslucent() != translucent)
1003 __pFooter->SetTransparent(translucent);
1004 __transparentFooter = translucent;
1009 AdjustClientBounds();
1015 _Form::SetActionBarsVisible(unsigned long actionBars, bool visible)
1019 ((actionBars & FORM_ACTION_BAR_INDICATOR) || (actionBars & FORM_ACTION_BAR_HEADER) ||
1020 (actionBars & FORM_ACTION_BAR_FOOTER)),
1021 E_INVALID_OPERATION,
1022 E_INVALID_OPERATION,
1023 ("[E_INVALID_OPERATION] The current state of the instance prohibits the execution of the specified operation. "));
1025 if ((!(__formStyle & FORM_STYLE_INDICATOR) && (actionBars & FORM_ACTION_BAR_INDICATOR))
1026 || (!(__formStyle & FORM_STYLE_HEADER) && (actionBars & FORM_ACTION_BAR_HEADER))
1027 || (!(__formStyle & FORM_STYLE_FOOTER) && (actionBars & FORM_ACTION_BAR_FOOTER)))
1029 SysLog(NID_UI_CTRL, "[E_INVALID_OPERATION] The current state of the instance prohibits the execution of the specified operation.");
1030 return E_INVALID_OPERATION;
1033 Rectangle bounds = GetBounds();
1036 if (actionBars & FORM_ACTION_BAR_INDICATOR)
1038 SetIndicatorShowState(visible);
1041 if (actionBars & FORM_ACTION_BAR_HEADER)
1043 if (IsHeaderVisible() != visible)
1047 if (visible == true)
1050 if (IsIndicatorVisible())
1052 Rectangle indicatorBounds = GetIndicatorBounds();
1053 adjHeight = indicatorBounds.height;
1055 Rectangle bounds = __pHeader->GetBounds();
1056 bounds.y = adjHeight;
1058 SetHeaderBounds(bounds);
1060 __pHeader->SetVisibleState(visible);
1065 if (actionBars & FORM_ACTION_BAR_FOOTER)
1069 __pFooter->SetVisibleState(visible);
1073 AdjustClientBounds();
1079 _Form::SetTitleIcon(const Bitmap* pTitleBitmap)
1081 SysTryReturn(NID_UI_CTRL, (__formStyle & FORM_STYLE_TITLE), E_INVALID_OPERATION,
1082 E_INVALID_OPERATION, "[E_INVALID_OPERATION] This API is only for FORM_STYLE_TITLE.");
1084 SysTryReturn(NID_UI_CTRL, __pHeader, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] The title is not valid.");
1086 result r = __pHeader->SetTitleIcon(*pTitleBitmap);
1087 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1093 _Form::SetTitleText(const String& title, HorizontalAlignment alignment)
1095 SysTryReturn(NID_UI_CTRL, (__formStyle & FORM_STYLE_TITLE), E_INVALID_OPERATION,
1096 E_INVALID_OPERATION, "[E_INVALID_OPERATION] This API is only for FORM_STYLE_TITLE.");
1098 SysTryReturn(NID_UI_CTRL, __pHeader, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] The title is not valid.");
1100 result r = __pHeader->SetTitleText(title, alignment);
1101 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1107 _Form::SetSoftkeyEnabled(_Softkey softkey, bool enable)
1109 result r = E_SYSTEM;
1111 if (CheckSoftkey(softkey) == false)
1116 __enableSoftkey[softkey] = enable;
1124 _Form::SetOptionkeyActionId(int actionId)
1126 result r = E_SYSTEM;
1128 if (HasOptionkey() == false)
1133 __actionId[SOFTKEY_COUNT] = actionId;
1141 _Form::SetSoftkeyActionId(_Softkey softkey, int actionId)
1143 result r = E_SYSTEM;
1145 if (CheckSoftkey(softkey) == false)
1150 __actionId[softkey] = actionId;
1158 _Form::SetSoftkeyText(_Softkey softkey, const String& text)
1160 result r = E_SYSTEM;
1162 if (CheckSoftkey(softkey) == false)
1167 __softkeyText[softkey] = text;
1175 _Form::SetSoftkeyIcon(_Softkey softkey, const Bitmap& normalBitmap, const Bitmap* pPressedBitmap)
1177 result r = E_SYSTEM;
1179 if (CheckSoftkey(softkey) == false)
1184 int softkey_icon_size = 0;
1186 GET_SHAPE_CONFIG(FOOTER::SOFTKEY_ICON_SIZE, GetOrientation(), softkey_icon_size);
1188 Bitmap* pClonedNormalBitmap = _BitmapImpl::CloneN(normalBitmap);
1190 if (pClonedNormalBitmap)
1192 if (__pSoftkeyNormalIcon[softkey] != null)
1194 delete __pSoftkeyNormalIcon[softkey];
1197 __pSoftkeyNormalIcon[softkey] = pClonedNormalBitmap;
1199 __pSoftkeyNormalIcon[softkey]->Scale(Dimension(softkey_icon_size, softkey_icon_size));
1204 if (pPressedBitmap != null)
1206 Bitmap* pClonedPressedBitmap = _BitmapImpl::CloneN(*pPressedBitmap);
1208 if (pClonedPressedBitmap)
1210 if (__pSoftkeyPressedIcon[softkey] != null)
1212 delete __pSoftkeyPressedIcon[softkey];
1215 __pSoftkeyPressedIcon[softkey] = pClonedPressedBitmap;
1217 __pSoftkeyPressedIcon[softkey]->Scale(Dimension(softkey_icon_size, softkey_icon_size));
1227 _Form::HasFooter(void) const
1240 _Form::HasHeader(void) const
1253 _Form::HasIndicator(void) const
1255 if (__pIndicator && (GetFormStyle() & FORM_STYLE_INDICATOR))
1266 _Form::HasTitle(void) const
1268 if (__pHeader && (__formStyle & FORM_STYLE_TITLE))
1279 _Form::HasTab(void) const
1281 if ((__pTab && (__formStyle & FORM_STYLE_TEXT_TAB))
1282 || (__pTab && (__formStyle & FORM_STYLE_ICON_TAB)))
1293 _Form::IsIndicatorVisible(void) const
1295 _Control* pParent = GetParent();
1296 _Frame* pFrame = dynamic_cast<_Frame*>(pParent);
1298 bool visible = true;
1300 if (pFrame && IsAttachedToMainTree())
1302 visible = __pIndicator->GetIndicatorShowState();
1303 SysTryReturn(NID_UI_CTRL, GetLastResult() == E_SUCCESS, false, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1307 visible = __indicatorShowState;
1314 _Form::IsHeaderVisible(void) const
1318 return __pHeader->IsVisible();
1322 SysLog(NID_UI_CTRL, "[E_SYSTEM] The header is not valid.");
1328 _Form::IsFooterVisible(void) const
1332 return __pFooter->IsVisible();
1336 SysLog(NID_UI_CTRL, "[E_SYSTEM] The footer is not valid.");
1342 _Form::IsIndicatorTranslucent(void) const
1344 _Control* pParent = GetParent();
1345 _Frame* pFrame = dynamic_cast<_Frame*>(pParent);
1347 _IndicatorOpacity opacity = _INDICATOR_OPACITY_UNKNOWN;
1349 bool transparent = false;
1351 if (pFrame && IsAttachedToMainTree())
1353 FrameShowMode mode = pFrame->GetShowMode();
1354 if (mode == FRAME_SHOW_MODE_FULL_SCREEN)
1356 opacity = __pIndicator->GetIndicatorOpacity();
1357 SysTryReturn(NID_UI_CTRL, GetLastResult() == E_SUCCESS, false, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1359 if (opacity == _INDICATOR_OPACITY_TRANSLUCENT)
1363 else if (opacity == _INDICATOR_OPACITY_OPAQUE)
1365 transparent = false;
1371 transparent = __transparentIndicator;
1378 _Form::IsHeaderTranslucent(void) const
1380 return __transparentHeader;
1384 _Form::IsFooterTranslucent(void) const
1386 return __transparentFooter;
1390 _Form::IsTabTranslucent(void) const
1392 return __transparentTab;
1396 _Form::HasOptionkey(void) const
1398 if (GetFormStyle() & FORM_STYLE_OPTIONKEY)
1409 _Form::HasSoftkey(_Softkey softkey) const
1411 unsigned long __formStyle = FORM_STYLE_NORMAL;
1413 if (softkey == _SOFTKEY_0)
1415 __formStyle = FORM_STYLE_SOFTKEY_0;
1417 else if (softkey == _SOFTKEY_1)
1419 __formStyle = FORM_STYLE_SOFTKEY_1;
1426 if (GetFormStyle() & __formStyle)
1437 _Form::IsSoftkeyEnabled(_Softkey softkey) const
1439 if (CheckSoftkey(softkey) == false)
1444 return __enableSoftkey[softkey];
1448 _Form::CheckSoftkey(_Softkey softkey) const
1452 if (HasSoftkey(softkey) == false)
1457 if (softkey >= _SOFTKEY_COUNT)
1466 _Form::IsOrientationRoot(void) const
1472 _Form::TranslateToClientAreaPosition(const Point& position) const
1474 Rectangle clientArea = GetClientBounds();
1475 return Point(position.x - clientArea.x, position.y - clientArea.y);
1479 _Form::TranslateFromClientAreaPosition(const Point& clientPosition) const
1481 Rectangle clientArea = GetClientBounds();
1482 return Point(clientPosition.x + clientArea.x, clientPosition.y + clientArea.y);
1486 _Form::DeflateClientRectHeight(int height)
1497 __deflatedHeight = height;
1499 AdjustClientBounds();
1505 if (!(__pFooter->GetVisibleState()) || IsFooterTranslucent())
1507 adjHeight = GetToolbarHeight(false);
1510 Rectangle bounds(0, GetClientBounds().y + GetClientBounds().height-adjHeight,
1511 GetClientBounds().width, GetToolbarHeight(false));
1512 SetFooterBounds(bounds);
1519 _Form::CreateHeaderN(void)
1521 _Toolbar* __pHeader = _Toolbar::CreateToolbarN(true);
1522 SysTryReturn(NID_UI_CTRL, __pHeader, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1528 _Form::CreateFooterN(void)
1530 _Toolbar* __pFooter = _Toolbar::CreateToolbarN(false);
1531 SysTryReturn(NID_UI_CTRL, __pFooter, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1537 _Form::CreateTabN(void)
1539 _Tab* __pTab = _Tab::CreateTabN();
1540 SysTryReturn(NID_UI_CTRL, __pTab, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1546 _Form::CreateIndicatorN(void)
1548 _Indicator* pIndicator = new (std::nothrow) _Indicator;
1549 SysTryReturn(NID_UI_CTRL, pIndicator, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1555 _Form::GetToolbarHeight(bool header) const
1557 int toolbarHeight = 0;
1559 if (header && (__formStyle & FORM_STYLE_HEADER))
1563 toolbarHeight = __pHeader->GetBounds().height;
1566 else if (header && (__formStyle & FORM_STYLE_TITLE))
1568 GET_SHAPE_CONFIG(HEADER::HEIGHT, GetOrientation(), toolbarHeight);
1570 else if (__formStyle & FORM_STYLE_SOFTKEY_0 || __formStyle & FORM_STYLE_SOFTKEY_1 || __formStyle & FORM_STYLE_OPTIONKEY)
1572 GET_SHAPE_CONFIG(FOOTER::SOFTKEY_HEIGHT, GetOrientation(), toolbarHeight);
1578 toolbarHeight = __pFooter->GetBounds().height;
1581 //GET_SHAPE_CONFIG(L"FOOTER_HEIGHT", GetOrientation(), toolbarHeight);
1584 return toolbarHeight;
1588 _Form::GetTabHeight(void) const
1592 if ((__formStyle & FORM_STYLE_TEXT_TAB) || (__formStyle & FORM_STYLE_ICON_TAB))
1594 GET_SHAPE_CONFIG(TAB::HEIGHT, GetOrientation(), height);
1601 _Form::RemoveHeader(void)
1603 result r = E_SUCCESS;
1606 r = DetachSystemChild(*__pHeader);
1607 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1610 AdjustClientBounds();
1621 _Form::RemoveFooter(void)
1623 result r = E_SUCCESS;
1626 r = DetachSystemChild(*__pFooter);
1627 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1630 AdjustClientBounds();
1641 _Form::RemoveTab(void)
1643 result r = E_SUCCESS;
1646 r = DetachSystemChild(*__pTab);
1647 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1650 AdjustClientBounds();
1661 _Form::RemoveIndicator(void)
1663 result r = E_SUCCESS;
1666 r = DetachSystemChild(*__pIndicator);
1667 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
1668 __pIndicator = null;
1679 _Form::SetHeaderBounds(Rectangle& bounds)
1681 SysTryReturn(NID_UI_CTRL, __pHeader, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] Header isn't constructed.");
1683 bool movable = __pHeader->IsMovable();
1684 bool resizable = __pHeader->IsResizable();
1686 __pHeader->SetMovable(true);
1687 __pHeader->SetResizable(true);
1689 result r = E_SUCCESS;
1690 r = __pHeader->SetBounds(bounds);
1691 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1693 __pHeader->SetMovable(movable);
1694 __pHeader->SetResizable(resizable);
1696 AdjustClientBounds();
1702 _Form::SetHeaderFloatBounds(FloatRectangle& bounds)
1704 SysTryReturn(NID_UI_CTRL, __pHeader, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] Header isn't constructed.");
1706 bool movable = __pHeader->IsMovable();
1707 bool resizable = __pHeader->IsResizable();
1709 __pHeader->SetMovable(true);
1710 __pHeader->SetResizable(true);
1712 result r = E_SUCCESS;
1713 r = __pHeader->SetBounds(bounds);
1714 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1716 __pHeader->SetMovable(movable);
1717 __pHeader->SetResizable(resizable);
1719 AdjustClientBounds();
1725 _Form::SetFooterBounds(Rectangle& bounds)
1727 SysTryReturn(NID_UI_CTRL, __pFooter, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] Footer isn't constructed.");
1729 bool movable = __pFooter->IsMovable();
1730 bool resizable = __pFooter->IsResizable();
1732 __pFooter->SetMovable(true);
1733 __pFooter->SetResizable(true);
1735 result r = E_SUCCESS;
1736 r = __pFooter->SetBounds(bounds);
1737 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1739 __pFooter->SetMovable(movable);
1740 __pFooter->SetResizable(resizable);
1742 AdjustClientBounds();
1748 _Form::SetTabBounds(Rectangle& bounds)
1750 SysTryReturn(NID_UI_CTRL, __pTab, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] Tab isn't constructed.");
1752 bool movable = __pTab->IsMovable();
1753 bool resizable = __pTab->IsResizable();
1755 __pTab->SetMovable(true);
1756 __pTab->SetResizable(true);
1758 result r = E_SUCCESS;
1759 r = __pTab->SetBounds(bounds);
1760 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1762 __pTab->SetMovable(movable);
1763 __pTab->SetResizable(resizable);
1765 AdjustClientBounds();
1771 _Form::AddActionEventListener(_IActionEventListener& listener)
1773 if (__pActionEvent == null)
1775 __pActionEvent = _ActionEvent::CreateInstanceN(*this);
1777 SysTryReturn(NID_UI_CTRL, __pActionEvent, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] System error occurred.")
1780 result r = __pActionEvent->AddListener(listener);
1781 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1787 _Form::AddOptionkeyActionListener(_IActionEventListener& listener)
1789 if (HasOptionkey() == false)
1796 _Form::AddSoftkeyActionListener(_Softkey softkey, _IActionEventListener& listener)
1798 if (CheckSoftkey(softkey) == false)
1805 _Form::RemoveActionEventListener(_IActionEventListener& listener)
1807 SysTryReturn(NID_UI_CTRL, __pActionEvent, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] This instance isn't constructed.")
1808 // Todo : check fail case of RemoveListener
1809 result r = __pActionEvent->RemoveListener(listener);
1810 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1816 _Form::RemoveOptionkeyActionListener(_IActionEventListener& listener)
1818 if (HasOptionkey() == false)
1825 _Form::RemoveSoftkeyActionListener(_Softkey softkey, _IActionEventListener& listener)
1827 if (CheckSoftkey(softkey) == false)
1834 _Form::OnActionPerformed(const _Control& source, int actionId)
1838 case ID_BACK_BUTTON:
1839 if (__pFormBackEventListener)
1841 __pFormBackEventListener->OnFormBackRequested(*this);
1851 _Form::OnChildVisibleStateChanged(const _Control& child)
1853 if (IsHeaderVisible())
1856 if (IsIndicatorVisible())
1858 Rectangle indicatorBounds = GetIndicatorBounds();
1859 adjHeight = indicatorBounds.height;
1861 Rectangle bounds = __pHeader->GetBounds();
1862 bounds.y = adjHeight;
1863 SetHeaderBounds(bounds);
1866 AdjustClientBounds();
1870 _Form::GetIndicatorBounds(void) const
1872 _Control* pParent = GetParent();
1873 _Frame* pFrame = dynamic_cast<_Frame*>(pParent);
1877 FrameShowMode mode = pFrame->GetShowMode();
1878 if (mode != FRAME_SHOW_MODE_FULL_SCREEN)
1880 return Rectangle(0, 0, 0, 0);
1884 int indicatorwidth = GetClientBounds().width;
1885 int indicatorheight = 0;
1887 GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, GetOrientation(), indicatorheight);
1889 Rectangle rect (0, 0, indicatorwidth, indicatorheight);
1891 SetLastResult(E_SUCCESS);
1897 _Form::GetIndicatorFloatBounds(void) const
1899 _Control* pParent = GetParent();
1900 _Frame* pFrame = dynamic_cast<_Frame*>(pParent);
1904 FrameShowMode mode = pFrame->GetShowMode();
1905 if (mode != FRAME_SHOW_MODE_FULL_SCREEN)
1907 return FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f);
1911 int indicatorwidth = GetClientBounds().width;
1912 int indicatorheight = 0;
1914 GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, GetOrientation(), indicatorheight);
1916 Rectangle rect (0, 0, indicatorwidth, indicatorheight);
1918 Tizen::Graphics::FloatRectangle outputRect(rect.x, rect.y, rect.width, rect.height);
1920 SetLastResult(E_SUCCESS);
1926 _Form::SetHeader(_Toolbar* pToolbar)
1928 __pHeader = pToolbar;
1932 _Form::SetFooter(_Toolbar* pToolbar)
1934 __pFooter = pToolbar;
1938 _Form::SetTab(_Tab* pTab)
1944 _Form::SetTabStyle(int style)
1946 __pTab->SetStyle(style);
1950 _Form::SetIndicatorShowState(bool state)
1952 result r = E_SUCCESS;
1954 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
1955 SysTryReturn(NID_UI_CTRL, pEcoreEvas, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Unable to get evas");
1957 _Control* pParent = GetParent();
1960 pParent = const_cast<_Control*>(pEcoreEvas->GetFrame());
1962 _Frame* pFrame = dynamic_cast<_Frame*>(pParent);
1964 if (pFrame && IsAttachedToMainTree())
1966 FrameShowMode mode = pFrame->GetShowMode();
1967 if (mode == FRAME_SHOW_MODE_FULL_SCREEN)
1969 r = __pIndicator->SetIndicatorShowState(state);
1970 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1974 r = __pIndicator->SetIndicatorShowState(false);
1978 else if (!pFrame && IsAttachedToMainTree())
1980 r = __pIndicator->SetIndicatorShowState(false);
1983 __indicatorShowState = state;
1989 _Form::SetIndicatorOpacity(_IndicatorOpacity opacity)
1991 result r = E_SUCCESS;
1993 _Control* pParent = GetParent();
1994 _Frame* pFrame = dynamic_cast<_Frame*>(pParent);
1996 if (pFrame && IsAttachedToMainTree())
1998 FrameShowMode mode = pFrame->GetShowMode();
1999 if (mode == FRAME_SHOW_MODE_FULL_SCREEN)
2001 r = __pIndicator->SetIndicatorOpacity(opacity);
2002 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
2006 if (opacity == _INDICATOR_OPACITY_TRANSLUCENT)
2008 __transparentIndicator = true;
2010 else if (opacity == _INDICATOR_OPACITY_OPAQUE)
2012 __transparentIndicator = false;
2019 _Form::AddIndicatorObject(void)
2021 result r = E_SUCCESS;
2025 r = __pIndicator->AddEvasObject(this);
2032 _Form::DeleteIndicatorObject(void)
2034 result r = E_SUCCESS;
2037 r = __pIndicator->DeleteEvasObject();
2044 _Form::AttachedToMainTree(void)
2046 _Frame* pFrame = dynamic_cast<_Frame*>(GetParent());
2049 FrameShowMode mode = pFrame->GetShowMode();
2050 if (mode != FRAME_SHOW_MODE_FULL_SCREEN)
2052 SetBounds(Rectangle(0, 0, pFrame->GetBounds().width, pFrame->GetBounds().height));
2056 result r = E_SUCCESS;
2058 if (FORM_STYLE_INDICATOR & GetFormStyle())
2060 AddIndicatorObject();
2062 if (__indicatorShowState != IsIndicatorVisible())
2064 SetIndicatorShowState(__indicatorShowState);
2067 if (__transparentIndicator != IsIndicatorTranslucent())
2069 if (__transparentIndicator == true)
2071 SetIndicatorOpacity(_INDICATOR_OPACITY_TRANSLUCENT);
2075 SetIndicatorOpacity(_INDICATOR_OPACITY_OPAQUE);
2079 r = GetLastResult();
2080 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
2084 r = SetIndicatorShowState(false);
2085 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
2092 _Form::DetachingFromMainTree(void)
2094 result r = E_SUCCESS;
2095 r = DeleteIndicatorObject();
2100 _Form::AdjustClientBounds(void)
2102 result r = E_SUCCESS;
2104 Dimension size = GetSize();
2105 Rectangle clientBounds(0, 0, size.width, size.height);
2109 clientBounds.height -= __deflatedHeight;
2112 Rectangle indicatorBounds = GetIndicatorBounds();
2114 _Control* pParent = GetParent();
2115 _Frame* pFrame = dynamic_cast<_Frame*>(pParent);
2118 FrameShowMode mode = pFrame->GetShowMode();
2119 if (mode == FRAME_SHOW_MODE_FULL_SCREEN)
2121 if (FORM_STYLE_INDICATOR & __formStyle)
2123 if (IsIndicatorVisible() && !IsIndicatorTranslucent())
2125 clientBounds.y += indicatorBounds.height;
2126 clientBounds.height -= indicatorBounds.height;
2133 if (FORM_STYLE_INDICATOR & __formStyle)
2135 if (IsIndicatorVisible() && !IsIndicatorTranslucent())
2137 clientBounds.y += indicatorBounds.height;
2138 clientBounds.height -= indicatorBounds.height;
2145 if (__pHeader->GetVisibleState() && !IsHeaderTranslucent())
2147 clientBounds.y += GetToolbarHeight(true);
2148 clientBounds.height -= GetToolbarHeight(true);
2154 if (__pTab->GetVisibleState()) //&& !IsHeaderTranslucent())
2156 clientBounds.y += GetTabHeight();
2157 clientBounds.height -= GetTabHeight();
2163 if (FORM_STYLE_FOOTER & __formStyle || FORM_STYLE_SOFTKEY_0 & __formStyle || FORM_STYLE_SOFTKEY_1 & __formStyle
2164 || FORM_STYLE_OPTIONKEY & __formStyle)
2166 if (__pFooter->GetVisibleState() && !IsFooterTranslucent())
2168 clientBounds.height -= GetToolbarHeight(false);
2173 if (clientBounds.height < 0)
2175 SysLog(NID_UI_CTRL, "[E_SYSTEM] The Client bounds is not valid. : client height(%d), indicator height(%d), header height(%d), footer height(%d)",
2176 clientBounds.height, indicatorBounds.height, GetToolbarHeight(true), GetToolbarHeight(false));
2179 SetClientBounds(clientBounds);
2186 _Form::OnBoundsChanged(void)
2188 Rectangle toolbarBounds;
2189 FloatRectangle indicatorFloatBounds(0.0f, 0.0f, 0.0f, 0.0f);
2191 int indicatorheight = 0;
2193 GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, GetOrientation(), indicatorheight);
2195 __pIndicator->SetBounds(Rectangle(0, 0, GetClientBounds().width, indicatorheight));
2196 AdjustClientBounds();
2200 indicatorFloatBounds = GetIndicatorFloatBounds();
2202 toolbarBounds = GetHeader()->GetBounds();
2203 toolbarBounds.width = GetSize().width;
2205 FloatRectangle bounds(toolbarBounds.x, indicatorFloatBounds.height, toolbarBounds.width, toolbarBounds.height);
2206 SetHeaderFloatBounds(bounds);
2211 toolbarBounds = GetFooter()->GetBounds();
2212 toolbarBounds.width = GetSize().width;
2213 toolbarBounds.y = GetSize().height - toolbarBounds.height;
2214 SetFooterBounds(toolbarBounds);
2219 toolbarBounds = GetTab()->GetBounds();
2220 toolbarBounds.width = GetSize().width;
2221 SetTabBounds(toolbarBounds);
2224 AdjustClientBounds();
2227 }}} // Tizen::Ui::Controls