if(pContainer != null)
{
pContainer->Activate(true);
+ pContainer->AddListener(*this);
}
r = _SettingInfoImpl::AddSettingEventListenerForInternal(*this);
return E_SUCCESS;
}
+_PopupPresenter*
+_MessageBox::GetPresenter(void)
+{
+ return static_cast <_PopupPresenter*>(__pMsgboxPresenter);
+}
+
void
_MessageBox::OnDraw()
{
_Popup::OnDeactivated();
}
-result
-_MessageBox::OnAttachedToMainTree(void)
+void
+_MessageBox::InitializeAccessibilityElement(void)
{
result r = E_SUCCESS;
- SysTryReturn(NID_UI_CTRL, GetVisibleState() != false, E_INVALID_OPERATION,
- E_INVALID_OPERATION, "[E_INVALID_OPERATION] This control is not 'displayable'");
+ _Popup::InitializeAccessibilityElement();
- _Control* pOwner = GetOwner();
- if (pOwner)
+ if (_pTitleTextAccessibilityElement != null)
{
- GetEcoreEvasMgr()->GetEcoreEvas()->SetOwner(*this, *pOwner);
+ _pTitleTextAccessibilityElement->SetName(L"MessageBoxTitleText");
}
- r = __pMsgboxPresenter->OnAttachedToMainTree();
- SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ __pMsgboxPresenter->InitializeAccessibilityElement();
+ r = GetLastResult();
+ SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
- return r;
+ return;
}
result
void
_MessageBox::OnBoundsChanged(void)
{
+ _AccessibilityContainer* pContainer = null;
+
+ pContainer = GetAccessibilityContainer();
+
SetClientBounds(FloatRectangle(0.0f, 0.0f, GetBoundsF().width, GetBoundsF().height));
+ if ((_pTitleTextAccessibilityElement != null) && (HasTitle() == true))
+ {
+ _pTitleTextAccessibilityElement->SetBounds(__pMsgboxPresenter->GetTitleTextBounds());
+ }
+
+ if (GetMsgBoxStyle() == MSGBOX_STYLE_NONE && pContainer != null)
+ {
+ _AccessibilityElement* pElementMessageBox = pContainer->GetChildElement(L"MessageBox");
+
+ if (pElementMessageBox != null)
+ {
+ pElementMessageBox->SetBounds(FloatRectangle(0.0f, 0.0f, GetBoundsF().width, GetBoundsF().height));
+ }
+ }
+
return;
}
}
}
+bool
+_MessageBox::OnAccessibilityFocusMovedNext(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ return false;
+}
+
+bool
+_MessageBox::OnAccessibilityFocusMovedPrevious(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ return false;
+}
+
+bool
+_MessageBox::OnAccessibilityReadElement(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ return false;
+}
+
+bool
+_MessageBox::OnAccessibilityReadingElement(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ return false;
+}
+
+bool
+_MessageBox::OnAccessibilityFocusIn(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ return false;
+}
+
+bool
+_MessageBox::OnAccessibilityFocusOut(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ return false;
+}
+
+bool
+_MessageBox::OnAccessibilityActionPerformed(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ return __pMsgboxPresenter->OnAccessibilityActionPerformed(control, element);
+}
+
+bool
+_MessageBox::OnAccessibilityValueIncreased(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ return false;
+}
+
+bool
+_MessageBox::OnAccessibilityValueDecreased(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ return false;
+}
}}} // Tizen::Ui::Controls
: __pMessageBox(null)
, __pButtonListener(null)
, __msgboxResult(MSGBOX_RESULT_CLOSE)
- , __pTextAccessibilityElement(null)
- , __pTitleTextObject(null)
, __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)
, __buttonNum(0)
, __prevPositionY(-1.0f)
delete __pButtonListener;
__pButtonListener = null;
- if (__pTitleTextObject != null)
- {
- __pTitleTextObject->RemoveAll();
- delete __pTitleTextObject;
- __pTitleTextObject = null;
- }
-
if (__pBodyTextObject != null)
{
__pBodyTextObject->RemoveAll();
delete __pScroll;
__pScroll = null;
}
-
- if (__pTextAccessibilityElement)
- {
- __pTextAccessibilityElement->Activate(false);
- __pTextAccessibilityElement = null;
- }
}
result
{
result r = E_SUCCESS;
+ float titleTextSize = 0.0f;
+ float minTitleTextSize = 0.0f;
float defaultWidth = 0.0f;
float titleHeight = 0.0f;
float bottomHeight = 0.0f;
float transBottomMargin = 0.0f;
float labelHeight = 0.0f;
+ GET_SHAPE_CONFIG(POPUP::TITLE_TEXT_SIZE, orientation, titleTextSize);
+ GET_SHAPE_CONFIG(POPUP::MIN_TITLE_TEXT_SIZE, orientation, minTitleTextSize);
+
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::TITLE_HEIGHT, orientation, titleHeight);
- __titleBounds.width = __textBounds.width;
- __pTitleTextObject->SetBounds(__titleBounds);
+ _titleBounds.width = __textBounds.width;
+ _pTitleTextObject->SetBounds(_titleBounds);
+
+ r = CalculateTitleTextSize(titleTextSize, minTitleTextSize);
+ SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
- __pTitleTextObject->Compose();
- __titleBounds.height = titleHeight - titleTopMargin;
+ _titleBounds.height = titleHeight - titleTopMargin;
}
// Text
// TitleText
if (__pMessageBox->HasTitle() == true)
{
- __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 = 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.");
- r = __pTitleTextObject->Construct();
+ r = _pTitleTextObject->Construct();
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
FloatRectangle bounds = FloatRectangle(titleLeftMargin + transLeftMargin,
defaultWidth - (titleLeftMargin + titleRightMargin + transLeftMargin + transRightMargin),
titleHeight - titleTopMargin);
- labelHeight = GetLabelHeight(__pTitleTextObject, const_cast <wchar_t*>(__pMessageBox->GetTitleText().GetPointer()),
- __pMessageBox->GetTitleText().GetLength(), bodyTextSize, bounds);
+ labelHeight = GetLabelHeight(_pTitleTextObject, const_cast <wchar_t*>(__pMessageBox->GetTitleText().GetPointer()),
+ __pMessageBox->GetTitleText().GetLength(), titleTextSize, bounds, true);
- __titleBounds = FloatRectangle(titleLeftMargin + transLeftMargin,
+ r = GetLastResult();
+ 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);
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
labelHeight = GetLabelHeight(__pBodyTextObject, const_cast <wchar_t*>(__pMessageBox->GetText().GetPointer()),
- __pMessageBox->GetText().GetLength(), bodyTextSize, __textBounds);
+ __pMessageBox->GetText().GetLength(), bodyTextSize, __textBounds, false);
+
+ r = GetLastResult();
+ SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
if (__pMessageBox->GetText().GetLength() > 0)
{
return r;
CATCH:
- delete __pTitleTextObject;
- __pTitleTextObject = null;
+ delete _pTitleTextObject;
+ _pTitleTextObject = null;
delete __pBodyTextObject;
__pBodyTextObject = null;
}
float
-_MessageBoxPresenter::GetLabelHeight(TextObject* textObject, wchar_t* text, int length, float bodyTextSize, FloatRectangle bounds)
+_MessageBoxPresenter::GetLabelHeight(TextObject* textObject, wchar_t* text, int length, float bodyTextSize, FloatRectangle bounds, bool isTitle)
{
TextSimple* pSimpleTextForBodyText = null;
+ result r = E_SUCCESS;
// Text
- result r = SetFontInfo(FONT_STYLE_PLAIN, bodyTextSize);
- SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to set font.", GetErrorMessage(r));
-
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();
+
+ if (isTitle == true)
+ {
+ float minTitleTextSize = 0.0f;
+
+ GET_SHAPE_CONFIG(MESSAGEBOX::MIN_TITLE_TEXT_SIZE, __pMessageBox->GetOrientation(), minTitleTextSize);
+
+ r = CalculateTitleTextSize(bodyTextSize, minTitleTextSize);
+ SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+ else
+ {
+ r = SetFontInfo(FONT_STYLE_PLAIN, bodyTextSize);
+ SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to set font.", GetErrorMessage(r));
+
+ textObject->SetFont(_pFont, 0, textObject->GetTextLength());
+
+ textObject->Compose();
+ }
+
+ SetLastResult(r);
return textObject->GetTotalHeightF();
+
CATCH:
return 0.0f;
}
}
void
-_MessageBoxPresenter::OnFontChanged(Font* pFont)
-{
- _pFont = pFont;
-}
-
-void
-_MessageBoxPresenter::OnFontInfoRequested(unsigned long& style, float& size)
-{
- style = __fontStyle;
- size = __fontSize;
-}
-
-result
-_MessageBoxPresenter::SetFontInfo(unsigned long style, float size)
-{
- __fontStyle = style;
- __fontSize = size;
-
- _pFont = __pMessageBox->GetFallbackFont();
- SysTryReturnResult(NID_UI_CTRL, _pFont != null, GetLastResult(), "Failed to get a font.");
-
- return E_SUCCESS;
-}
-
-void
_MessageBoxPresenter::Draw(void)
{
result r = E_SUCCESS;
float defaultWidth = 0.0f;
- float titleTextSize = 0.0f;
float textSize = 0.0f;
orientation = __pMessageBox->GetOrientation();
GET_SHAPE_CONFIG(MESSAGEBOX::DEFAULT_WIDTH, orientation, defaultWidth);
- GET_SHAPE_CONFIG(MESSAGEBOX::TITLE_TEXT_SIZE, orientation, titleTextSize);
GET_SHAPE_CONFIG(MESSAGEBOX::TEXT_SIZE, orientation, textSize);
}
// Draw Title
- if (__pTitleTextObject != null)
+ if (_pTitleTextObject != null)
{
- r = SetFontInfo(FONT_STYLE_PLAIN, titleTextSize);
+ r = SetFontInfo(FONT_STYLE_PLAIN, _titleTextSize);
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
- __pTitleTextObject->SetFont(_pFont, 0, __pTitleTextObject->GetTextLength());
- __pTitleTextObject->SetForegroundColor(__pMessageBox->GetTitleTextColor(), 0, __pTitleTextObject->GetTextLength());
- __pTitleTextObject->SetBounds(__titleBounds);
+ _pTitleTextObject->SetFont(_pFont, 0, _pTitleTextObject->GetTextLength());
+ _pTitleTextObject->SetForegroundColor(__pMessageBox->GetTitleTextColor(), 0, _pTitleTextObject->GetTextLength());
+ _pTitleTextObject->SetBounds(_titleBounds);
- __pTitleTextObject->Draw(*_CanvasImpl::GetInstance(*pCanvas));
+ _pTitleTextObject->Draw(*_CanvasImpl::GetInstance(*pCanvas));
}
__pLabel->SetTextColor(__pMessageBox->GetTextColor());
__pButtons[i]->SetText(__buttonText[i]);
__pButtons[i]->AddTouchEventListener(*__pButtonListener);
+ __pButtons[i]->AddKeyEventListener(*__pButtonListener);
pImpl = _ControlImpl::GetInstance(*__pButtons[i]);
pButtonCore = dynamic_cast<_Button*>(&pImpl->GetCore());
pButtonCore->SetTouchPressThreshold(0.16);
__pMessageBox->AttachChild(*pButtonCore);
}
+
+ if (i != 0)
+ {
+ __pButtons[i-1]->SetNextFocus(__pButtons[i]);
+ __pButtons[i]->SetPreviousFocus(__pButtons[i-1]);
+ }
}
return r;
}
FloatRectangle
-_MessageBoxPresenter::GetTitleBounds(void) const
-{
- return __titleBounds;
-}
-
-FloatRectangle
_MessageBoxPresenter::GetTextBounds(void) const
{
return __textBounds;
return (int) __msgboxResult;
}
-result
-_MessageBoxPresenter::OnAttachedToMainTree(void)
+void
+_MessageBoxPresenter::InitializeAccessibilityElement(void)
{
result r = E_SUCCESS;
- _AccessibilityElement* pTitleTextAccessibility = null;
- pTitleTextAccessibility = __pMessageBox->GetTitleTextAccessibilityElement();
- if ((pTitleTextAccessibility != null) && (__pTextAccessibilityElement != null))
+ _AccessibilityContainer* pContainer = null;
+
+ pContainer = __pMessageBox->GetAccessibilityContainer();
+
+ if (pContainer == null)
{
- return r;
+ return ;
}
- _AccessibilityContainer* pContainer = __pMessageBox->GetAccessibilityContainer();
- if (pContainer != null)
+ if (__pLabel != null)
{
- float titleHeight = 0.0f;
- GET_SHAPE_CONFIG(MESSAGEBOX::TITLE_HEIGHT, __pMessageBox->GetOrientation(), titleHeight);
-
- if (pTitleTextAccessibility == null)
+ _AccessibilityContainer* pLabelContainer = __pLabel->GetAccessibilityContainer();
+ if (pLabelContainer != null)
{
- pTitleTextAccessibility = new (std::nothrow) _AccessibilityElement(true);
- SysTryReturn(NID_UI_CTRL, pTitleTextAccessibility != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,"[E_OUT_OF_MEMORY] Memory allocation failed.");
-
- pTitleTextAccessibility->Construct(L"MessageBoxTitleText", __titleBounds);
- pTitleTextAccessibility->SetLabel(__pMessageBox->GetTitleText());
- pTitleTextAccessibility->SetTrait(L"Popup Title");
+ _AccessibilityElement* pLabelElement = pLabelContainer->GetChildElement(L"LabelText");
+ if (pLabelElement != null)
+ {
+ pLabelElement->SetName(L"MessageBoxText");
+ pLabelElement->SetTrait(L"Popup body text");
+ }
- pContainer->AddElement(*pTitleTextAccessibility);
+ // Add Container
+ pContainer->AddChildContainer(*pLabelContainer);
}
+ }
- if (__pTextAccessibilityElement == null)
+ if (__pMessageBox->GetMsgBoxStyle() != MSGBOX_STYLE_NONE)
+ {
+ for (int i = 0; i < __buttonNum; i++)
{
- __pTextAccessibilityElement = new (std::nothrow) _AccessibilityElement(true);
- SysTryReturn(NID_UI_CTRL, __pTextAccessibilityElement != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,"[E_OUT_OF_MEMORY] Memory allocation failed.");
+ _ControlImpl* pImpl = null;
+ _Button* pButtonCore = null;
- __pTextAccessibilityElement->Construct(L"MessageBoxText", __textBounds);
- __pTextAccessibilityElement->SetLabel(__pMessageBox->GetText());
- __pTextAccessibilityElement->SetTrait(L"Popup body text");
+ pImpl = _ControlImpl::GetInstance(*__pButtons[i]);
- pContainer->AddElement(*__pTextAccessibilityElement);
- }
+ pButtonCore = dynamic_cast<_Button*>(&pImpl->GetCore());
+ r = GetLastResult();
+ SysTryReturnVoidResult(NID_UI_CTRL, pButtonCore != null, r, "[%s] Propagating.", GetErrorMessage(r));
- if (__pMessageBox->GetMsgBoxStyle() != MSGBOX_STYLE_NONE)
- {
- for (int i = 0; i < __buttonNum; i++)
+ _AccessibilityContainer* pButtonContainer = pButtonCore->GetAccessibilityContainer();
+ if (pButtonContainer != null)
{
- _ControlImpl* pImpl = null;
- _Button* pButtonCore = null;
-
- pImpl = _ControlImpl::GetInstance(*__pButtons[i]);
-
- pButtonCore = dynamic_cast<_Button*>(&pImpl->GetCore());
- r = GetLastResult();
- SysTryReturn(NID_UI_CTRL, pButtonCore != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
-
- _AccessibilityContainer* pButtonContainer = pButtonCore->GetAccessibilityContainer();
- if (pButtonContainer != null)
+ _AccessibilityElement* pButtonElement = pButtonContainer->GetChildElement(L"ButtonText");
+ if (pButtonElement != null)
{
- _AccessibilityElement* pButtonElement = pButtonContainer->GetChildElement(L"ButtonText");
- if (pButtonElement != null)
- {
- String numberString = null;
- numberString = Integer::ToString(i + 1);
+ String numberString = null;
+ numberString = Integer::ToString(i + 1);
- String buttonName = L"MessageBoxButton";
- buttonName.Append(numberString);
+ String buttonName = L"MessageBoxButton";
+ buttonName.Append(numberString);
- pButtonElement->SetName(buttonName);
- }
-
- // Add Container
- pContainer->AddChildContainer(*pButtonContainer);
+ pButtonElement->SetName(buttonName);
}
+
+ // Add Container
+ pContainer->AddChildContainer(*pButtonContainer);
}
}
}
+ else
+ {
+ _AccessibilityElement* pElementMessageBox = new (std::nothrow) _AccessibilityElement(true);
+ SysTryReturnVoidResult(NID_UI_CTRL, pElementMessageBox != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
+
+ pElementMessageBox->SetSupportOperatingGesture(false);
+ pElementMessageBox->SetName(L"MessageBox");
+ pElementMessageBox->SetTrait(L"MessageBox");
+ pElementMessageBox->SetHint(L"double tap to close");
+ pElementMessageBox->SetBounds(FloatRectangle(0.0f, 0.0f, __pMessageBox->GetBoundsF().width, __pMessageBox->GetBoundsF().height));
+ pContainer->AddElement(*pElementMessageBox);
+ }
+}
- return r;
-
+_Popup*
+_MessageBoxPresenter::GetCore(void)
+{
+ return static_cast <_Popup*>(__pMessageBox);
}
bool
}
bool
+_MessageBoxPresenter::OnAccessibilityActionPerformed(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+{
+ if (__pMessageBox->GetMsgBoxStyle() == MSGBOX_STYLE_NONE)
+ {
+ SetReturnValue(MSGBOX_RESULT_CLOSE);
+ _ModalLoopManager::GetInstance()->EndMainLoop(MSGBOX_RESULT_CLOSE, false);
+ }
+
+ return true;
+}
+
+bool
_MessageBoxPresenter::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
{
__touchOutBounds = false;
}
}
+void
+_MessageBoxPresenter::_MessageBoxButtonListener::OnKeyPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
+{
+ const _ControlImpl* pImpl = null;
+ const _Button* pControl = null;
+
+ pImpl = _ControlImpl::GetInstance(source);
+ pControl = dynamic_cast<const _Button*>(&pImpl->GetCore());
+
+ if (pControl != null)
+ {
+
+ _Button* pFocusControl = null;
+ switch (keyCode)
+ {
+ case KEY_RIGHT:
+ pFocusControl = dynamic_cast<_Button*>(pControl->GetNextFocus());
+ break;
+
+ case KEY_LEFT:
+ pFocusControl = dynamic_cast<_Button*>(pControl->GetPreviousFocus());
+ break;
+ default :
+ break;
+ }
+
+ if (pFocusControl != null)
+ {
+ _Control* pParentControl = pFocusControl->GetParent();
+
+ if (pParentControl != null)
+ {
+ pParentControl->OnChildControlFocusMoved(*pFocusControl);
+ }
+
+ pFocusControl->SetFocused();
+ pFocusControl->DrawFocus();
+ }
+ }
+
+ return ;
+}
}}} // Tizen::Ui::Controls
if(pContainer != null)
{
pContainer->Activate(true);
- InitializeAccessibilityElement();
}
return r;
return E_SUCCESS;
}
+_PopupPresenter*
+_Popup::GetPresenter(void)
+{
+ return __pPopupPresenter;
+}
+
result
_Popup::DoModal(int& modalResult)
{
{
_pTitleTextAccessibilityElement->SetLabel(title);
}
-
return E_SUCCESS;
}
else
{
return E_SYSTEM;
}
+
}
String
SysTryReturn(NID_UI_CTRL, GetVisibleState() != false, E_INVALID_OPERATION,
E_INVALID_OPERATION, "[E_INVALID_OPERATION] This control is not 'displayable'");
- GetEcoreEvasMgr()->GetEcoreEvas()->SetOwner(*this, *GetOwner());
+ _Control* pOwner = GetOwner();
+ if (pOwner != null)
+ {
+ GetEcoreEvasMgr()->GetEcoreEvas()->SetOwner(*this, *pOwner);
+ }
+
+ InitializeAccessibilityElement();
return E_SUCCESS;
}
_AccessibilityContainer* pContainer = GetAccessibilityContainer();
if (pContainer != null)
{
- float titleHeight = 0.0f;
- GET_SHAPE_CONFIG(POPUP::TITLE_HEIGHT, GetOrientation(), titleHeight);
- _pTitleTextAccessibilityElement = new (std::nothrow) _AccessibilityElement(true);
- SysTryReturnVoidResult(NID_UI_CTRL, _pTitleTextAccessibilityElement != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ pContainer->RemoveAllElement();
+ _pTitleTextAccessibilityElement = null;
+ if (HasTitle() == true)
+ {
+ _pTitleTextAccessibilityElement = new (std::nothrow) _AccessibilityElement(true);
+ SysTryReturnVoidResult(NID_UI_CTRL, _pTitleTextAccessibilityElement != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
- _pTitleTextAccessibilityElement->Construct(L"PopupTitleText", __pPopupPresenter->GetTitleTextBounds());
- _pTitleTextAccessibilityElement->SetLabel(GetTitleText());
- _pTitleTextAccessibilityElement->SetTrait(L"Popup Title");
+ _PopupPresenter* pPresenter = GetPresenter();
+ SysTryReturnVoidResult(NID_UI_CTRL, pPresenter != null, E_SYSTEM, "[E_SYSTEM] This instance is not constructed.");
+ _pTitleTextAccessibilityElement->Construct(L"PopupTitleText", pPresenter->GetTitleTextBounds());
+ _pTitleTextAccessibilityElement->SetLabel(GetTitleText());
+ _pTitleTextAccessibilityElement->SetTrait(L"Popup Title");
- pContainer->AddElement(*_pTitleTextAccessibilityElement);
+ pContainer->AddElement(*_pTitleTextAccessibilityElement);
+ }
}
return;
SetClientBounds(GetPopupClientArea());
if (__pPopupPresenter != null)
{
- __pPopupPresenter->UpdateEffectBounds();
+ __pPopupPresenter->OnBoundsChanged();
}
- if (_pTitleTextAccessibilityElement != null)
+ if ((_pTitleTextAccessibilityElement != null) && (HasTitle() == true))
{
- float titleHeight = 0.0f;
- GET_SHAPE_CONFIG(POPUP::TITLE_HEIGHT, GetOrientation(), titleHeight);
-
- _pTitleTextAccessibilityElement->SetBounds(FloatRectangle(0.0f, 0.0f, GetPopupClientArea().width, titleHeight));
+ _pTitleTextAccessibilityElement->SetBounds(__pPopupPresenter->GetTitleTextBounds());
}
}
return true;
}
-void
-_Popup::OnWindowStateChanged(void)
-{
- SetOrientationCallbackModeEnabled(true);
-
- _Window::OnWindowStateChanged();
-
- SetOrientationCallbackModeEnabled(false);
-}
-
}}} // Tizen::Ui::Controls
_PopupPresenter::_PopupPresenter(void)
: _pFont(null)
+ , _titleBounds(0.0f, 0.0f, 0.0f, 0.0f)
+ , _titleTextSize(0.0f)
+ , _fontStyle(0)
+ , _fontSize(0.0f)
+ , _pTitleTextObject(null)
, __pPopup(null)
, __pPopupVE(null)
, __pBackgroundVE(null)
- , __pTextObject(null)
- , __titleBounds(0.0f, 0.0f, 0.0f, 0.0f)
{
//empty statement
}
_PopupPresenter::~_PopupPresenter(void)
{
- if (__pTextObject != null)
+ if (_pTitleTextObject != null)
{
- delete __pTextObject;
- __pTextObject = null;
+ _pTitleTextObject->RemoveAll();
+ delete _pTitleTextObject;
+ _pTitleTextObject = null;
}
if (__pBackgroundVE != null)
void
_PopupPresenter::OnFontInfoRequested(unsigned long& style, float& size)
{
- float textSize = 0.0f;
- GET_SHAPE_CONFIG(POPUP::TITLE_TEXT_SIZE, __pPopup->GetOrientation(), textSize);
+ style = _fontStyle;
+ size = _fontSize;
+}
+
+result
+_PopupPresenter::SetFontInfo(unsigned long style, float size)
+{
+ _fontStyle = style;
+ _fontSize = size;
- style = FONT_STYLE_PLAIN;
- size = textSize;
+ _pFont = GetCore()->GetFallbackFont();
+ SysTryReturnResult(NID_UI_CTRL, _pFont != null, GetLastResult(), "Failed to get a font.");
+
+ return E_SUCCESS;
}
result
result r = E_SUCCESS;
TextSimple* pSimpleText = null;
+ float titleTextSize = 0.0f;
+ float minTitleTextSize = 0.0f;
float titleHeight = 0.0f;
float titleTopMargin = 0.0f;
float titleLeftMargin = 0.0f;
orientation = __pPopup->GetOrientation();
+ GET_SHAPE_CONFIG(POPUP::TITLE_TEXT_SIZE, orientation, titleTextSize);
+ GET_SHAPE_CONFIG(POPUP::MIN_TITLE_TEXT_SIZE, orientation, minTitleTextSize);
GET_SHAPE_CONFIG(POPUP::TITLE_HEIGHT, orientation, titleHeight);
GET_SHAPE_CONFIG(POPUP::TITLE_TEXT_TOP_MARGIN, orientation, titleTopMargin);
GET_SHAPE_CONFIG(POPUP::BG_IMAGE_TRANSPARENT_LEFT_MARGIN, orientation, transLeftMargin);
GET_SHAPE_CONFIG(POPUP::BG_IMAGE_TRANSPARENT_RIGHT_MARGIN, orientation, transRightMargin);
- // Title font
- _pFont = __pPopup->GetFallbackFont();
- SysTryReturn(NID_UI_CTRL, _pFont != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
-
- if (__pTextObject != null)
+ if (_pTitleTextObject != null)
{
- delete __pTextObject;
+ delete _pTitleTextObject;
}
// Title text
- __pTextObject = new (std::nothrow) TextObject();
- SysTryReturn(NID_UI_CTRL, __pTextObject != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ _pTitleTextObject = new (std::nothrow) TextObject();
+ SysTryReturn(NID_UI_CTRL, _pTitleTextObject != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
- r = __pTextObject->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));
pSimpleText = new (std::nothrow) TextSimple(const_cast <wchar_t*>(title.GetPointer()),
title.GetLength(),
TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
SysTryCatch(NID_UI_CTRL, pSimpleText != null , r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
- __pTextObject->AppendElement(*pSimpleText);
- __pTextObject->SetForegroundColor(__pPopup->GetTitleTextColor(), 0, __pTextObject->GetTextLength());
- __pTextObject->SetWrap(TEXT_OBJECT_WRAP_TYPE_NONE);
- __pTextObject->SetAction(TEXT_OBJECT_ACTION_TYPE_ABBREV);
- __pTextObject->SetTextObjectEllipsisType(TEXT_OBJECT_ELLIPSIS_TYPE_TAIL);
+ _pTitleTextObject->AppendElement(*pSimpleText);
+ _pTitleTextObject->SetForegroundColor(__pPopup->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);
- __pTextObject->SetFont(_pFont, 0, __pTextObject->GetTextLength());
- __pTextObject->SetAlignment(TEXT_OBJECT_ALIGNMENT_LEFT);
+ _pTitleTextObject->SetAlignment(TEXT_OBJECT_ALIGNMENT_LEFT);
- __pTextObject->SetBounds(FloatRectangle(titleLeftMargin + transLeftMargin,
+ _pTitleTextObject->SetBounds(FloatRectangle(titleLeftMargin,
titleTopMargin,
- __pPopup->GetBoundsF().width - (titleLeftMargin + titleRightMargin + transLeftMargin + transRightMargin),
+ __pPopup->GetBoundsF().width - (titleLeftMargin + titleRightMargin),
titleHeight - titleTopMargin));
- __pTextObject->Compose();
- // After TextObject::Compose(), we can get text-object's height.
- __titleBounds.SetBounds(titleLeftMargin + transLeftMargin,
+ r = CalculateTitleTextSize(titleTextSize, minTitleTextSize);
+ SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ _titleBounds.SetBounds(titleLeftMargin,
titleTopMargin,
- __pPopup->GetBounds().width - (titleLeftMargin + titleRightMargin + transLeftMargin + transRightMargin),
- __pTextObject->GetTotalHeight());
+ __pPopup->GetBounds().width - (titleLeftMargin + titleRightMargin),
+ _pTitleTextObject->GetTotalHeight());
- __pTextObject->SetBounds(__titleBounds);
+ _pTitleTextObject->SetBounds(_titleBounds);
return r;
CATCH:
- delete __pTextObject;
- __pTextObject = null;
+ delete _pTitleTextObject;
+ _pTitleTextObject = null;
return r;
}
+result
+_PopupPresenter::CalculateTitleTextSize(float titleTextSize, float minTitleTextSize)
+{
+ result r = E_SUCCESS;
+
+ int titleTextLength = _pTitleTextObject->GetTextLength();
+
+ while (titleTextSize >= minTitleTextSize)
+ {
+ r = SetFontInfo(FONT_STYLE_PLAIN, titleTextSize);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] failed to set font.", GetErrorMessage(r));
+ _pTitleTextObject->SetFont(_pFont, 0, titleTextLength);
+ _pTitleTextObject->Compose();
+
+ if (titleTextLength <= _pTitleTextObject->GetTextLengthAt(0))
+ {
+ break;
+ }
+
+ --titleTextSize;
+ }
+
+ if (titleTextSize < minTitleTextSize)
+ {
+ _titleTextSize = minTitleTextSize;
+ }
+ else
+ {
+ _titleTextSize = titleTextSize;
+ }
+
+ return r;
+}
void
_PopupPresenter::OnDraw(void)
{
FloatRectangle
_PopupPresenter::GetTitleTextBounds(void) const
{
- return __titleBounds;
+ return _titleBounds;
+}
+
+void
+_PopupPresenter::OnBoundsChanged(void)
+{
+ UpdateEffectBounds();
+
+ if (__pPopup->HasTitle() == true)
+ {
+ UpdateTitleTextBounds();
+ }
+}
+
+void
+_PopupPresenter::UpdateTitleTextBounds(void)
+{
+ float titleLeftMargin = 0.0f;
+ float titleRightMargin = 0.0f;
+ float titleTextSize = 0.0f;
+ float minTitleTextSize = 0.0f;
+
+ _ControlOrientation orientation;
+
+ if (_pTitleTextObject == null)
+ {
+ return;
+ }
+
+ orientation = __pPopup->GetOrientation();
+
+ GET_SHAPE_CONFIG(POPUP::TITLE_TEXT_LEFT_MARGIN, orientation, titleLeftMargin);
+ GET_SHAPE_CONFIG(POPUP::TITLE_TEXT_RIGHT_MARGIN, orientation, titleRightMargin);
+
+ GET_SHAPE_CONFIG(POPUP::TITLE_TEXT_SIZE, orientation, titleTextSize);
+ GET_SHAPE_CONFIG(POPUP::MIN_TITLE_TEXT_SIZE, orientation, minTitleTextSize);
+
+ _titleBounds.width =__pPopup->GetBounds().width - (titleLeftMargin + titleRightMargin),
+
+ _pTitleTextObject->SetBounds(_titleBounds);
+
+ CalculateTitleTextSize(titleTextSize, minTitleTextSize);
}
void
// Draw Title
if (__pPopup->HasTitle())
{
- if (__pTextObject != null)
+ if (_pTitleTextObject != null)
{
- _pFont = __pPopup->GetFallbackFont();
- r = GetLastResult();
- SysTryCatch(NID_UI_CTRL, _pFont != null, , r, "[%s] Propagating.", GetErrorMessage(r));
+ r = SetFontInfo(FONT_STYLE_PLAIN, _titleTextSize);
+ SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
- __pTextObject->SetFont(_pFont, 0, __pTextObject->GetTextLength());
- __pTextObject->SetBounds(__titleBounds);
- __pTextObject->SetForegroundColor(__pPopup->GetTitleTextColor(), 0, __pTextObject->GetTextLength());
+ _pTitleTextObject->SetFont(_pFont, 0, _pTitleTextObject->GetTextLength());
+ _pTitleTextObject->SetBounds(_titleBounds);
+ _pTitleTextObject->SetForegroundColor(__pPopup->GetTitleTextColor(), 0, _pTitleTextObject->GetTextLength());
- __pTextObject->Draw(*_CanvasImpl::GetInstance(*pCanvas));
+ _pTitleTextObject->Draw(*_CanvasImpl::GetInstance(*pCanvas));
}
}
return true;
}
+_Popup*
+_PopupPresenter::GetCore(void)
+{
+ return __pPopup;
+}
}}} // Tizen::Ui::Controls
, __text(L"")
, __textColor(Color(0xFFFFFFFF))
, __animationRect(0.0f, 0.0f, 0.0f, 0.0f)
- , __pTextAccessibilityElement(null)
, __textState(false)
, __buttonState(false)
, __isTransparent(false)
delete __pButton;
__pButton = null;
- if (__pTextAccessibilityElement)
- {
- __pTextAccessibilityElement->Activate(false);
- __pTextAccessibilityElement = null;
- }
-
_SettingInfoImpl::RemoveSettingEventListenerForInternal(*this);
}
if(pContainer != null)
{
pContainer->Activate(true);
- InitializeAccessibilityElement();
}
r = _SettingInfoImpl::AddSettingEventListenerForInternal(*this);
return E_SUCCESS;
}
+_PopupPresenter*
+_ProgressPopup::GetPresenter(void)
+{
+ return static_cast <_PopupPresenter*>(__pProgressPopupPresenter);
+}
+
result
_ProgressPopup::DoModal(int& modalResult)
{
_titleText = title;
_titleState = true;
+ __pProgressPopupPresenter->SetTitleTextObject();
+
if (_pTitleTextAccessibilityElement != null)
{
_pTitleTextAccessibilityElement->SetLabel(title);
}
- __pProgressPopupPresenter->SetTitleTextObject();
-
return r;
}
__text = text;
__textState = true;
- if (__pTextAccessibilityElement != null)
- {
- __pTextAccessibilityElement->SetLabel(text);
- }
-
__pProgressPopupPresenter->SetTextObject();
return r;
{
SetClientBounds(FloatRectangle(0.0f, 0.0f, GetBoundsF().width, GetBoundsF().height));
+ if ((HasTitle() == true) && (_pTitleTextAccessibilityElement != null))
+ {
+ _pTitleTextAccessibilityElement->SetBounds(__pProgressPopupPresenter->GetTitleTextBounds());
+ }
+
return;
}
_Window::OnVisibleStateChanged();
}
-result
-_ProgressPopup::OnAttachedToMainTree(void)
-{
- SysTryReturn(NID_UI_CTRL, GetVisibleState() != false, E_INVALID_OPERATION,
- E_INVALID_OPERATION, "[E_INVALID_OPERATION] This control is not 'displayable'");
-
- GetEcoreEvasMgr()->GetEcoreEvas()->SetOwner(*this, *GetOwner());
-
- return E_SUCCESS;
-}
-
void
_ProgressPopup::OnActivated(void)
{
void
_ProgressPopup::InitializeAccessibilityElement(void)
{
- _AccessibilityContainer* pContainer = GetAccessibilityContainer();
- if (_pTitleTextAccessibilityElement == null)
- {
- _pTitleTextAccessibilityElement = new (std::nothrow) _AccessibilityElement(true);
- SysTryReturnVoidResult(NID_UI_CTRL, _pTitleTextAccessibilityElement != null, E_OUT_OF_MEMORY,"[E_OUT_OF_MEMORY] Memory allocation failed.");
+ result r = E_SUCCESS;
- _pTitleTextAccessibilityElement->Construct(L"ProgressPopupTitleText", __pProgressPopupPresenter->GetTitleBounds());
- _pTitleTextAccessibilityElement->SetLabel(GetTitleText());
- _pTitleTextAccessibilityElement->SetTrait(L"Popup Title");
+ _Popup::InitializeAccessibilityElement();
- pContainer->AddElement(*_pTitleTextAccessibilityElement);
+ if (_pTitleTextAccessibilityElement != null)
+ {
+ _pTitleTextAccessibilityElement->SetName(L"ProgressPopupTitleText");
}
- if (__pTextAccessibilityElement == null)
- {
- __pTextAccessibilityElement = new (std::nothrow) _AccessibilityElement(true);
- SysTryReturnVoidResult(NID_UI_CTRL, __pTextAccessibilityElement != null, E_OUT_OF_MEMORY,"[E_OUT_OF_MEMORY] Memory allocation failed.");
+ __pProgressPopupPresenter->InitializeAccessibilityElement();
+ r = GetLastResult();
+ SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
- __pTextAccessibilityElement->Construct(L"ProgressPopupText", __pProgressPopupPresenter->GetTextBounds());
- __pTextAccessibilityElement->SetLabel(GetText());
- __pTextAccessibilityElement->SetTrait(L"Popup body text");
+ if (HasButton() == true)
+ {
- pContainer->AddElement(*__pTextAccessibilityElement);
+ SetCancelButtonAccessibilityElement();
}
+ return;
+}
- if (HasButton() == true)
+void
+_ProgressPopup::SetCancelButtonAccessibilityElement(void)
+{
+ _AccessibilityContainer* pContainer = GetAccessibilityContainer();
+
+ if (pContainer != null)
{
_ControlImpl* pImpl = null;
_Button* pButtonCore = null;
SysTryReturnVoidResult(NID_UI_CTRL, pButtonCore != null, r, "[%s] Propagating.", GetErrorMessage(r));
_AccessibilityContainer* pButtonContainer = pButtonCore->GetAccessibilityContainer();
+
if (pButtonContainer != null)
{
_AccessibilityElement* pButtonElement = pButtonContainer->GetChildElement(L"ButtonText");
pContainer->AddChildContainer(*pButtonContainer);
}
}
- return;
}
-
-
void
_ProgressPopup::OnChangeLayout(_ControlOrientation orientation)
{
#include <FGrp_BitmapImpl.h>
#include <FGrp_CanvasImpl.h>
#include <FGrp_TextTextSimple.h>
+#include "FUi_AccessibilityContainer.h"
+#include "FUi_AccessibilityElement.h"
#include "FUi_CoordinateSystemUtils.h"
#include "FUi_ResourceManager.h"
#include "FUi_UiTouchEvent.h"
_ProgressPopupPresenter::_ProgressPopupPresenter(void)
: __pProgressPopup(null)
- , __pTitleTextObject(null)
, __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)
- , __fontSize(0.0f)
, __textObjectHeight(0.0f)
, __currentIndex(0)
, __buttonPressState(false)
_ProgressPopupPresenter::~_ProgressPopupPresenter(void)
{
- if (__pTitleTextObject != null)
- {
- __pTitleTextObject->RemoveAll();
- delete __pTitleTextObject;
- __pTitleTextObject = null;
- }
-
if (__pBodyTextObject != null)
{
__pBodyTextObject->RemoveAll();
_ProgressPopupPresenter::SetTitleTextObject(void)
{
float titleTextSize = 0.0f;
+ float minTitleTextSize = 0.0f;
float defaultWidth = 0.0f;
float titleHeight = 0.0f;
float titleTopMargin = 0.0f;
orientation = __pProgressPopup->GetOrientation();
GET_SHAPE_CONFIG(POPUP::TITLE_TEXT_SIZE, orientation, titleTextSize);
+ GET_SHAPE_CONFIG(POPUP::MIN_TITLE_TEXT_SIZE, orientation, minTitleTextSize);
GET_SHAPE_CONFIG(MESSAGEBOX::DEFAULT_WIDTH, orientation, defaultWidth);
GET_SHAPE_CONFIG(POPUP::TITLE_HEIGHT, orientation, titleHeight);
GET_SHAPE_CONFIG(POPUP::TITLE_TEXT_TOP_MARGIN, orientation, titleTopMargin);
{
result r = E_SUCCESS;
- if (__pTitleTextObject == null) //add for landscape
+ 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.");
+ _pTitleTextObject = new (std::nothrow) TextObject();
+ SysTryReturnVoidResult(NID_UI_CTRL, _pTitleTextObject != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
- r = SetFontInfo(FONT_STYLE_PLAIN, titleTextSize);
- SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Failed to set font.", GetErrorMessage(r));
-
- r = __pTitleTextObject->Construct();
+ r = _pTitleTextObject->Construct();
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()),
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->SetFont(_pFont, 0, __pTitleTextObject->GetTextLength());
- __pTitleTextObject->SetAlignment(TEXT_OBJECT_ALIGNMENT_LEFT);
+ _pTitleTextObject->SetAlignment(TEXT_OBJECT_ALIGNMENT_LEFT);
}
- __pTitleTextObject->SetBounds(FloatRectangle(titleLeftMargin + transLeftMargin,
+
+ _pTitleTextObject->SetBounds(FloatRectangle(titleLeftMargin + transLeftMargin,
titleTopMargin + transTopMargin,
defaultWidth - (titleLeftMargin + titleRightMargin + transLeftMargin + transRightMargin),
titleHeight - titleTopMargin));
- __pTitleTextObject->Compose();
- __titleBounds = FloatRectangle(titleLeftMargin + transLeftMargin,
+ 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);
return;
CATCH:
- delete __pTitleTextObject;
- __pTitleTextObject = null;
+ delete _pTitleTextObject;
+ _pTitleTextObject = null;
return;
}
{
__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.");
{
__pScrollPanel->SetBounds(__textBounds);
}
+
}
return;
}
void
-_ProgressPopupPresenter::OnFontChanged(Font* pFont)
-{
- _pFont = pFont;
-}
-
-void
-_ProgressPopupPresenter::OnFontInfoRequested(unsigned long& style, float& size)
-{
- style = __fontStyle;
- size = __fontSize;
-}
-
-result
-_ProgressPopupPresenter::SetFontInfo(unsigned long style, float size)
-{
- __fontStyle = style;
- __fontSize = size;
-
- _pFont = __pProgressPopup->GetFallbackFont();
- SysTryReturnResult(NID_UI_CTRL, _pFont != null, GetLastResult(), "Failed to get a font.");
-
- return E_SUCCESS;
-}
-
-void
_ProgressPopupPresenter::Draw(void)
{
result r = E_SUCCESS;
}
// Draw Title text
- if (__pTitleTextObject != null)
+ if (_pTitleTextObject != null)
{
- r = SetFontInfo(FONT_STYLE_PLAIN, titleTextSize);
+ r = SetFontInfo(FONT_STYLE_PLAIN, _titleTextSize);
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
- __pTitleTextObject->SetFont(_pFont, 0, __pTitleTextObject->GetTextLength());
- __pTitleTextObject->SetBounds(__titleBounds);
- __pTitleTextObject->Draw(*_CanvasImpl::GetInstance(*pCanvas));
+ _pTitleTextObject->SetFont(_pFont, 0, _pTitleTextObject->GetTextLength());
+ _pTitleTextObject->SetBounds(_titleBounds);
+ _pTitleTextObject->Draw(*_CanvasImpl::GetInstance(*pCanvas));
}
if (__pLabel != null)
}
FloatRectangle
-_ProgressPopupPresenter::GetTitleBounds(void) const
-{
- return __titleBounds;
-}
-
-FloatRectangle
_ProgressPopupPresenter::GetTextBounds(void) const
{
return __textBounds;
return FloatRectangle(x, y, width, height);
}
+void
+_ProgressPopupPresenter::InitializeAccessibilityElement(void)
+{
+ _AccessibilityContainer* pContainer = __pProgressPopup->GetAccessibilityContainer();
+
+ if (pContainer == null)
+ {
+ return ;
+ }
+
+ if (__pLabel != null)
+ {
+ _AccessibilityContainer* pLabelContainer = __pLabel->GetAccessibilityContainer();
+ if (pLabelContainer != null)
+ {
+ _AccessibilityElement* pLabelElement = pLabelContainer->GetChildElement(L"LabelText");
+ if (pLabelElement != null)
+ {
+ pLabelElement->SetName(L"ProgressPopupText");
+ pLabelElement->SetTrait(L"Popup body text");
+ }
+
+ // Add Container
+ pContainer->AddChildContainer(*pLabelContainer);
+ }
+ }
+}
+
+
+_Popup*
+_ProgressPopupPresenter::GetCore(void)
+{
+ return static_cast <_Popup*>(__pProgressPopup);
+}
+
bool
_ProgressPopupPresenter::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
{
#include <FSysISettingEventListener.h>
#include <FUiCtrlMessageBox.h>
#include "FUiCtrl_Popup.h"
-
+#include "FUi_IAccessibilityListener.h"
namespace Tizen { namespace Ui { namespace Controls
{
, virtual public _IUiEventListener
, virtual public _IUiEventPreviewer
, virtual public Tizen::System::ISettingEventListener
+ , public _IAccessibilityListener
{
// Lifecycle
public:
virtual void OnActivated(void);
virtual void OnDeactivated(void);
- virtual result OnAttachedToMainTree(void);
-
virtual void OnChangeLayout(_ControlOrientation orientation);
virtual void OnBoundsChanged(void);
virtual void OnSettingChanged(Tizen::Base::String& key);
+ virtual bool OnAccessibilityFocusMovedNext(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+ virtual bool OnAccessibilityFocusMovedPrevious(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+ virtual bool OnAccessibilityReadingElement(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+ virtual bool OnAccessibilityReadElement(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+ virtual bool OnAccessibilityFocusIn(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+ virtual bool OnAccessibilityFocusOut(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+ virtual bool OnAccessibilityActionPerformed(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+ virtual bool OnAccessibilityValueIncreased(const _AccessibilityContainer& control, const _AccessibilityElement& element);
+ virtual bool OnAccessibilityValueDecreased(const _AccessibilityContainer& control, const _AccessibilityElement& element);
// Accessors
public:
MessageBoxStyle GetMsgBoxStyle(void) const;
protected:
result SetPresenter(const _MessageBoxPresenter& msgboxPresenter);
+ virtual _PopupPresenter* GetPresenter(void);
// Touch Event Listener
virtual bool OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo);
virtual bool OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo);
virtual bool OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo);
+ virtual void InitializeAccessibilityElement(void);
private:
_MessageBox(void);
virtual result ShowAndWait(int& modalResult);
- result OnAttachedToMainTree(void);
-
- void OnFontChanged(Tizen::Graphics::Font* pFont);
- void OnFontInfoRequested(unsigned long& style, float& size);
result OnChangeLayout(_ControlOrientation orientation);
- result SetFontInfo(unsigned long style, float size);
-
// get touch event from _MessageBox, for drawing scroll in TextObject
virtual bool OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo);
virtual bool OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo);
void UpdateButtonString(void);
+ void InitializeAccessibilityElement(void);
+
+ bool OnAccessibilityActionPerformed(const _AccessibilityContainer& control, const _AccessibilityElement& element);
//Accessor
public:
float GetBodyTextHeight(void) const;
float GetBodyTextObjHeight(void) const;
- Tizen::Graphics::FloatRectangle GetTitleBounds(void) const;
Tizen::Graphics::FloatRectangle GetTextBounds(void) const;
protected:
virtual void ProcessEvent(void);
-
+ virtual _Popup* GetCore(void);
private:
_MessageBoxPresenter(const _MessageBoxPresenter& rhs);
_MessageBoxPresenter& operator =(const _MessageBoxPresenter& rhs);
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 GetLabelHeight(Tizen::Graphics::_Text::TextObject* textObject, wchar_t* text, int length, float fontSize, FloatRectangle bounds, bool isTitle);
float GetLeftRightLabelMargin(void);
void GetButtonString(void);
private:
class _MessageBoxButtonListener
: public ITouchEventListener
+ , public IKeyEventListener
, virtual public Tizen::Base::Runtime::IEventListener
{
public:
const Tizen::Ui::TouchEventInfo& touchInfo) {}
virtual void OnTouchFocusOut(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition,
const Tizen::Ui::TouchEventInfo& touchInfo) {}
+ virtual void OnKeyPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode);
+ virtual void OnKeyReleased(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode) {}
+ virtual void OnKeyLongPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode) {}
private:
_ControlHandle __buttonHandle;
Tizen::Ui::Controls::Button* __pButtons[MSGBOX_MAX_BUTTON_NUM];
Tizen::Base::String __buttonText[MSGBOX_MAX_BUTTON_NUM];
- Tizen::Ui::_AccessibilityElement* __pTextAccessibilityElement;
-
- Tizen::Graphics::_Text::TextObject* __pTitleTextObject;
Tizen::Graphics::_Text::TextObject* __pBodyTextObject;
- 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;
-
float __scrollPos;
int __buttonNum;
float __prevPositionY;
virtual void UpdateClientBounds(const Tizen::Graphics::FloatDimension& size, Tizen::Graphics::FloatRectangle& clientBounds);
virtual bool IsRotationSynchronized(void) const;
- virtual void OnWindowStateChanged(void);
-
// Accessor
public:
void SetColor(const Tizen::Graphics::Color& color);
_Popup(void);
result SetPresenter(const _PopupPresenter& popupPresenter);
+ virtual _PopupPresenter* GetPresenter(void);
virtual void InitializeAccessibilityElement(void);
Tizen::Graphics::FloatRectangle GetTitleTextBounds(void) const;
void UpdateEffectBounds(void);
+ void UpdateTitleTextBounds(void);
void OnActivated(void);
+ void OnBoundsChanged(void);
void OnFontChanged(Tizen::Graphics::Font* pFont);
void OnFontInfoRequested(unsigned long& style, float& size);
+ result SetFontInfo(unsigned long style, float size);
// Touch Event Listener
virtual bool OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo);
protected:
virtual void ProcessEvent(void);
+ result CalculateTitleTextSize(float titleTextSize, float minTitleTextSize);
+ virtual _Popup* GetCore(void);
private:
_PopupPresenter(const _PopupPresenter& rhs);
//Attribute
protected:
Tizen::Graphics::Font* _pFont;
+ Tizen::Graphics::FloatRectangle _titleBounds;
+ float _titleTextSize;
+ unsigned long _fontStyle;
+ float _fontSize;
+ Tizen::Graphics::_Text::TextObject* _pTitleTextObject;
+
private:
_Popup* __pPopup;
Tizen::Ui::Animations::_VisualElement* __pPopupVE;
Tizen::Ui::Animations::_VisualElement* __pBackgroundVE;
- Tizen::Graphics::_Text::TextObject* __pTextObject;
- Tizen::Graphics::FloatRectangle __titleBounds;
-
}; // _PopupPresenter
virtual void OnFontChanged(Tizen::Graphics::Font* pFont);
virtual void OnFontInfoRequested(unsigned long& style, float& size);
- virtual result OnAttachedToMainTree(void);
-
virtual void OnActivated(void);
virtual void OnDeactivated(void);
float GetTotalHeight(void) const;
Tizen::Graphics::FloatRectangle GetAnimationRect(void) const;
+ Tizen::Graphics::FloatRectangle GetTitleBounds(void) const;
void SetButtonText(void);
+ void SetCancelButtonAccessibilityElement(void);
protected:
result SetPresenter(const _ProgressPopupPresenter& ProgressPopupPresenter);
+ virtual _PopupPresenter* GetPresenter(void);
- virtual void InitializeAccessibilityElement(void);
+ virtual void InitializeAccessibilityElement(void);
private:
_ProgressPopup(void);
Tizen::Graphics::FloatRectangle __animationRect;
- Tizen::Ui::_AccessibilityElement* __pTextAccessibilityElement;
-
bool __textState;
bool __buttonState;
bool __isTransparent;
float GetBodyTextObjHeight(void) const;
Tizen::Graphics::FloatRectangle GetButtonBounds(void) const;
- Tizen::Graphics::FloatRectangle GetTitleBounds(void) const;
Tizen::Graphics::FloatRectangle GetTextBounds(void) const;
result PlayProcessAnimation(void);
result StopProcessAnimation(void);
result SetProcessAnimation(void);
- void OnFontChanged(Tizen::Graphics::Font* pFont);
- void OnFontInfoRequested(unsigned long& style, float& size);
-
- result SetFontInfo(unsigned long style, float size);
-
// Touch Event Listener
virtual bool OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo);
virtual bool OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo);
result OnChangeLayout(_ControlOrientation orientation);
+ void InitializeAccessibilityElement(void);
+
private:
_ProgressPopupPresenter(const _ProgressPopupPresenter& rhs);
_ProgressPopupPresenter& operator =(const _ProgressPopupPresenter& rhs);
-
+ virtual _Popup* GetCore(void);
//Attribute
private:
_ProgressPopup* __pProgressPopup;
- Tizen::Graphics::_Text::TextObject* __pTitleTextObject;
Tizen::Graphics::_Text::TextObject* __pBodyTextObject;
- Tizen::Graphics::FloatRectangle __titleBounds;
Tizen::Graphics::FloatRectangle __textBounds;
Tizen::Ui::Controls::_Label* __pLabel;
_Animation* __pAnimation;
Tizen::Base::Collection::ArrayList* __pAnimationFrameList;
- unsigned long __fontStyle;
- float __fontSize;
-
float __textObjectHeight;
int __currentIndex;
DECLARE_SHAPE_CONFIG(BUTTON_SIDE_MARGIN_02, 25);
DECLARE_SHAPE_CONFIG(BUTTON_SIDE_MARGIN_03, 26);
DECLARE_SHAPE_CONFIG(TEXT_HEIGHT, 27);
+ DECLARE_SHAPE_CONFIG(MIN_TITLE_TEXT_SIZE, 28);
DECLARE_END_UI_CONFIG(MESSAGEBOX);
#endif //_FUI_RESOURCE_MESSAGEBOX_CONFIG_H_
DECLARE_SHAPE_CONFIG(BG_OUTLINE_EFFECT_RIGHT_MARGIN, 21);
DECLARE_SHAPE_CONFIG(BODY_TEXT_HEIGHT, 22);
DECLARE_SHAPE_CONFIG(PROCESS_ANIMATION_WITH_TITLE_TOP_MARGIN, 23);
+ DECLARE_SHAPE_CONFIG(MIN_TITLE_TEXT_SIZE, 24);
DECLARE_END_UI_CONFIG(POPUP);
#endif //_FUI_RESOURCE_POPUP_CONFIG_H_
ADD_SHAPE_CONFIG(TITLE_HEIGHT, 78); // 20130403
ADD_SHAPE_CONFIG(TITLE_TEXT_SIZE, 50); // 20121113
+ ADD_SHAPE_CONFIG(MIN_TITLE_TEXT_SIZE, 42); // 20121113
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(TITLE_HEIGHT, 78); //20130403
ADD_SHAPE_CONFIG(TITLE_TEXT_SIZE, 50); //20121113
+ ADD_SHAPE_CONFIG(MIN_TITLE_TEXT_SIZE, 42); //20130507
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