__pDateTimeBar->SetVisibleState(false);
__pDateTimeBar->Close();
ResetFlickAnimationTimer();
+ __pDateTimeBar->FireDateTimeChangeEvent(DATE_INTERNAL_CHANGE_CANCELED);
return true;
}
_EditDate::OnDateTimeChanged(const _Control& source, int year, int month, int day, int hour, int minute)
{
__pEditDatePresenter->Animate();
+ __pEditDatePresenter->SetLastSelectedId(DATETIME_ID_NONE);
Invalidate();
FireDateChangeEvent(DATE_INTERNAL_CHANGE_SAVED);
return;
void
_EditDate::OnDateTimeChangeCanceled(const _Control& source)
{
+ __pEditDatePresenter->SetLastSelectedId(DATETIME_ID_NONE);
Invalidate();
-
FireDateChangeEvent(DATE_INTERNAL_CHANGE_CANCELED);
return;
}
, __dayBounds(FloatRectangle())
, __monthBounds(FloatRectangle())
, __yearBounds(FloatRectangle())
+ , __dayTouchBounds(FloatRectangle())
+ , __monthTouchBounds(FloatRectangle())
+ , __yearTouchBounds(FloatRectangle())
, __titleBounds(FloatRectangle())
, __datePickerEnabled(true)
, __selectedId(DATETIME_ID_NONE)
__yearBounds.height = editDateHeight;
}
- __dayBounds.width = GetTextWidth(DATETIME_ID_DAY);
- __monthBounds.width = GetTextWidth(DATETIME_ID_MONTH);
- __yearBounds.width = GetTextWidth(DATETIME_ID_YEAR);
+ __dayBounds.width = __elementWidth;
+ __monthBounds.width = __elementWidth;
+ __yearBounds.width = __elementWidth;
- __dayBounds.x = (__elementWidth - __dayBounds.width) / 2.0f;
- __monthBounds.x = (__elementWidth - __monthBounds.width) / 2.0f;
- __yearBounds.x = (__elementWidth - __yearBounds.width) / 2.0f;
+ __dayBounds.x = 0.0f;
+ __monthBounds.x = 0.0f;
+ __yearBounds.x = 0.0f;
__dayBounds.y = bounds.y;
__monthBounds.y = bounds.y;
CalculateAreaBounds();
- r = DrawText(*pCanvas, GetDateAreaBounds(DATETIME_ID_DAY), dayString);
+ r = DrawText(*pCanvas, GetDateAreaBounds(DATETIME_ID_DAY), dayString, DATETIME_ID_DAY);
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
- r = DrawText(*pCanvas, GetDateAreaBounds(DATETIME_ID_MONTH), monthString);
+ r = DrawText(*pCanvas, GetDateAreaBounds(DATETIME_ID_MONTH), monthString, DATETIME_ID_MONTH);
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
- r = DrawText(*pCanvas, GetDateAreaBounds(DATETIME_ID_YEAR), yearString);
+ r = DrawText(*pCanvas, GetDateAreaBounds(DATETIME_ID_YEAR), yearString, DATETIME_ID_YEAR);
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
r = DrawDividers(*pCanvas);
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ CalculateTouchAreaBounds();
+
delete pCanvas;
return r;
if (GetLocaleDateFormat() == DATE_FORMAT_DDMMYYYY)
{
- __monthBounds.x = __elementWidth + __dividerLineWidth + (__elementWidth - __monthBounds.width) / 2.0f;
- __yearBounds.x = (2.0f * __elementWidth) + (2.0f * __dividerLineWidth) + (__elementWidth - __yearBounds.width) / 2.0f;
+ __monthBounds.x = __dayBounds.x + __dayBounds.width + __dividerLineWidth;
+ __yearBounds.x = __monthBounds.x + __monthBounds.width + __dividerLineWidth;
}
else if (GetLocaleDateFormat() == DATE_FORMAT_MMDDYYYY)
{
- __dayBounds.x = __elementWidth + __dividerLineWidth + (__elementWidth - __dayBounds.width) / 2.0f;
- __yearBounds.x = (2.0f * __elementWidth) + (2.0f * __dividerLineWidth) + (__elementWidth - __yearBounds.width) / 2.0f;
+ __dayBounds.x = __monthBounds.x + __monthBounds.width + __dividerLineWidth;
+ __yearBounds.x = __dayBounds.x + __dayBounds.width + __dividerLineWidth;
}
else if (GetLocaleDateFormat() == DATE_FORMAT_YYYYMMDD)
{
- __monthBounds.x = __elementWidth + __dividerLineWidth + (__elementWidth - __monthBounds.width) / 2.0f;
- __dayBounds.x = (2.0f * __elementWidth) + (2.0f * __dividerLineWidth) + (__elementWidth - __dayBounds.width) / 2.0f;
+ __monthBounds.x = __yearBounds.x + __yearBounds.width + __dividerLineWidth;
+ __dayBounds.x = __monthBounds.x + __monthBounds.width + __dividerLineWidth;
}
else if (GetLocaleDateFormat() == DATE_FORMAT_YYYYDDMM)
{
- __dayBounds.x = __elementWidth + __dividerLineWidth + (__elementWidth - __dayBounds.width) / 2.0f;
- __monthBounds.x = (2.0f * __elementWidth) + (2.0f * __dividerLineWidth) + (__elementWidth - __monthBounds.width) / 2.0f;
+ __dayBounds.x = __yearBounds.x + __yearBounds.width + __dividerLineWidth;
+ __monthBounds.x = __dayBounds.x + __dayBounds.width + __dividerLineWidth;
}
return r;
}
+void
+_EditDatePresenter::CalculateTouchAreaBounds(void)
+{
+ __dayTouchBounds.width = GetTextWidth(DATETIME_ID_DAY);
+ __dayTouchBounds.x = __dayBounds.x + (__elementWidth - __dayTouchBounds.width) / 2.0f;
+ __dayTouchBounds.y = __dayBounds.y;
+ __dayTouchBounds.height = __dayBounds.height;
+
+ __monthTouchBounds.width = GetTextWidth(DATETIME_ID_MONTH);
+ __monthTouchBounds.x = __monthBounds.x + (__elementWidth - __monthTouchBounds.width) / 2.0f;
+ __monthTouchBounds.y = __monthBounds.y;
+ __monthTouchBounds.height = __monthBounds.height;
+
+ __yearTouchBounds.width = GetTextWidth(DATETIME_ID_YEAR);
+ __yearTouchBounds.x = __yearBounds.x + (__elementWidth - __yearTouchBounds.width) / 2.0f;
+ __yearTouchBounds.y = __yearBounds.y;
+ __yearTouchBounds.height = __yearBounds.height;
+
+ return;
+}
+
result
_EditDatePresenter::DrawTitle(Canvas& canvas)
{
}
result
-_EditDatePresenter::DrawText(Canvas& canvas, const FloatRectangle& bounds, const String& text)
+_EditDatePresenter::DrawText(Canvas& canvas, const FloatRectangle& bounds, const String& text, _DateTimeId boxId)
{
Color textColor;
GET_COLOR_CONFIG(EDITDATE::TEXT_NORMAL, textColor);
}
- _DateTimeId boxId = DATETIME_ID_NONE;
- boxId = GetBoxIdFromPosition(FloatPoint(bounds.x, bounds.y));
-
if (boxId == __selectedId && boxId != DATETIME_ID_NONE)
{
GET_COLOR_CONFIG(EDITDATE::TEXT_PRESSED, textColor);
{
_DateTimeId displayBoxId = DATETIME_ID_NONE;
- if (point.y < __dayBounds.y || point.y > __dayBounds.y + __dayBounds.height)
+ if (point.y < __dayTouchBounds.y || point.y > __dayTouchBounds.y + __dayTouchBounds.height)
{
return displayBoxId;
}
- if (__dayBounds.Contains(point) == true)
+ if (__dayTouchBounds.Contains(point) == true)
{
displayBoxId = DATETIME_ID_DAY;
}
- else if (__monthBounds.Contains(point) == true)
+ else if (__monthTouchBounds.Contains(point) == true)
{
displayBoxId = DATETIME_ID_MONTH;
}
- else if (__yearBounds.Contains(point) == true)
+ else if (__yearTouchBounds.Contains(point) == true)
{
displayBoxId = DATETIME_ID_YEAR;
}
_EditTime::OnDateTimeChanged(const _Control& source, int year, int month, int day, int hour, int minute)
{
__pEditTimePresenter->Animate();
+ __pEditTimePresenter->SetLastSelectedId(DATETIME_ID_NONE);
Invalidate();
FireTimeChangeEvent(TIME_INTERNAL_CHANGE_SAVED);
return;
void
_EditTime::OnDateTimeChangeCanceled(const _Control& source)
{
+ __pEditTimePresenter->SetLastSelectedId(DATETIME_ID_NONE);
Invalidate();
-
FireTimeChangeEvent(TIME_INTERNAL_CHANGE_CANCELED);
return;
}
, __pEditTime(null)
, __bounds(FloatRectangle())
, __titleBounds(FloatRectangle())
+ , __hourTouchBounds(FloatRectangle())
+ , __minuteTouchBounds(FloatRectangle())
, __ampmString(String())
, __hourString(String())
, __minuteString(String())
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)
{
return r;
}
+void
+_EditTimePresenter::CalculateTouchAreaBounds(const FloatRectangle hourBounds, const FloatRectangle minuteBounds)
+{
+ __hourTouchBounds.width = GetTextWidth(DATETIME_ID_HOUR);
+ __hourTouchBounds.x = hourBounds.x + (hourBounds.width - __hourTouchBounds.width) / 2.0f;
+ __hourTouchBounds.y = hourBounds.y;
+ __hourTouchBounds.height = hourBounds.height;
+
+ __minuteTouchBounds.width = GetTextWidth(DATETIME_ID_MINUTE);
+ __minuteTouchBounds.x = minuteBounds.x + (minuteBounds.width - __minuteTouchBounds.width) / 2.0f;
+ __minuteTouchBounds.y = minuteBounds.y;
+ __minuteTouchBounds.height = minuteBounds.height;
+
+ return;
+}
+
result
_EditTimePresenter::InitializeTitleObject(void)
{
FloatRectangle colonBounds(0.0f, 0.0f, 0.0f, 0.0f);
float colonMargin = 0.0f;
- float hourMinuteWidth = 0.0f;
Dimension textArea;
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));
if (__24hours == false)
{
- r = DrawText(*pCanvas, ampmBounds, __ampmString, __amPmTextSize);
+ 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));
+ CalculateTouchAreaBounds(hourBounds, minuteBounds);
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;
}
}
result
-_EditTimePresenter::DrawText(Canvas& canvas, const FloatRectangle& bounds, const String& text, float textSize)
+_EditTimePresenter::DrawText(Canvas& canvas, const FloatRectangle& bounds, const String& text, _DateTimeId boxId, float textSize)
{
result r = E_SUCCESS;
Color textColor;
- _DateTimeId boxId = DATETIME_ID_NONE;
- boxId = GetBoxIdFromPosition(FloatPoint(bounds.x + 1.0f, bounds.y));
-
if (!__pEditTime->IsEnabled())
{
if (boxId == DATETIME_ID_AMPM)
{
_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);
-
if (__24hours == false)
{
ampmBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_AMPM);
}
- if (point.y < hourBounds.y || point.y > hourBounds.y + hourBounds.height)
+ if (point.y < __hourTouchBounds.y || point.y > __hourTouchBounds.y + __hourTouchBounds.height)
{
return displayBoxId;
}
- if (hourBounds.Contains(point) == true)
+ if (__hourTouchBounds.Contains(point) == true)
{
displayBoxId = DATETIME_ID_HOUR;
}
- else if (minuteBounds.Contains(point) == true)
+ else if (__minuteTouchBounds.Contains(point) == true)
{
displayBoxId = DATETIME_ID_MINUTE;
}
result Draw(void);
_DateTimeId GetLastSelectedId(void) const;
+ void SetLastSelectedId(_DateTimeId boxId);
Tizen::Graphics::FloatRectangle GetDateAreaBounds(_DateTimeId id) const;
Tizen::Graphics::FloatRectangle GetTitleBounds(void) const;
int GetLocaleDateFormat(void) const;
float GetTextWidth(_DateTimeId boxId) const;
result CalculateAreaBounds(void);
result DrawTitle(Tizen::Graphics::Canvas& canvas);
- result DrawText(Tizen::Graphics::Canvas& canvas, const Tizen::Graphics::FloatRectangle& bounds, const Tizen::Base::String& text);
+ result DrawText(Tizen::Graphics::Canvas& canvas, const Tizen::Graphics::FloatRectangle& bounds, const Tizen::Base::String& text, _DateTimeId boxId = DATETIME_ID_NONE);
result DrawDividers(Tizen::Graphics::Canvas& canvas);
_DateTimeId GetBoxIdFromPosition(const Tizen::Graphics::FloatPoint& point) const;
- void SetLastSelectedId(_DateTimeId boxId);
+
+ void CalculateTouchAreaBounds(void);
private:
_DateTimeModel* __pEditDateTimeModel;
Tizen::Graphics::FloatRectangle __dayBounds;
Tizen::Graphics::FloatRectangle __monthBounds;
Tizen::Graphics::FloatRectangle __yearBounds;
+ Tizen::Graphics::FloatRectangle __dayTouchBounds;
+ Tizen::Graphics::FloatRectangle __monthTouchBounds;
+ Tizen::Graphics::FloatRectangle __yearTouchBounds;
Tizen::Graphics::FloatRectangle __titleBounds;
Tizen::Base::String __title;
Tizen::Base::String __lastSelectedValue;
bool Is24HourNotationEnabled(void) const;
_DateTimeId GetLastSelectedId(void) const;
+ void SetLastSelectedId(_DateTimeId boxId);
Tizen::Graphics::FloatRectangle GetDisplayAreaBoundsFromHoursStyle(_DateTimeId displayBoxId) const;
float GetTextWidth(_DateTimeId boxId) const;
void SetTitleBounds(void);
void SetTimeConversion(void);
result DrawTitle(Tizen::Graphics::Canvas& canvas);
- result DrawText(Tizen::Graphics::Canvas& canvas, const Tizen::Graphics::FloatRectangle& bounds, const Tizen::Base::String& text, float textSize = 0.0f);
+ result DrawText(Tizen::Graphics::Canvas& canvas, const Tizen::Graphics::FloatRectangle& bounds, const Tizen::Base::String& text, _DateTimeId displayBoxId, float textSize = 0.0f);
result DrawColon(Tizen::Graphics::Canvas& canvas, const Tizen::Graphics::FloatRectangle& bounds);
_DateTimeId GetBoxIdFromPosition(const Tizen::Graphics::FloatPoint& point) const;
- void SetLastSelectedId(_DateTimeId boxId);
result LoadResource(void);
result DrawResourceBitmap(Tizen::Graphics::Canvas& canvas, const Tizen::Graphics::FloatRectangle& bounds, Tizen::Graphics::Bitmap* pBitmap);
+ void CalculateTouchAreaBounds(const Tizen::Graphics::FloatRectangle hourBounds, const Tizen::Graphics::FloatRectangle minuteBounds);
private:
_DateTimeModel* __pEditDateTimeModel;
Tizen::Graphics::FloatRectangle __bounds;
Tizen::Graphics::FloatRectangle __titleBounds;
+ Tizen::Graphics::FloatRectangle __hourTouchBounds;
+ Tizen::Graphics::FloatRectangle __minuteTouchBounds;
Tizen::Base::String __ampmString;
Tizen::Base::String __hourString;