DrawContentBitmap(canvas, bounds, boxId);
FloatRectangle drawAreaBounds(0.0f, 0.0f, 0.0f, 0.0f);
- drawAreaBounds = bounds;
+ drawAreaBounds.x = bounds.x + 2.0f;
+ drawAreaBounds.y = bounds.y + 2.0f;
+ drawAreaBounds.width = bounds.width - 4.0f;
+ drawAreaBounds.height = bounds.height - 4.0f;
TextSimple* pSimpleText = null;
pSimpleText = new (std::nothrow)TextSimple((const_cast <wchar_t*>(text.GetPointer())), text.GetLength(), TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
SysTryReturnVoidResult(NID_UI_CTRL, !__isAnimating, E_SUCCESS, "Rolling animation is in progress.");
SysAssertf((__pFont != null), "Font instance must not be null.");
- (_FontImpl::GetInstance(*__pFont))->SetSize(__dateFontSize);
-
result r = E_SUCCESS;
FloatRectangle rect;
String monthString;
String yearString;
String dayString;
String newValue;
+ TextSimple* pOldSimpleText = null;
+ TextSimple* pNewSimpleText = null;
_DateTimeUtils dateTimeUtils;
monthString = dateTimeUtils.GetMonthString(GetMonth());
__pFont->GetTextExtent(newValue, newValue.GetLength(), newTextDim);
__pFont->GetTextExtent(__lastSelectedValue, __lastSelectedValue.GetLength(), oldTextDim);
- newTextDim.width += 2.0f;
- oldTextDim.width += 2.0f;
-
if (newTextDim.width > oldTextDim.width)
{
textPoint.x = (rect.width - oldTextDim.width) / 2.0f;
}
- SysTryReturnVoidResult(NID_UI_CTRL, (rect.x + textPoint.x < __pEditDate->GetBoundsF().width), E_SUCCESS, "Rolling animation cann't be played.");
+ SysTryReturnVoidResult(NID_UI_CTRL, (rect.x + textPoint.x < __pEditDate->GetBoundsF().width), E_SUCCESS, "Rolling animation can't be played.");
__isAnimating = true;
pNewVisualElement->SetShowState(true);
pOldVisualElement->SetShowState(true);
- if (newTextDim.width > oldTextDim.width)
- {
- textPoint.x = (rect.width - newTextDim.width) / 2.0f;
- textPoint.y = (rect.height - newTextDim.height) / 2.0f;
- __pContentProvider->SetBounds(FloatRectangle((rect.x + textPoint.x) * 1.0f, (rect.y + textPoint.y) * 1.0f, newTextDim.width * 1.0f, newTextDim.height * 1.0f));
- pNewVisualElement->SetBounds(FloatRectangle(0.0f, newTextDim.height * 1.0f, newTextDim.width * 1.0f, newTextDim.height * 1.0f));
-
- rect.width = __pContentProvider->GetBounds().width;
- rect.height = __pContentProvider->GetBounds().height;
-
- textPoint.x = (rect.width - oldTextDim.width) / 2.0f;
- textPoint.y = (rect.height - oldTextDim.height) / 2.0f;
-
- rect.x = __pContentProvider->GetBounds().x - 2.0f;
- rect.y = __pContentProvider->GetBounds().y;
- rect.width = __pContentProvider->GetBounds().width + 4.0f;
+ __pContentProvider->SetBounds(FloatRectangle((rect.x + 2.0f), (rect.y + 2.0f), (rect.width - 4.0f), (rect.height - 4.0f)));
+ textPoint.x = (__pContentProvider->GetBounds().width - newTextDim.width) / 2.0f;
+ textPoint.y = (__pContentProvider->GetBounds().height - newTextDim.height) / 2.0f;
- pOldVisualElement->SetBounds(FloatRectangle(textPoint.x * 1.0f, 0.0f, oldTextDim.width * 1.0f, oldTextDim.height * 1.0f));
- }
- else
+ if (textPoint.x < 0)
{
- textPoint.x = (rect.width - oldTextDim.width) / 2.0f;
- textPoint.y = (rect.height - oldTextDim.height) / 2.0f;
- __pContentProvider->SetBounds(FloatRectangle((rect.x + textPoint.x) * 1.0f, (rect.y + textPoint.y) * 1.0f, oldTextDim.width * 1.0f, oldTextDim.height * 1.0f));
- pOldVisualElement->SetBounds(FloatRectangle(0.0f, 0.0f, oldTextDim.width * 1.0f, oldTextDim.height * 1.0f));
+ textPoint.x = 0.0f;
+ newTextDim.width = __pContentProvider->GetBounds().width;
+ }
- rect.width = __pContentProvider->GetBounds().width;
- rect.height = __pContentProvider->GetBounds().height;
+ if (textPoint.y < 0)
+ {
+ textPoint.y = 0.0f;
+ }
- textPoint.x = (rect.width - newTextDim.width) / 2.0f;
- textPoint.y = (rect.height - newTextDim.height) / 2.0f;
+ pNewVisualElement->SetBounds(FloatRectangle(textPoint.x, oldTextDim.height, newTextDim.width, newTextDim.height));
+ textPoint.x = (__pContentProvider->GetBounds().width - oldTextDim.width) / 2.0f;
+ textPoint.y = (__pContentProvider->GetBounds().height - oldTextDim.height) / 2.0f;
- rect.x = __pContentProvider->GetBounds().x - 2.0f;
- rect.y = __pContentProvider->GetBounds().y;
- rect.width = __pContentProvider->GetBounds().width + 4.0f;
+ if (textPoint.x < 0)
+ {
+ textPoint.x = 0.0f;
+ oldTextDim.width = __pContentProvider->GetBounds().width;
+ }
- pNewVisualElement->SetBounds(FloatRectangle(textPoint.x * 1.0f, newTextDim.height * 1.0f, newTextDim.width * 1.0f, newTextDim.height * 1.0f));
+ if (textPoint.y < 0)
+ {
+ textPoint.y = 0.0f;
}
- pCanvas = pEditDateElement->GetCanvasN(rect);
+ pOldVisualElement->SetBounds(FloatRectangle(textPoint.x, textPoint.y, oldTextDim.width, oldTextDim.height));
+
+ pCanvas = pEditDateElement->GetCanvasN(__pContentProvider->GetBounds());
pCanvas->SetBackgroundColor(contentBgColor);
pCanvas->Clear();
delete pCanvas;
pNewBoundsAnimation->SetDuration(300);
pNewBoundsAnimation->SetPropertyName("bounds.position");
- pNewBoundsAnimation->SetStartValue(Variant(FloatPoint(pNewVisualElement->GetBounds().x * 1.0f, newTextDim.height * 1.0f)));
+ pNewBoundsAnimation->SetStartValue(Variant(FloatPoint(pNewVisualElement->GetBounds().x * 1.0f, oldTextDim.height * 1.0f)));
pNewBoundsAnimation->SetEndValue(Variant(FloatPoint(pNewVisualElement->GetBounds().x * 1.0f, 0.0f)));
pNewBoundsAnimation->SetVisualElementAnimationStatusEventListener(this);
pOldBoundsAnimation->SetEndValue(Variant(FloatPoint(pOldVisualElement->GetBounds().x * 1.0f, oldTextDim.height * -1.0f)));
pOldBoundsAnimation->SetVisualElementAnimationStatusEventListener(this);
+ pOldSimpleText = new (std::nothrow)TextSimple((const_cast <wchar_t*>(__lastSelectedValue.GetPointer())), __lastSelectedValue.GetLength(), TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
+ SysTryCatch(NID_UI_CTRL, (pOldSimpleText != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+
pCanvas = pOldVisualElement->GetCanvasN();
r = GetLastResult();
SysTryCatch(NID_UI_CTRL, (pCanvas != null), , r, "[%s] Propagating.", GetErrorMessage(r));
pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
pCanvas->Clear();
pCanvas->SetForegroundColor(textPressedColor);
- (_FontImpl::GetInstance(*__pFont))->SetStyle(FONT_STYLE_BOLD);
- pCanvas->SetFont(*__pFont);
- pCanvas->DrawText(FloatPoint(0.0f, 0.0f), __lastSelectedValue);
+
+ (_FontImpl::GetInstance(*__pFont))->SetSize(__dateFontSize);
+ (_FontImpl::GetInstance(*__pFont))->SetStyle(FONT_STYLE_PLAIN);
+ __textObject.RemoveAll();
+ __textObject.AppendElement(*pOldSimpleText);
+
+ __textObject.SetFont(__pFont, 0, __textObject.GetTextLength());
+ __textObject.SetForegroundColor(textPressedColor, 0, __textObject.GetTextLength());
+ __textObject.SetBounds(pCanvas->GetBounds());
+ __textObject.Draw(*_CanvasImpl::GetInstance(*pCanvas));
delete pCanvas;
pCanvas = null;
+ pNewSimpleText = new (std::nothrow)TextSimple((const_cast <wchar_t*>(newValue.GetPointer())), newValue.GetLength(), TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
+ SysTryCatch(NID_UI_CTRL, (pNewSimpleText != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+
pCanvas = pNewVisualElement->GetCanvasN();
r = GetLastResult();
SysTryCatch(NID_UI_CTRL, (pCanvas != null), , r, "[%s] Propagating.", GetErrorMessage(r));
pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
pCanvas->Clear();
pCanvas->SetForegroundColor(textPressedColor);
- (_FontImpl::GetInstance(*__pFont))->SetStyle(FONT_STYLE_BOLD);
- pCanvas->SetFont(*__pFont);
- pCanvas->DrawText(FloatPoint(0.0f, 0.0f), newValue);
+
+ (_FontImpl::GetInstance(*__pFont))->SetSize(__dateFontSize);
+ (_FontImpl::GetInstance(*__pFont))->SetStyle(FONT_STYLE_PLAIN);
+ __textObject.RemoveAll();
+ __textObject.AppendElement(*pNewSimpleText);
+
+ __textObject.SetFont(__pFont, 0, __textObject.GetTextLength());
+ __textObject.SetForegroundColor(textPressedColor, 0, __textObject.GetTextLength());
+ __textObject.SetBounds(pCanvas->GetBounds());
+ __textObject.Draw(*_CanvasImpl::GetInstance(*pCanvas));
delete pCanvas;
pCanvas = null;
return;
- CATCH:
+CATCH:
__isAnimating = false;
__pContentProvider->Destroy();
__pContentProvider = null;
delete pCanvas;
pCanvas = null;
+ delete pOldSimpleText;
+ pOldSimpleText = null;
+
+ delete pNewSimpleText;
+ pNewSimpleText = null;
+
return;
}