From c49fa1cd93217851cd6e5ea23f6b113b459b482d Mon Sep 17 00:00:00 2001 From: DongJinJeon Date: Tue, 16 Apr 2013 17:20:25 +0900 Subject: [PATCH] add scroll on messageBox, ProgressPopup Change-Id: I156dced874266406b256f033005a14b1f3814b08 Signed-off-by: DongJinJeon --- src/ui/controls/FUiCtrl_MessageBoxPresenter.cpp | 233 +++++++++++---------- src/ui/controls/FUiCtrl_ProgressPopupPresenter.cpp | 85 ++++++-- src/ui/inc/FUiCtrl_MessageBoxPresenter.h | 10 + src/ui/inc/FUiCtrl_ProgressPopupPresenter.h | 5 + src/ui/resource/FUi_ResourceMessageBoxConfig.cpp | 2 +- src/ui/resource/FUi_ResourcePopupConfig.cpp | 2 +- 6 files changed, 200 insertions(+), 137 deletions(-) diff --git a/src/ui/controls/FUiCtrl_MessageBoxPresenter.cpp b/src/ui/controls/FUiCtrl_MessageBoxPresenter.cpp index 4bbae85..eefceb9 100644 --- a/src/ui/controls/FUiCtrl_MessageBoxPresenter.cpp +++ b/src/ui/controls/FUiCtrl_MessageBoxPresenter.cpp @@ -35,7 +35,9 @@ #include "FUi_CoordinateSystemUtils.h" #include "FUiCtrl_ButtonImpl.h" #include "FUiCtrl_Button.h" +#include "FUiCtrl_Label.h" #include "FUiCtrl_Scroll.h" +#include "FUiCtrl_ScrollPanel.h" #include "FUiCtrl_MessageBox.h" #include "FUiCtrl_MessageBoxPresenter.h" @@ -61,7 +63,9 @@ _MessageBoxPresenter::_MessageBoxPresenter(void) , __pBodyTextObject(null) , __titleBounds(0.0f, 0.0f, 0.0f, 0.0f) , __textBounds(0.0f, 0.0f, 0.0f, 0.0f) + , __pLabel(null) , __pScroll(null) + , __pScrollPanel(null) , __fontStyle(0) , __fontSize(0.0f) , __scrollPos(0.0f) @@ -105,6 +109,20 @@ _MessageBoxPresenter::~_MessageBoxPresenter(void) __pBodyTextObject = null; } + if (__pLabel != null) + { + __pScrollPanel->DetachChild(*__pLabel); + delete __pLabel; + __pLabel = null; + } + + if (__pScrollPanel != null) + { + __pMessageBox->DetachChild(*__pScrollPanel); + delete __pScrollPanel; + __pScrollPanel = null; + } + if (__pScroll != null) { __pMessageBox->DetachSystemChild(*__pScroll); @@ -130,8 +148,6 @@ _MessageBoxPresenter::OnChangeLayout(_ControlOrientation orientation) float maxHeight = 0.0f; float textTopMargin = 0.0f; - float textLeftMargin = 0.0f; - float textRightMargin = 0.0f; float titleTopMargin = 0.0f; float titleLeftMargin = 0.0f; @@ -139,16 +155,13 @@ _MessageBoxPresenter::OnChangeLayout(_ControlOrientation orientation) float transTopMargin = 0.0f; float transBottomMargin = 0.0f; - float transLeftMargin = 0.0f; - float transRightMargin = 0.0f; + float labelHeight = 0.0f; GET_SHAPE_CONFIG(MESSAGEBOX::DEFAULT_WIDTH, orientation, defaultWidth); GET_SHAPE_CONFIG(MESSAGEBOX::BOTTOM_HEIGHT, orientation, bottomHeight); GET_SHAPE_CONFIG(MESSAGEBOX::MAX_HEIGHT, orientation, maxHeight); GET_SHAPE_CONFIG(MESSAGEBOX::TEXT_TOP_MRAGIN, orientation, textTopMargin); - GET_SHAPE_CONFIG(MESSAGEBOX::TEXT_LEFT_MARGIN, orientation, textLeftMargin); - GET_SHAPE_CONFIG(MESSAGEBOX::TEXT_RIGHT_MARGIN, orientation, textRightMargin); GET_SHAPE_CONFIG(MESSAGEBOX::TITLE_TEXT_TOP_MARGIN, orientation, titleTopMargin); GET_SHAPE_CONFIG(MESSAGEBOX::TITLE_TEXT_LEFT_MARGIN, orientation, titleLeftMargin); @@ -156,10 +169,8 @@ _MessageBoxPresenter::OnChangeLayout(_ControlOrientation orientation) GET_SHAPE_CONFIG(MESSAGEBOX::BG_IMAGE_TRANSPARENT_TOP_MARGIN, orientation, transTopMargin); GET_SHAPE_CONFIG(MESSAGEBOX::BG_IMAGE_TRANSPARENT_BOTTOM_MARGIN, orientation, transBottomMargin); - GET_SHAPE_CONFIG(MESSAGEBOX::BG_IMAGE_TRANSPARENT_LEFT_MARGIN, orientation, transLeftMargin); - GET_SHAPE_CONFIG(MESSAGEBOX::BG_IMAGE_TRANSPARENT_RIGHT_MARGIN, orientation, transRightMargin); - __textBounds.width = defaultWidth - (textLeftMargin + textRightMargin + transLeftMargin + transRightMargin); + __textBounds.width = defaultWidth - GetLeftRightLabelMargin(); // TitleText if (__pMessageBox->HasTitle() == true) @@ -170,45 +181,26 @@ _MessageBoxPresenter::OnChangeLayout(_ControlOrientation orientation) __pTitleTextObject->SetBounds(__titleBounds); __pTitleTextObject->Compose(); - - __titleBounds.height = __pTitleTextObject->GetTotalHeightF(); - + __titleBounds.height = titleHeight - titleTopMargin; } // Text __pBodyTextObject->SetBounds(__textBounds); + __pBodyTextObject->Compose(); // Text bounds - __pBodyTextObject->SetBounds(__textBounds); + __pScrollPanel->SetBounds(__textBounds); - // Scroll in Text - if (__pBodyTextObject->GetTotalHeightF() > __textObjHeight) - { - float maxH = __pBodyTextObject->GetTotalHeightF(); + labelHeight = __pBodyTextObject->GetTotalHeightF(); - if (__pScroll == null) - { - __pScroll = _Scroll::CreateScrollN(*__pMessageBox, - SCROLL_DIRECTION_VERTICAL, - true, - true, - false, - false, - __textObjHeight, - maxH, - 0.0f); - - SysTryReturnResult(NID_UI_CTRL, __pScroll != null, E_OUT_OF_MEMORY, "[E_SYSTEM] Failed to create the scroll."); - - __pMessageBox->AttachSystemChild(*__pScroll); - } + if (labelHeight < __textObjHeight) + { + __pLabel->SetBounds(FloatRectangle(0.0f, (__textObjHeight - labelHeight)/2.0f, __textBounds.width, labelHeight)); } - else if (__pScroll != null) + else { - __pMessageBox->DetachSystemChild(*__pScroll); - delete __pScroll; - __pScroll = null; + __pLabel->SetBounds(FloatRectangle(0.0f, 0.0f, __textBounds.width, labelHeight)); } for (int i = 0; i < __buttonNum; i++) @@ -237,7 +229,6 @@ _MessageBoxPresenter::Initialize(_MessageBox& msgbox) float textTopMargin = 0.0f; float textTopMarginNoButton = 0.0f; float textLeftMargin = 0.0f; - float textRightMargin = 0.0f; float titleTopMargin = 0.0f; float titleLeftMargin = 0.0f; @@ -248,6 +239,8 @@ _MessageBoxPresenter::Initialize(_MessageBox& msgbox) float transLeftMargin = 0.0f; float transRightMargin = 0.0f; + float labelHeight = 0.0f; + _ControlOrientation orientation; __pMessageBox = &msgbox; @@ -266,7 +259,6 @@ _MessageBoxPresenter::Initialize(_MessageBox& msgbox) GET_SHAPE_CONFIG(MESSAGEBOX::TEXT_TOP_MRAGIN, orientation, textTopMargin); GET_SHAPE_CONFIG(MESSAGEBOX::TEXT_TOP_MRAGIN_NO_BUTTON, orientation, textTopMarginNoButton); GET_SHAPE_CONFIG(MESSAGEBOX::TEXT_LEFT_MARGIN, orientation, textLeftMargin); - GET_SHAPE_CONFIG(MESSAGEBOX::TEXT_RIGHT_MARGIN, orientation, textRightMargin); GET_SHAPE_CONFIG(MESSAGEBOX::TITLE_TEXT_TOP_MARGIN, orientation, titleTopMargin); GET_SHAPE_CONFIG(MESSAGEBOX::TITLE_TEXT_LEFT_MARGIN, orientation, titleLeftMargin); @@ -280,99 +272,76 @@ _MessageBoxPresenter::Initialize(_MessageBox& msgbox) // TitleText if (__pMessageBox->HasTitle() == true) { - r = SetFontInfo(FONT_STYLE_PLAIN, titleTextSize); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Failed to set font.", GetErrorMessage(r)); - __pTitleTextObject = new (std::nothrow) TextObject(); SysTryReturn(NID_UI_CTRL, __pTitleTextObject != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Unable to create TitleTextObject."); __pTitleTextObject->Construct(); - TextSimple* pSimpleTextForTitleText = new (std::nothrow) TextSimple(const_cast (__pMessageBox->GetTitleText().GetPointer()), - __pMessageBox->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(__pMessageBox->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->SetFont(_pFont, 0, __pTitleTextObject->GetTextLength()); - __pTitleTextObject->SetAlignment(TEXT_OBJECT_ALIGNMENT_LEFT); - __pTitleTextObject->SetBounds(FloatRectangle(titleLeftMargin + transLeftMargin, + FloatRectangle bounds = FloatRectangle(titleLeftMargin + transLeftMargin, titleTopMargin + transTopMargin, defaultWidth - (titleLeftMargin + titleRightMargin + transLeftMargin + transRightMargin), - titleHeight - titleTopMargin)); - __pTitleTextObject->Compose(); + titleHeight - titleTopMargin); + + labelHeight = GetLabelHeight(__pTitleTextObject, const_cast (__pMessageBox->GetTitleText().GetPointer()), + __pMessageBox->GetTitleText().GetLength(), bodyTextSize, bounds); __titleBounds = FloatRectangle(titleLeftMargin + transLeftMargin, titleTopMargin + transTopMargin, defaultWidth - (titleLeftMargin + titleRightMargin + transLeftMargin + transRightMargin), - __pTitleTextObject->GetTotalHeightF()); - + titleHeight - titleTopMargin); } else { titleHeight = 0; } - // Text - r = SetFontInfo(FONT_STYLE_PLAIN, bodyTextSize); - SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to set font.", GetErrorMessage(r)); - - __pBodyTextObject = new (std::nothrow) TextObject(); - SysTryCatch(NID_UI_CTRL, __pBodyTextObject != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); - - __pBodyTextObject->Construct(); - - pSimpleTextForBodyText = new (std::nothrow) TextSimple(const_cast (__pMessageBox->GetText().GetPointer()), - __pMessageBox->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."); - - __pBodyTextObject->AppendElement(*pSimpleTextForBodyText); - __pBodyTextObject->SetForegroundColor(__pMessageBox->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->SetBounds(FloatRectangle(textLeftMargin + transLeftMargin, - titleHeight + textTopMargin + transTopMargin, - defaultWidth - (textLeftMargin + textRightMargin + transLeftMargin + transRightMargin), - maxHeight - titleHeight)); - __pBodyTextObject->Compose(); - // Text bounds __textBounds.SetBounds(textLeftMargin + transLeftMargin, titleHeight + textTopMargin + transTopMargin, - defaultWidth - (textLeftMargin + textRightMargin + transLeftMargin + transRightMargin), + defaultWidth - GetLeftRightLabelMargin(), __textObjHeight); + if ((__pMessageBox->HasTitle() == false) && (__pMessageBox->GetMsgBoxStyle() == MSGBOX_STYLE_NONE)) { __textBounds.y = transTopMargin + textTopMarginNoButton; } - __pBodyTextObject->SetBounds(__textBounds); - // Scroll in Text - if (__pBodyTextObject->GetTotalHeightF() > __textObjHeight) - { - float maxH = __pBodyTextObject->GetTotalHeightF(); + __pLabel = _Label::CreateLabelN(); + SysTryCatch(NID_UI_CTRL, __pLabel != null, , E_OUT_OF_MEMORY, "[E_SYSTEM] Failed to create the scroll."); - __pScroll = _Scroll::CreateScrollN(*__pMessageBox, - SCROLL_DIRECTION_VERTICAL, - true, - true, - false, - false, - __textObjHeight, - maxH, - 0.0f); + __pBodyTextObject = new (std::nothrow) TextObject(); + SysTryCatch(NID_UI_CTRL, __pBodyTextObject != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + __pBodyTextObject->Construct(); + labelHeight = GetLabelHeight(__pBodyTextObject, const_cast (__pMessageBox->GetText().GetPointer()), + __pMessageBox->GetText().GetLength(), bodyTextSize, __textBounds); - SysTryCatch(NID_UI_CTRL, __pScroll != null, , E_OUT_OF_MEMORY, "[E_SYSTEM] Failed to create the scroll."); + if (__pMessageBox->GetText().GetLength() > 0) + { + __textObjHeight = __pBodyTextObject->GetLineHeightAtF(0) * 3.0; + __textBounds.height = __textObjHeight; + } - __pMessageBox->AttachSystemChild(*__pScroll); + if (labelHeight < __textObjHeight) + { + __pLabel->SetBounds(FloatRectangle(0.0f, (__textObjHeight - labelHeight)/2.0f, __textBounds.width, labelHeight)); } + else + { + __pLabel->SetBounds(FloatRectangle(0.0f, 0.0f, __textBounds.width, labelHeight)); + } + + + __pLabel->SetText(__pMessageBox->GetText()); + __pLabel->SetTextConfig(bodyTextSize, LABEL_TEXT_STYLE_NORMAL); + __pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT); + __pLabel->SetMargin(0.0f, 0.0f, 0.0f, 0.0f); + + __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); + __pMessageBox->AttachChild(*__pScrollPanel); r = CreateButtons(); SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r)); @@ -392,6 +361,52 @@ CATCH: return r; } +float +_MessageBoxPresenter::GetLabelHeight(TextObject* textObject, wchar_t* text, int length, float bodyTextSize, FloatRectangle bounds) +{ + TextSimple* pSimpleTextForBodyText = null; + + // Text + result r = SetFontInfo(FONT_STYLE_PLAIN, bodyTextSize); + SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to set font.", GetErrorMessage(r)); + + textObject->Construct(); + + pSimpleTextForBodyText = new (std::nothrow) TextSimple(text, length, 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."); + + textObject->AppendElement(*pSimpleTextForBodyText); + textObject->SetWrap(TEXT_OBJECT_WRAP_TYPE_WORD); + textObject->SetAction(TEXT_OBJECT_ACTION_TYPE_ABBREV); + textObject->SetFont(_pFont, 0, textObject->GetTextLength()); + textObject->SetAlignment(TEXT_OBJECT_ALIGNMENT_LEFT|TEXT_OBJECT_ALIGNMENT_MIDDLE); + textObject->SetBounds(bounds); + textObject->Compose(); + + return textObject->GetTotalHeightF(); +CATCH: + delete pSimpleTextForBodyText; + return 0.0f; +} + +float +_MessageBoxPresenter::GetLeftRightLabelMargin(void) +{ + float textLeftMargin = 0.0f; + float textRightMargin = 0.0f; + float transLeftMargin = 0.0f; + float transRightMargin = 0.0f; + + _ControlOrientation orientation = __pMessageBox->GetOrientation(); + + GET_SHAPE_CONFIG(MESSAGEBOX::TEXT_LEFT_MARGIN, orientation, textLeftMargin); + GET_SHAPE_CONFIG(MESSAGEBOX::TEXT_RIGHT_MARGIN, orientation, textRightMargin); + GET_SHAPE_CONFIG(MESSAGEBOX::BG_IMAGE_TRANSPARENT_LEFT_MARGIN, orientation, transLeftMargin); + GET_SHAPE_CONFIG(MESSAGEBOX::BG_IMAGE_TRANSPARENT_RIGHT_MARGIN, orientation, transRightMargin); + + return textLeftMargin + textRightMargin + transLeftMargin + transRightMargin; +} + void _MessageBoxPresenter::OnFontChanged(Font* pFont) { @@ -487,22 +502,12 @@ _MessageBoxPresenter::Draw(void) __pTitleTextObject->SetFont(_pFont, 0, __pTitleTextObject->GetTextLength()); __pTitleTextObject->SetForegroundColor(__pMessageBox->GetTitleTextColor(), 0, __pTitleTextObject->GetTextLength()); + __pTitleTextObject->SetBounds(__titleBounds); __pTitleTextObject->Draw(*_CanvasImpl::GetInstance(*pCanvas)); } - // Draw Text - if (__pBodyTextObject != null) - { - r = SetFontInfo(FONT_STYLE_PLAIN, textSize); - SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r)); - - __pBodyTextObject->SetFont(_pFont, 0, __pBodyTextObject->GetTextLength()); - __pBodyTextObject->SetForegroundColor(__pMessageBox->GetTextColor(), 0, __pBodyTextObject->GetTextLength()); - - __pBodyTextObject->Draw(*_CanvasImpl::GetInstance(*pCanvas)); - } - + __pLabel->SetTextColor(__pMessageBox->GetTextColor()); //fall thtrough CATCH: delete pCanvas; diff --git a/src/ui/controls/FUiCtrl_ProgressPopupPresenter.cpp b/src/ui/controls/FUiCtrl_ProgressPopupPresenter.cpp index dc48802..ca9aee6 100755 --- a/src/ui/controls/FUiCtrl_ProgressPopupPresenter.cpp +++ b/src/ui/controls/FUiCtrl_ProgressPopupPresenter.cpp @@ -29,6 +29,8 @@ #include "FUi_CoordinateSystemUtils.h" #include "FUi_ResourceManager.h" #include "FUi_UiTouchEvent.h" +#include "FUiCtrl_Label.h" +#include "FUiCtrl_ScrollPanel.h" #include "FUiCtrl_ProgressPopupPresenter.h" #include "FUiCtrl_ProgressPopup.h" @@ -52,6 +54,8 @@ _ProgressPopupPresenter::_ProgressPopupPresenter(void) , __pBodyTextObject(null) , __titleBounds(0.0f, 0.0f, 0.0f, 0.0f) , __textBounds(0.0f, 0.0f, 0.0f, 0.0f) + , __pLabel(null) + , __pScrollPanel(null) , __pAnimation(null) , __pAnimationFrameList(null) , __fontStyle(0) @@ -80,6 +84,20 @@ _ProgressPopupPresenter::~_ProgressPopupPresenter(void) __pBodyTextObject = null; } + if (__pLabel != null) + { + __pScrollPanel->DetachChild(*__pLabel); + delete __pLabel; + __pLabel = null; + } + + if (__pScrollPanel != null) + { + __pProgressPopup->DetachChild(*__pScrollPanel); + delete __pScrollPanel; + __pScrollPanel = null; + } + if (__pAnimationFrameList != null) { delete __pAnimationFrameList; @@ -240,6 +258,8 @@ _ProgressPopupPresenter::SetTextObject(void) 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."); __pBodyTextObject = new (std::nothrow) TextObject(); SysTryReturnVoidResult(NID_UI_CTRL, __pBodyTextObject != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); @@ -264,19 +284,49 @@ _ProgressPopupPresenter::SetTextObject(void) GET_SHAPE_CONFIG(MESSAGEBOX::BOTTOM_HEIGHT, orientation, bottomHeight); } - __pBodyTextObject->SetBounds(FloatRectangle(textLeftMargin + transLeftMargin, - titleHeight + textTopMargin + transTopMargin + animationWidth + noTitleHeight, - defaultWidth - (textLeftMargin + textRightMargin + transLeftMargin + transRightMargin), - maxHeight - titleHeight - bottomHeight - animationWidth)); - __pBodyTextObject->Compose(); - // Calculate Text bounds __textBounds.SetBounds(textLeftMargin + transLeftMargin, titleHeight + textTopMargin + transTopMargin + animationWidth + noTitleHeight, defaultWidth - (textLeftMargin + textRightMargin + transLeftMargin + transRightMargin), - __textObjectHeight); + maxHeight - titleHeight - bottomHeight - animationWidth); __pBodyTextObject->SetBounds(__textBounds); + + 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())); + } + + + __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 (__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; @@ -285,6 +335,12 @@ CATCH: delete __pBodyTextObject; __pBodyTextObject = null; + delete __pLabel; + __pLabel = null; + + delete __pScrollPanel; + __pScrollPanel = null; + return; } @@ -492,20 +548,7 @@ _ProgressPopupPresenter::Draw(void) __pTitleTextObject->Draw(*_CanvasImpl::GetInstance(*pCanvas)); } - // Draw Body text - if (__pBodyTextObject != null) - { - r = SetFontInfo(FONT_STYLE_PLAIN, bodyTextSize); - SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r)); - - __pBodyTextObject->SetFont(_pFont, 0, __pBodyTextObject->GetTextLength()); - - __pBodyTextObject->Draw(*_CanvasImpl::GetInstance(*pCanvas)); - } - - //fall thtrough -CATCH: - delete pCanvas; + __pLabel->SetTextColor(__pProgressPopup->GetTextColor()); return; } diff --git a/src/ui/inc/FUiCtrl_MessageBoxPresenter.h b/src/ui/inc/FUiCtrl_MessageBoxPresenter.h index a4402d6..adc8a65 100644 --- a/src/ui/inc/FUiCtrl_MessageBoxPresenter.h +++ b/src/ui/inc/FUiCtrl_MessageBoxPresenter.h @@ -30,13 +30,18 @@ #include "FUi_UiTouchEvent.h" #include "FUiCtrl_PopupPresenter.h" +namespace Tizen { namespace Graphics { namespace _Text { + class TextObject; +}}} // Tizen::Graphics::_Text namespace Tizen { namespace Ui { namespace Controls { class Button; class _MessageBox; +class _Label; class _Scroll; +class _ScrollPanel; /** * @class _MessageBoxPresenter @@ -101,6 +106,9 @@ private: void SetReturnValue(MessageBoxModalResult rtn); int GetReturnValue(void) const; + float GetLabelHeight(Tizen::Graphics::_Text::TextObject* textObject, wchar_t* text, int length, float fontSize, FloatRectangle bounds); + float GetLeftRightLabelMargin(void); + // Inner class private: class _MessageBoxButtonListener @@ -163,7 +171,9 @@ private: Tizen::Graphics::FloatRectangle __titleBounds; Tizen::Graphics::FloatRectangle __textBounds; + Tizen::Ui::Controls::_Label* __pLabel; Tizen::Ui::Controls::_Scroll* __pScroll; + Tizen::Ui::Controls::_ScrollPanel* __pScrollPanel; unsigned long __fontStyle; float __fontSize; diff --git a/src/ui/inc/FUiCtrl_ProgressPopupPresenter.h b/src/ui/inc/FUiCtrl_ProgressPopupPresenter.h index 83ea5ba..44ecff2 100644 --- a/src/ui/inc/FUiCtrl_ProgressPopupPresenter.h +++ b/src/ui/inc/FUiCtrl_ProgressPopupPresenter.h @@ -34,6 +34,8 @@ namespace Tizen { namespace Ui { namespace Controls { class _ProgressPopup; +class _Label; +class _ScrollPanel; /** @@ -105,6 +107,9 @@ private: Tizen::Graphics::FloatRectangle __titleBounds; Tizen::Graphics::FloatRectangle __textBounds; + Tizen::Ui::Controls::_Label* __pLabel; + Tizen::Ui::Controls::_ScrollPanel* __pScrollPanel; + _Animation* __pAnimation; Tizen::Base::Collection::ArrayList* __pAnimationFrameList; diff --git a/src/ui/resource/FUi_ResourceMessageBoxConfig.cpp b/src/ui/resource/FUi_ResourceMessageBoxConfig.cpp index d64f6a5..f899988 100755 --- a/src/ui/resource/FUi_ResourceMessageBoxConfig.cpp +++ b/src/ui/resource/FUi_ResourceMessageBoxConfig.cpp @@ -56,7 +56,7 @@ START_UI_CONFIG(MESSAGEBOX); ADD_SHAPE_CONFIG(BOTTOM_HEIGHT, 118); // 20130403 ADD_SHAPE_CONFIG(TEXT_SIZE, 38); // 20130403 - ADD_SHAPE_CONFIG(TEXT_HEIGHT, 88); // 20130403 + ADD_SHAPE_CONFIG(TEXT_HEIGHT, 132); // 20130403 ADD_SHAPE_CONFIG(TEXT_LEFT_MARGIN, 29); // 20130403 ADD_SHAPE_CONFIG(TEXT_RIGHT_MARGIN, 29); // 20130403 diff --git a/src/ui/resource/FUi_ResourcePopupConfig.cpp b/src/ui/resource/FUi_ResourcePopupConfig.cpp index d930f00..2fd40d5 100755 --- a/src/ui/resource/FUi_ResourcePopupConfig.cpp +++ b/src/ui/resource/FUi_ResourcePopupConfig.cpp @@ -84,7 +84,7 @@ START_UI_CONFIG(POPUP); ADD_SHAPE_CONFIG(TITLE_TEXT_TOP_MARGIN, 20); //20130403 ADD_SHAPE_CONFIG(TITLE_TEXT_LEFT_MARGIN, 29); //20130403 ADD_SHAPE_CONFIG(TITLE_TEXT_RIGHT_MARGIN, 29); //20130403 - ADD_SHAPE_CONFIG(BODY_TEXT_HEIGHT, 88); //20130403 + ADD_SHAPE_CONFIG(BODY_TEXT_HEIGHT, 132); //20130403 ADD_SHAPE_CONFIG(TOP_BORDER, 6); // Compatibility 2.0 ADD_SHAPE_CONFIG(BOTTOM_BORDER, 30); // Compatibility 2.0 -- 2.7.4