FloatPoint textPoint;
TextSimple* pOldSimpleText = null;
TextSimple* pNewSimpleText = null;
+ bool isCustomBitmap = false;
_DateTimeUtils dateTimeUtils;
monthString = dateTimeUtils.GetMonthString(GetMonth());
VisualElementPropertyAnimation* pNewBoundsAnimation = null;
VisualElementPropertyAnimation* pOldBoundsAnimation = null;
Canvas *pCanvas = null;
+ Canvas *pContentCanvas = null;
Color contentBgColor;
Color textPressedColor;
float contentTextMargin;
pNewVisualElement->SetShowState(true);
pOldVisualElement->SetShowState(true);
- __pContentProvider->SetBounds(FloatRectangle((rect.x + contentTextMargin), (rect.y + contentTextMargin), (rect.width - (contentTextMargin * 2.0f)), (rect.height - (contentTextMargin * 2.0f))));
+ __pContentProvider->SetBounds(FloatRectangle((rect.x + contentTextMargin), (rect.y + (contentTextMargin * 2.0f)), (rect.width - (contentTextMargin * 2.0f)), (rect.height - (contentTextMargin * 4.0f))));
pNewVisualElement->SetBounds(FloatRectangle(0, 0, __pContentProvider->GetBounds().width, __pContentProvider->GetBounds().height));
pOldVisualElement->SetBounds(FloatRectangle(0, 0, __pContentProvider->GetBounds().width, __pContentProvider->GetBounds().height));
- pCanvas = pEditDateElement->GetCanvasN(__pContentProvider->GetBounds());
- pCanvas->SetBackgroundColor(contentBgColor);
+ pContentCanvas = pEditDateElement->GetCanvasN(__pContentProvider->GetBounds());
+ r = GetLastResult();
+ SysTryCatch(NID_UI_CTRL, (pContentCanvas != null), , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pContentCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
+ pContentCanvas->Clear();
+
+ pCanvas = pEditDateElement->GetCanvasN(rect);
+ r = GetLastResult();
+ SysTryCatch(NID_UI_CTRL, (pCanvas != null), , r, "[%s] Propagating.", GetErrorMessage(r));
+ pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
pCanvas->Clear();
+ rect.x = 0.0f;
+ rect.y = 0.0f;
+ r = DrawResourceBitmap(*pCanvas, rect, __pContentBgPressedColorReplacementBitmap);
+ isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::CONTENT_BG_PRESSED);
+
+ if (!isCustomBitmap)
+ {
+ result res = DrawResourceBitmap(*pCanvas, rect, __pContentBgEffectPressedBitmap);
+
+ if (res != E_SUCCESS)
+ {
+ SysLog(NID_UI_CTRL, "[%s] Propagating.", GetErrorMessage(res));
+ }
+ }
+
delete pCanvas;
pCanvas = null;
+ if (r != E_SUCCESS)
+ {
+ pContentCanvas->SetBackgroundColor(contentBgColor);
+ pContentCanvas->Clear();
+ }
+
+ delete pContentCanvas;
+ pContentCanvas = null;
+
pEditDateElement->AttachChild(*__pContentProvider);
__pContentProvider->AttachChild(*pOldVisualElement);
__pContentProvider->AttachChild(*pNewVisualElement);
delete pNewSimpleText;
pNewSimpleText = null;
+ delete pContentCanvas;
+ pContentCanvas = null;
+
return;
}
String hourString;
String minuteString;
String newValue;
+ TextSimple* pOldSimpleText = null;
+ TextSimple* pNewSimpleText = null;
+ bool isCustomBitmap = false;
_DateTimeUtils dateTimeUtils;
int hours = GetHour();
VisualElementPropertyAnimation* pNewBoundsAnimation = null;
VisualElementPropertyAnimation* pOldBoundsAnimation = null;
Canvas *pCanvas = null;
+ Canvas *pContentCanvas = null;
Color contentBgColor;
Color textNormalColor;
Color textPressedColor;
+ float contentTextMargin;
GET_COLOR_CONFIG(EDITTIME::CONTENT_BG_PRESSED, contentBgColor);
GET_COLOR_CONFIG(EDITTIME::TEXT_PRESSED, textPressedColor);
+ GET_SHAPE_CONFIG(EDITDATE::CONTENT_TEXT_MARGIN, __pEditTime->GetOrientation(), contentTextMargin);
__pFont->GetTextExtent(newValue, newValue.GetLength(), newTextDim);
__pFont->GetTextExtent(__lastSelectedValue, __lastSelectedValue.GetLength(), oldTextDim);
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));
+ __pContentProvider->SetBounds(FloatRectangle((rect.x + contentTextMargin), (rect.y + (contentTextMargin * 2.0f)), (rect.width - (contentTextMargin * 2.0f)), (rect.height - (contentTextMargin * 4.0f))));
- rect.x = __pContentProvider->GetBounds().x;
- rect.y = __pContentProvider->GetBounds().y;
- rect.width = __pContentProvider->GetBounds().width;
- rect.height = __pContentProvider->GetBounds().height;
+ pNewVisualElement->SetBounds(FloatRectangle(0, 0, __pContentProvider->GetBounds().width, __pContentProvider->GetBounds().height));
+ pOldVisualElement->SetBounds(FloatRectangle(0, 0, __pContentProvider->GetBounds().width, __pContentProvider->GetBounds().height));
- textPoint.x = (rect.width - oldTextDim.width) / 2.0f;
- textPoint.y = (rect.height - oldTextDim.height) / 2.0f;
+ pContentCanvas = pEditTimeElement->GetCanvasN(__pContentProvider->GetBounds());
+ r = GetLastResult();
+ SysTryCatch(NID_UI_CTRL, (pContentCanvas != null), , r, "[%s] Propagating.", GetErrorMessage(r));
+ pContentCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
+ pContentCanvas->Clear();
- pOldVisualElement->SetBounds(FloatRectangle(textPoint.x * 1.0f, 0.0f, oldTextDim.width * 1.0f, oldTextDim.height * 1.0f));
- }
- else
+ pCanvas = pEditTimeElement->GetCanvasN(rect);
+ r = GetLastResult();
+ SysTryCatch(NID_UI_CTRL, (pCanvas != null), , r, "[%s] Propagating.", GetErrorMessage(r));
+ pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
+ pCanvas->Clear();
+ rect.x = 0.0f;
+ rect.y = 0.0f;
+ r = DrawResourceBitmap(*pCanvas, rect, __pContentBgPressedColorReplacementBitmap);
+ isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::CONTENT_BG_PRESSED);
+
+ if (!isCustomBitmap)
{
- 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));
+ result res = DrawResourceBitmap(*pCanvas, rect, __pContentBgEffectPressedBitmap);
- rect.x = __pContentProvider->GetBounds().x;
- rect.y = __pContentProvider->GetBounds().y;
- rect.width = __pContentProvider->GetBounds().width;
- rect.height = __pContentProvider->GetBounds().height;
+ if (res != E_SUCCESS)
+ {
+ SysLog(NID_UI_CTRL, "[%s] Propagating.", GetErrorMessage(res));
+ }
+ }
- textPoint.x = (rect.width - newTextDim.width) / 2.0f;
- textPoint.y = (rect.height - newTextDim.height) / 2.0f;
+ delete pCanvas;
+ pCanvas = null;
- pNewVisualElement->SetBounds(FloatRectangle(textPoint.x * 1.0f, newTextDim.height * 1.0f, newTextDim.width * 1.0f, newTextDim.height * 1.0f));
+ if (r != E_SUCCESS)
+ {
+ pContentCanvas->SetBackgroundColor(contentBgColor);
+ pContentCanvas->Clear();
}
- pCanvas = pEditTimeElement->GetCanvasN(rect);
- pCanvas->SetBackgroundColor(contentBgColor);
- pCanvas->Clear();
- delete pCanvas;
+ delete pContentCanvas;
+ pContentCanvas = null;
pEditTimeElement->AttachChild(*__pContentProvider);
pNewBoundsAnimation->SetDuration(300);
pNewBoundsAnimation->SetPropertyName("bounds.position");
- pNewBoundsAnimation->SetStartValue(Variant(FloatPoint(pNewVisualElement->GetBounds().x * 1.0f, newTextDim.height * 1.0f)));
- pNewBoundsAnimation->SetEndValue(Variant(FloatPoint(pNewVisualElement->GetBounds().x * 1.0f, 0.0f)));
+ pNewBoundsAnimation->SetStartValue(Variant(FloatPoint(pNewVisualElement->GetBounds().x, oldTextDim.height)));
+ pNewBoundsAnimation->SetEndValue(Variant(FloatPoint(pNewVisualElement->GetBounds().x, 0.0f)));
pNewBoundsAnimation->SetVisualElementAnimationStatusEventListener(this);
pOldBoundsAnimation = new (std::nothrow) VisualElementPropertyAnimation();
pOldBoundsAnimation->SetDuration(300);
pOldBoundsAnimation->SetPropertyName("bounds.position");
- pOldBoundsAnimation->SetStartValue(Variant(FloatPoint(pOldVisualElement->GetBounds().x * 1.0f, 0.0f)));
- pOldBoundsAnimation->SetEndValue(Variant(FloatPoint(pOldVisualElement->GetBounds().x * 1.0f, oldTextDim.height * -1.0f)));
+ pOldBoundsAnimation->SetStartValue(Variant(FloatPoint(pOldVisualElement->GetBounds().x, 0.0f)));
+ pOldBoundsAnimation->SetEndValue(Variant(FloatPoint(pOldVisualElement->GetBounds().x, 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(__timeFontSize);
+ (_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(FloatRectangle(0, 0, pCanvas->GetBounds().width, pCanvas->GetBounds().height));
+ __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(__timeFontSize);
+ (_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(FloatRectangle(0, 0, pCanvas->GetBounds().width, pCanvas->GetBounds().height));
+ __textObject.Draw(*_CanvasImpl::GetInstance(*pCanvas));
delete pCanvas;
pCanvas = null;
delete pOldBoundsAnimation;
pOldBoundsAnimation = null;
- delete pCanvas;
- pCanvas = null;
+ delete pOldSimpleText;
+ pOldSimpleText = null;
+
+ delete pNewSimpleText;
+ pNewSimpleText = null;
+
+ delete pContentCanvas;
+ pContentCanvas = null;
return;
}