void
_ProgressPopupPresenter::SetTitleTextObject(void)
{
+ result r = E_SUCCESS;
+
+ TextSimple* pSimpleTextForTitleText = null;
+
float titleTextSize = 0.0f;
float minTitleTextSize = 0.0f;
float defaultWidth = 0.0f;
GET_SHAPE_CONFIG(POPUP::BG_IMAGE_TRANSPARENT_LEFT_MARGIN, orientation, transLeftMargin);
GET_SHAPE_CONFIG(POPUP::BG_IMAGE_TRANSPARENT_RIGHT_MARGIN, orientation, transRightMargin);
- if (__pProgressPopup->HasTitle())
+ if (_pTitleTextObject == null)
{
- result r = E_SUCCESS;
+ _pTitleTextObject = new (std::nothrow) TextObject();
+ SysTryReturnVoidResult(NID_UI_CTRL, _pTitleTextObject != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
- if (_pTitleTextObject == null) //add for landscape
- {
- _pTitleTextObject = new (std::nothrow) TextObject();
- SysTryReturnVoidResult(NID_UI_CTRL, _pTitleTextObject != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
-
- r = _pTitleTextObject->Construct();
- SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ r = _pTitleTextObject->Construct();
+ SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+ else
+ {
+ r = _pTitleTextObject->RemoveAll();
+ SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ }
- TextSimple* pSimpleTextForTitleText = new (std::nothrow) TextSimple(const_cast <wchar_t*>(__pProgressPopup->GetTitleText().GetPointer()),
- __pProgressPopup->GetTitleText().GetLength(),
- TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
- SysTryCatch(NID_UI_CTRL, pSimpleTextForTitleText != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ pSimpleTextForTitleText = new (std::nothrow) TextSimple(const_cast <wchar_t*>(__pProgressPopup->GetTitleText().GetPointer()),
+ __pProgressPopup->GetTitleText().GetLength(),
+ TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
+ SysTryCatch(NID_UI_CTRL, pSimpleTextForTitleText != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
- _pTitleTextObject->AppendElement(*pSimpleTextForTitleText);
- _pTitleTextObject->SetForegroundColor(__pProgressPopup->GetTitleTextColor(), 0, _pTitleTextObject->GetTextLength());
- _pTitleTextObject->SetWrap(TEXT_OBJECT_WRAP_TYPE_NONE);
- _pTitleTextObject->SetAction(TEXT_OBJECT_ACTION_TYPE_ABBREV);
- _pTitleTextObject->SetTextObjectEllipsisType(TEXT_OBJECT_ELLIPSIS_TYPE_TAIL);
+ _pTitleTextObject->AppendElement(*pSimpleTextForTitleText);
+ _pTitleTextObject->SetForegroundColor(__pProgressPopup->GetTitleTextColor(), 0, _pTitleTextObject->GetTextLength());
+ _pTitleTextObject->SetWrap(TEXT_OBJECT_WRAP_TYPE_NONE);
+ _pTitleTextObject->SetAction(TEXT_OBJECT_ACTION_TYPE_ABBREV);
+ _pTitleTextObject->SetTextObjectEllipsisType(TEXT_OBJECT_ELLIPSIS_TYPE_TAIL);
- _pTitleTextObject->SetAlignment(TEXT_OBJECT_ALIGNMENT_LEFT);
- }
+ _pTitleTextObject->SetAlignment(TEXT_OBJECT_ALIGNMENT_LEFT);
- _pTitleTextObject->SetBounds(FloatRectangle(titleLeftMargin + transLeftMargin,
- titleTopMargin + transTopMargin,
- defaultWidth - (titleLeftMargin + titleRightMargin + transLeftMargin + transRightMargin),
- titleHeight - titleTopMargin));
+ _pTitleTextObject->SetBounds(FloatRectangle(titleLeftMargin + transLeftMargin,
+ titleTopMargin + transTopMargin,
+ defaultWidth - (titleLeftMargin + titleRightMargin + transLeftMargin + transRightMargin),
+ titleHeight - titleTopMargin));
- r = CalculateTitleTextSize(titleTextSize, minTitleTextSize);
- SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ r = CalculateTitleTextSize(titleTextSize, minTitleTextSize);
+ SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
- _titleBounds = FloatRectangle(titleLeftMargin + transLeftMargin,
- titleTopMargin + transTopMargin,
- defaultWidth - (titleLeftMargin + titleRightMargin + transLeftMargin + transRightMargin),
- titleHeight - titleTopMargin);
- }
+ _titleBounds = FloatRectangle(titleLeftMargin + transLeftMargin,
+ titleTopMargin + transTopMargin,
+ defaultWidth - (titleLeftMargin + titleRightMargin + transLeftMargin + transRightMargin),
+ titleHeight - titleTopMargin);
return;
CATCH:
void
_ProgressPopupPresenter::SetTextObject(void)
{
+ result r = E_SUCCESS;
+
+ TextSimple* pSimpleTextForBodyText = null;
+
float bodyTextSize = 0.0f;
float defaultWidth = 0.0f;
float titleHeight = 0.0f;
float textRightMargin = 0.0f;
float bottomHeight = 0.0f;
float transTopMargin = 0.0f;
- float transBottomMargin = 0.0f;
float transLeftMargin = 0.0f;
float transRightMargin = 0.0f;
float animationWidth = 0.0f;
float textTopMargin = 0.0f;
- float textBottomMargin = 0.0f;
float animationTopMargin = 0.0f;
_ControlOrientation orientation;
GET_SHAPE_CONFIG(POPUP::PROCESS_ANIMATION_WIDTH, orientation, animationWidth);
GET_SHAPE_CONFIG(POPUP::BG_IMAGE_TRANSPARENT_TOP_MARGIN, orientation, transTopMargin);
- GET_SHAPE_CONFIG(POPUP::BG_IMAGE_TRANSPARENT_BOTTOM_MARGIN, orientation, transBottomMargin);
GET_SHAPE_CONFIG(POPUP::BG_IMAGE_TRANSPARENT_LEFT_MARGIN, orientation, transLeftMargin);
GET_SHAPE_CONFIG(POPUP::BG_IMAGE_TRANSPARENT_RIGHT_MARGIN, orientation, transRightMargin);
GET_SHAPE_CONFIG(POPUP::PROCESS_TEXT_TOP_MARGIN, orientation, textTopMargin);
- GET_SHAPE_CONFIG(POPUP::PROCESS_TEXT_BOTTOM_MARGIN, orientation, textBottomMargin);
GET_SHAPE_CONFIG(POPUP::BODY_TEXT_HEIGHT, orientation, __textObjectHeight);
GET_SHAPE_CONFIG(MESSAGEBOX::TEXT_LEFT_MARGIN, orientation, textLeftMargin);
GET_SHAPE_CONFIG(MESSAGEBOX::TEXT_RIGHT_MARGIN, orientation, textRightMargin);
GET_SHAPE_CONFIG(POPUP::PROCESS_ANIMATION_NO_TITLE_TOP_MARGIN, orientation, animationTopMargin);
}
- if (__pProgressPopup->HasText())
+ if (__pBodyTextObject == null)
{
- result r = E_SUCCESS;
+ __pBodyTextObject = new (std::nothrow) TextObject();
+ SysTryReturnVoidResult(NID_UI_CTRL, __pBodyTextObject != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
- if (__pBodyTextObject == null) //add for landscape
- {
- __pLabel = _Label::CreateLabelN();
- SysTryCatch(NID_UI_CTRL, __pLabel != null, , E_OUT_OF_MEMORY, "[E_SYSTEM] Failed to create the scroll.");
+ r = __pBodyTextObject->Construct();
+ SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
- __pBodyTextObject = new (std::nothrow) TextObject();
- SysTryReturnVoidResult(NID_UI_CTRL, __pBodyTextObject != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ __pLabel = _Label::CreateLabelN();
+ SysTryCatch(NID_UI_CTRL, __pLabel != null, , E_OUT_OF_MEMORY, "[E_SYSTEM] Failed to create the scroll.");
+ }
+ else
+ {
+ r = __pBodyTextObject->RemoveAll();
+ SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ }
- r = SetFontInfo(FONT_STYLE_PLAIN, bodyTextSize);
- SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Failed to set font.", GetErrorMessage(r));
+ pSimpleTextForBodyText = new (std::nothrow) TextSimple(const_cast <wchar_t*>(__pProgressPopup->GetText().GetPointer()),
+ __pProgressPopup->GetText().GetLength(),
+ TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
+ SysTryCatch(NID_UI_CTRL, pSimpleTextForBodyText != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
- r = __pBodyTextObject->Construct();
- SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ __pBodyTextObject->AppendElement(*pSimpleTextForBodyText);
+ __pBodyTextObject->SetForegroundColor(__pProgressPopup->GetTextColor(), 0, __pBodyTextObject->GetTextLength());
+ __pBodyTextObject->SetWrap(TEXT_OBJECT_WRAP_TYPE_WORD);
- TextSimple* pSimpleTextForBodyText = new (std::nothrow) TextSimple(const_cast <wchar_t*>(__pProgressPopup->GetText().GetPointer()),
- __pProgressPopup->GetText().GetLength(),
- TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
- SysTryCatch(NID_UI_CTRL, pSimpleTextForBodyText != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ r = SetFontInfo(FONT_STYLE_PLAIN, bodyTextSize);
+ SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to set font.", GetErrorMessage(r));
- __pBodyTextObject->AppendElement(*pSimpleTextForBodyText);
- __pBodyTextObject->SetForegroundColor(__pProgressPopup->GetTextColor(), 0, __pBodyTextObject->GetTextLength());
- __pBodyTextObject->SetWrap(TEXT_OBJECT_WRAP_TYPE_WORD);
- __pBodyTextObject->SetFont(_pFont, 0, __pBodyTextObject->GetTextLength());
- __pBodyTextObject->SetAlignment(TEXT_OBJECT_ALIGNMENT_LEFT|TEXT_OBJECT_ALIGNMENT_MIDDLE);
- }
+ __pBodyTextObject->SetFont(_pFont, 0, __pBodyTextObject->GetTextLength());
+ __pBodyTextObject->SetAlignment(TEXT_OBJECT_ALIGNMENT_LEFT);
- if (__pProgressPopup->HasButton())
- {
- GET_SHAPE_CONFIG(MESSAGEBOX::BOTTOM_HEIGHT, orientation, bottomHeight);
- }
-
- // Calculate Text bounds
- __textBounds.SetBounds(textLeftMargin + transLeftMargin,
- titleHeight + textTopMargin + transTopMargin + animationWidth + animationTopMargin,
- defaultWidth - (textLeftMargin + textRightMargin + transLeftMargin + transRightMargin),
- maxHeight - titleHeight - bottomHeight - animationWidth);
+ if (__pProgressPopup->HasButton())
+ {
+ GET_SHAPE_CONFIG(MESSAGEBOX::BOTTOM_HEIGHT, orientation, bottomHeight);
+ }
- __pBodyTextObject->SetBounds(__textBounds);
+ // Calculate Text bounds
+ __textBounds.SetBounds(textLeftMargin + transLeftMargin,
+ titleHeight + textTopMargin + transTopMargin + animationWidth + animationTopMargin,
+ defaultWidth - (textLeftMargin + textRightMargin + transLeftMargin + transRightMargin),
+ maxHeight - titleHeight - bottomHeight - animationWidth);
- if (__pProgressPopup->GetText().GetLength() > 0)
- {
- __pBodyTextObject->Compose();
- __textObjectHeight = __pBodyTextObject->GetLineHeightAtF(0) * 3.0;
- __textBounds.height = __textObjectHeight;
- }
-
- if (__pBodyTextObject->GetTotalHeightF() < __textObjectHeight)
- {
- __pLabel->SetBounds(FloatRectangle(0.0f, (__textObjectHeight - __pBodyTextObject->GetTotalHeightF())/2.0f, __textBounds.width, __pBodyTextObject->GetTotalHeightF()));
- }
- else
- {
- __pLabel->SetBounds(FloatRectangle(0.0f, 0.0f, __textBounds.width, __pBodyTextObject->GetTotalHeightF()));
- }
+ __pBodyTextObject->SetBounds(__textBounds);
+ if (__pProgressPopup->GetText().GetLength() > 0)
+ {
+ __pBodyTextObject->Compose();
+ __textObjectHeight = __pBodyTextObject->GetLineHeightAtF(0) * 3.0;
+ __textBounds.height = __textObjectHeight;
+ }
- __pLabel->SetText(__pProgressPopup->GetText());
- __pLabel->SetTextConfig(bodyTextSize, LABEL_TEXT_STYLE_NORMAL);
- __pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
- __pLabel->SetMargin(0.0f, 0.0f, 0.0f, 0.0f);
+ if (__pBodyTextObject->GetTotalHeightF() < __textObjectHeight)
+ {
+ __pLabel->SetBounds(FloatRectangle(0.0f, (__textObjectHeight - __pBodyTextObject->GetTotalHeightF())/2.0f, __textBounds.width, __pBodyTextObject->GetTotalHeightF()));
+ }
+ else
+ {
+ __pLabel->SetBounds(FloatRectangle(0.0f, 0.0f, __textBounds.width, __pBodyTextObject->GetTotalHeightF()));
+ }
- if (__pScrollPanel == null)
- {
- __pScrollPanel = _ScrollPanel::CreateScrollPanelN(__textBounds, SCROLL_PANEL_SCROLL_DIRECTION_VERTICAL, true);
- SysTryCatch(NID_UI_CTRL, __pScrollPanel != null, , E_OUT_OF_MEMORY, "[E_SYSTEM] Failed to create the scroll.");
+ __pLabel->SetText(__pProgressPopup->GetText());
+ __pLabel->SetTextConfig(bodyTextSize, LABEL_TEXT_STYLE_NORMAL);
+ __pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
+ __pLabel->SetMargin(0.0f, 0.0f, 0.0f, 0.0f);
- __pScrollPanel->SetBounds(__textBounds);
- __pScrollPanel->AttachChild(*__pLabel);
- __pProgressPopup->AttachChild(*__pScrollPanel);
- }
- else
- {
- __pScrollPanel->SetBounds(__textBounds);
- }
+ if (__pScrollPanel == null)
+ {
+ __pScrollPanel = _ScrollPanel::CreateScrollPanelN(__textBounds, SCROLL_PANEL_SCROLL_DIRECTION_VERTICAL, true);
+ SysTryCatch(NID_UI_CTRL, __pScrollPanel != null, , E_OUT_OF_MEMORY, "[E_SYSTEM] Failed to create the scroll.");
+ __pScrollPanel->SetBounds(__textBounds);
+ __pScrollPanel->AttachChild(*__pLabel);
+ __pProgressPopup->AttachChild(*__pScrollPanel);
+ }
+ else
+ {
+ __pScrollPanel->SetBounds(__textBounds);
}
return;
-
CATCH:
delete __pBodyTextObject;
__pBodyTextObject = null;