, __pPmBoxPressedEffectBitmap(null)
, __pPmBoxDisabledEffectBitmap(null)
, __pColonBitmap(null)
+ , __pBgNormalBitmap(null)
+ , __pBgEffectBitmap(null)
, __pFont(null)
, __pPmBox(null)
{
delete __pColonBitmap;
__pColonBitmap = null;
+ delete __pBgNormalBitmap;
+ __pBgNormalBitmap = null;
+
+ delete __pBgEffectBitmap;
+ __pBgEffectBitmap = null;
+
for (int i = 0; i < DATETIME_ID_MAX; i++)
{
delete __pDisplayBox[i];
__pView->SetBackgroundColor(backgroundColor);
// Draw DisplayBox Background
- pCanvas->SetBackgroundColor(backgroundColor);
- pCanvas->Clear();
+ DrawBackground(*pCanvas);
DrawDividers(*pCanvas);
int indexBox = 0;
int boxCount = 0;
- float dateElementWidth = 0;
-
- float dateTimeDisplayBoxHeight = 0;
- float amPmDisplayBoxHeight = 0;
-
- float dateTimeElementY = 0;
- float amPmElementY = 0;
- float dividerMargin = 0;
- float dateTimeMargin = 0;
- float leftMargin = 0;
- float timeOutputMargin = 0;
- float timeElementWidth = 0;
- float colonWidth = 0;
- float colonMargin = 0;
- float amPmWidth = 0;
- float amPmMargin = 0;
+ float dpDateElementWidth = 0.0f;
+ float dtpDateElementWidth = 0.0f;
+
+ float dateTimeDisplayBoxHeight = 0.0f;
+ float amPmDisplayBoxHeight = 0.0f;
+
+ float dateTimeElementY = 0.0f;
+ float amPmElementY = 0.0f;
+ float dividerMargin = 0.0f;
+ float dateTimeMargin = 0.0f;
+ float timeOutputMargin = 0.0f;
+ float timeElementWidth = 0.0f;
+ float colonWidth = 0.0f;
+ float colonMargin = 0.0f;
+ float amPmWidth = 0.0f;
+ float amPmMargin = 0.0f;
for (indexBox = 0; indexBox < DATETIME_ID_MAX; indexBox++)
{
__pView->SetDisplayVisualElementBounds(outputAreaBounds);
GET_FIXED_VALUE_CONFIG(DATETIMEPICKER::DIVIDER_WIDTH, orientation, dividerMargin);
- GET_SHAPE_CONFIG(DATETIMEPICKER::DATE_ELEMENT_WIDTH, orientation, dateElementWidth);
+ GET_SHAPE_CONFIG(DATETIMEPICKER::DP_DATE_ELEMENT_WIDTH, orientation, dpDateElementWidth);
+ GET_SHAPE_CONFIG(DATETIMEPICKER::DTP_DATE_ELEMENT_WIDTH, orientation, dtpDateElementWidth);
GET_SHAPE_CONFIG(DATETIMEPICKER::DATETIME_DISPLAY_BOX_HEIGHT, orientation, dateTimeDisplayBoxHeight);
GET_SHAPE_CONFIG(DATETIMEPICKER::AMPM_DISPLAY_BOX_HEIGHT, orientation, amPmDisplayBoxHeight);
GET_SHAPE_CONFIG(DATETIMEPICKER::DATE_TIME_MARGIN, orientation, dateTimeMargin);
- GET_SHAPE_CONFIG(DATETIMEPICKER::LEFT_MARGIN, orientation, leftMargin);
GET_SHAPE_CONFIG(DATETIMEPICKER::TIME_OUTPUT_MARGIN, orientation, timeOutputMargin);
GET_SHAPE_CONFIG(DATETIMEPICKER::TIME_ELEMENT_WIDTH, orientation, timeElementWidth);
GET_SHAPE_CONFIG(DATETIMEPICKER::COLON_WIDTH, orientation, colonWidth);
dateTimeElementY = (outputAreaBounds.height - dateTimeDisplayBoxHeight) / 2.0f;
amPmElementY = (outputAreaBounds.height - amPmDisplayBoxHeight) / 2.0f;
- dateBounds.width = monthBounds.width = yearBounds.width = dateElementWidth;
+ if (__pickerStyle == DATETIME_OUTPUT_STYLE_DATE)
+ {
+ dateBounds.width = monthBounds.width = yearBounds.width = dpDateElementWidth;
+ }
+ else
+ {
+ dateBounds.width = monthBounds.width = yearBounds.width = dtpDateElementWidth;
+ }
hourBounds.width = minuteBounds.width = timeElementWidth;
amPmBounds.width = amPmWidth;
{
case DATE_FORMAT_DDMMYYYY:
{
- dateBounds.x = leftMargin;
monthBounds.x = dateBounds.x + dateBounds.width + dividerMargin;
yearBounds.x = monthBounds.x + monthBounds.width + dividerMargin;
hourBounds.x = yearBounds.x + yearBounds.width + dateTimeMargin;
break;
case DATE_FORMAT_MMDDYYYY:
{
- monthBounds.x = leftMargin;
dateBounds.x = monthBounds.x + monthBounds.width + dividerMargin;
yearBounds.x = dateBounds.x + dateBounds.width + dividerMargin;
hourBounds.x = yearBounds.x + yearBounds.width + dateTimeMargin;
break;
case DATE_FORMAT_YYYYMMDD:
{
- yearBounds.x = leftMargin;
monthBounds.x = yearBounds.x + yearBounds.width + dividerMargin;
dateBounds.x = monthBounds.x + monthBounds.width + dividerMargin;
hourBounds.x = dateBounds.x + dateBounds.width + dateTimeMargin;
break;
case DATE_FORMAT_YYYYDDMM:
{
- yearBounds.x = leftMargin;
dateBounds.x = yearBounds.x + yearBounds.width + dividerMargin;
monthBounds.x = dateBounds.x + dateBounds.width + dividerMargin;
hourBounds.x = monthBounds.x + monthBounds.width + dateTimeMargin;
}
else
{
- hourBounds.x = dateTimeMargin + leftMargin + timeOutputMargin;
+ hourBounds.x = dateTimeMargin + timeOutputMargin;
minuteBounds.x = hourBounds.x + hourBounds.width + colonWidth + 2 * colonMargin;
amPmBounds.x = minuteBounds.x + minuteBounds.width + amPmMargin;
}
void
_DateTimePresenter::LoadResource(void)
{
- Color colonColor;
+ Color color;
result r = E_SUCCESS;
Bitmap* pColonBitmap = null;
+ Bitmap* pBgBitmap = null;
r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::AMPM_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pPmBoxNormalBitmap);
SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::COLON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pColonBitmap);
SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
- GET_COLOR_CONFIG(DATETIMEPICKER::TEXT_NORMAL, colonColor);
+ GET_COLOR_CONFIG(DATETIMEPICKER::TEXT_NORMAL, color);
- __pColonBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pColonBitmap, Color::GetColor(COLOR_ID_WHITE), colonColor);
+ __pColonBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pColonBitmap, Color::GetColor(COLOR_ID_WHITE), color);
r = GetLastResult();
SysTryCatch(NID_UI_CTRL, (__pColonBitmap != null), , r, "[%s] Propagating.", GetErrorMessage(r));
+ r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pBgBitmap);
+ SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ GET_COLOR_CONFIG(DATETIMEPICKER::DISPLAY_BG_NORMAL, color);
+
+ __pBgNormalBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pBgBitmap, Color::GetColor(COLOR_ID_MAGENTA), color);
+ r = GetLastResult();
+ SysTryCatch(NID_UI_CTRL, (__pBgNormalBitmap != null), , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::BG_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, __pBgEffectBitmap);
+ SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+
delete pColonBitmap;
+ delete pBgBitmap;
return;
delete __pPmBoxDisabledEffectBitmap;
__pPmBoxDisabledEffectBitmap = null;
+ delete pColonBitmap;
+
delete __pColonBitmap;
__pColonBitmap = null;
- delete pColonBitmap;
+ delete pBgBitmap;
+
+ delete __pBgNormalBitmap;
+ __pBgNormalBitmap = null;
+
+ delete __pBgEffectBitmap;
+ __pBgEffectBitmap = null;
return;
}
}
void
+_DateTimePresenter::DrawBackground(Canvas& canvas)
+{
+ result r = E_SUCCESS;
+ FloatRectangle bounds = canvas.GetBoundsF();
+
+ if (__pBgEffectBitmap)
+ {
+ if (__pBgEffectBitmap->IsNinePatchedBitmap() == true)
+ {
+ canvas.DrawNinePatchedBitmap(bounds, *__pBgEffectBitmap);
+ SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+ else
+ {
+ canvas.DrawBitmap(bounds, *__pBgEffectBitmap);
+ SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+ }
+
+ if (__pBgNormalBitmap)
+ {
+ if (__pBgNormalBitmap->IsNinePatchedBitmap() == true)
+ {
+ canvas.DrawNinePatchedBitmap(bounds, *__pBgNormalBitmap);
+ SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+ else
+ {
+ canvas.DrawBitmap(bounds, *__pBgNormalBitmap);
+ SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+ }
+
+ return;
+}
+
+void
_DateTimePresenter::DrawDividers(Canvas& canvas)
{
result r = E_SUCCESS;
FloatRectangle outputArea(0.0f, 0.0f, 0.0f, 0.0f);
FloatRectangle headerBounds = __pView->GetHeaderBounds();
- float margin = 0;
+ float xMargin = 0.0f;
+ float yMargin = 0.0f;
- GET_SHAPE_CONFIG(DATETIMEPICKER::TOP_MARGIN, orientation, margin);
+ GET_SHAPE_CONFIG(DATETIMEPICKER::LEFT_MARGIN, orientation, outputArea.x);
+ GET_SHAPE_CONFIG(DATETIMEPICKER::TOP_MARGIN, orientation, outputArea.y);
- outputArea.y = headerBounds.y + headerBounds.height + margin;
- outputArea.width = __pView->GetBounds().width;
+ outputArea.y += headerBounds.y + headerBounds.height;
+ outputArea.width = __pView->GetBounds().width - 2 * outputArea.x;
GET_SHAPE_CONFIG(DATETIMEPICKER::OUTPUT_AREA_HEIGHT, orientation, outputArea.height);