// Open Service Platform
// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
//
-// Licensed under the Flora License, Version 1.0 (the License);
+// Licensed under the Apache License, Version 2.0 (the License);
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
-// http://floralicense.org/license/
+// http://www.apache.org/licenses/LICENSE-2.0/
//
// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
+// distributed under the License is distributed on an ”AS IS” BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
, __pAmPmBgNormalColorReplacementBitmap(null)
, __pAmPmBgDisabledColorReplacementBitmap(null)
, __pAmPmBgPressedColorReplacementBitmap(null)
+ , __pAmPmBgHighlightedColorReplacementBitmap(null)
, __pAmPmBgEffectNomralBitmap(null)
, __pAmPmBgEffectPressedBitmap(null)
, __pAmPmBgEffectDisabledBitmap(null)
, __pColonColorReplacementBitmap(null)
, __pColonDisabledColorReplacementBitmap(null)
+ , __pContentBgNormalColorReplacementBitmap(null)
+ , __pContentBgDisabledColorReplacementBitmap(null)
+ , __pContentBgPressedColorReplacementBitmap(null)
+ , __pContentBgHighlightedColorReplacementBitmap(null)
+ , __pContentBgEffectNormalBitmap(null)
+ , __pContentBgEffectPressedBitmap(null)
+ , __pContentBgEffectDisabledBitmap(null)
, __pContentProvider(null)
, __textObject()
, __pFont(null)
delete __pAmPmBgPressedColorReplacementBitmap;
__pAmPmBgPressedColorReplacementBitmap = null;
+ delete __pAmPmBgHighlightedColorReplacementBitmap;
+ __pAmPmBgHighlightedColorReplacementBitmap = null;
+
delete __pAmPmBgEffectNomralBitmap;
__pAmPmBgEffectNomralBitmap = null;
delete __pColonDisabledColorReplacementBitmap;
__pColonDisabledColorReplacementBitmap = null;
+
+ delete __pContentBgNormalColorReplacementBitmap;
+ __pContentBgNormalColorReplacementBitmap = null;
+
+ delete __pContentBgDisabledColorReplacementBitmap;
+ __pContentBgDisabledColorReplacementBitmap = null;
+
+ delete __pContentBgPressedColorReplacementBitmap;
+ __pContentBgPressedColorReplacementBitmap = null;
+
+ delete __pContentBgHighlightedColorReplacementBitmap;
+ __pContentBgHighlightedColorReplacementBitmap = null;
+
+ delete __pContentBgEffectNormalBitmap;
+ __pContentBgEffectNormalBitmap = null;
+
+ delete __pContentBgEffectPressedBitmap;
+ __pContentBgEffectPressedBitmap = null;
+
+ delete __pContentBgEffectDisabledBitmap;
+ __pContentBgEffectDisabledBitmap = null;
}
_EditTimePresenter*
FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
- float width = 0.0f;
+ float editTimeHeight = 0.0f;
float colonWidth = 0.0f;
- float margin = 0.0f;
+ float timeAmPmMargin = 0.0f;
float colonMargin = 0.0f;
float timeElementWidth = 0.0f;
float amPmHeight = 0.0f;
float titleTimeMargin = 0.0f;
float leftMargin = 0.0f;
- GET_SHAPE_CONFIG(EDITTIME::TIME_WIDTH, __pEditTime->GetOrientation(), width);
- GET_SHAPE_CONFIG(EDITTIME::HEIGHT, __pEditTime->GetOrientation(), bounds.height);
+ GET_SHAPE_CONFIG(EDITTIME::HEIGHT, __pEditTime->GetOrientation(), editTimeHeight);
GET_SHAPE_CONFIG(EDITTIME::COLON_WIDTH, __pEditTime->GetOrientation(), colonWidth);
- GET_SHAPE_CONFIG(EDITTIME::TIME_AMPM_MARGIN, __pEditTime->GetOrientation(), margin);
- GET_SHAPE_CONFIG(EDITTIME::TIME_TEXT_LEFT_MARGIN, __pEditTime->GetOrientation(), leftMargin);
+ GET_SHAPE_CONFIG(EDITTIME::TIME_AMPM_MARGIN, __pEditTime->GetOrientation(), timeAmPmMargin);
GET_SHAPE_CONFIG(EDITTIME::COLON_MARGIN, __pEditTime->GetOrientation(), colonMargin);
- GET_SHAPE_CONFIG(EDITTIME::HOUR_MINUTE_WIDTH, __pEditTime->GetOrientation(), timeElementWidth);
GET_SHAPE_CONFIG(EDITTIME::AMPM_HEIGHT, __pEditTime->GetOrientation(), amPmHeight);
GET_SHAPE_CONFIG(EDITTIME::TITLE_TIME_MARGIN, __pEditTime->GetOrientation(), titleTimeMargin);
GET_SHAPE_CONFIG(EDITTIME::TIME_HEIGHT, __pEditTime->GetOrientation(), timeHeight);
+ GET_SHAPE_CONFIG(EDITTIME::TIME_TEXT_LEFT_MARGIN, __pEditTime->GetOrientation(), leftMargin);
+
if (__pEditTime->GetBoundsF().height > bounds.height)
{
- bounds.height = __pEditTime->GetBoundsF().height;
+ editTimeHeight = __pEditTime->GetBoundsF().height;
}
+ bounds.y = (editTimeHeight - timeHeight) / 2.0f;
+
if (!__title.IsEmpty())
{
if (displayBoxId == DATETIME_ID_AMPM)
else
{
bounds.y = __titleBounds.y + __titleBounds.height + titleTimeMargin;
- bounds.height = timeHeight;
}
}
- if (__pEditTime->GetOrientation() == _CONTROL_ORIENTATION_LANDSCAPE)
- {
- leftMargin = 0.0f;
- }
+ bounds.x = leftMargin;
+ bounds.height = timeHeight;
- bounds.x = leftMargin + ((width - (2.0f * timeElementWidth + colonWidth + 2.0f * colonMargin)) / 2.0f);
+ timeElementWidth = GetTimeElementWidth();
if (displayBoxId == DATETIME_ID_HOUR)
{
- bounds.width = GetTextWidth(displayBoxId);
+ bounds.width = timeElementWidth;
}
else if (displayBoxId == DATETIME_ID_MINUTE)
{
- bounds.width = GetTextWidth(displayBoxId);
- bounds.x = bounds.x + timeElementWidth + colonWidth + 2.0f * colonMargin + (timeElementWidth - bounds.width) / 2.0f;
-
+ bounds.x = bounds.x + timeElementWidth + colonWidth + (2.0f * colonMargin);
+ bounds.width = timeElementWidth;
}
else if (displayBoxId == DATETIME_ID_AMPM)
{
- bounds.x = leftMargin + width + margin;
+ bounds.x = leftMargin + (2.0f * timeElementWidth) + colonWidth + (2.0f * colonMargin) + timeAmPmMargin;
if (__title.IsEmpty())
{
- bounds.y = bounds.y + (bounds.height - amPmHeight) / 2.0f;
+ bounds.y = (editTimeHeight - amPmHeight) / 2.0f;
}
GET_SHAPE_CONFIG(EDITTIME::AMPM_WIDTH, __pEditTime->GetOrientation(), bounds.width);
void
_EditTimePresenter::SetTitleBounds(void)
{
- GET_SHAPE_CONFIG(EDITTIME::TIME_TEXT_LEFT_MARGIN, __pEditTime->GetOrientation(), __titleBounds.x);
+ GET_SHAPE_CONFIG(EDITTIME::TITLE_TEXT_LEFT_MARGIN, __pEditTime->GetOrientation(), __titleBounds.x);
GET_SHAPE_CONFIG(EDITTIME::WIDTH, __pEditTime->GetOrientation(), __titleBounds.width);
GET_SHAPE_CONFIG(EDITTIME::TITLE_HEIGHT, __pEditTime->GetOrientation(), __titleBounds.height);
+ __titleBounds.width = __titleBounds.width - __titleBounds.x;
return;
}
Color buttonNormalBgColor;
Color buttonDisabledBgColor;
- Color buttonNormalPressedColor;
+ Color buttonPressedColor;
+ Color buttonHighlightedColor;
+ Color contentNormalBgColor;
+ Color contentDisabledBgColor;
+ Color contentPressedColor;
+ Color contentHighlightedColor;
Color colonTextColor;
Color colonTextDisabledColor;
Bitmap* pTempBitmap = null;
GET_COLOR_CONFIG(EDITTIME::BUTTON_BG_NORMAL, buttonNormalBgColor);
- GET_COLOR_CONFIG(EDITTIME::BUTTON_BG_PRESSED, buttonNormalPressedColor);
+ GET_COLOR_CONFIG(EDITTIME::BUTTON_BG_PRESSED, buttonPressedColor);
GET_COLOR_CONFIG(EDITTIME::BUTTON_BG_DISABLED, buttonDisabledBgColor);
+ GET_COLOR_CONFIG(EDITTIME::BUTTON_BG_HIGHLIGHTED, buttonHighlightedColor);
+
+ GET_COLOR_CONFIG(EDITTIME::CONTENT_BG_NORMAL, contentNormalBgColor);
+ GET_COLOR_CONFIG(EDITTIME::CONTENT_BG_DISABLED, contentDisabledBgColor);
+ GET_COLOR_CONFIG(EDITTIME::CONTENT_BG_PRESSED, contentPressedColor);
+ GET_COLOR_CONFIG(EDITTIME::CONTENT_BG_HIGHLIGHTED, contentHighlightedColor);
+
GET_COLOR_CONFIG(EDITTIME::TEXT_NORMAL, colonTextColor);
GET_COLOR_CONFIG(EDITTIME::TEXT_DISABLED, colonTextDisabledColor);
r = GET_BITMAP_CONFIG_N(EDITTIME::COLON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
- __pColonColorReplacementBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_WHITE),
+ __pColonColorReplacementBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA),
colonTextColor);
SysTryCatch(NID_UI_CTRL, (__pColonColorReplacementBitmap != null), r = GetLastResult(), GetLastResult(),
"[%s] Propagating.", GetErrorMessage(GetLastResult()));
- __pColonDisabledColorReplacementBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_WHITE),
+ __pColonDisabledColorReplacementBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA),
colonTextDisabledColor);
SysTryCatch(NID_UI_CTRL, (__pColonDisabledColorReplacementBitmap != null), r = GetLastResult(), GetLastResult(),
"[%s] Propagating.", GetErrorMessage(GetLastResult()));
delete pTempBitmap;
pTempBitmap = null;
- r = GET_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
+ r = GET_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
__pAmPmBgDisabledColorReplacementBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), buttonDisabledBgColor);
delete pTempBitmap;
pTempBitmap = null;
- r = GET_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
+ r = GET_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
- __pAmPmBgPressedColorReplacementBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), buttonNormalPressedColor);
+ __pAmPmBgPressedColorReplacementBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), buttonPressedColor);
SysTryCatch(NID_UI_CTRL, (__pAmPmBgPressedColorReplacementBitmap != null), r = GetLastResult(), GetLastResult(),
"[%s] Propagating.", GetErrorMessage(GetLastResult()));
+ delete pTempBitmap;
+ pTempBitmap = null;
+
+ r = GET_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
+ SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pAmPmBgHighlightedColorReplacementBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), buttonHighlightedColor);
+ SysTryCatch(NID_UI_CTRL, (__pAmPmBgHighlightedColorReplacementBitmap != null), r = GetLastResult(), GetLastResult(),
+ "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ delete pTempBitmap;
+ pTempBitmap = null;
+
+ r = GET_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
+ SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pContentBgNormalColorReplacementBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), contentNormalBgColor);
+ SysTryCatch(NID_UI_CTRL, (__pContentBgNormalColorReplacementBitmap != null), r = GetLastResult(), GetLastResult(),
+ "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ delete pTempBitmap;
+ pTempBitmap = null;
+
+ r = GET_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
+ SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pContentBgPressedColorReplacementBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), contentPressedColor);
+ SysTryCatch(NID_UI_CTRL, (__pContentBgPressedColorReplacementBitmap != null), r = GetLastResult(), GetLastResult(),
+ "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ delete pTempBitmap;
+ pTempBitmap = null;
+
+ r = GET_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
+ SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pContentBgDisabledColorReplacementBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), contentDisabledBgColor);
+ SysTryCatch(NID_UI_CTRL, (__pContentBgDisabledColorReplacementBitmap != null), r = GetLastResult(), GetLastResult(),
+ "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ delete pTempBitmap;
+ pTempBitmap = null;
+
+ r = GET_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
+ SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pContentBgHighlightedColorReplacementBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), contentHighlightedColor);
+ SysTryCatch(NID_UI_CTRL, (__pContentBgHighlightedColorReplacementBitmap != null), r = GetLastResult(), GetLastResult(),
+ "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
r = GET_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pAmPmBgEffectNomralBitmap);
SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
r = GET_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_EFFECT_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, __pAmPmBgEffectDisabledBitmap);
SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+ r = GET_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pContentBgEffectNormalBitmap);
+ SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = GET_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pContentBgEffectPressedBitmap);
+ SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = GET_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_EFFECT_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, __pContentBgEffectDisabledBitmap);
+ SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+
delete pTempBitmap;
pTempBitmap = null;
delete __pAmPmBgPressedColorReplacementBitmap;
__pAmPmBgPressedColorReplacementBitmap = null;
+ delete __pAmPmBgDisabledColorReplacementBitmap;
+ __pAmPmBgDisabledColorReplacementBitmap = null;
+
+ delete __pAmPmBgHighlightedColorReplacementBitmap;
+ __pAmPmBgHighlightedColorReplacementBitmap = null;
+
+ delete __pContentBgNormalColorReplacementBitmap;
+ __pContentBgNormalColorReplacementBitmap = null;
+
+ delete __pContentBgPressedColorReplacementBitmap;
+ __pContentBgPressedColorReplacementBitmap = null;
+
+ delete __pContentBgDisabledColorReplacementBitmap;
+ __pContentBgDisabledColorReplacementBitmap = null;
+
+ delete __pContentBgHighlightedColorReplacementBitmap;
+ __pContentBgHighlightedColorReplacementBitmap = null;
+
delete __pAmPmBgEffectNomralBitmap;
__pAmPmBgEffectNomralBitmap = null;
delete __pAmPmBgEffectPressedBitmap;
__pAmPmBgEffectPressedBitmap = null;
+ delete __pAmPmBgEffectDisabledBitmap;
+ __pAmPmBgEffectDisabledBitmap = null;
+
+ delete __pContentBgEffectNormalBitmap;
+ __pContentBgEffectNormalBitmap = null;
+
+ delete __pContentBgEffectPressedBitmap;
+ __pContentBgEffectPressedBitmap = null;
+
+ delete __pContentBgEffectDisabledBitmap;
+ __pContentBgEffectDisabledBitmap = null;
+
delete __pColonColorReplacementBitmap;
__pColonColorReplacementBitmap = null;
+ delete __pColonDisabledColorReplacementBitmap;
+ __pColonDisabledColorReplacementBitmap = null;
+
return r;
}
return r;
}
+float
+_EditTimePresenter::GetTimeElementWidth(void) const
+{
+ FloatRectangle bounds;
+ FloatDimension minSize;
+ bounds = __pEditTime->GetBoundsF();
+
+ float timeElementWidth = 0.0f;
+ float timeElementMinWidth = 0.0f;
+ float editTimeWidth = 0.0f;
+
+ GET_SHAPE_CONFIG(EDITTIME::HOUR_MINUTE_WIDTH, __pEditTime->GetOrientation(), timeElementWidth);
+ GET_SHAPE_CONFIG(EDITTIME::HOUR_MINUTE_MIN_WIDTH, __pEditTime->GetOrientation(), timeElementMinWidth);
+ GET_SHAPE_CONFIG(EDITTIME::WIDTH, __pEditTime->GetOrientation(), editTimeWidth);
+
+ GET_DIMENSION_CONFIG(EDITTIME::MIN_SIZE, __pEditTime->GetOrientation(), minSize);
+
+ if (bounds.width >= editTimeWidth)
+ {
+ return timeElementWidth;
+ }
+
+ if (bounds.width <= minSize.width)
+ {
+ timeElementWidth = timeElementMinWidth;
+ }
+ else if (bounds.width < editTimeWidth && bounds.width > minSize.width)
+ {
+ timeElementWidth = timeElementWidth -
+ ((timeElementWidth - timeElementMinWidth) / (editTimeWidth - minSize.width)) * (editTimeWidth - bounds.width);
+ }
+
+ return timeElementWidth;
+}
+
result
_EditTimePresenter::InitializeTitleObject(void)
{
FloatRectangle colonBounds(0.0f, 0.0f, 0.0f, 0.0f);
float colonMargin = 0.0f;
- float hourMinuteWidth = 0.0f;
Dimension textArea;
pReplacementBitmap = __pAmPmBgPressedColorReplacementBitmap;
pEffectBitmap = __pAmPmBgEffectPressedBitmap;
}
-
- r = DrawResourceBitmap(*pCanvas, ampmBounds, pReplacementBitmap);
- SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
-
- if (!isCustomBitmap)
- {
- r = DrawResourceBitmap(*pCanvas, ampmBounds, pEffectBitmap);
- SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
- }
}
if (GetHour() >= DATETIME_HOUR_MAX_FOR_24NOTATION)
GET_SHAPE_CONFIG(EDITTIME::COLON_WIDTH, __pEditTime->GetOrientation(), colonBounds.width);
GET_SHAPE_CONFIG(EDITTIME::COLON_MARGIN, __pEditTime->GetOrientation(), colonMargin);
GET_SHAPE_CONFIG(EDITTIME::AMPM_HEIGHT, __pEditTime->GetOrientation(), colonBounds.height);
- GET_SHAPE_CONFIG(EDITTIME::HOUR_MINUTE_WIDTH, __pEditTime->GetOrientation(), hourMinuteWidth);
- colonBounds.x = hourBounds.x + hourMinuteWidth + colonMargin;
+ colonBounds.x = hourBounds.x + hourBounds.width + colonMargin;
colonBounds.y = hourBounds.y + (hourBounds.height - colonBounds.height) / 2.0f;
if (__title.IsEmpty() == false)
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
}
- r = DrawText(*pCanvas, hourBounds, __hourString);
+ r = DrawText(*pCanvas, hourBounds, __hourString, DATETIME_ID_HOUR);
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
- r = DrawText(*pCanvas, minuteBounds, __minuteString);
+ r = DrawText(*pCanvas, minuteBounds, __minuteString, DATETIME_ID_MINUTE);
+ SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = DrawColon(*pCanvas, colonBounds);
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
if (__24hours == false)
{
- r = DrawText(*pCanvas, ampmBounds, __ampmString, __amPmTextSize);
+ r = DrawResourceBitmap(*pCanvas, ampmBounds, pReplacementBitmap);
+ SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ if (!isCustomBitmap)
+ {
+ r = DrawResourceBitmap(*pCanvas, ampmBounds, pEffectBitmap);
+ SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+
+ r = DrawText(*pCanvas, ampmBounds, __ampmString, DATETIME_ID_AMPM, __amPmTextSize);
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
}
- r = DrawColon(*pCanvas, colonBounds);
- SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-
CATCH:
delete pCanvas;
r = DrawResourceBitmap(canvas, bounds, __pColonColorReplacementBitmap);
}
- if ( r != E_SUCCESS)
- {
- r = DrawText(canvas, bounds, L":");
- SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
- }
-
return r;
}
}
(_FontImpl::GetInstance(*__pFont))->SetSize(__titleFontSize);
+ (_FontImpl::GetInstance(*__pFont))->SetStyle(FONT_STYLE_BOLD);
__titleObject.SetFont(__pFont, 0, __titleObject.GetTextLength());
__titleObject.Draw(*_CanvasImpl::GetInstance(canvas));
}
result
-_EditTimePresenter::DrawText(Canvas& canvas, const FloatRectangle& bounds, const String& text, float textSize)
+_EditTimePresenter::DrawContentBitmap(Canvas& canvas, const FloatRectangle& bounds, _DateTimeId boxId)
{
result r = E_SUCCESS;
- Color textColor;
+ bool isCustomBitmap = false;
+ Bitmap* pReplacementBitmap = null;
+ Bitmap* pEffectBitmap = null;
+
+ if (!__pEditTime->IsEnabled())
+ {
+ isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::CONTENT_BG_DISABLED);
+ pReplacementBitmap = __pContentBgDisabledColorReplacementBitmap;
+ pEffectBitmap = __pContentBgEffectDisabledBitmap;
+ }
+ else if (__selectedId != boxId)
+ {
+ isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::CONTENT_BG_NORMAL);
+ pReplacementBitmap = __pContentBgNormalColorReplacementBitmap;
+ pEffectBitmap = __pContentBgEffectNormalBitmap;
+ }
+ else
+ {
+ isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::CONTENT_BG_PRESSED);
+ pReplacementBitmap = __pContentBgPressedColorReplacementBitmap;
+ pEffectBitmap = __pContentBgEffectPressedBitmap;
+ }
+
+ r = DrawResourceBitmap(canvas, bounds, pReplacementBitmap);
+ SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ if (!isCustomBitmap)
+ {
+ r = DrawResourceBitmap(canvas, bounds, pEffectBitmap);
+ SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
- _DateTimeId boxId = DATETIME_ID_NONE;
- boxId = GetBoxIdFromPosition(FloatPoint(bounds.x + 1.0f, bounds.y));
+ return r;
+}
+
+result
+_EditTimePresenter::DrawText(Canvas& canvas, const FloatRectangle& bounds, const String& text, _DateTimeId boxId, float textSize)
+{
+ result r = E_SUCCESS;
+
+ Color textColor;
if (!__pEditTime->IsEnabled())
{
}
}
+ if (boxId != DATETIME_ID_AMPM)
+ {
+ DrawContentBitmap(canvas, bounds, boxId);
+ }
+
FloatRectangle drawAreaBounds(0.0f, 0.0f, 0.0f, 0.0f);
drawAreaBounds = bounds;
__textObject.RemoveAll();
(_FontImpl::GetInstance(*__pFont))->SetSize(__timeFontSize);
+ (_FontImpl::GetInstance(*__pFont))->SetStyle(FONT_STYLE_PLAIN);
__textObject.AppendElement(*pSimpleText);
- if (boxId == DATETIME_ID_AMPM)
+ if (boxId == __selectedId && boxId != DATETIME_ID_AMPM)
{
- (_FontImpl::GetInstance(*__pFont))->SetSize(textSize);
- __textObject.SetFont(__pFont, 0, __textObject.GetTextLength());
+ (_FontImpl::GetInstance(*__pFont))->SetStyle(FONT_STYLE_BOLD);
}
- else
+
+ if (boxId == DATETIME_ID_AMPM)
{
- __textObject.SetFont(__pFont, 0, __textObject.GetTextLength());
+ (_FontImpl::GetInstance(*__pFont))->SetSize(textSize);
}
+ __textObject.SetFont(__pFont, 0, __textObject.GetTextLength());
+
__textObject.SetForegroundColor(textColor, 0, __textObject.GetTextLength());
__textObject.SetBounds(drawAreaBounds);
__textObject.Draw(*_CanvasImpl::GetInstance(canvas));
{
_DateTimeId displayBoxId = DATETIME_ID_NONE;
- FloatRectangle hourBounds(0.0f, 0.0f, 0.0f, 0.0f);
- FloatRectangle minuteBounds(0.0f, 0.0f, 0.0f, 0.0f);
FloatRectangle ampmBounds(0.0f, 0.0f, 0.0f, 0.0f);
-
- hourBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_HOUR);
- minuteBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_MINUTE);
+ FloatRectangle hoursBounds(0.0f, 0.0f, 0.0f, 0.0f);
+ FloatRectangle minutesBounds(0.0f, 0.0f, 0.0f, 0.0f);
if (__24hours == false)
{
ampmBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_AMPM);
}
- if (point.y < hourBounds.y || point.y > hourBounds.y + hourBounds.height)
+ hoursBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_HOUR);
+ minutesBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_MINUTE);
+
+ if (point.y < hoursBounds.y || point.y > hoursBounds.y + hoursBounds.height)
{
return displayBoxId;
}
- if (hourBounds.Contains(point) == true)
+ if (hoursBounds.Contains(point) == true)
{
displayBoxId = DATETIME_ID_HOUR;
}
- else if (minuteBounds.Contains(point) == true)
+ else if (minutesBounds.Contains(point) == true)
{
displayBoxId = DATETIME_ID_MINUTE;
}
_DateTimeId boxId = GetBoxIdFromPosition(point);
- if (boxId == GetLastSelectedId() || boxId != __selectedId || boxId == DATETIME_ID_NONE)
+ if ((boxId == GetLastSelectedId() && boxId != DATETIME_ID_AMPM) || boxId != __selectedId || boxId == DATETIME_ID_NONE)
{
if (__pEditTime->GetDateTimeBar() != null && __pEditTime->GetDateTimeBar()->IsActivated())
{
VisualElementPropertyAnimation* pNewBoundsAnimation = null;
VisualElementPropertyAnimation* pOldBoundsAnimation = null;
Canvas *pCanvas = null;
+ Color contentBgColor;
+ Color textNormalColor;
+ Color textPressedColor;
+
+ GET_COLOR_CONFIG(EDITTIME::CONTENT_BG_PRESSED, contentBgColor);
+ GET_COLOR_CONFIG(EDITTIME::TEXT_PRESSED, textPressedColor);
__pFont->GetTextExtent(newValue, newValue.GetLength(), newTextDim);
__pFont->GetTextExtent(__lastSelectedValue, __lastSelectedValue.GetLength(), oldTextDim);
}
pCanvas = pEditTimeElement->GetCanvasN(rect);
- pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
+ pCanvas->SetBackgroundColor(contentBgColor);
pCanvas->Clear();
delete pCanvas;
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);
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);