{
if (!this->__useStableRenderer && srcBufferInfo.bitsPerPixel == 32 && (GetCompositeMode() != COMPOSITE_MODE_SRC_OVER || srcBitmap.__isPremultiplied))
{
- _Util::Rectangle<int> srcBounds =
- {
- int(Math::Floor(srcRectD.x)),
- int(Math::Floor(srcRectD.y)),
- int(Math::Ceiling(srcRectD.x + srcRectD.w) - Math::Floor(srcRectD.x)),
- int(Math::Ceiling(srcRectD.y + srcRectD.h) - Math::Floor(srcRectD.y))
- };
-
_Util::Pixmap srcImageUnclipped(srcBufferInfo.width, srcBufferInfo.height, srcBufferInfo.bitsPerPixel, srcBufferInfo.pPixels, srcBufferInfo.pitch);
- _Util::Pixmap srcImage = srcImageUnclipped.GetSubBitmap(srcBounds.x, srcBounds.y, srcBounds.w, srcBounds.h);
+ _Util::Pixmap srcImage = srcImageUnclipped.GetSubBitmap(srcRect.x, srcRect.y, srcRect.w, srcRect.h);
_ApplySrcBitmapAttrib(srcImage, srcBitmap, srcBitmap.__isOpaqueAllOver);
_Util::Pixmap dstImageUnclipped(dstBufferInfo.width, dstBufferInfo.height, dstBufferInfo.bitsPerPixel, dstBufferInfo.pPixels, dstBufferInfo.pitch);
evas_object_image_pixels_dirty_set((Evas_Object*) this->__windowHandle, true);
#else
Evas_Object* pSourceObject = _GetWindowSourceObject(this->__windowHandle);
- evas_object_image_data_set(pSourceObject, evas_object_image_data_get(pSourceObject, EINA_TRUE));
evas_object_image_data_update_add(pSourceObject, 0, 0, bufferWidth, bufferHeight);
#endif
evas_object_image_data_update_add((Evas_Object*) this->__windowHandle, x1, y1, x2 - x1, y2 - y1);
#else
Evas_Object* pSourceObject = _GetWindowSourceObject(this->__windowHandle);
- evas_object_image_data_set(pSourceObject, evas_object_image_data_get(pSourceObject, EINA_TRUE));
evas_object_image_data_update_add(pSourceObject, x1, y1, x2 - x1, y2 - y1);
#endif
__updateContents = true;
}
void
-_AccessibilityElement::SetTrait(AccessibilityTraits trait)
-{
- __trait = trait;
- __traitString = (_traitString[__trait]);
- __updateContents = true;
-}
-void
_AccessibilityElement::SetTrait(const Tizen::Base::String& trait)
{
__traitString = trait;
{
return __status;
}
-AccessibilityTraits
-_AccessibilityElement::GetTrait(void) const
-{
- return __trait;
-}
String
_AccessibilityElement::GetTraitString(void) const
{
return __pCore->SetStatus(status);
}
void
-_AccessibilityElementImpl::SetTrait(AccessibilityTraits trait)
-{
- SysTryReturn(NID_UI, __pCore, , E_SYSTEM, "[E_SYSTEM] System Error.");
- return __pCore->SetTrait(trait);
-}
-void
_AccessibilityElementImpl::SetTrait(const Tizen::Base::String& trait)
{
SysTryReturn(NID_UI, __pCore, , E_SYSTEM, "[E_SYSTEM] System Error.");
SysTryReturn(NID_UI, __pCore, L"", E_SYSTEM, "[E_SYSTEM] System Error.");
return __pCore->GetStatus();
}
-AccessibilityTraits
-_AccessibilityElementImpl::GetTrait(void) const
-{
- SysTryReturn(NID_UI, __pCore, ACCESSIBILITY_TRAITS_NONE, E_SYSTEM, "[E_SYSTEM] System Error.");
- return __pCore->GetTrait();
-}
Tizen::Base::String
_AccessibilityElementImpl::GetTraitString(void) const
{
}
pFrame = UiApp::GetInstance()->GetAppFrame()->GetFrame();
+
if (pFrame != null)
{
int accesibilityVisualElementLevel = 3000;
}
_Control* pControl = null;
Point pt((int)point.x, (int)point.y);
- _TouchManager* pTouchManager = _TouchManager::GetInstance();
- _Control* pCapturedControl = pTouchManager->GetCapturedControl();
- if (pCapturedControl)
+ _Window* pWindow = _ControlManager::GetInstance()->GetTopVisibleWindow();
+ if (!(pWindow->IsLayoutChangable()))
{
- if(pCapturedControl->GetAbsoluteBounds().Contains(pt))
- {
- pControl = pCapturedControl;
- }
+ Rectangle topWindowAbsBounds = pWindow->GetAbsoluteBounds();
+ pt.x = pt.x + topWindowAbsBounds.x;
+ pt.y = pt.y + topWindowAbsBounds.y;
}
- else
- {
- pControl = _ControlManager::GetInstance()->GetTopmostTouchedControl(pt);
- }
- if (pControl == null)
+ pControl = _ControlManager::GetInstance()->GetTopmostTouchedControl(pt);
+ if (!(pControl->GetAbsoluteBounds().Contains(pt)))
{
return false;
}
bool
_AccessibilitySystemSettingLoader::IsScreenReaderActivated(void)
{
- return GetEcoreEvasMgr()->GetEcoreEvas()->IsAccessibilityScreenReaderActivated();
+// return GetEcoreEvasMgr()->GetEcoreEvas()->IsAccessibilityScreenReaderActivated();
+ bool enable = false;
+ _SettingInfoImpl::GetValue(L"http://tizen.org/setting/speech.tts.screen", enable);
+ return enable;
}
float
}
bool
+_DateTimeBar::OnFocusGained(const _Control& control)
+{
+ return true;
+}
+
+bool
+_DateTimeBar::OnFocusLost(const _Control& control)
+{
+ __pDateTimeBarPresenter->SetItemFocused(false);
+ return true;
+}
+
+void
+_DateTimeBar::OnDrawFocus(void)
+{
+ __pDateTimeBarPresenter->SetItemFocused(true);
+ __pDateTimeBarPresenter->DrawFocus();
+ return;
+}
+
+bool
+_DateTimeBar::OnKeyPressed(const _Control &source, const _KeyInfo &keyInfo)
+{
+ return __pDateTimeBarPresenter->OnKeyPressed(source,keyInfo);
+}
+
+bool
_DateTimeBar::OnAccessibilityFocusMovedNext(const _AccessibilityContainer& control, const _AccessibilityElement& element)
{
return __pDateTimeBarPresenter->OnAccessibilityFocusMovedNext(control, element);
}
else if (__accessibilityFocusOutIndex > focusInIndex)
{
- if(pFocusInAccessibilityElement != null && pFocusInAccessibilityElement->GetBounds().x < 0)
+ if (pFocusInAccessibilityElement != null && pFocusInAccessibilityElement->GetBounds().x < 0)
{
__pDateTimeBarPresenter->MovePrevious();
}
using namespace Tizen::Base::Runtime;
using namespace Tizen::Graphics::_Text;
-const int UPDATE_ITEM_COUNT = 3;
-
namespace Tizen { namespace Ui { namespace Controls
{
, __arrowAreaBounds(FloatRectangle())
, __windowAreaBounds(FloatRectangle())
, __pBgColorReplacementBitmap(null)
+ , __pFocusBitmap(null)
, __pArrowColorReplacementBitmap(null)
, __isInitialAnimation(false)
, __initialAnimationValue(0.0f)
, __pFont(null)
+ , __isFocused(false)
+ , __focusedIndex(-1)
+ , __focusBounds(FloatRectangle())
{
}
delete __pBgColorReplacementBitmap;
__pBgColorReplacementBitmap = null;
+ delete __pFocusBitmap;
+ __pFocusBitmap = null;
+
delete __pArrowColorReplacementBitmap;
__pArrowColorReplacementBitmap = null;
SysTryCatch(NID_UI_CTRL, __pBgColorReplacementBitmap != null, r = GetLastResult(), GetLastResult(), "[%s] Propagating.",
GetErrorMessage(GetLastResult()));
+ r = GET_BITMAP_CONFIG_N(FOCUSUI::FOCUS, BITMAP_PIXEL_FORMAT_ARGB8888, __pFocusBitmap);
+ SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+
r = LoadArrowBitmap();
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to load resources.", GetErrorMessage(r));
delete __pBgColorReplacementBitmap;
__pBgColorReplacementBitmap = null;
+ delete __pFocusBitmap;
+ __pFocusBitmap = null;
+
return r;
}
r = DrawArrow(*pCanvas);
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ if (__isFocused)
+ {
+ DrawFocus();
+ }
+
+CATCH:
delete pCanvas;
return r;
+}
+result
+_DateTimeBarPresenter::DrawFocus()
+{
+ Canvas* pCanvas = __pDateTimeBar->GetCanvasN();
+ SysTryReturnResult(NID_UI_CTRL, (pCanvas != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Unable to create canvas.");
+
+ result r = E_SUCCESS;
+
+ if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*__pFocusBitmap))
+ {
+ r = pCanvas->DrawNinePatchedBitmap(__focusBounds, *__pFocusBitmap);
+ SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+ else
+ {
+ r = pCanvas->DrawBitmap(__focusBounds, *__pFocusBitmap);
+ SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ }
CATCH:
+
delete pCanvas;
return r;
}
+void
+_DateTimeBarPresenter::SetItemFocused(bool isFocused)
+{
+ if (!__isFocused)
+ {
+ __focusedIndex = (GetSelectedItemIndex() - 1);
+ _DateTimeBarItem* pItem = null;
+ pItem = GetItemAt(__focusedIndex);
+
+ __focusBounds = pItem->GetBounds();
+ }
+ __isFocused = isFocused;
+ return;
+}
+
result
_DateTimeBarPresenter::DrawItem(Canvas& canvas)
{
}
bool
+_DateTimeBarPresenter::OnKeyPressed(const _Control &source, const _KeyInfo &keyInfo)
+{
+ if (!__isFocused)
+ {
+ return false;
+ }
+
+ _KeyCode keyCode = keyInfo.GetKeyCode();
+
+ switch (keyCode)
+ {
+ case KEY_RIGHT:
+ {
+ if ((__focusBounds.x + __focusBounds.width) > (GetWindowBounds().width - __focusBounds.width))
+ {
+ MoveNext();
+ }
+ else
+ {
+ __focusBounds.x = __focusBounds.x + __focusBounds.width + GetItemMargin();
+ __pDateTimeBar->Invalidate();
+
+ }
+ __focusedIndex = GetItemIndexFromPosition(FloatPoint(__focusBounds.x, __focusBounds.y));
+
+ break;
+ }
+
+ case KEY_LEFT:
+ {
+ if ((__focusBounds.x - __focusBounds.width) < 0)
+ {
+ MovePrevious();
+ }
+ else
+ {
+ __focusBounds.x = __focusBounds.x - __focusBounds.width - GetItemMargin();
+ __pDateTimeBar->Invalidate();
+ }
+ __focusedIndex = GetItemIndexFromPosition(FloatPoint(__focusBounds.x, __focusBounds.y));
+
+ break;
+ }
+
+ case KEY_ENTER:
+ {
+ _DateTimeBarItem* pItem = null;
+
+ SetItemSelected(__focusedIndex);
+ __pDateTimeBarModel->SetFirstDrawnItemIndex((__focusedIndex));
+
+ if (__focusedIndex >= 0)
+ {
+ pItem = GetItemAt(__focusedIndex);
+ }
+
+ if (pItem != null)
+ {
+ __pDateTimeBar->SetVisibleState(false);
+ __pDateTimeBar->Close();
+
+ __pDateTimeBar->FireActionEvent(pItem->GetActionId());
+
+ if (__pDateTimeBar->GetSelectedBoxId() >= DATETIME_ID_YEAR && __pDateTimeBar->GetSelectedBoxId() <= DATETIME_ID_DAY)
+ {
+ __pDateTimeBar->FireDateTimeChangeEvent(DATE_INTERNAL_CHANGE_SAVED);
+ }
+ else if (__pDateTimeBar->GetSelectedBoxId() >= DATETIME_ID_HOUR && __pDateTimeBar->GetSelectedBoxId() <= DATETIME_ID_MINUTE)
+ {
+ __pDateTimeBar->FireDateTimeChangeEvent(TIME_INTERNAL_CHANGE_SAVED);
+ }
+ }
+ __isFocused = false;
+ break;
+ }
+
+ default:
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool
_DateTimeBarPresenter::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
{
if (&source != __pDateTimeBar)
GET_COLOR_CONFIG(DATETIMEPICKER::TEXT_NORMAL, __textColor[DATETIME_STATUS_NORMAL]);
GET_COLOR_CONFIG(DATETIMEPICKER::TEXT_HIGHLIGHTED, __textColor[DATETIME_STATUS_HIGHLIGHTED]);
- GET_COLOR_CONFIG(DATETIMEPICKER::TEXT_PRESSED, __textColor[DATETIME_STATUS_PRESSED]);
+ GET_COLOR_CONFIG(DATETIMEPICKER::TEXT_PRESSED, __textColor[DATETIME_STATUS_SELECTED]);
GET_COLOR_CONFIG(DATETIMEPICKER::TEXT_DISABLED, __textColor[DATETIME_STATUS_DISABLED]);
}
if (__boxId == DATETIME_ID_AMPM)
{
isCustomBitmap[DATETIME_STATUS_NORMAL] = IS_CUSTOM_BITMAP(DATETIMEPICKER::AMPM_BG_NORMAL);
- isCustomBitmap[DATETIME_STATUS_PRESSED] = IS_CUSTOM_BITMAP(DATETIMEPICKER::AMPM_BG_PRESSED);
+ isCustomBitmap[DATETIME_STATUS_SELECTED] = IS_CUSTOM_BITMAP(DATETIMEPICKER::AMPM_BG_PRESSED);
isCustomBitmap[DATETIME_STATUS_HIGHLIGHTED] = IS_CUSTOM_BITMAP(DATETIMEPICKER::AMPM_BG_HIGHLIGHTED);
isCustomBitmap[DATETIME_STATUS_DISABLED] = IS_CUSTOM_BITMAP(DATETIMEPICKER::AMPM_BG_DISABLED);
}
else
{
isCustomBitmap[DATETIME_STATUS_NORMAL] = IS_CUSTOM_BITMAP(DATETIMEPICKER::CONTENT_BG_NORMAL);
- isCustomBitmap[DATETIME_STATUS_PRESSED] = IS_CUSTOM_BITMAP(DATETIMEPICKER::CONTENT_BG_PRESSED);
+ isCustomBitmap[DATETIME_STATUS_SELECTED] = IS_CUSTOM_BITMAP(DATETIMEPICKER::CONTENT_BG_PRESSED);
isCustomBitmap[DATETIME_STATUS_HIGHLIGHTED] = IS_CUSTOM_BITMAP(DATETIMEPICKER::CONTENT_BG_HIGHLIGHTED);
isCustomBitmap[DATETIME_STATUS_DISABLED] = IS_CUSTOM_BITMAP(DATETIMEPICKER::CONTENT_BG_DISABLED);
}
_DateTimeDisplayBox::SetBackgroundBitmap(Bitmap **pBackgroundNormalBitmap, Bitmap **pBackgroundEffectBitmap)
{
GET_COLOR_CONFIG(DATETIMEPICKER::AMPM_TEXT_NORMAL, __textColor[DATETIME_STATUS_NORMAL]);
- GET_COLOR_CONFIG(DATETIMEPICKER::AMPM_TEXT_PRESSED, __textColor[DATETIME_STATUS_PRESSED]);
+ GET_COLOR_CONFIG(DATETIMEPICKER::AMPM_TEXT_PRESSED, __textColor[DATETIME_STATUS_SELECTED]);
GET_COLOR_CONFIG(DATETIMEPICKER::AMPM_TEXT_HIGHLIGHTED, __textColor[DATETIME_STATUS_HIGHLIGHTED]);
GET_COLOR_CONFIG(DATETIMEPICKER::AMPM_TEXT_DISABLED, __textColor[DATETIME_STATUS_DISABLED]);
#include <FBaseColIEnumeratorT.h>
#include <FBaseSysLog.h>
#include <FGrp_BitmapImpl.h>
+#include <FSysSettingInfo.h>
#include "FUiCtrl_DateTimePicker.h"
#include "FUiAnim_VisualElement.h"
using namespace Tizen::Graphics;
using namespace Tizen::Ui;
using namespace Tizen::Ui::Animations;
+using namespace Tizen::System;
namespace Tizen { namespace Ui { namespace Controls
{
_DateTimePicker::~_DateTimePicker(void)
{
+ SettingInfo::RemoveSettingEventListener(*this);
+
if (__pDateTimeChangeEvent != null)
{
delete __pDateTimeChangeEvent;
pView->GetAccessibilityContainer()->Activate(true);
}
+ r = SettingInfo::AddSettingEventListener(*pView);
+ SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
return pView;
CATCH:
return;
}
+bool
+_DateTimePicker::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
+{
+ if (&source != this)
+ {
+ return false;
+ }
+
+ return __pPresenter->OnKeyPressed(source, keyInfo);
+}
+
+bool
+_DateTimePicker::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
+{
+ if (&source != this)
+ {
+ return false;
+ }
+
+ return __pPresenter->OnKeyReleased(source, keyInfo);
+}
+
+void
+_DateTimePicker::OnDrawFocus(void)
+{
+ __pPresenter->DrawFocus();
+ return;
+}
+
+bool
+_DateTimePicker::OnFocusGained(const _Control& source)
+{
+ return _Control::OnFocusGained(source);
+}
+
+bool
+_DateTimePicker::OnFocusLost(const _Control& source)
+{
+ result r = __pPresenter->ReleaseFocus();
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ _Control::OnFocusLost(source);
+ return true;
+}
+
+void
+_DateTimePicker::OnSettingChanged(Tizen::Base::String& key)
+{
+ if (key.Equals(L"http://tizen.org/setting/locale.date.format", false)
+ || key.Equals(L"http://tizen.org/setting/locale.time.format.24hour", false))
+ {
+ __pPresenter->UpdateLocaleDateTimeFormat();
+ Invalidate();
+ }
+
+ return;
+}
+
Font*
_DateTimePicker::GetDateTimeFont(void)
{
* @brief This is the implementation file for the _DateTimePresenter class.
*/
-#include <vconf.h>
+#include <FSysSettingInfo.h>
#include <FBaseErrorDefine.h>
#include <FBaseSysLog.h>
#include <FGrp_TextTextObject.h>
using namespace Tizen::Graphics;
using namespace Tizen::Graphics::_Text;
using namespace Tizen::Ui::Animations;
+using namespace Tizen::System;
namespace Tizen { namespace Ui { namespace Controls
{
_DateTimePresenter::_DateTimePresenter(int pickerStyle, const String& title)
: __pView(null)
, __pModel(null)
- , __selectedBoxIndex(-1)
+ , __selectedBoxIndex(0)
, __focusedBoxIndex(0)
, __pInputPad(null)
, __inputPadType(INPUTPAD_STYLE_NORMAL)
, __hour(0)
, __minute(0)
, __is24HourNotation(false)
+ , __dtp24HourSet(false)
, __isPm(false)
, __isPmButtonPressed(false)
, __isFocusBoxChanged(false)
, __pBgEffectBitmap(null)
, __pFont(null)
, __pPmBox(null)
+ , __keypadEnabled(false)
{
for (int i = 0; i < DATETIME_ID_MAX; i++)
{
SysTryReturnResult(NID_UI_CTRL, (__pModel != null), E_OUT_OF_MEMORY, "Memory allocation failed.");
// Load display data for sync with model data
+ UpdateTimeFormat();
LoadPickerData();
if (__inputPadEnabled == true)
__pInputPad->SetFont(__pFont);
- _DateTimeDisplayBox* pDisplayBox = __pDisplayBox[__focusedBoxIndex];
+ if (__pInputPad->IsFocusable() == true)
+ {
+ __pInputPad->SetFocusable(false);
+ }
+
+ _DateTimeDisplayBox* pDisplayBox = __pDisplayBox[__selectedBoxIndex];
SysTryCatch(NID_UI_CTRL, (pDisplayBox != null), , E_SYSTEM,
"[E_SYSTEM] A system error has occurred. Failed to get Display box.");
_DateTimePresenter::Set24HourNotationEnabled(bool enable)
{
__is24HourNotation = enable;
+ __dtp24HourSet = true;
UpdateDateTimeOutputConfig();
}
if (boxId == displayBoxId)
{
SetFocusBox(i);
- ChangeInputPadStyle(boxId);
return;
}
}
}
void
+_DateTimePresenter::UpdateLocaleDateTimeFormat(void)
+{
+ UpdateTimeFormat();
+
+ UpdateDateTimeOutputConfig();
+
+ LoadPickerData();
+
+ for (int i = 0; i < __outputBoxMaxCount; i++)
+ {
+ AdjustDisplayValue(i);
+ }
+
+ return;
+}
+
+void
+_DateTimePresenter::UpdateTimeFormat(void)
+{
+ if (!__dtp24HourSet)
+ {
+ String key(L"http://tizen.org/setting/locale.time.format.24hour");
+ SettingInfo::GetValue(key , __is24HourNotation);
+ }
+
+ return;
+}
+
+void
_DateTimePresenter::OnChangeLayout(_ControlOrientation orientation)
{
result r = E_SUCCESS;
int touchedAreaId = CalculateTouchArea(touchinfo.GetCurrentPosition().x, touchinfo.GetCurrentPosition().y);
+ if (touchedAreaId != DATETIME_AREA_INPUT)
+ {
+ __keypadEnabled = false;
+ }
+
if (touchedAreaId == DATETIME_AREA_OUTPUT_AMPM)
{
__isPmButtonPressed = true;
- __pView->Draw();
+ __pView->Invalidate(true);
return true;
}
- __selectedBoxIndex = CalculateTouchOutputArea(touchinfo.GetCurrentPosition().x, touchinfo.GetCurrentPosition().y);
-
return true;
}
int touchedAreaId = CalculateTouchArea(touchinfo.GetCurrentPosition().x, touchinfo.GetCurrentPosition().y);
+ if (touchedAreaId != DATETIME_AREA_INPUT)
+ {
+ __keypadEnabled = false;
+ }
+
if (__isPmButtonPressed == true)
{
if (touchedAreaId == DATETIME_AREA_OUTPUT_AMPM)
__inputComposing = DATETIME_INPUT_END;
__changeFocusCounter = DATE_TIME_CHANGE_FOCUS_COUNTER_MIN;
__isPmButtonPressed = false;
- __pView->Draw();
+ __pView->Invalidate(true);
return true;
}
if ((touchedAreaId == DATETIME_AREA_NONE) || (touchedAreaId == DATETIME_AREA_INPUT) ||
(touchedAreaId == DATETIME_AREA_OUTPUT_AMPM))
{
- __selectedBoxIndex = -1;
__isPmButtonPressed = false;
- __pView->Draw();
+ __pView->Invalidate(true);
return true;
}
if (touchedAreaId == DATETIME_AREA_OUTPUT)
{
newOutputFocusedIndex = CalculateTouchOutputArea(touchinfo.GetCurrentPosition().x, touchinfo.GetCurrentPosition().y);
- if ((newOutputFocusedIndex == (-1)) || (newOutputFocusedIndex == __focusedBoxIndex))
- {
- __selectedBoxIndex = -1;
- __pView->Draw();
+ if (newOutputFocusedIndex == (-1))
+ {
return true;
}
{
AdjustDisplayValue(i);
}
-
- SetFocusBox(newOutputFocusedIndex);
+ }
+ else
+ {
+ __selectedBoxIndex = newOutputFocusedIndex;
}
_VisualElement* pVisualElement = null;
r = GetLastResult();
SysTryReturn(NID_UI_CTRL, (pCanvas != null), false, r, "[%s] Propagating.", GetErrorMessage(r));
- DrawDateTimeDisplayBox(*pCanvas, __focusedBoxIndex);
+ DrawDateTimeDisplayBox(*pCanvas, __selectedBoxIndex);
delete pCanvas;
- __selectedBoxIndex = -1;
__inputComposing = DATETIME_INPUT_END;
__changeFocusCounter = DATE_TIME_CHANGE_FOCUS_COUNTER_MIN;
- int boxId = __pDisplayBox[__focusedBoxIndex]->GetDisplayBoxId();
+ int boxId = __pDisplayBox[__selectedBoxIndex]->GetDisplayBoxId();
ChangeInputPadStyle(boxId);
- __pView->Draw();
+ __pView->Invalidate(true);
return true;
}
return false;
}
- __selectedBoxIndex = -1;
__isPmButtonPressed = false;
__inputComposing = DATETIME_INPUT_END;
__changeFocusCounter = DATE_TIME_CHANGE_FOCUS_COUNTER_MIN;
- __pView->Draw();
+ __pView->Invalidate(true);
return true;
}
void
_DateTimePresenter::OnInputPadValueChanged(const _Control& source, int inputPadReturnValue)
{
+ HandleInputPadValueChange(inputPadReturnValue);
+}
+
+void
+_DateTimePresenter::OnActionPerformed(const _Control& source, int actionId)
+{
+ HandleSaveCancelAction(actionId);
+}
+
+bool
+_DateTimePresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
+{
+ int boxId = 0;
+ __keypadEnabled = true;
+
+ _KeyCode keyCode = keyInfo.GetKeyCode();
+
+ if (__focusedBoxIndex < __outputBoxMaxCount)
+ {
+ boxId = __pDisplayBox[__focusedBoxIndex]->GetDisplayBoxId();
+
+ if ((keyCode != _KEY_RIGHT) && (keyCode != _KEY_LEFT) && (boxId == DATETIME_ID_MONTH))
+ {
+ //month can be changed only with touch on input pad
+ return true;
+ }
+ }
+
+ switch (keyCode)
+ {
+ case _KEY_RIGHT:
+ {
+ if (__pickerStyle != DATETIME_OUTPUT_STYLE_DATE && __focusedBoxIndex < __outputBoxMaxCount)
+ {
+ __focusedBoxIndex++;
+ SetFocusBox(__focusedBoxIndex);
+ }
+ else if (__pickerStyle == DATETIME_OUTPUT_STYLE_DATE && __focusedBoxIndex < __outputBoxMaxCount-1)
+ {
+ __focusedBoxIndex++;
+ SetFocusBox(__focusedBoxIndex);
+ }
+ else
+ {
+ return false;
+ }
+ }
+ break;
+ case _KEY_LEFT:
+ {
+ if (__focusedBoxIndex > 0)
+ {
+ __focusedBoxIndex--;
+ SetFocusBox(__focusedBoxIndex);
+ }
+ else
+ {
+ return false;
+ }
+ }
+ break;
+ case _KEY_ENTER:
+ {
+ if (__focusedBoxIndex == __outputBoxMaxCount)
+ {
+ __isPmButtonPressed = true;
+ }
+ }
+ break;
+ case _KEY_0:
+ case _KEY_NUMPAD_0:
+ HandleInputPadValueChange(0);
+ break;
+ case _KEY_1:
+ case _KEY_NUMPAD_1:
+ HandleInputPadValueChange(1);
+ break;
+ case _KEY_2:
+ case _KEY_NUMPAD_2:
+ HandleInputPadValueChange(2);
+ break;
+ case _KEY_3:
+ case _KEY_NUMPAD_3:
+ HandleInputPadValueChange(3);
+ break;
+ case _KEY_4:
+ case _KEY_NUMPAD_4:
+ HandleInputPadValueChange(4);
+ break;
+ case _KEY_5:
+ case _KEY_NUMPAD_5:
+ HandleInputPadValueChange(5);
+ break;
+ case _KEY_6:
+ case _KEY_NUMPAD_6:
+ HandleInputPadValueChange(6);
+ break;
+ case _KEY_7:
+ case _KEY_NUMPAD_7:
+ HandleInputPadValueChange(7);
+ break;
+ case _KEY_8:
+ case _KEY_NUMPAD_8:
+ HandleInputPadValueChange(8);
+ break;
+ case _KEY_9:
+ case _KEY_NUMPAD_9:
+ HandleInputPadValueChange(9);
+ break;
+ default:
+ return false;
+ }
+
+ __pView->Invalidate(true);
+ return true;
+}
+
+bool
+_DateTimePresenter::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
+{
+ _KeyCode keyCode = keyInfo.GetKeyCode();
+ if (__isPmButtonPressed == true && keyCode == _KEY_ENTER)
+ {
+ __isPm = (!__isPm);
+ __isPmButtonPressed = false;
+ __pView->Invalidate(true);
+ }
+
+ return true;
+}
+
+result
+_DateTimePresenter::DrawFocus(void)
+{
+ result r = E_SUCCESS;
+ __keypadEnabled = true;
+ __focusedBoxIndex = __selectedBoxIndex;
+
+ __pView->Invalidate(true);
+ return r;
+}
+
+result
+_DateTimePresenter::ReleaseFocus(void)
+{
+ result r = E_SUCCESS;
+ __keypadEnabled = false;
+ __focusedBoxIndex = 0;
+ __selectedBoxIndex = 0;
+
+ __pView->Invalidate(true);
+ return r;
+}
+
+void
+_DateTimePresenter::HandleInputPadValueChange(int inputPadReturnValue)
+{
if ((__inputPadEnabled == false) || (inputPadReturnValue == -1))
{
return;
}
- int boxId = __pDisplayBox[__focusedBoxIndex]->GetDisplayBoxId();
+ if ((__keypadEnabled == true) && (__pickerStyle != DATETIME_OUTPUT_STYLE_DATE) && (__focusedBoxIndex == __outputBoxMaxCount))
+ {
+ //in case of Am/Pm if keypad enabled, inputpad values need not be handled though in focus
+ return;
+ }
+
+ int boxId = __pDisplayBox[__selectedBoxIndex]->GetDisplayBoxId();
int currentNumber = GetNumberInBox(boxId);
int newNumber = 0;
}
}
- __pView->Draw();
+ __pView->Invalidate(true);
}
void
-_DateTimePresenter::OnActionPerformed(const _Control& source, int actionId)
+_DateTimePresenter::HandleSaveCancelAction(int actionId)
{
result r = E_SUCCESS;
__inputComposing = DATETIME_INPUT_END;
__changeFocusCounter = DATE_TIME_CHANGE_FOCUS_COUNTER_MIN;
__focusedBoxIndex = 0;
+ __selectedBoxIndex = 0;
- int boxId = __pDisplayBox[__focusedBoxIndex]->GetDisplayBoxId();
+ int boxId = __pDisplayBox[__selectedBoxIndex]->GetDisplayBoxId();
SetFocusBoxId(boxId);
__pView->Close();
float leftMargin = 0.0f;
GET_SHAPE_CONFIG(DATETIMEPICKER::DATETIME_OUTPUT_LEFT_MARGIN, orientation, leftMargin);
- switch (GetLocaleDateFormat())
+ _DateTimeUtils dateTimeUtils;
+ int localeDateFormat = dateTimeUtils.GetLocaleDateFormat();
+
+ switch (localeDateFormat)
{
case DATE_FORMAT_DDMMYYYY:
{
}
GET_COLOR_CONFIG(DATETIMEPICKER::AMPM_BG_NORMAL, backgroundColor[DATETIME_STATUS_NORMAL]);
- GET_COLOR_CONFIG(DATETIMEPICKER::AMPM_BG_PRESSED, backgroundColor[DATETIME_STATUS_PRESSED]);
+ GET_COLOR_CONFIG(DATETIMEPICKER::AMPM_BG_PRESSED, backgroundColor[DATETIME_STATUS_SELECTED]);
GET_COLOR_CONFIG(DATETIMEPICKER::AMPM_BG_HIGHLIGHTED, backgroundColor[DATETIME_STATUS_HIGHLIGHTED]);
GET_COLOR_CONFIG(DATETIMEPICKER::AMPM_BG_DISABLED, backgroundColor[DATETIME_STATUS_DISABLED]);
r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::CONTENT_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pDisplayBoxNormalBitmap[DATETIME_STATUS_NORMAL]);
SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
- r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::CONTENT_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pDisplayBoxNormalBitmap[DATETIME_STATUS_PRESSED]);
+ r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::CONTENT_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pDisplayBoxNormalBitmap[DATETIME_STATUS_SELECTED]);
SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::CONTENT_BG_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, pDisplayBoxNormalBitmap[DATETIME_STATUS_HIGHLIGHTED]);
r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::AMPM_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pAmPmNormalBitmap[DATETIME_STATUS_NORMAL]);
SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
- r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::AMPM_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pAmPmNormalBitmap[DATETIME_STATUS_PRESSED]);
+ r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::AMPM_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pAmPmNormalBitmap[DATETIME_STATUS_SELECTED]);
SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::AMPM_BG_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, pAmPmNormalBitmap[DATETIME_STATUS_HIGHLIGHTED]);
SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
isDisplayBoxCustomBitmap[DATETIME_STATUS_NORMAL] = IS_CUSTOM_BITMAP(DATETIMEPICKER::CONTENT_BG_NORMAL);
- isDisplayBoxCustomBitmap[DATETIME_STATUS_PRESSED] = IS_CUSTOM_BITMAP(DATETIMEPICKER::CONTENT_BG_PRESSED);
+ isDisplayBoxCustomBitmap[DATETIME_STATUS_SELECTED] = IS_CUSTOM_BITMAP(DATETIMEPICKER::CONTENT_BG_PRESSED);
isDisplayBoxCustomBitmap[DATETIME_STATUS_HIGHLIGHTED] = IS_CUSTOM_BITMAP(DATETIMEPICKER::CONTENT_BG_HIGHLIGHTED);
isDisplayBoxCustomBitmap[DATETIME_STATUS_DISABLED] = IS_CUSTOM_BITMAP(DATETIMEPICKER::CONTENT_BG_DISABLED);
isAmPmCustomBitmap[DATETIME_STATUS_NORMAL] = IS_CUSTOM_BITMAP(DATETIMEPICKER::AMPM_BG_NORMAL);
- isAmPmCustomBitmap[DATETIME_STATUS_PRESSED] = IS_CUSTOM_BITMAP(DATETIMEPICKER::AMPM_BG_PRESSED);
+ isAmPmCustomBitmap[DATETIME_STATUS_SELECTED] = IS_CUSTOM_BITMAP(DATETIMEPICKER::AMPM_BG_PRESSED);
isAmPmCustomBitmap[DATETIME_STATUS_HIGHLIGHTED] = IS_CUSTOM_BITMAP(DATETIMEPICKER::AMPM_BG_HIGHLIGHTED);
isAmPmCustomBitmap[DATETIME_STATUS_DISABLED] = IS_CUSTOM_BITMAP(DATETIMEPICKER::AMPM_BG_DISABLED);
SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
}
- if (!isDisplayBoxCustomBitmap[DATETIME_STATUS_PRESSED])
+ if (!isDisplayBoxCustomBitmap[DATETIME_STATUS_SELECTED])
{
- r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::CONTENT_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pDisplayBoxEffectBitmap[DATETIME_STATUS_PRESSED]);
+ r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::CONTENT_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pDisplayBoxEffectBitmap[DATETIME_STATUS_SELECTED]);
SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
}
if (!isDisplayBoxCustomBitmap[DATETIME_STATUS_HIGHLIGHTED])
{
- r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::CONTENT_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pDisplayBoxEffectBitmap[DATETIME_STATUS_HIGHLIGHTED]);
+ r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::CONTENT_BG_EFFECT_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, __pDisplayBoxEffectBitmap[DATETIME_STATUS_HIGHLIGHTED]);
SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
}
SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
}
- if (!isAmPmCustomBitmap[DATETIME_STATUS_PRESSED])
+ if (!isAmPmCustomBitmap[DATETIME_STATUS_SELECTED])
{
- r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::AMPM_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pAmPmEffectBitmap[DATETIME_STATUS_PRESSED]);
+ r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::AMPM_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pAmPmEffectBitmap[DATETIME_STATUS_SELECTED]);
SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
}
{
status = DATETIME_STATUS_DISABLED;
}
- else if (index == __selectedBoxIndex)
- {
- status = DATETIME_STATUS_PRESSED;
- }
- else if (index == __focusedBoxIndex)
+ else
{
- status = DATETIME_STATUS_HIGHLIGHTED;
+ if (__keypadEnabled)
+ {
+ if (index == __focusedBoxIndex)
+ {
+ status = DATETIME_STATUS_HIGHLIGHTED;
+ }
+ }
+ else
+ {
+ if (index == __selectedBoxIndex)
+ {
+ status = DATETIME_STATUS_SELECTED;
+ }
+ }
}
if (boxId == DATETIME_ID_YEAR)
{
- if ((__inputComposing == DATETIME_INPUT_BEGIN) && (status == DATETIME_STATUS_HIGHLIGHTED))
+ if ((__inputComposing == DATETIME_INPUT_BEGIN) && ((__keypadEnabled && status == DATETIME_STATUS_HIGHLIGHTED)
+ || (!__keypadEnabled && status == DATETIME_STATUS_SELECTED)))
{
String length = L"%0d";
}
else
{
- if ((__inputComposing == DATETIME_INPUT_BEGIN) && (status == DATETIME_STATUS_HIGHLIGHTED))
+ if ((__inputComposing == DATETIME_INPUT_BEGIN) && ((__keypadEnabled && status == DATETIME_STATUS_HIGHLIGHTED)
+ || (!__keypadEnabled && status == DATETIME_STATUS_SELECTED)))
{
r = text.Format(DATETIME_DISPLAY_STRING_MAX_LENGTH, L"%d", number);
SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
_DateTimeUtils dateTimeUtils;
-
-
if (__isPm == false)
{
dateTimeUtils.GetAmPm(text, AM_TYPE);
}
else if (__isPmButtonPressed == true)
{
- __pPmBox->DrawDisplayBox(canvas, DATETIME_STATUS_PRESSED);
+ __pPmBox->DrawDisplayBox(canvas, DATETIME_STATUS_SELECTED);
}
else
{
- __pPmBox->DrawDisplayBox(canvas, DATETIME_STATUS_NORMAL);
+ if (__keypadEnabled && __focusedBoxIndex == __outputBoxMaxCount)
+ {
+ __pPmBox->DrawDisplayBox(canvas, DATETIME_STATUS_HIGHLIGHTED);
+ }
+ else
+ {
+ __pPmBox->DrawDisplayBox(canvas, DATETIME_STATUS_NORMAL);
+ }
}
}
void
_DateTimePresenter::SetFocusBox(int index)
{
- __focusedBoxIndex = index;
+ if (__keypadEnabled)
+ {
+ __focusedBoxIndex = index;
+
+ if (__focusedBoxIndex < __outputBoxMaxCount)
+ {
+ __selectedBoxIndex = __focusedBoxIndex;
+ }
+ }
+
__isFocusBoxChanged = true;
+ __inputComposing = DATETIME_INPUT_END;
+ __changeFocusCounter = DATE_TIME_CHANGE_FOCUS_COUNTER_MIN;
+
+ int boxId = __pDisplayBox[__selectedBoxIndex]->GetDisplayBoxId();
+
+ ChangeInputPadStyle(boxId);
}
void
_DateTimePresenter::LoadPickerData(void)
{
+ _DateTimeUtils dateTimeUtils;
+
__year = GetYear();
__month = GetMonth();
__day = GetDay();
__isPm = false;
}
}
+
__minute = GetMinute();
}
{
maxValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
- if(__hour == DATETIME_HOUR_MIN)
+ if (__hour == DATETIME_HOUR_MIN)
{
minValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
}
void
_DateTimePresenter::ChangeFocusBox(void)
{
- if (__focusedBoxIndex < (__outputBoxMaxCount - 1))
+ if (__keypadEnabled)
{
- __focusedBoxIndex++;
- int boxId = __pDisplayBox[__focusedBoxIndex]->GetDisplayBoxId();
- ChangeInputPadStyle(boxId);
- __isFocusBoxChanged = true;
+ if (__focusedBoxIndex < __outputBoxMaxCount - 1)
+ {
+ __focusedBoxIndex++;
+ __selectedBoxIndex = __focusedBoxIndex;
+ int boxId = __pDisplayBox[__focusedBoxIndex]->GetDisplayBoxId();
+ ChangeInputPadStyle(boxId);
+ __isFocusBoxChanged = true;
+ }
+ }
+ else
+ {
+ if (__selectedBoxIndex < (__outputBoxMaxCount - 1))
+ {
+ __selectedBoxIndex++;
+ __focusedBoxIndex = __selectedBoxIndex;
+ int boxId = __pDisplayBox[__selectedBoxIndex]->GetDisplayBoxId();
+ ChangeInputPadStyle(boxId);
+ __isFocusBoxChanged = true;
+ }
}
for (int i = 0; i < __outputBoxMaxCount; i++)
__changeFocusCounter = DATE_TIME_CHANGE_FOCUS_COUNTER_MIN;
}
-int
-_DateTimePresenter::GetLocaleDateFormat(void) const
-{
- int localeDateFormat = -1;
- int error = vconf_get_int(VCONFKEY_SETAPPL_DATE_FORMAT_INT, &localeDateFormat);
- if (error == -1)
- {
- localeDateFormat = SETTING_DATE_FORMAT_DD_MM_YYYY;
- }
-
- return localeDateFormat;
-}
-
void
_DateTimePresenter::SetAccessibilityElementText(void)
{
#include <FBaseDateTime.h>
#include <FLclDateTimeSymbols.h>
+#include <FLclLocaleManager.h>
+#include <FLclDateTimeFormatter.h>
+#include <FSysSettingInfo.h>
#include "FUiCtrl_DateTimeUtils.h"
+#include "FUiCtrl_DateTimeDefine.h"
#include "FUi_ResourceManager.h"
using namespace Tizen::Base;
using namespace Tizen::Locales;
using namespace Tizen::Base::Collection;
+using namespace Tizen::System;
namespace Tizen { namespace Ui { namespace Controls
{
dateSymbols.Construct(CALENDAR_GREGORIAN);
const IList* pListOfShortMonths = dateSymbols.GetShortMonths();
- SysTryReturn(NID_LCL, (pListOfShortMonths != null), text, E_SYSTEM, "[E_SYSTEM] A system error has occurred. pListOfShortMonths is null.");
+ SysTryReturn(NID_UI_CTRL, (pListOfShortMonths != null), text, E_SYSTEM, "[E_SYSTEM] A system error has occurred. pListOfShortMonths is null.");
String* pObj = null;
pObj = static_cast<String*>(const_cast<Object*>(pListOfShortMonths->GetAt(month - 1)));
dateSymbols.Construct(CALENDAR_GREGORIAN);
const IList* pListOfAmPm = dateSymbols.GetAmPm();
- SysTryReturnVoidResult(NID_LCL, (pListOfAmPm != null), E_SYSTEM, "[E_SYSTEM] A system error has occurred. pListOfAmPm is null.");
+ SysTryReturnVoidResult(NID_UI_CTRL, (pListOfAmPm != null), E_SYSTEM, "[E_SYSTEM] A system error has occurred. pListOfAmPm is null.");
String* pObj = null;
pObj = static_cast<String*>(const_cast<Object*>(pListOfAmPm->GetAt(amPmType)));
return text;
}
+
+int
+_DateTimeUtils::GetLocaleDateFormat(void) const
+{
+ result r = E_SUCCESS;
+
+ LocaleManager localeManager;
+ int localeDateFormat = 0;
+
+ r = localeManager.Construct();
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, localeDateFormat, E_SYSTEM, "[E_SYSTEM] A system error has occurred.");
+
+ Locale systemLocale = localeManager.GetSystemLocale();
+
+ DateTimeFormatter* pDateFormatter = DateTimeFormatter::CreateDateFormatterN(systemLocale, DATE_TIME_STYLE_LONG);
+ r = GetLastResult();
+ SysTryReturn(NID_UI_CTRL, pDateFormatter != null, localeDateFormat, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ String formatString = pDateFormatter->GetPattern();
+ formatString.ToLowerCase();
+
+ delete pDateFormatter;
+ pDateFormatter = null;
+
+ int stringLength = formatString.GetLength();
+ String parsedString = L"";
+
+ for (int i = 0; i < stringLength; i++)
+ {
+ wchar_t ch = '\0';
+ r = formatString.GetCharAt(i, ch);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, localeDateFormat, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ if (ch == 'd' && !parsedString.Contains(L"DD"))
+ {
+ parsedString.Append(L"DD");
+ }
+ else if (ch == 'm' && !parsedString.Contains(L"MM"))
+ {
+ parsedString.Append(L"MM");
+ }
+ else if (ch == 'y' && !parsedString.Contains(L"YYYY"))
+ {
+ parsedString.Append(L"YYYY");
+ }
+
+ if (parsedString.GetLength() == LOCALE_DATE_FORMAT_STRING_LENGTH)
+ {
+ break;
+ }
+ }
+
+ if (parsedString.Equals(L"DDMMYYYY", false))
+ {
+ localeDateFormat = DATE_FORMAT_DDMMYYYY;
+ }
+ else if (parsedString.Equals(L"MMDDYYYY", false))
+ {
+ localeDateFormat = DATE_FORMAT_MMDDYYYY;
+ }
+ else if (parsedString.Equals(L"YYYYMMDD", false))
+ {
+ localeDateFormat = DATE_FORMAT_YYYYMMDD;
+ }
+ else if (parsedString.Equals(L"YYYYDDMM", false))
+ {
+ localeDateFormat = DATE_FORMAT_YYYYDDMM;
+ }
+
+ return localeDateFormat;
+}
+
}}} // Tizen::Ui::Controls
* @brief This is the implementation file for the _EditDate class.
*/
-#include <vconf.h>
#include <FSysSettingInfo.h>
#include "FUi_AccessibilityContainer.h"
#include "FUi_AccessibilityElement.h"
__pAccessibilityDayElement->SetTrait(ACCESSIBILITY_TRAITS_DAY);
__pAccessibilityDayElement->SetHint(hintText);
- switch (__pEditDatePresenter->GetLocaleDateFormat())
+ _DateTimeUtils dateTimeUtils;
+ int localeDateFormat = dateTimeUtils.GetLocaleDateFormat();
+
+ switch (localeDateFormat)
{
- case SETTING_DATE_FORMAT_DD_MM_YYYY:
+ case DATE_FORMAT_DDMMYYYY:
pContainer->AddElement(*__pAccessibilityDayElement);
pContainer->AddElement(*__pAccessibilityMonthElement);
pContainer->AddElement(*__pAccessibilityYearElement);
break;
- case SETTING_DATE_FORMAT_MM_DD_YYYY:
+ case DATE_FORMAT_MMDDYYYY:
pContainer->AddElement(*__pAccessibilityMonthElement);
pContainer->AddElement(*__pAccessibilityDayElement);
pContainer->AddElement(*__pAccessibilityYearElement);
break;
- case SETTING_DATE_FORMAT_YYYY_MM_DD:
+ case DATE_FORMAT_YYYYMMDD:
pContainer->AddElement(*__pAccessibilityYearElement);
pContainer->AddElement(*__pAccessibilityMonthElement);
pContainer->AddElement(*__pAccessibilityDayElement);
break;
- case SETTING_DATE_FORMAT_YYYY_DD_MM:
+ case DATE_FORMAT_YYYYDDMM:
pContainer->AddElement(*__pAccessibilityYearElement);
pContainer->AddElement(*__pAccessibilityDayElement);
pContainer->AddElement(*__pAccessibilityMonthElement);
bool
_EditDate::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
{
- SetFocused(true);
-
FloatRectangle absoluteBounds = GetAbsoluteBoundsF();
if (absoluteBounds.y != __absoluteBounds.y || absoluteBounds.height != __absoluteBounds.height)
return;
}
+bool
+_EditDate::OnKeyPressed(const _Control &source, const _KeyInfo &keyInfo)
+{
+ _KeyCode keyCode = keyInfo.GetKeyCode();
+
+ switch (keyCode)
+ {
+ case _KEY_ENTER:
+ {
+
+ FloatRectangle absoluteBounds = GetAbsoluteBoundsF();
+
+ if (absoluteBounds.y != __absoluteBounds.y || absoluteBounds.height != __absoluteBounds.height)
+ {
+ CalculateDateTimeBarPosition();
+ }
+ break;
+ }
+ default:
+ break;
+
+ }
+
+ return __pEditDatePresenter->OnKeyPressed(source, keyInfo);
+}
+
+bool
+_EditDate::OnFocusGained(const _Control &source)
+{
+ __pEditDatePresenter->SetFocusedElement();
+ return true;
+}
+
+bool
+_EditDate::OnFocusLost(const _Control &source)
+{
+ __pEditDatePresenter->OnFocusLost(source);
+ return true;
+}
+
+void
+_EditDate::OnDrawFocus(void)
+{
+ __pEditDatePresenter->SetFocusState(true);
+ __pEditDatePresenter->DrawFocus();
+ return;
+}
+
FloatRectangle
_EditDate::GetParentWindowBounds(void) const
{
dayString.Append(GetDay());
String monthString = GetDateTimeBar()->GetMonthValue(GetMonth()).GetPointer();
- switch (__pEditDatePresenter->GetLocaleDateFormat())
+ _DateTimeUtils dateTimeUtils;
+ int localeDateFormat = dateTimeUtils.GetLocaleDateFormat();
+
+ switch (localeDateFormat)
{
- case SETTING_DATE_FORMAT_DD_MM_YYYY:
+ case DATE_FORMAT_DDMMYYYY:
string.Append(dayString.GetPointer());
string.Append(space.GetPointer());
string.Append(monthString.GetPointer());
string.Append(space.GetPointer());
string.Append(yearString.GetPointer());
break;
- case SETTING_DATE_FORMAT_MM_DD_YYYY:
+ case DATE_FORMAT_MMDDYYYY:
string.Append(monthString.GetPointer());
string.Append(space.GetPointer());
string.Append(dayString.GetPointer());
string.Append(space.GetPointer());
string.Append(yearString.GetPointer());
break;
- case SETTING_DATE_FORMAT_YYYY_MM_DD:
+ case DATE_FORMAT_YYYYMMDD:
string.Append(yearString.GetPointer());
string.Append(space.GetPointer());
string.Append(monthString.GetPointer());
string.Append(space.GetPointer());
string.Append(dayString.GetPointer());
break;
- case SETTING_DATE_FORMAT_YYYY_DD_MM:
+ case DATE_FORMAT_YYYYDDMM:
string.Append(yearString.GetPointer());
string.Append(space.GetPointer());
string.Append(dayString.GetPointer());
, __isAnimating(false)
, __isEditDateInitialized(false)
, __elementWidth(0.0f)
+ , __focusStatus(FOCUS_NONE)
+ , __isEnterKeyPressed(false)
+ , __isFocused(false)
{
}
return r;
}
-int
-_EditDatePresenter::GetLocaleDateFormat(void) const
-{
- int localeDateFormat = -1;
- int error = vconf_get_int(VCONFKEY_SETAPPL_DATE_FORMAT_INT, &localeDateFormat);
- if (error == -1)
- {
- localeDateFormat = SETTING_DATE_FORMAT_DD_MM_YYYY;
- }
-
- return localeDateFormat;
-}
-
DateTime
_EditDatePresenter::GetDate(void) const
{
_EditDatePresenter::Draw(void)
{
result r = E_SUCCESS;
-
if (__isAnimating)
{
return E_SUCCESS;
r = DrawText(*pCanvas, GetDateAreaBounds(DATETIME_ID_YEAR), yearString, DATETIME_ID_YEAR);
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ if (__pEditDate->IsFocused())
+ {
+ DrawFocus();
+ }
+
+CATCH:
delete pCanvas;
+ return r;
+}
+
+result
+_EditDatePresenter::DrawFocus(void)
+{
+ FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
+
+ Canvas* pCanvas = __pEditDate->GetCanvasN();
+ SysTryReturnResult(NID_UI_CTRL, (pCanvas != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Unable to create canvas.");
+
+ if (__focusStatus == FOCUS_DAY)
+ {
+ bounds = GetDateAreaBounds(DATETIME_ID_DAY);
+ }
+ else if (__focusStatus == FOCUS_MONTH)
+ {
+ bounds = GetDateAreaBounds(DATETIME_ID_MONTH);
+ }
+ else if (__focusStatus == FOCUS_YEAR)
+ {
+ bounds = GetDateAreaBounds(DATETIME_ID_YEAR);
+ }
+
+ bounds.y = bounds.y - (__adjustFocusHeight / 2.0f);
+ bounds.height = bounds.height + __adjustFocusHeight;
+
+ result r = E_SUCCESS;
+
+ if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*__pContentBgHighlightedColorReplacementBitmap))
+ {
+ r = pCanvas->DrawNinePatchedBitmap(bounds, *__pContentBgHighlightedColorReplacementBitmap);
+ SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+ else
+ {
+ r = pCanvas->DrawBitmap(bounds, *__pContentBgHighlightedColorReplacementBitmap);
+ SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ }
+ delete pCanvas;
return r;
- CATCH:
+CATCH:
delete pCanvas;
return r;
}
+void
+_EditDatePresenter::UpdateLastSelectedValue(_DateTimeId id, bool isTouchPressed)
+{
+ __selectedId = id;
+ SetLastSelectedId(id);
+ __lastSelectedValue = "";
+ _DateTimeUtils dateTimeUtils;
+
+ if (GetLastSelectedId() == DATETIME_ID_YEAR)
+ {
+ __lastSelectedValue.Format(10, L"%04d", GetYear());
+ if (isTouchPressed)
+ {
+ PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
+ }
+ }
+ else if (GetLastSelectedId() == DATETIME_ID_MONTH)
+ {
+ __lastSelectedValue = dateTimeUtils.GetMonthString(GetMonth());
+ if (isTouchPressed)
+ {
+ PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
+ }
+ }
+ else if (GetLastSelectedId() == DATETIME_ID_DAY)
+ {
+ __lastSelectedValue.Format(10, L"%02d", GetDay());
+ if (isTouchPressed)
+ {
+ PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
+ }
+ }
+
+ __pEditDate->Invalidate();
+ return;
+}
+
result
_EditDatePresenter::CalculateAreaBounds(void)
{
result r = E_SUCCESS;
- if (GetLocaleDateFormat() == DATE_FORMAT_DDMMYYYY)
+ _DateTimeUtils dateTimeUtils;
+ int localeDateFormat = dateTimeUtils.GetLocaleDateFormat();
+
+ if (localeDateFormat == DATE_FORMAT_DDMMYYYY)
{
__monthBounds.x = __dayBounds.x + __dayBounds.width + __elementMargin;
__yearBounds.x = __monthBounds.x + __monthBounds.width + __elementMargin;
}
- else if (GetLocaleDateFormat() == DATE_FORMAT_MMDDYYYY)
+ else if (localeDateFormat == DATE_FORMAT_MMDDYYYY)
{
__dayBounds.x = __monthBounds.x + __monthBounds.width + __elementMargin;
__yearBounds.x = __dayBounds.x + __dayBounds.width + __elementMargin;
}
- else if (GetLocaleDateFormat() == DATE_FORMAT_YYYYMMDD)
+ else if (localeDateFormat == DATE_FORMAT_YYYYMMDD)
{
__monthBounds.x = __yearBounds.x + __yearBounds.width + __elementMargin;
__dayBounds.x = __monthBounds.x + __monthBounds.width + __elementMargin;
}
- else if (GetLocaleDateFormat() == DATE_FORMAT_YYYYDDMM)
+ else if (localeDateFormat == DATE_FORMAT_YYYYDDMM)
{
__dayBounds.x = __yearBounds.x + __yearBounds.width + __elementMargin;
__monthBounds.x = __dayBounds.x + __dayBounds.width + __elementMargin;
return;
}
+void
+_EditDatePresenter::SetFocusState(bool isFocused)
+{
+ __isFocused = isFocused;
+}
+
+void
+_EditDatePresenter::SetFocusedElement()
+{
+ _DateTimeUtils dateTimeUtils;
+ int localeDateFormat = dateTimeUtils.GetLocaleDateFormat();
+ if (__focusStatus == FOCUS_NONE)
+ {
+ if (localeDateFormat == DATE_FORMAT_DDMMYYYY)
+ {
+ __focusStatus = FOCUS_DAY;
+ }
+ else if (localeDateFormat == DATE_FORMAT_MMDDYYYY)
+ {
+ __focusStatus = FOCUS_MONTH;
+ }
+ else if (localeDateFormat == DATE_FORMAT_YYYYMMDD)
+ {
+ __focusStatus = FOCUS_YEAR;
+ }
+ else if (localeDateFormat == DATE_FORMAT_YYYYDDMM)
+ {
+ __focusStatus = FOCUS_YEAR;
+ }
+ }
+ return;
+}
+
+bool
+_EditDatePresenter::OnFocusLost(const _Control &source)
+{
+ if (!__isEnterKeyPressed)
+ {
+ __focusStatus = FOCUS_NONE;
+ }
+ else
+ {
+ __isEnterKeyPressed = false;
+ }
+ __pEditDate->Invalidate();
+ return true;
+}
+
+bool
+_EditDatePresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
+{
+ if (!__isFocused)
+ {
+ return false;
+ }
+ _KeyCode keyCode = keyInfo.GetKeyCode();
+
+ int minValue = -1;
+ int maxValue = -1;
+ int displayValue = -1;
+
+ _DateTimeId boxId = DATETIME_ID_NONE;
+ _DateTimeUtils dateTimeUtils;
+ int localeDateFormat = dateTimeUtils.GetLocaleDateFormat();
+
+ switch (keyCode)
+ {
+ case _KEY_RIGHT:
+ {
+ if (__focusStatus == FOCUS_DAY)
+ {
+ if (localeDateFormat == DATE_FORMAT_DDMMYYYY || localeDateFormat == DATE_FORMAT_YYYYDDMM)
+ {
+ __focusStatus = FOCUS_MONTH;
+ }
+ else if (localeDateFormat == DATE_FORMAT_MMDDYYYY)
+ {
+ __focusStatus = FOCUS_YEAR;
+ }
+ }
+ else if (__focusStatus == FOCUS_MONTH)
+ {
+ if (localeDateFormat == DATE_FORMAT_DDMMYYYY)
+ {
+ __focusStatus = FOCUS_YEAR;
+ }
+ else if (localeDateFormat == DATE_FORMAT_MMDDYYYY || localeDateFormat == DATE_FORMAT_YYYYMMDD)
+ {
+ __focusStatus = FOCUS_DAY;
+ }
+ }
+ else if (__focusStatus == FOCUS_YEAR)
+ {
+ if (localeDateFormat == DATE_FORMAT_YYYYMMDD)
+ {
+ __focusStatus = FOCUS_MONTH;
+ }
+ else if (localeDateFormat == DATE_FORMAT_YYYYDDMM)
+ {
+ __focusStatus = FOCUS_DAY;
+ }
+ }
+ __pEditDate->Invalidate();
+ break;
+ }
+
+ case _KEY_LEFT:
+ {
+ if (__focusStatus == FOCUS_DAY)
+ {
+ if (localeDateFormat == DATE_FORMAT_YYYYDDMM)
+ {
+ __focusStatus = FOCUS_YEAR;
+ }
+ else if (localeDateFormat == DATE_FORMAT_MMDDYYYY || localeDateFormat == DATE_FORMAT_YYYYMMDD)
+ {
+ __focusStatus = FOCUS_MONTH;
+ }
+ }
+ else if (__focusStatus == FOCUS_MONTH)
+ {
+ if (localeDateFormat == DATE_FORMAT_YYYYMMDD)
+ {
+ __focusStatus = FOCUS_YEAR;
+ }
+ else if (localeDateFormat == DATE_FORMAT_DDMMYYYY || localeDateFormat == DATE_FORMAT_YYYYDDMM)
+ {
+ __focusStatus = FOCUS_DAY;
+ }
+ }
+ else if (__focusStatus == FOCUS_YEAR)
+ {
+ if (localeDateFormat == DATE_FORMAT_DDMMYYYY)
+ {
+ __focusStatus = FOCUS_MONTH;
+ }
+ else if (localeDateFormat == DATE_FORMAT_MMDDYYYY)
+ {
+ __focusStatus = FOCUS_DAY;
+ }
+ }
+ __pEditDate->Invalidate();
+ break;
+ }
+
+ case _KEY_ENTER:
+ {
+ __isEnterKeyPressed = true;
+ if (__focusStatus == FOCUS_DAY)
+ {
+ _DateTimeUtils dateTimeUtils;
+ maxValue = dateTimeUtils.CalculateMaxDay(GetYear(), GetMonth());
+ minValue = DATETIME_DAY_MIN;
+ displayValue = GetDay();
+ boxId = DATETIME_ID_DAY;
+
+ if (__pEditDate->GetDateTimeBar()->GetItemCount() > 0)
+ {
+ __pEditDate->GetDateTimeBar()->RemoveAllItems();
+ }
+ }
+
+ else if (__focusStatus == FOCUS_MONTH)
+ {
+ minValue = DATETIME_MONTH_MIN;
+ maxValue = DATETIME_MONTH_MAX;
+ displayValue = GetMonth();
+ boxId = DATETIME_ID_MONTH;
+
+ if (__pEditDate->GetDateTimeBar()->GetItemCount() > 0)
+ {
+ __pEditDate->GetDateTimeBar()->RemoveAllItems();
+ }
+ }
+ else if (__focusStatus == FOCUS_YEAR)
+ {
+ minValue = GetMinYear();
+ maxValue = GetMaxYear();
+ displayValue = GetYear();
+ boxId = DATETIME_ID_YEAR;
+
+ if (__pEditDate->GetDateTimeBar()->GetItemCount() > 0)
+ {
+ __pEditDate->GetDateTimeBar()->RemoveAllItems();
+ }
+ }
+ FloatRectangle absoluteBounds = __pEditDate->GetAbsoluteBoundsF();
+
+ FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
+ bounds = GetDateAreaBounds(boxId);
+ bounds.x += absoluteBounds.x;
+ __pEditDate->GetDateTimeBar()->CalculateArrowBounds(bounds);
+ __pEditDate->GetDateTimeBar()->SetInitialValue(minValue, maxValue, displayValue, boxId);
+ __pEditDate->GetDateTimeBar()->SetVisibleState(true);
+ __pEditDate->GetDateTimeBar()->Open();
+
+ UpdateLastSelectedValue(boxId, false);
+ break;
+ }
+ default:
+ {
+ return false;
+ }
+ }
+ return true;
+}
+
bool
_EditDatePresenter::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
{
return true;
}
- SetLastSelectedId(__selectedId);
-
- __lastSelectedValue = "";
- _DateTimeUtils dateTimeUtils;
- if (GetLastSelectedId() == DATETIME_ID_YEAR)
- {
- __lastSelectedValue.Format(10, L"%04d", GetYear());
- PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
- }
- else if (GetLastSelectedId() == DATETIME_ID_MONTH)
- {
- __lastSelectedValue = dateTimeUtils.GetMonthString(GetMonth());
- PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
- }
- else if (GetLastSelectedId() == DATETIME_ID_DAY)
- {
- __lastSelectedValue.Format(10, L"%02d", GetDay());
- PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
- }
-
- Draw();
+ UpdateLastSelectedValue(__selectedId, true);
if ((__pEditDate->GetDateTimeBar() != null) && (GetLastSelectedId() != DATETIME_ID_NONE))
{
}
else
{
- text = GetText(__cursorPos-SURRONDING_TEXT_SIZE, __cursorPos - 1);
+ int previousTextSize = 0;
+
+ for( int index = 0; index < __cursorPos; index++)
+ {
+ previousTextSize++;
+ if ( __pTextBuffer[__cursorPos-index-1] != 0x20)
+ {
+ break;
+ }
+ }
+
+ if (previousTextSize < SURRONDING_TEXT_SIZE)
+ {
+ previousTextSize = SURRONDING_TEXT_SIZE;
+ }
+
+ text = GetText(__cursorPos - previousTextSize, __cursorPos - 1);
}
+
stringLength = text.GetLength();
cursorPosition = stringLength;
}
}
}
- if (__pEdit->GetEditStyle() & EDIT_STYLE_CLEAR)
+ if (__pEdit->GetEditStyle() & EDIT_STYLE_CLEAR && __pTextString->GetLength() > 0)
{
if ((__pressedPoint.x >= __clearIconBounds.x) && (__pressedPoint.x <= __clearIconBounds.x + __clearIconBounds.width)) // Clear Icon Pressed
{
ScrollText(-textGapFromBottom);
}
}
+ else
+ {
+ if (firstDisplayY > 0)
+ {
+ ScrollText(-firstDisplayY);
+ }
+ }
FloatRectangle absCursorBounds(0.0f, 0.0f, 0.0f, 0.0f);
CalculateAbsoluteCursorBounds(__cursorPos, absCursorBounds);
__pEditTimePresenter->Draw();
- if(unlikely((_AccessibilityManager::IsActivated())))
+ if (unlikely((_AccessibilityManager::IsActivated())))
{
UpdateAccessibilityElement();
}
bool
_EditTime::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
{
- SetFocused(true);
-
FloatRectangle absoluteBounds = GetAbsoluteBoundsF();
if (absoluteBounds.y != __absoluteBounds.y || absoluteBounds.height != __absoluteBounds.height)
{
return;
}
+void
+_EditTime::OnDrawFocus(void)
+{
+ __pEditTimePresenter->SetFocusState(true);
+ __pEditTimePresenter->DrawFocus();
+ return;
+}
+
+bool
+_EditTime::OnKeyPressed(const _Control &source, const _KeyInfo &keyInfo)
+{
+ _KeyCode keyCode = keyInfo.GetKeyCode();
+
+ switch (keyCode)
+ {
+ case _KEY_ENTER:
+ {
+ FloatRectangle absoluteBounds = GetAbsoluteBoundsF();
+
+ if (absoluteBounds.y != __absoluteBounds.y || absoluteBounds.height != __absoluteBounds.height)
+ {
+ CalculateDateTimeBarPosition();
+ }
+ break;
+ }
+ default:
+ break;
+
+ }
+
+ return __pEditTimePresenter->OnKeyPressed(source, keyInfo);
+}
+
+bool
+_EditTime::OnFocusGained(const _Control &source)
+{
+ __pEditTimePresenter->SetFocusedElement();
+ return true;
+}
+
+bool
+_EditTime::OnFocusLost(const _Control &source)
+{
+ return __pEditTimePresenter->OnFocusLost(source);
+}
+
FloatRectangle
_EditTime::GetParentWindowBounds(void) const
{
, __timeFontSize(0.0f)
, __isAnimating(false)
, __isEditTimeInitialized(false)
+ , __focusStatus(FOCUS_NONE)
+ , __isEnterKeyPressed(false)
+ , __isFocused(false)
{
}
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
}
+ if (__pEditTime->IsFocused())
+ {
+ DrawFocus();
+ }
+
CATCH:
delete pCanvas;
+ return r;
+}
+
+result
+_EditTimePresenter::DrawFocus(void)
+{
+ FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
+ Canvas* pCanvas = __pEditTime->GetCanvasN();
+ SysTryReturnResult(NID_UI_CTRL, (pCanvas != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Unable to create canvas.");
+
+ if (__focusStatus == FOCUS_HOUR)
+ {
+ bounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_HOUR);
+ }
+ else if (__focusStatus == FOCUS_MINUTE)
+ {
+ bounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_MINUTE);
+ }
+ else if (__focusStatus == FOCUS_AMPM)
+ {
+ bounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_AMPM);
+ }
+ result r = E_SUCCESS;
+
+ bounds.y = bounds.y - (__adjustFocusHeight / 2.0f);
+ bounds.height = bounds.height + __adjustFocusHeight;
+
+ if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*__pContentBgHighlightedColorReplacementBitmap))
+ {
+ r = pCanvas->DrawNinePatchedBitmap(bounds, *__pContentBgHighlightedColorReplacementBitmap);
+ SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+ else
+ {
+ r = pCanvas->DrawBitmap(bounds, *__pContentBgHighlightedColorReplacementBitmap);
+ SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+
+ delete pCanvas;
+ return r;
+
+CATCH:
+ delete pCanvas;
return r;
}
return __lastSelectedId;
}
+void
+_EditTimePresenter::SetFocusedElement()
+{
+ if (__focusStatus == FOCUS_NONE || __focusStatus == FOCUS_AMPM)
+ {
+ __focusStatus = FOCUS_HOUR;
+ }
+
+ return;
+}
+
+void
+_EditTimePresenter::SetFocusState(bool isFocused)
+{
+ __isFocused = isFocused;
+ return;
+}
+
+bool
+_EditTimePresenter::OnFocusLost(const _Control &source)
+{
+ if (!__isEnterKeyPressed || __focusStatus == FOCUS_AMPM)
+ {
+ __focusStatus = FOCUS_NONE;
+ }
+ else
+ {
+ __isEnterKeyPressed = false;
+ }
+ __pEditTime->Invalidate();
+ return true;
+}
+
+bool
+_EditTimePresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
+{
+ if (!__isFocused)
+ {
+ return false;
+ }
+ _KeyCode keyCode = keyInfo.GetKeyCode();
+
+ int minValue = -1;
+ int maxValue = -1;
+ int displayValue = -1;
+
+ _DateTimeId boxId = DATETIME_ID_HOUR;
+
+ switch (keyCode)
+ {
+ case _KEY_RIGHT:
+ {
+ __isEnterKeyPressed = false;
+ if (__focusStatus == FOCUS_HOUR)
+ {
+ __focusStatus = FOCUS_MINUTE;
+ }
+ else if (__focusStatus == FOCUS_MINUTE)
+ {
+ if (!Is24HourNotationEnabled())
+ {
+ __focusStatus = FOCUS_AMPM;
+ }
+ }
+
+ __pEditTime->Invalidate();
+ break;
+ }
+
+ case _KEY_LEFT:
+ {
+ __isEnterKeyPressed = false;
+ if (__focusStatus == FOCUS_MINUTE)
+ {
+ __focusStatus = FOCUS_HOUR;
+ }
+ else if (__focusStatus == FOCUS_AMPM)
+ {
+ __focusStatus = FOCUS_MINUTE;
+ }
+ __pEditTime->Invalidate();
+ break;
+ }
+
+ case _KEY_ENTER:
+ {
+ __isEnterKeyPressed = true;
+ if (__focusStatus == FOCUS_HOUR)
+ {
+ boxId = DATETIME_ID_HOUR;
+ if (__pEditTime->GetDateTimeBar() != null)
+ {
+ if (!Is24HourNotationEnabled())
+ {
+ if (GetHour() == 0)
+ {
+ minValue = DATETIME_HOUR_MIN + 1;
+ maxValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
+ displayValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
+ }
+ else if (GetHour() > DATETIME_HOUR_MAX_FOR_24NOTATION)
+ {
+ minValue = DATETIME_HOUR_MIN + 1;
+ maxValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
+ displayValue = __pEditTime->GetHour() - DATETIME_HOUR_MAX_FOR_24NOTATION;
+ }
+ else
+ {
+ minValue = DATETIME_HOUR_MIN + 1;
+ maxValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
+ displayValue = __pEditTime->GetHour();
+ }
+ }
+ else
+ {
+ minValue = DATETIME_HOUR_MIN;
+ maxValue = DATETIME_HOUR_MAX;
+ displayValue = __pEditTime->GetHour();
+ }
+
+ if (__pEditTime->GetDateTimeBar()->GetItemCount() > 0)
+ {
+ __pEditTime->GetDateTimeBar()->RemoveAllItems();
+ }
+ }
+ }
+ else if (__focusStatus == FOCUS_MINUTE)
+ {
+ if (__pEditTime->GetDateTimeBar() != null)
+ {
+ minValue = DATETIME_MINUTE_MIN;
+ maxValue = DATETIME_MINUTE_MAX;
+ displayValue = __pEditTime->GetMinute();
+
+ if (__pEditTime->GetDateTimeBar()->GetItemCount() > 0)
+ {
+ __pEditTime->GetDateTimeBar()->RemoveAllItems();
+ }
+ }
+ boxId = DATETIME_ID_MINUTE;
+ }
+ else if (__focusStatus == FOCUS_AMPM)
+ {
+ SetAmEnabled(!GetAmEnabled());
+ __pEditTime->FireTimeChangeEvent(TIME_INTERNAL_CHANGE_SAVED);
+ boxId = DATETIME_ID_AMPM;
+
+ DrawFocus();
+ }
+
+ if ((__pEditTime->GetDateTimeBar() != null) && (boxId != DATETIME_ID_AMPM))
+ {
+ FloatRectangle absoluteBounds = __pEditTime->GetAbsoluteBoundsF();
+
+ FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
+ bounds = GetDisplayAreaBoundsFromHoursStyle(boxId);
+ bounds.x += absoluteBounds.x;
+
+ __pEditTime->GetDateTimeBar()->SetInitialValue(minValue, maxValue, displayValue, boxId);
+ __pEditTime->GetDateTimeBar()->CalculateArrowBounds(bounds);
+ __pEditTime->GetDateTimeBar()->SetVisibleState(true);
+ __pEditTime->GetDateTimeBar()->Open();
+ UpdateLastSelectedValue(boxId, false);
+ }
+ break;
+ }
+
+ default:
+ {
+ return false;
+ }
+ }
+ return true;
+}
+
bool
_EditTimePresenter::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
{
return true;
}
+ UpdateLastSelectedValue(__selectedId, true);
+ if (GetLastSelectedId() == DATETIME_ID_AMPM)
+ {
+ return true;
+ }
+
+ Draw();
+
+ if ((__pEditTime->GetDateTimeBar() != null) && (boxId != DATETIME_ID_AMPM) && (GetLastSelectedId() != DATETIME_ID_NONE))
+ {
+ FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
+ bounds = GetDisplayAreaBoundsFromHoursStyle(GetLastSelectedId());
+ FloatRectangle absoluteBounds(0.0f, 0.0f, 0.0f, 0.0f);
+ absoluteBounds = __pEditTime->GetAbsoluteBoundsF();
+ bounds.x += absoluteBounds.x;
+
+ __pEditTime->GetDateTimeBar()->CalculateArrowBounds(bounds);
+
+ if (__pEditTime->GetDateTimeBar()->IsActivated())
+ {
+ __pEditTime->GetDateTimeBar()->RefreshItems();
+ }
+ else
+ {
+ __pEditTime->GetDateTimeBar()->SetVisibleState(true);
+ __pEditTime->GetDateTimeBar()->Open();
+ }
+ }
+
+ __selectedId = DATETIME_ID_NONE;
+ return true;
+}
- SetLastSelectedId(__selectedId);
+void
+_EditTimePresenter::UpdateLastSelectedValue(_DateTimeId boxId, bool isTouchPressed)
+{
+ __selectedId = boxId;
+ SetLastSelectedId(boxId);
__lastSelectedValue = "";
- _DateTimeUtils dateTimeUtils;
if (GetLastSelectedId() == DATETIME_ID_HOUR)
{
if (hours == DATETIME_HOUR_MIN)
{
- hours = hours + DATETIME_HOUR_MAX_FOR_24NOTATION;
+ hours = hours + DATETIME_HOUR_MAX_FOR_24NOTATION;
}
}
__lastSelectedValue.Format(10, L"%02d", hours);
- PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
+ if (isTouchPressed)
+ {
+ PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
+ }
}
else if (GetLastSelectedId() == DATETIME_ID_MINUTE)
{
__lastSelectedValue.Format(10, L"%02d", GetMinute());
- PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
+ if (isTouchPressed)
+ {
+ PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
+ }
}
else if (GetLastSelectedId() == DATETIME_ID_AMPM)
{
SetAmEnabled(!GetAmEnabled());
__pEditTime->FireTimeChangeEvent(TIME_INTERNAL_CHANGE_SAVED);
- __pEditTime->UpdateAccessibilityElement();
- PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
-
+ if (isTouchPressed)
+ {
+ __pEditTime->UpdateAccessibilityElement();
+ PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
+ }
__selectedId = DATETIME_ID_NONE;
if (__pEditTime->GetDateTimeBar() != null && __pEditTime->GetDateTimeBar()->IsActivated())
__pEditTime->GetDateTimeBar()->SetVisibleState(false);
__pEditTime->GetDateTimeBar()->Close();
}
-
- Draw();
-
- return true;
- }
-
- Draw();
-
- if ((__pEditTime->GetDateTimeBar() != null) && (boxId != DATETIME_ID_AMPM) && (GetLastSelectedId() != DATETIME_ID_NONE))
- {
- FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
- bounds = GetDisplayAreaBoundsFromHoursStyle(GetLastSelectedId());
- FloatRectangle absoluteBounds(0.0f, 0.0f, 0.0f, 0.0f);
- absoluteBounds = __pEditTime->GetAbsoluteBoundsF();
- bounds.x += absoluteBounds.x;
-
- __pEditTime->GetDateTimeBar()->CalculateArrowBounds(bounds);
-
- if (__pEditTime->GetDateTimeBar()->IsActivated())
- {
- __pEditTime->GetDateTimeBar()->RefreshItems();
- }
- else
- {
- __pEditTime->GetDateTimeBar()->SetVisibleState(true);
- __pEditTime->GetDateTimeBar()->Open();
- }
}
__selectedId = DATETIME_ID_NONE;
- return true;
+ __pEditTime->Invalidate();
+ return;
}
bool
}
GET_COLOR_CONFIG(INPUTPAD::BUTTON_BG_NORMAL, buttonColor[DATETIME_STATUS_NORMAL]);
- GET_COLOR_CONFIG(INPUTPAD::BUTTON_BG_PRESSED, buttonColor[DATETIME_STATUS_PRESSED]);
+ GET_COLOR_CONFIG(INPUTPAD::BUTTON_BG_PRESSED, buttonColor[DATETIME_STATUS_SELECTED]);
GET_COLOR_CONFIG(INPUTPAD::BUTTON_BG_HIGHLIGHTED, buttonColor[DATETIME_STATUS_HIGHLIGHTED]);
GET_COLOR_CONFIG(INPUTPAD::BUTTON_BG_DISABLED, buttonColor[DATETIME_STATUS_DISABLED]);
r = GET_BITMAP_CONFIG_N(INPUTPAD::BUTTON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pButtonBgNormalBitmap[DATETIME_STATUS_NORMAL]);
SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
- r = GET_BITMAP_CONFIG_N(INPUTPAD::BUTTON_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pButtonBgNormalBitmap[DATETIME_STATUS_PRESSED]);
+ r = GET_BITMAP_CONFIG_N(INPUTPAD::BUTTON_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pButtonBgNormalBitmap[DATETIME_STATUS_SELECTED]);
SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
r = GET_BITMAP_CONFIG_N(INPUTPAD::BUTTON_BG_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, pButtonBgNormalBitmap[DATETIME_STATUS_HIGHLIGHTED]);
SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
isCustomBitmap[DATETIME_STATUS_NORMAL] = IS_CUSTOM_BITMAP(INPUTPAD::BUTTON_BG_NORMAL);
- isCustomBitmap[DATETIME_STATUS_PRESSED] = IS_CUSTOM_BITMAP(INPUTPAD::BUTTON_BG_PRESSED);
+ isCustomBitmap[DATETIME_STATUS_SELECTED] = IS_CUSTOM_BITMAP(INPUTPAD::BUTTON_BG_PRESSED);
isCustomBitmap[DATETIME_STATUS_HIGHLIGHTED] = IS_CUSTOM_BITMAP(INPUTPAD::BUTTON_BG_HIGHLIGHTED);
isCustomBitmap[DATETIME_STATUS_DISABLED] = IS_CUSTOM_BITMAP(INPUTPAD::BUTTON_BG_DISABLED);
SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
}
- if (!isCustomBitmap[DATETIME_STATUS_PRESSED])
+ if (!isCustomBitmap[DATETIME_STATUS_SELECTED])
{
- r = GET_BITMAP_CONFIG_N(INPUTPAD::BUTTON_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pKeypadButtonEffectBitmap[DATETIME_STATUS_PRESSED]);
+ r = GET_BITMAP_CONFIG_N(INPUTPAD::BUTTON_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pKeypadButtonEffectBitmap[DATETIME_STATUS_SELECTED]);
SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
}
}
else if (__pressedIndex == index)
{
- status = DATETIME_STATUS_PRESSED;
+ status = DATETIME_STATUS_SELECTED;
GET_COLOR_CONFIG(INPUTPAD::TEXT_PRESSED, textColor);
}
else
}
isCustomBitmap[DATETIME_STATUS_NORMAL] = IS_CUSTOM_BITMAP(INPUTPAD::BUTTON_BG_NORMAL);
- isCustomBitmap[DATETIME_STATUS_PRESSED] = IS_CUSTOM_BITMAP(INPUTPAD::BUTTON_BG_PRESSED);
+ isCustomBitmap[DATETIME_STATUS_SELECTED] = IS_CUSTOM_BITMAP(INPUTPAD::BUTTON_BG_PRESSED);
isCustomBitmap[DATETIME_STATUS_HIGHLIGHTED] = IS_CUSTOM_BITMAP(INPUTPAD::BUTTON_BG_HIGHLIGHTED);
isCustomBitmap[DATETIME_STATUS_DISABLED] = IS_CUSTOM_BITMAP(INPUTPAD::BUTTON_BG_DISABLED);
if (__pressedIndex >= 0)
{
RefreshButton(__pressedIndex);
- if (__pInputPadEventListener != null)
- {
- __pInputPadEventListener->OnInputPadValueChanged(source, GetReturnValue(__pressedIndex));
- }
-
return true;
}
return false;
}
- if (__pressedIndex >= 0)
+ SysTryReturn(NID_UI_CTRL, __pressedIndex >= 0, true, E_SUCCESS, "Touch pressed Index is invalid, ignoring touch release");
+
+ int refreshIndex = __pressedIndex;
+ int currentReleasedIndex = GetIndexFromTouchedPosition(touchinfo.GetCurrentPosition());
+
+ if (currentReleasedIndex >= 0)
{
- int refreshIndex = __pressedIndex;
- __pressedIndex = -1;
- RefreshButton(refreshIndex);
+ if (__pInputPadEventListener != null)
+ {
+ __pInputPadEventListener->OnInputPadValueChanged(source, GetReturnValue(currentReleasedIndex));
+ }
+ }
- return true;
+ __pressedIndex = -1;
+ if (refreshIndex >= 0)
+ {
+ RefreshButton(refreshIndex);
}
- return false;
+ return true;
}
bool
result
_SearchBar::SetModeLocked(bool modeLocked)
{
+ if (modeLocked == true && GetMode() == SEARCH_BAR_MODE_NORMAL)
+ {
+ __pEdit->SetViewModeEnabled(true);
+ }
+
+ if (modeLocked == false && __pEdit->IsViewModeEnabled())
+ {
+ __pEdit->SetViewModeEnabled(false);
+ }
+
return __pSearchBarPresenter->SetModeLocked(modeLocked);
}
bool
_SearchBar::OnFocusGained(const _Control& source)
{
- SetMode(SEARCH_BAR_MODE_INPUT);
- __pEdit->SetFocused();
+ if (GetVisibleState() == true)
+ {
+ SetMode(SEARCH_BAR_MODE_INPUT);
+ __pEdit->SetFocused();
+ }
+
return false;
}
}
void
+_Slider::OnDrawFocus(void)
+{
+ __pSliderPresenter->SetFocusMode(true);
+ Invalidate();
+ return;
+}
+
+bool
+_Slider::OnFocusGained(const _Control& source)
+{
+ __pSliderPresenter->SetFocusMode(true);
+ Invalidate();
+
+ return true;
+}
+
+
+bool
+_Slider::OnFocusLost(const _Control& source)
+{
+ __pSliderPresenter->SetFocusMode(false);
+ Invalidate();
+
+ return true;
+}
+
+void
+_Slider::OnFocusModeStateChanged()
+{
+ __pSliderPresenter->SetFocusMode(false);
+ Invalidate();
+}
+
+bool
+_Slider::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
+{
+
+ if(__pSliderPresenter->GetFocusMode() == false)
+ {
+ return false;
+ }
+
+ _KeyCode keyCode = keyInfo.GetKeyCode();
+
+ if (keyCode == _KEY_RIGHT)
+ {
+ SetValue(GetValue() + 1);
+ Invalidate();
+ return true;
+ }
+
+ if (keyCode == _KEY_LEFT)
+ {
+ SetValue(GetValue() - 1);
+ Invalidate();
+ return true;
+ }
+
+ return false;
+}
+
+void
_Slider::OnBoundsChanged(void)
{
__pSliderPresenter->OnBoundsChanged();
, __handleX(0)
, __prevSliderValue(0)
, __isSliderPressed(false)
+ , __isFocusModeStateChanged(false)
, __isNeedToBeUpdated(true)
, __isResourceLoaded(false)
, __isCustomHandle(false)
float offset = 0.0f;
float minimumHeight = 0.0f;
float minimumWidth = 0.0f;
- float topMargin = 0.0f;
float iconRightMargin = 0.0f;
float titleHeight = 0.0f;
FloatRectangle titleTextBounds;
}
__rect = FloatRectangle(0.0f, 0.0f, __pSlider->GetBoundsF().width, __pSlider->GetBoundsF().height);
- r = GET_SHAPE_CONFIG(SLIDER::BAR_TOP_MARGIN, orientation, topMargin);
- SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
-
r = GET_SHAPE_CONFIG(SLIDER::ICON_RIGHT_MARGIN, orientation, iconRightMargin);
SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
minimumHeight = minimumHeight + titleHeight;
}
- if (__rect.height < minimumHeight )
+ if (__rect.height < minimumHeight)
{
__rect.height = minimumHeight;
}
}
}
}
- else if (__isSliderPressed == true) // pressed
+ else if (__isSliderPressed == true) // pressed
{
pHandleBitmap = __pHandlePressedBitmap;
pHandleEffectBitmap = __pHandlePressedEffectBitmap;
isCustomHandleBitmap = IS_CUSTOM_BITMAP(SLIDER::HANDLE_BG_PRESSED);
}
- else if (__pSlider->IsFocused() == true)
- {
- pHandleBitmap = __pHandleHighlightedBitmap;
- pHandleEffectBitmap = __pHandleHighlightedEffectBitmap;
- isCustomHandleBitmap = IS_CUSTOM_BITMAP(SLIDER::HANDLE_BG_HIGHLIGHTED);
- }
else //(__isSliderPressed == false) // normal state
{
pHandleBitmap = __pHandleNormalBitmap;
DrawBitmap(canvas, __barBgRect, __pBarBgColorReplacementBitmap);
if (isCustomBarBitmap == false)
{
- DrawBitmap(canvas, __barBgRect, __pBarBgResourceEffectBitmap);
+ DrawBitmap(canvas, __barBgRect, __pBarBgResourceEffectBitmap);
}
isCustomBarBitmap = IS_CUSTOM_BITMAP(SLIDER::BAR_NORMAL);
DrawBitmap(canvas, FloatRectangle(__barRect.x, __barRect.y, (__barRect.width + __handleRect.width / 2), __barRect.height), __pBarColorReplacementBitmap);
if (isCustomBarBitmap == false)
{
- DrawBitmap(canvas, FloatRectangle(__barRect.x, __barRect.y, (__barRect.width + __handleRect.width / 2), __barRect.height), __pBarResourceEffectBitmap);
+ DrawBitmap(canvas, FloatRectangle(__barRect.x, __barRect.y, (__barRect.width + __handleRect.width / 2), __barRect.height), __pBarResourceEffectBitmap);
}
__handleRect.x = __touchRect.x + __handleX;
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
if (isCustomHandleBitmap == false)
{
- r = DrawBitmap(*pHandleCanvas, FloatRectangle(0.0f, 0.0f, __handleRect.width, __handleRect.height), pHandleEffectBitmap);
- SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ r = DrawBitmap(*pHandleCanvas, FloatRectangle(0.0f, 0.0f, __handleRect.width, __handleRect.height), pHandleEffectBitmap);
+ SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
}
}
else
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
}
+ if ((__pSlider->IsFocused()) && (__isFocusModeStateChanged == true))
+ {
+ if (__pHandleHighlightedBitmap)
+ {
+ if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*__pHandleHighlightedBitmap))
+ {
+ r = pHandleCanvas->DrawNinePatchedBitmap(FloatRectangle(0.0f, 0.0f, __handleRect.width, __handleRect.height), *__pHandleHighlightedBitmap);
+ }
+ else
+ {
+ r = pHandleCanvas->DrawBitmap(FloatRectangle(0.0f, 0.0f, __handleRect.width, __handleRect.height), *__pHandleHighlightedBitmap);
+ }
+ SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+ }
+
r = __pSlider->UpdateHandle(__handleRect);
if (r != E_SUCCESS)
{
if (__pTitleTextObject == null)
{
__pTitleTextObject = new (std::nothrow) TextObject();
- SysTryReturn(NID_UI_CTRL, __pTitleTextObject != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+ SysTryReturn(NID_UI_CTRL, __pTitleTextObject != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
__pTitleTextObject->Construct();
}
r = GET_SHAPE_CONFIG(SLIDER::TITLE_TEXT_POSITION_X, orientation, titleTextBounds.x);
SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, FloatRectangle(), r, "[%s] Propagating.", GetErrorMessage(r));
- r = GET_SHAPE_CONFIG(SLIDER::BAR_TOP_MARGIN, orientation, topMargin);
+ r = GET_SHAPE_CONFIG(SLIDER::TITLE_TEXT_POSITION_Y, orientation, topMargin);
SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, FloatRectangle(), r, "[%s] Propagating.", GetErrorMessage(r));
titleTextBounds.y = topMargin;
return;
}
+void
+_SliderPresenter::SetFocusMode(bool focusmode)
+{
+ __isFocusModeStateChanged = focusmode;
+}
+
+bool
+_SliderPresenter::GetFocusMode(void)
+{
+ return __isFocusModeStateChanged;
+}
+
result
_SliderPresenter::SetThumbBitmap(SliderThumbStatus status, const Bitmap& bitmap)
{
pSplitPanel->SetBackgroundColor(Color(0,0,0,0));
- pSplitPanel->GetAccessibilityContainer()->Activate(true);
+ if (pSplitPanel->GetAccessibilityContainer())
+ {
+ pSplitPanel->GetAccessibilityContainer()->Activate(true);
+ }
return pSplitPanel;
return __pSplitPanelPresenter->OnTapGestureCanceled(gesture);
}
+bool
+_SplitPanel::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
+{
+ return __pSplitPanelPresenter->OnKeyPressed(source, keyInfo);
+}
+
+bool
+_SplitPanel::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
+{
+ return __pSplitPanelPresenter->OnKeyReleased(source, keyInfo);
+}
+
+void
+_SplitPanel::OnDrawFocus(void)
+{
+ __pSplitPanelPresenter->DrawFocus();
+ return;
+}
+
+bool
+_SplitPanel::OnFocusGained(const _Control& source)
+{
+ return _Control::OnFocusGained(source);
+}
+
+bool
+_SplitPanel::OnFocusLost(const _Control& source)
+{
+ result r = __pSplitPanelPresenter->ReleaseFocus();
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ _Control::OnFocusLost(source);
+ return true;
+}
+
result
_SplitPanel::SetPane(_Control* pControl, SplitPanelPaneOrder paneOrder)
{
{
if (__pDividerVisualElement)
{
- __pAccessibilityElement = new (std::nothrow) _AccessibilityElement(true);
- SysTryReturn(NID_UI_CTRL, __pAccessibilityElement, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
-
dividerRect = __pSplitPanelPresenter->GetDividerRectangle();
if (GetDividerStyle() == SPLIT_PANEL_DIVIDER_STYLE_FIXED)
{
- hintText = String(L"double tap to open/close the split area");
- __pAccessibilityElement->SetTrait(L"Split view button");
+ hintText = String(L"Drag scroll Fixed");
}
else
{
- hintText = String(L"double tap and move to adjust split area");
- __pAccessibilityElement->SetTrait(L"Drag scroll");
+ hintText = String(L"Drag scroll, double tap and move to adjust split area");
}
- __pAccessibilityElement->SetBounds(dividerRect);
+ __pAccessibilityElement = new (std::nothrow) _AccessibilityElement(true);
+ SysTryReturn(NID_UI_CTRL, __pAccessibilityElement, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+
+ __pAccessibilityElement->SetBounds(_CoordinateSystemUtils::ConvertToInteger(dividerRect));
+ __pAccessibilityElement->SetTrait(ACCESSIBILITY_TRAITS_NONE);
__pAccessibilityElement->SetHint(hintText);
__pAccessibilityElement->SetLabel(L"");
__pAccessibilityElement->SetName(L"SplitPanelDivider");
, __pDividerBackgroundBitmap(null)
, __pDividerBackgroundEffectBitmap(null)
, __pDividerThumbBitmap(null)
+ , __pFocusBitmap(null)
, __transactionIdMaximize(0)
, __transactionIdRestore(0)
+ , __currentFocusedPane(SPLIT_PANEL_PANE_ORDER_FIRST)
, __controlAnimatorInterpolator(ANIMATION_INTERPOLATOR_LINEAR)
, __visualElementInterpolator(L"Linear")
{
delete __pDividerBackgroundEffectBitmap;
__pDividerBackgroundEffectBitmap = null;
+
+ delete __pFocusBitmap;
+ __pFocusBitmap = null;
}
result
{
FloatPoint point(0.0f, 0.0f);
+ ReleaseFocus();
+
point = touchinfo.GetCurrentPosition();
if (CheckDividerTouchRegion(point.x, point.y) == true)
{
__splitPanelDividerPressed = true;
+ Draw();
+ return true;
}
- Draw();
-
- return E_SUCCESS;
+ return false;
}
bool
_SplitPanelPresenter::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
{
+ ReleaseFocus();
+
if (__splitPanelDividerPressed == true)
{
PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
__splitPanelDividerPressed = false;
Draw();
+ return true;
}
-
- if (__isChangeBounds == true)
+ else
{
- __isChangeBounds = false;
+ if (__isChangeBounds == true)
+ {
+ __isChangeBounds = false;
+ }
+ return false;
}
-
- return E_SUCCESS;
}
bool
FloatPoint point(0.0f, 0.0f);
Bitmap* pThumbBitmap = null;
+ ReleaseFocus();
+
if (__pSplitPanel != &source || __splitPanelDividerPressed == false )
{
return false;
return false;
}
+bool
+_SplitPanelPresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
+{
+ _KeyCode keyCode = keyInfo.GetKeyCode();
+
+ if (keyCode == _KEY_RIGHT)
+ {
+ if (__currentFocusedPane == SPLIT_PANEL_PANE_ORDER_FIRST)
+ {
+ ReleaseFocus();
+ __currentFocusedPane = SPLIT_PANEL_PANE_ORDER_SECOND;
+ DrawFocus(__currentFocusedPane);
+ }
+ }
+ else if (keyCode == _KEY_LEFT)
+ {
+ if (__currentFocusedPane == SPLIT_PANEL_PANE_ORDER_SECOND)
+ {
+ ReleaseFocus();
+ __currentFocusedPane = SPLIT_PANEL_PANE_ORDER_FIRST;
+ DrawFocus(__currentFocusedPane);
+ }
+ }
+ else
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool
+_SplitPanelPresenter::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
+{
+ _KeyCode keyCode = keyInfo.GetKeyCode();
+
+ if (keyCode == _KEY_RIGHT || keyCode == _KEY_LEFT)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+result
+_SplitPanelPresenter::DrawFocus(SplitPanelPaneOrder focusedPane)
+{
+ result r = E_SUCCESS;
+ Canvas* pSplitPanelCanvas = null;
+ FloatRectangle currentFocusBounds(0.0f, 0.0f, 0.0f, 0.0f);
+
+ _Control* pControl = null;
+
+ if (focusedPane == SPLIT_PANEL_PANE_ORDER_FIRST)
+ {
+ pControl = __pSplitPanel->GetPane(SPLIT_PANEL_PANE_ORDER_FIRST);
+ __currentFocusedPane = SPLIT_PANEL_PANE_ORDER_FIRST;
+ currentFocusBounds = GetPaneBounds(SPLIT_PANEL_PANE_ORDER_FIRST);
+ }
+ else
+ {
+ pControl = __pSplitPanel->GetPane(SPLIT_PANEL_PANE_ORDER_SECOND);
+ __currentFocusedPane = SPLIT_PANEL_PANE_ORDER_SECOND;
+ currentFocusBounds = GetPaneBounds(SPLIT_PANEL_PANE_ORDER_SECOND);
+ }
+
+ if (pControl != null)
+ {
+ pControl->SetFocused();
+ pControl->DrawFocus();
+ }
+ else
+ {
+ pSplitPanelCanvas = __pSplitPanel->GetCanvasN();
+ SysTryReturnResult(NID_UI_CTRL, (pSplitPanelCanvas != null), E_SYSTEM, "A system error has occurred. Failed to get the canvas of SplitPanel.");
+
+ //give focus
+ if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*__pFocusBitmap))
+ {
+ r = pSplitPanelCanvas->DrawNinePatchedBitmap(currentFocusBounds, *__pFocusBitmap);
+ SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+ else
+ {
+ r = pSplitPanelCanvas->DrawBitmap(currentFocusBounds, *__pFocusBitmap);
+ SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+
+ delete pSplitPanelCanvas;
+ }
+
+ return r;
+
+CATCH:
+ delete pSplitPanelCanvas;
+ return r;
+}
+
+result
+_SplitPanelPresenter::ReleaseFocus(void)
+{
+ result r = E_SUCCESS;
+ Canvas* pSplitPanelCanvas = null;
+ FloatRectangle panebounds(0.0f, 0.0f, 0.0f, 0.0f);
+
+ if (__currentFocusedPane == SPLIT_PANEL_PANE_ORDER_FIRST &&
+ __pSplitPanel->GetPane(SPLIT_PANEL_PANE_ORDER_FIRST) == null)
+ {
+ panebounds = GetPaneBounds(SPLIT_PANEL_PANE_ORDER_FIRST);
+ }
+ else if (__currentFocusedPane == SPLIT_PANEL_PANE_ORDER_SECOND &&
+ __pSplitPanel->GetPane(SPLIT_PANEL_PANE_ORDER_SECOND) == null)
+ {
+ panebounds = GetPaneBounds(SPLIT_PANEL_PANE_ORDER_SECOND);
+ }
+ else
+ {
+ return r;
+ }
+
+ pSplitPanelCanvas = __pSplitPanel->GetCanvasN();
+ SysTryReturnResult(NID_UI_CTRL, (pSplitPanelCanvas != null), E_SYSTEM, "A system error has occurred. Failed to get the canvas of SplitPanel.");
+
+ //reset
+ pSplitPanelCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
+ pSplitPanelCanvas->Clear(panebounds);
+
+ delete pSplitPanelCanvas;
+
+ return r;
+}
+
result
_SplitPanelPresenter::SetDividerStyle(SplitPanelDividerStyle splitPanelDividerStyle)
{
__pDividerBackgroundBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pDividerBackgroundBitmap, Color::GetColor(COLOR_ID_MAGENTA), __dividerBackgroundColor);
SysTryCatch(NID_UI_CTRL, (__pDividerBackgroundBitmap != null), , r, "[%s] Failed to get replacement color bitmap.", GetErrorMessage(GetLastResult()));
+ r = GET_BITMAP_CONFIG_N(FOCUSUI::FOCUS, BITMAP_PIXEL_FORMAT_ARGB8888, __pFocusBitmap);
+ SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+
delete pDividerBackgroundBitmap;
return r;
FloatRectangle clientBounds(0.0f, 0.0f, 0.0f, 0.0f);
FloatRectangle firstPaneBounds(0.0f, 0.0f, 0.0f, 0.0f);
FloatRectangle secondPaneBounds(0.0f, 0.0f, 0.0f, 0.0f);
+ FloatRectangle dividerBounds(0.0f, 0.0f, 0.0f, 0.0f);
FloatPoint panePostion(0.0f, 0.0f);
_Control* pFirstPane = null;
_Control* pSecondPane = null;
{
secondPaneBounds = FloatRectangle(0.0f, clientBounds.height + __dividerRectangle.height, clientBounds.width, clientBounds.height - __dividerRectangle.y - __dividerRectangle.height);
}
+
+ dividerBounds = __dividerRectangle;
+ dividerBounds.x = clientBounds.width;
+
+ __pSplitPanel->SetDividerVisualElementBounds(dividerBounds);
}
else if (IsPaneMaximized(SPLIT_PANEL_PANE_ORDER_SECOND))
{
{
firstPaneBounds = FloatRectangle(0.0f, clientBounds.y -__dividerRectangle.y - __dividerRectangle.height, clientBounds.width, __dividerRectangle.y);
}
+
+ dividerBounds = __dividerRectangle;
+ dividerBounds.x = -__dividerRectangle.width;
+
+ __pSplitPanel->SetDividerVisualElementBounds(dividerBounds);
}
else
{
{
if (pFirstPane->IsResizable())
{
- pFirstPane->SetBounds(firstPaneBounds);
+ r = pFirstPane->SetBounds(firstPaneBounds);
+ if (IsFailed(r))
+ {
+ SysLog(NID_UI_CTRL, "[%s] SetBounds failed.", GetErrorMessage(r));
+ }
}
r = pFirstPane->SetPosition(Point(0.0f, 0.0f));
{
if (pSecondPane->IsResizable())
{
- pSecondPane->SetBounds(secondPaneBounds);
+ r = pSecondPane->SetBounds(secondPaneBounds);
+ if (IsFailed(r))
+ {
+ SysLog(NID_UI_CTRL, "[%s] SetBounds failed.", GetErrorMessage(r));
+ }
}
r = pSecondPane->SetPosition(Point(0.0f, 0.0f));
float width = 0.0f;
float height = 0.0f;
FloatRectangle clientBounds(0.0f, 0.0f, 0.0f, 0.0f);
- FloatRectangle dividerBounds(0.0f, 0.0f, 0.0f, 0.0f);
_ControlOrientation orientation = _CONTROL_ORIENTATION_PORTRAIT;
Bitmap* pThumbBitmap = null;
{
__dividerRectangle = FloatRectangle(dividerPosition, 0.0f, width, height);
__dividerThumbRectangle = FloatRectangle(dividerPosition, ((height - pThumbBitmap->GetHeightF()) / 2.0f), pThumbBitmap->GetWidthF(), pThumbBitmap->GetHeightF());
-
- dividerBounds = __dividerRectangle;
-
- if (IsPaneMaximized(SPLIT_PANEL_PANE_ORDER_FIRST))
- {
- dividerBounds.x = clientBounds.width;
- }
- else if (IsPaneMaximized(SPLIT_PANEL_PANE_ORDER_SECOND))
- {
- dividerBounds.x = -__dividerRectangle.width;
- }
}
}
else
{
__dividerRectangle = FloatRectangle(0.0f, dividerPosition, width, height);
__dividerThumbRectangle = FloatRectangle(((width - pThumbBitmap->GetWidth()) / 2.0f), dividerPosition, pThumbBitmap->GetWidthF(), pThumbBitmap->GetHeightF());
-
- dividerBounds = __dividerRectangle;
-
- if (IsPaneMaximized(SPLIT_PANEL_PANE_ORDER_FIRST))
- {
- dividerBounds.y = clientBounds.height;
- }
- else if (IsPaneMaximized(SPLIT_PANEL_PANE_ORDER_SECOND))
- {
- dividerBounds.y = -__dividerRectangle.height;
- }
}
}
- __pSplitPanel->SetDividerVisualElementBounds(dividerBounds);
+ __pSplitPanel->SetDividerVisualElementBounds(__dividerRectangle);
}
result
return secondPaneBounds;
}
+FloatRectangle
+_SplitPanelPresenter::GetPaneBounds(SplitPanelPaneOrder paneOrder)
+{
+ FloatRectangle firstPaneBounds;
+ FloatRectangle secondPaneBounds;
+
+ FloatRectangle clientBounds = __pSplitPanel->GetBoundsF();
+
+ if (__pSplitPanel->GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL)
+ {
+ firstPaneBounds = FloatRectangle(0.0f, 0.0f, __dividerRectangle.x, clientBounds.height);
+ secondPaneBounds = FloatRectangle(__dividerRectangle.x + __dividerRectangle.width, 0.0f, clientBounds.width - __dividerRectangle.x - __dividerRectangle.width, clientBounds.height);
+ }
+ else
+ {
+ firstPaneBounds = FloatRectangle(0.0f, 0.0f, clientBounds.width, __dividerRectangle.y);
+ secondPaneBounds = FloatRectangle(0.0f, __dividerRectangle.y + __dividerRectangle.height, clientBounds.width, clientBounds.height - __dividerRectangle.y - __dividerRectangle.height);
+ }
+
+ if (paneOrder == SPLIT_PANEL_PANE_ORDER_FIRST)
+ {
+ return firstPaneBounds;
+ }
+
+ return secondPaneBounds;
+}
+
VisualElementPropertyAnimation*
_SplitPanelPresenter::GetVisualElementAnimation(Tizen::Base::String propertyName)
{
if ((pItem->GetContextItem() != null && abs(moveDistanceX) > abs(moveDistanceY * 2)) || pItem->IsContextItem())
{
- if (!pItem->IsContextItem())
+ if (!pItem->IsContextItem() && !pItem->IsAnimationPlaying())
{
pItem->GetItemIndex(__sweptItemTag.groupIndex, __sweptItemTag.itemIndex);
__sweptItemPosition = pItem->GetPositionF();
firstLoadedItemTag.itemIndex = -1;
}
+ for (int i = 0; i < itemCount; i++)
+ {
+ UnloadItem(groupIndex, i);
+ }
+
+ __pListModel->GetFirstLoadedItemIndex(firstLoadedItemTag.groupIndex, firstLoadedItemTag.itemIndex);
_TableViewItem* pItem = FindItem(firstLoadedItemTag);
if (pItem != null)
{
}
}
- for (int i = 0; i < itemCount; i++)
- {
- UnloadItem(groupIndex, i);
- }
AdjustClientAreaBounds(false, -groupTotalHeight);
return E_SUCCESS;
{
int itemCountInGroup = __pListModel->GetItemCountInGroup(__expandableItemTag.groupIndex);
+ float groupTotalHeight = 0;
+ _TableViewItem* pItem = null;
+ for (int i = 0; i < itemCountInGroup; i++)
+ {
+ pItem = static_cast<_TableViewItem*>(__pListModel->GetItemFromTemporaryBuffer(__expandableItemTag.groupIndex, i));
+ groupTotalHeight += pItem->GetItemHeight();
+ }
+
if (completedNormally == false)
{
TableViewItemTag current;
UnloadItem(__expandableItemTag.groupIndex, i);
}
- _TableViewItem* pCurrentItem = FindItem(current);
- if (pCurrentItem == null)
- {
- SysTryReturnVoidResult(NID_UI_CTRL, pCurrentItem != null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.")
- }
+ _TableViewItem* pCurrentItem = LoadItem(current.groupIndex, current.itemIndex);
+ FloatRectangle itemBounds = pCurrentItem->GetBoundsF();
+ itemBounds.y = CalculateItemPositionY(current.groupIndex, current.itemIndex);
+ pCurrentItem->SetBounds(itemBounds);
- FloatRectangle itemBounds;
float nextItemPositionY = pCurrentItem->GetBoundsF().y + pCurrentItem->GetBoundsF().height;
FloatRectangle screenBounds = __pTableView->GetBoundsF();
UnloadItem(current.groupIndex, current.itemIndex);
}
}
+
+ int currentGroupIndex = -1;
+ int currentItemIndex = -1;
+ GetTopDrawnItemIndex(currentGroupIndex, currentItemIndex);
+ if (__expandableItemTag.groupIndex < currentGroupIndex)
+ {
+ SetScrollPosition(GetScrollPosition() - groupTotalHeight, false);
+ }
}
else
{
}
}
- float groupTotalHeight = 0;
- _TableViewItem* pItem = null;
- for (int i = 0; i < itemCountInGroup; i++)
- {
- pItem = static_cast<_TableViewItem*>(__pListModel->GetItemFromTemporaryBuffer(__expandableItemTag.groupIndex, i));
- groupTotalHeight += pItem->GetItemHeight();
- }
-
AdjustClientAreaBounds(false, -groupTotalHeight);
}
, __pTokenBgBitmap(null)
, __pTokenBgNormalEffectBitmap(null)
, __pTokenBgPressedEffectBitmap(null)
+ , __pTokenBgReplacementFocusBitmap(null)
+ , __pTokenBgFocusEffectBitmap(null)
, __pressedTokenIndex(-1)
, __isEditingToken(false)
, __edittingTokenIndex(-1)
, __touchPressInfo(FloatPoint(-1.0f, -1.0f))
, __editContentFontSize(0.0f)
, __trackTokenIndex(-1)
+ , __focusedTokenIndex(-1)
+ , __focusedEditingTokenIndex(-1)
, __isAnimationInProgress(false)
{
}
delete __pTokenBgPressedEffectBitmap;
__pTokenBgPressedEffectBitmap = null;
+ delete __pTokenBgReplacementFocusBitmap;
+ __pTokenBgReplacementFocusBitmap = null;
+
+ delete __pTokenBgFocusEffectBitmap;
+ __pTokenBgFocusEffectBitmap = null;
+
if (__pDescriptionTextVisualElement)
{
__pDescriptionTextVisualElement->Destroy();
float tokenBottomMargin = 0.0f;
float tokenHeight = 0.0f;
_ControlOrientation orientation = __pTokenEdit->GetOrientation();
+ Color focusTokenColor;
+ Bitmap* pTokenBgFocusBitmap = null;
GET_SHAPE_CONFIG(TOKENEDIT::LEFT_MARGIN, orientation, tokenLeftMargin);
GET_SHAPE_CONFIG(TOKENEDIT::RIGHT_MARGIN, orientation, tokenRightMargin);
GET_SHAPE_CONFIG(TOKENEDIT::TOP_MARGIN, orientation, tokenTopMargin);
GET_SHAPE_CONFIG(TOKENEDIT::BOTTOM_MARGIN, orientation, tokenBottomMargin);
GET_SHAPE_CONFIG(TOKENEDIT::TOKEN_HEIGHT, orientation, tokenHeight);
+ GET_COLOR_CONFIG(TOKENEDIT::BG_FOCUS, focusTokenColor);
// For drawing token in specific area
__clientRect.x = tokenLeftMargin;
r = GET_BITMAP_CONFIG_N(TOKENEDIT::BG_PRESSED_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, __pTokenBgPressedEffectBitmap);
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ r = GET_BITMAP_CONFIG_N(TOKENEDIT::BG_FOCUS, BITMAP_PIXEL_FORMAT_ARGB8888, pTokenBgFocusBitmap);
+ SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pTokenBgReplacementFocusBitmap = _BitmapImpl::GetColorReplacedBitmapN(
+ *pTokenBgFocusBitmap,Color::GetColor(COLOR_ID_MAGENTA), focusTokenColor);
+ SysTryCatch(NID_UI_CTRL, __pTokenBgReplacementFocusBitmap != null, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = GET_BITMAP_CONFIG_N(TOKENEDIT::BG_FOCUS_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, __pTokenBgFocusEffectBitmap);
+ SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ delete pTokenBgFocusBitmap;
+ pTokenBgFocusBitmap = null;
+
+
__isTokenEditPresenterInitialized = true;
__previousCursorPosition = GetCursorPosition();
delete __pTokenBgNormalEffectBitmap;
__pTokenBgNormalEffectBitmap = null;
+ delete __pTokenBgPressedEffectBitmap;
+ __pTokenBgPressedEffectBitmap = null;
+
+ delete pTokenBgFocusBitmap;
+ pTokenBgFocusBitmap = null;
+
+ delete __pTokenBgReplacementFocusBitmap;
+ __pTokenBgReplacementFocusBitmap = null;
+
return r;
}
}
}
+ if (__focusedTokenIndex == i && IsFocused() && (!__isEditingToken))
+ {
+ if (__pTokenBgReplacementFocusBitmap)
+ {
+ if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*__pTokenBgReplacementFocusBitmap))
+ {
+ pTokenCanvas->DrawNinePatchedBitmap(tokenRect, *__pTokenBgReplacementFocusBitmap);
+ }
+ else
+ {
+ pTokenCanvas->DrawBitmap(tokenRect, *__pTokenBgReplacementFocusBitmap);
+ }
+ }
+
+ if (__pTokenBgFocusEffectBitmap)
+ {
+ if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*__pTokenBgFocusEffectBitmap))
+ {
+ pTokenCanvas->DrawNinePatchedBitmap(tokenRect, *__pTokenBgFocusEffectBitmap);
+ }
+ else
+ {
+ pTokenCanvas->DrawBitmap(tokenRect, *__pTokenBgFocusEffectBitmap);
+ }
+ }
+
+ }
+
pTokenElement->SetAnimationProvider(null);
if (pToken->isImplicitAnimation)
{
{
__pressedTokenIndex++;
}
+ else if (__focusedTokenIndex >= index)
+ {
+ __focusedTokenIndex++;
+ }
}
return r;
{
__pressedTokenIndex--;
}
+
+ if (index == __focusedTokenIndex)
+ {
+ __focusedTokenIndex = -1;
+ }
+ else if(index >= 0 && index < __focusedTokenIndex)
+ {
+ __focusedTokenIndex--;
+ }
}
else if (index == __pressedTokenIndex)
{
SetCursorDisabled(false);
StartCursorTimer();
}
+ else if (index == __focusedTokenIndex)
+ {
+ __focusedTokenIndex = -1;
+ }
return r;
}
if ((__isEditingToken == true) && (__pressedTokenIndex != -1))
{
- _VisualElement* pEditVisualElement = __pTokenEdit->GetVisualElement();
- SysTryReturnResult(NID_UI_CTRL, pEditVisualElement, E_SYSTEM, "A system error has occurred. Failed to get root visual element.");
-
- _VisualElement* pCursorVisualElement = GetCursorVisualElement();
- SysTryReturnResult(NID_UI_CTRL, pCursorVisualElement, E_SYSTEM, "A system error has occurred. Failed to get cursor visual element.");
-
- _Token* pToken = null;
- _VisualElement* pTokenVisualElement = null;
-
- pToken = static_cast <_Token*>(__pTokenList->GetAt(__pressedTokenIndex));
-
- bool isParentChanged = false;
- if (pToken)
- {
- pTokenVisualElement = pToken->GetVisualElement();
- SysTryReturnResult(NID_UI_CTRL, pTokenVisualElement, E_SYSTEM, "A system error has occurred. Failed to get token visual element.");
-
- if (pCursorVisualElement->GetParent() != pTokenVisualElement)
- {
- isParentChanged = true;
- result r = E_SUCCESS;
- r = (pCursorVisualElement->GetParent())->DetachChild(*pCursorVisualElement);
- SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
-
- r = pTokenVisualElement->AttachChild(*pCursorVisualElement);
- SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
- }
- }
+ r = AttachCursorToPressedToken();
+ SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
}
if (__isEditingToken == false)
_TokenEditPresenter::OnFocusLost(void)
{
result r = E_SUCCESS;
+ __isFocus = false;
//Remove pressed state on focus lost
__pressedTokenIndex = -1;
-
- __isFocus = false;
+ __focusedTokenIndex = -1;
+ __focusedEditingTokenIndex = -1;
_EditPresenter::StopTitleSlidingTimer();
__isTitleSliding = false;
bool
_TokenEditPresenter::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
{
+ //Remove token focus on touch press
+ __focusedTokenIndex = -1;
+ __focusedEditingTokenIndex = -1;
int tokenIndex = GetTokenIndexFromCoordinate(_CoordinateSystemUtils::ConvertToInteger(touchinfo.GetCurrentPosition()));
__trackTokenIndex = tokenIndex;
__edittingTokenIndex = -1;
__isEditingToken = false;
- CheckTokenScrolling();
+ if ((__focusedTokenIndex == -1) && (__focusedEditingTokenIndex != -1)
+ && (inputTokenString.GetLength() > 0))
+ {
+ //1. Tokenedit is focussed
+ //2. The valid Editing token is focussed
+ __focusedTokenIndex = __focusedEditingTokenIndex;
+ ScrollToFocussedToken();
+ }
+ else
+ {
+ CheckTokenScrolling();
+ }
SetCursorDisabled(false);
if (inputTokenString.GetLength() <= 0)
{
MakeToken();
}
+ else if ((__focusedEditingTokenIndex == -1) && (__focusedTokenIndex != -1) && (!__isEditingToken))
+ {
+ if (__isEditModeEnabled)
+ {
+ __edittingTokenIndex = __focusedTokenIndex;
+ __pressedTokenIndex = __edittingTokenIndex;
+ __isEditingToken = true;
+ __focusedEditingTokenIndex = __focusedTokenIndex;
+ __focusedTokenIndex = -1;
+ __isTokenEditingFinished = false;
+
+ SetEditingTokenTextBounds(__edittingTokenIndex);
+
+ r = AttachCursorToPressedToken();
+ SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+ }
+ else
+ {
+ //Focussed token is ready to be edited again.
+ __focusedEditingTokenIndex = -1;
+ }
for (int i = 0; i < __pTokenList->GetCount(); i++)
{
InitializeTokenVisibilityAt(i);
}
- if (__pressedTokenIndex < 0)
+ if ((__pressedTokenIndex < 0) || (__focusedEditingTokenIndex > -1))
{
SetCursorDisabled(true);
__pTokenEdit->Draw();
__pTokenEdit->Invalidate();
return;
}
+ else if (__focusedTokenIndex >= 0 && __edittingTokenIndex < 0 && !__isEditingToken)
+ {
+ RemoveTokenAt(__focusedTokenIndex);
+ __pTokenEdit->Invalidate();
+ return;
+ }
+
//Backspace on Blocked text, delete full block
if (IsBlocked() == true)
return;
}
+result
+_TokenEditPresenter::AttachCursorToPressedToken(void)
+{
+ result r = E_SUCCESS;
+
+ _VisualElement* pEditVisualElement = __pTokenEdit->GetVisualElement();
+ SysTryReturnResult(NID_UI_CTRL, pEditVisualElement, E_SYSTEM, "A system error has occurred. Failed to get root visual element.");
+
+ _VisualElement* pCursorVisualElement = GetCursorVisualElement();
+ SysTryReturnResult(NID_UI_CTRL, pCursorVisualElement, E_SYSTEM, "A system error has occurred. Failed to get cursor visual element.");
+
+ _Token* pToken = null;
+ _VisualElement* pTokenVisualElement = null;
+
+ pToken = static_cast <_Token*>(__pTokenList->GetAt(__pressedTokenIndex));
+ if (pToken)
+ {
+ pTokenVisualElement = pToken->GetVisualElement();
+ SysTryReturnResult(NID_UI_CTRL, pTokenVisualElement, E_SYSTEM, "A system error has occurred. Failed to get token visual element.");
+
+ if (pCursorVisualElement->GetParent() != pTokenVisualElement)
+ {
+ r = (pCursorVisualElement->GetParent())->DetachChild(*pCursorVisualElement);
+ SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
+
+ r = pTokenVisualElement->AttachChild(*pCursorVisualElement);
+ SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
+ }
+ }
+
+ return r;
+}
+
bool
_TokenEditPresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
{
_KeyCode keyCode = keyInfo.GetKeyCode();
+ bool focusChanged = false;
+ int tokenCount = GetTokenCount();
if (IsUsbKeyboardConnected() && (keyInfo.GetKeyModifier() & _KEY_MODIFIER_CTRL))
{
}
}
+ if ((keyCode == _KEY_NUM_LEFT) || (keyCode == _KEY_LEFT))
+ {
+ if (!__isEditingToken)
+ {
+ if ((__focusedTokenIndex > 0) && (__focusedTokenIndex < tokenCount))
+ {
+ __focusedTokenIndex--;
+ focusChanged = true;
+ }
+ }
+ }
+
+ if ((keyCode == _KEY_NUM_RIGHT) || (keyCode == _KEY_RIGHT))
+ {
+ int lastTokenIndex = tokenCount - 1;
+ if (!__isEditingToken)
+ {
+ if (__pressedTokenIndex != -1)
+ {
+ __pressedTokenIndex = -1;
+ __focusedTokenIndex = 0;
+ focusChanged = true;
+ }
+ else if (__focusedTokenIndex < lastTokenIndex)
+ {
+ __focusedTokenIndex++;
+ focusChanged = true;
+ }
+ }
+ }
+
+ if (focusChanged)
+ {
+ ScrollToFocussedToken();
+ }
+
return _EditPresenter::OnKeyPressed(source, keyInfo);
}
+
+result
+_TokenEditPresenter::ScrollToFocussedToken(void)
+{
+ result r = E_SUCCESS;
+ int tokenCount = GetTokenCount();
+ FloatRectangle focussedTokenRectangle;
+ float newScrollValue = 0.0f;
+ float tokenTopMargin = 0.0f;
+ float tokenBottomMargin = 0.0f;
+ _ControlOrientation orientation = __pTokenEdit->GetOrientation();
+
+
+ GET_SHAPE_CONFIG(TOKENEDIT::TOP_MARGIN, orientation, tokenTopMargin);
+ GET_SHAPE_CONFIG(TOKENEDIT::BOTTOM_MARGIN, orientation, tokenBottomMargin);
+
+ FloatRectangle tokenEditRect = __pTokenEdit->GetBoundsF();
+
+ if ((__focusedTokenIndex > -1) && (__focusedTokenIndex < tokenCount))
+ {
+ _Token* pToken = null;
+ pToken = static_cast <_Token*>(__pTokenList->GetAt(__focusedTokenIndex));
+
+ focussedTokenRectangle = pToken->displayRect;
+
+ float focussedTokenPosition= focussedTokenRectangle.y + focussedTokenRectangle.height ;
+
+ if ((focussedTokenRectangle.y > 0) && (focussedTokenPosition < tokenEditRect.height))
+ {
+ //Focused token is within the tokenEdit boundary
+ DrawToken();
+ }
+ else
+ {
+ if (focussedTokenRectangle.y < 0)
+ {
+ //Focused token is above the upper boundary
+ newScrollValue = focussedTokenRectangle.y - tokenTopMargin - __scrollValue;
+ }
+ else
+ {
+ //Focused token is below the lower boundary
+ newScrollValue = focussedTokenPosition - tokenEditRect.height + tokenBottomMargin - __scrollValue;
+ }
+
+ r = RecalculateTokenBounds(newScrollValue);
+ SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
+ }
+ }
+
+ return r;
+}
+
}}} //Tizen::Ui::Controls
: public _IAccessibilityListener
{
public:
- FooterItemAccessibilityListener(void){}
+ FooterItemAccessibilityListener(const Tizen::Ui::Controls::_Toolbar* toolbar)
+ :__pToolbar(null)
+ {
+ __pToolbar = const_cast<Tizen::Ui::Controls::_Toolbar*>(toolbar);
+ }
virtual ~FooterItemAccessibilityListener(void){}
virtual bool OnAccessibilityFocusMovedNext(const _AccessibilityContainer& control, const _AccessibilityElement& element){return true;}
virtual bool OnAccessibilityFocusMovedPrevious(const _AccessibilityContainer& control, const _AccessibilityElement& element){return true;}
virtual bool OnAccessibilityReadingElement(const _AccessibilityContainer& control, const _AccessibilityElement& element){return true;}
virtual bool OnAccessibilityReadElement(const _AccessibilityContainer& control, const _AccessibilityElement& element){return true;}
- virtual bool OnAccessibilityFocusIn(const _AccessibilityContainer& control, const _AccessibilityElement& element){return true;}
+ virtual bool OnAccessibilityFocusIn(const _AccessibilityContainer& control, const _AccessibilityElement& element)
+ {
+ FloatRectangle rect = element.GetAbsoluteBounds();
+ Dimension screen = _ResourceManager::GetInstance()->GetLogicalScreenSizen();
+ int screenW = _ControlManager::GetInstance()->GetOrientation() == _CONTROL_ORIENTATION_PORTRAIT ? screen.width : screen.height;
+ if(rect.x < 0.0f)
+ {
+ __pToolbar->GetPresenter()->AdjustItemPositionX(-(rect.x));
+ __pToolbar->Invalidate(true);
+ }
+ else if(rect.x + rect.width > screenW)
+ {
+ float adjustX = 0.0f;
+ if(rect.x + rect.width > screenW)
+ {
+ adjustX = -(rect.x + rect.width - screenW);
+ }
+ else
+ {
+ adjustX = -rect.x;
+ }
+ __pToolbar->GetPresenter()->AdjustItemPositionX(adjustX);
+ __pToolbar->Invalidate(true);
+ }
+ return true;
+ }
virtual bool OnAccessibilityFocusOut(const _AccessibilityContainer& control, const _AccessibilityElement& element){return true;}
virtual bool OnAccessibilityValueIncreased(const _AccessibilityContainer& control, const _AccessibilityElement& element){return true;}
virtual bool OnAccessibilityValueDecreased(const _AccessibilityContainer& control, const _AccessibilityElement& element){return true;}
_AccessibilityManager::GetInstance()->RequestAutoReading(_ACCESSIBILITY_AUTO_READING_MODE_FIRST_ITEM_OF_CONTENTS);
return true;
}
+private:
+ Tizen::Ui::Controls::_Toolbar* __pToolbar;
};
-FooterItemAccessibilityListener footerItemAccessibilityListener;
}
namespace Tizen { namespace Ui { namespace Controls
, __titleTextArea(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f))
, __itemArea(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f))
, __pTitleTextElement(null)
+ , __pAccessibilityListener(null)
{
_AccessibilityContainer* pContainer = null;
__isButtonBgColorSetByUser[i] = false;
__isButtonTextColorSetByUser[i] = false;
}
+ __pAccessibilityListener = new (std::nothrow) FooterItemAccessibilityListener(this);
}
_Toolbar::~_Toolbar(void)
__pTitleTextElement = null;
}
+ if(__pAccessibilityListener)
+ {
+ delete __pAccessibilityListener;
+ __pAccessibilityListener = null;
+ }
ClearLastResult();
}
|| style == TOOLBAR_TAB)
{
pElement->SetHint(L"Double tap to move to contents");
- pButton->GetAccessibilityContainer()->AddListener(footerItemAccessibilityListener);
+ pButton->GetAccessibilityContainer()->AddListener(*__pAccessibilityListener);
}
}
}
return E_SUCCESS;
}
+_ToolbarPresenter*
+_Toolbar::GetPresenter(void) const
+{
+ return __pToolbarPresenter;
+}
+
result
_Toolbar::ApplyUserGUI(ButtonType buttonType, _Button* pButton)
{
Tizen::Graphics::FloatRectangle GetParentWindowBounds() const;
void RefreshItems(void);
+ virtual bool OnFocusGained(const _Control &source);
+ virtual bool OnFocusLost(const _Control &source);
+ void OnDrawFocus(void);
+ bool OnKeyPressed(const _Control &source, const _KeyInfo &keyInfo);
+
// accessibility listener
virtual bool OnAccessibilityFocusMovedNext(const _AccessibilityContainer& control, const _AccessibilityElement& element);
virtual bool OnAccessibilityFocusMovedPrevious(const _AccessibilityContainer& control, const _AccessibilityElement& element);
int GetMaximumValue(void) const;
void SetMaximumValue(int maxValue);
+ result DrawFocus();
+ void SetItemFocused(bool isFocused);
+
float GetItemWidth(void) const;
float GetItemMargin(void) const;
float GetFontSize(void) const;
float GetLeftRightMargin(void) const;
+ bool OnKeyPressed(const _Control &source, const _KeyInfo &keyInfo);
virtual bool OnTouchPressed(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
virtual bool OnTouchReleased(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
virtual bool OnTouchMoved(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
Tizen::Graphics::FloatRectangle __arrowAreaBounds;
Tizen::Graphics::FloatRectangle __windowAreaBounds;
Tizen::Graphics::Bitmap* __pBgColorReplacementBitmap;
+ Tizen::Graphics::Bitmap* __pFocusBitmap;
Tizen::Graphics::Bitmap* __pArrowColorReplacementBitmap;
bool __isInitialAnimation;
int __initialAnimationValue;
Tizen::Graphics::Font* __pFont;
+ bool __isFocused;
+ int __focusedIndex;
+ Tizen::Graphics::FloatRectangle __focusBounds;
+ static const int UPDATE_ITEM_COUNT = 3;
+
}; // _DateTimeBarPresenter
}}} // Tizen::Ui::Controls
enum DateTimePickerStatus
{
DATETIME_STATUS_NORMAL = 0,
- DATETIME_STATUS_PRESSED,
+ DATETIME_STATUS_SELECTED,
DATETIME_STATUS_HIGHLIGHTED,
DATETIME_STATUS_DISABLED,
DATETIME_STATUS_MAX
DATE_FORMAT_YYYYMMDD,
DATE_FORMAT_YYYYDDMM
};
+
+enum _TimeFormat
+{
+ TIME_FORMAT_12HOUR = 0,
+ TIME_FORMAT_24HOUR
+};
+
+enum _FocusType
+{
+ FOCUS_DAY = 0,
+ FOCUS_MONTH,
+ FOCUS_YEAR,
+ FOCUS_HOUR,
+ FOCUS_MINUTE,
+ FOCUS_AMPM,
+ FOCUS_NONE
+};
+
}}} // Tizen::Ui::Controls
#endif // _FUI_CTRL_INTERNAL_DATETIME_DEFINE_H_
#include <FBaseDateTime.h>
#include <FBaseString.h>
#include <FBaseColLinkedListT.h>
+#include <FSysISettingEventListener.h>
#include "FUi_Window.h"
#include "FUiCtrl_IActionEventListener.h"
, virtual public Tizen::Ui::_IUiEventListener
, virtual public Tizen::Ui::_IUiEventPreviewer
, virtual public Tizen::Ui::_IAccessibilityListener
+ , virtual public Tizen::System::ISettingEventListener
{
DECLARE_CLASS_BEGIN(_DateTimePicker, _Control);
DECLARE_PROPERTY("year", GetPropertyYear, SetPropertyYear);
virtual void OnFontChanged(Tizen::Graphics::Font* pFont);
virtual void OnFontInfoRequested(unsigned long& style, float& size);
+
+ virtual bool OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo);
+ virtual bool OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo);
+ virtual void OnDrawFocus(void);
+ bool OnFocusGained(const _Control& source);
+ bool OnFocusLost(const _Control& source);
+
+ virtual void OnSettingChanged(Tizen::Base::String& key);
+
Tizen::Graphics::Font* GetDateTimeFont(void);
result InitializeFont(void);
Tizen::Ui::Animations::_VisualElement* __pDisplayVisualElement;
Tizen::Base::Collection::LinkedListT<Tizen::Ui::_AccessibilityElement*> __accessibilityElements;
+
}; // _DateTimePicker
}}} // Tizen::Ui::Controls
result SetFont(Tizen::Graphics::Font* pFont);
+ void UpdateLocaleDateTimeFormat(void);
+
+ void UpdateTimeFormat(void);
+
virtual void OnChangeLayout(Tizen::Ui::_ControlOrientation orientation);
virtual bool OnTouchPressed(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
virtual void OnActionPerformed(const Tizen::Ui::_Control& source, int actionId);
+ virtual bool OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo);
+ virtual bool OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo);
+ result DrawFocus(void);
+ result ReleaseFocus(void);
+
private:
void UpdateDateTimeOutputConfig(void);
void ChangeFocusBox(void);
- int GetLocaleDateFormat(void) const;
-
void SetAccessibilityElementText(void);
+ void HandleInputPadValueChange(int inputPadReturnValue);
+
+ void HandleSaveCancelAction(int actionId);
+
private:
_DateTimePresenter(const _DateTimePresenter&);
bool __is24HourNotation;
+ bool __dtp24HourSet;
+
bool __isPm;
bool __isPmButtonPressed;
_DateTimeDisplayBox* __pDisplayBox[DATETIME_ID_MAX];
_DateTimeDisplayBox* __pPmBox;
+
+ bool __keypadEnabled;
}; // _DateTimePresenter
}}} // Tizen::Ui::Controls
int CalculateMaxDay(int displayYear, int month) const ;
bool IsLeapYear(int year) const;
void GetAmPm(Tizen::Base::String& timeFormat, _AmPmType amPmType) const;
+ int GetLocaleDateFormat(void) const;
private:
_DateTimeUtils(const _DateTimeUtils&);
_DateTimeUtils& operator =(const _DateTimeUtils&);
+ static const int LOCALE_DATE_FORMAT_STRING_LENGTH = 8;
+
};
}}} // Tizen::Ui::Controls
virtual void OnFontChanged(Tizen::Graphics::Font* pFont);
virtual void OnFontInfoRequested(unsigned long& style, float& size);
virtual void OnSettingChanged(Tizen::Base::String& key);
+
+ virtual bool OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo);
+
+ virtual bool OnFocusGained(const _Control& source);
+ virtual bool OnFocusLost(const _Control& source);
+ virtual void OnDrawFocus(void);
+
Tizen::Graphics::FloatRectangle GetParentWindowBounds(void) const;
void SetXmlBoundsExist(bool isXmlBoundsExist);
result Initialize(void);
result Draw(void);
+ result DrawFocus(void);
+ void UpdateLastSelectedValue(_DateTimeId id, bool isTouchPressed);
_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;
- void Animate(void);
+ void Animate(void);
virtual bool OnTouchPressed(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
virtual bool OnTouchReleased(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
virtual void OnTouchMoveHandled(const Tizen::Ui::_Control& control);
void OnFontChanged(Tizen::Graphics::Font* pFont);
void OnFontInfoRequested(unsigned long& style, float& size);
+ void SetFocusState(bool isFocused);
+ void SetFocusedElement(void);
+ virtual bool OnFocusLost(const _Control& source);
+ virtual bool OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo);
+
virtual void OnVisualElementAnimationFinished (const Tizen::Ui::Animations::VisualElementAnimation &animation, const Tizen::Base::String &keyName, Tizen::Ui::Animations::VisualElement &target, bool completedNormally);
virtual void OnVisualElementAnimationRepeated (const Tizen::Ui::Animations::VisualElementAnimation &animation, const Tizen::Base::String &keyName, Tizen::Ui::Animations::VisualElement &target, long currentRepeatCount){}
bool __isEditDateInitialized;
float __elementWidth;
static const int __dividerCount = 2;
+ static const float __adjustFocusHeight = 8.0f;
+ _FocusType __focusStatus;
+ bool __isEnterKeyPressed;
+ bool __isFocused;
}; // _EditDatePresenter
}}} // Tizen::Ui::Controls
void OnFontChanged(Tizen::Graphics::Font* pFont);
void OnFontInfoRequested(unsigned long& style, float& size);
virtual void OnSettingChanged(Tizen::Base::String& key);
+
+ virtual bool OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo);
+ bool OnFocusGained(const _Control& source);
+ bool OnFocusLost(const _Control& source);
+ virtual void OnDrawFocus(void);
+
Tizen::Graphics::FloatRectangle GetParentWindowBounds(void) const;
void SetXmlBoundsExist(bool isXmlBoundsExist);
result Draw(void);
void Animate(void);
+ void SetFocusedElement(void);
+ void SetFocusState(bool isFocused);
+ bool OnFocusLost(const _Control& source);
+ bool OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo);
+
virtual bool OnTouchPressed(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
virtual bool OnTouchReleased(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
virtual bool OnTouchCanceled(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
void OnFontInfoRequested(unsigned long& style, float& size);
result Initialize(void);
void UpdateTimeFormat(void);
+ void UpdateLastSelectedValue(_DateTimeId boxId, bool __isTouchPressed);
virtual void OnVisualElementAnimationFinished (const Tizen::Ui::Animations::VisualElementAnimation &animation, const Tizen::Base::String &keyName, Tizen::Ui::Animations::VisualElement &target, bool completedNormally);
virtual void OnVisualElementAnimationRepeated (const Tizen::Ui::Animations::VisualElementAnimation &animation, const Tizen::Base::String &keyName, Tizen::Ui::Animations::VisualElement &target, long currentRepeatCount){}
virtual void OnVisualElementAnimationStarted (const Tizen::Ui::Animations::VisualElementAnimation &animation, const Tizen::Base::String &keyName, Tizen::Ui::Animations::VisualElement &target){}
+ result DrawFocus(void);
+
private:
_EditTimePresenter(const _EditTimePresenter&);
Tizen::Graphics::Bitmap* __pContentBgEffectNormalBitmap;
Tizen::Graphics::Bitmap* __pContentBgEffectPressedBitmap;
Tizen::Graphics::Bitmap* __pContentBgEffectDisabledBitmap;
+ Tizen::Graphics::Bitmap* __pfocusBitmap;
Tizen::Ui::Animations::VisualElement* __pContentProvider;
Tizen::Graphics::_Text::TextObject __textObject;
float __timeFontSize;
bool __isAnimating;
bool __isEditTimeInitialized;
+ _FocusType __focusStatus;
+ bool __isEnterKeyPressed;
+ bool __isFocused;
+ static const float __adjustFocusHeight = 8.0f;
}; // _EditTimePresenter
}}} // Tizen::Ui::Controls
virtual bool OnTouchReleased(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
virtual bool OnTouchMoved(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
virtual bool OnTouchCanceled(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
+ virtual void OnDrawFocus(void);
+ virtual bool OnFocusGained(const _Control& source);
+ virtual bool OnFocusLost(const _Control &source);
+ virtual bool OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo);
virtual void OnBoundsChanged(void);
virtual void OnChangeLayout(Tizen::Ui::_ControlOrientation orientation);
virtual void OnDraw(void);
virtual result OnAttachedToMainTree(void);
+ virtual void OnFocusModeStateChanged(void);
virtual void OnFontChanged(Tizen::Graphics::Font* pFont);
virtual void OnFontInfoRequested(unsigned long& style, float& size);
static _SliderPresenter* CreateInstanceN(const _Slider& slider);
result SetThumbBitmap(SliderThumbStatus status, const Tizen::Graphics::Bitmap& bitmap);
void SetThumbTextColor(SliderThumbStatus status, const Tizen::Graphics::Color& color);
-
+ void SetFocusMode(bool focusmode);
+ bool GetFocusMode(void);
virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer);
private:
int __handleX;
int __prevSliderValue;
bool __isSliderPressed;
+ bool __isFocusModeStateChanged;
bool __isNeedToBeUpdated;
bool __isResourceLoaded;
virtual bool OnAccessibilityValueIncreased(const Tizen::Ui::_AccessibilityContainer& control, const Tizen::Ui::_AccessibilityElement& element);
virtual bool OnAccessibilityValueDecreased(const Tizen::Ui::_AccessibilityContainer& control, const Tizen::Ui::_AccessibilityElement& element);
+ //key listners
+ virtual bool OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo);
+ virtual bool OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo);
+ virtual void OnDrawFocus(void);
+ bool OnFocusGained(const _Control& source);
+ bool OnFocusLost(const _Control& source);
+
public:
result AddSplitPanelEventListener(const _ISplitPanelEventListener& listener);
result RemoveSplitPanelEventListener(const _ISplitPanelEventListener& listener);
virtual bool OnTapGestureDetected(_TouchTapGestureDetector& gesture);
virtual bool OnTapGestureCanceled(_TouchTapGestureDetector& gesture);
+ virtual bool OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo);
+ virtual bool OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo);
+ result DrawFocus(SplitPanelPaneOrder focusedPane = SPLIT_PANEL_PANE_ORDER_FIRST);
+ result ReleaseFocus(void);
+
result SetDividerStyle(SplitPanelDividerStyle splitPanelDividerStyle);
SplitPanelDividerStyle GetDividerStyle(void) const;
Tizen::Ui::Control* GetPaneControl(SplitPanelPaneOrder paneOrder);
Tizen::Ui::Animations::AnimationTransactionStatus GetTransactionStatus(void);
Tizen::Graphics::FloatRectangle GetRestorePaneBounds(SplitPanelPaneOrder paneOrder);
+ Tizen::Graphics::FloatRectangle GetPaneBounds(SplitPanelPaneOrder paneOrder);
Tizen::Ui::Animations::VisualElementPropertyAnimation* GetVisualElementAnimation(Tizen::Base::String propertyName);
private:
Tizen::Graphics::Bitmap* __pDividerBackgroundBitmap;
Tizen::Graphics::Bitmap* __pDividerBackgroundEffectBitmap;
Tizen::Graphics::Bitmap* __pDividerThumbBitmap;
+ Tizen::Graphics::Bitmap* __pFocusBitmap;
Tizen::Graphics::Color __dividerBackgroundColor;
Tizen::Graphics::Color __dividerPressedBackgroundColor;
int __transactionIdMaximize;
int __transactionIdRestore;
+ //Focus UI
+ SplitPanelPaneOrder __currentFocusedPane;
+
Tizen::Ui::Animations::AnimationInterpolatorType __controlAnimatorInterpolator;
Tizen::Base::String __visualElementInterpolator;
virtual result ChangeLayout(_ControlOrientation orientation);
virtual void ResetTextBounds(void);
virtual bool OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo);
-
+ result ScrollToFocussedToken(void);
+ result AttachCursorToPressedToken(void);
private:
bool DrawToken(int count = -1);
Tizen::Graphics::Color GetTokenEditColor(const ExpandableEditAreaTokenStatus status) const;
Tizen::Graphics::Bitmap* __pTokenBgBitmap;
Tizen::Graphics::Bitmap* __pTokenBgNormalEffectBitmap;
Tizen::Graphics::Bitmap* __pTokenBgPressedEffectBitmap;
+ Tizen::Graphics::Bitmap* __pTokenBgReplacementFocusBitmap;
+ Tizen::Graphics::Bitmap* __pTokenBgFocusEffectBitmap;
int __pressedTokenIndex;
int __trackTokenIndex;
+ int __focusedTokenIndex;
+
+ int __focusedEditingTokenIndex;
+
bool __isAnimationInProgress;
static const int ANIMATION_DURATION_BOUNDS = 167;
namespace Tizen { namespace Ui
{
class _AccessibilityElement;
+class _IAccessibilityListener;
}} // Tizen::Ui
namespace Tizen { namespace Ui { namespace Controls
result SetTransBackButton(bool transparent);
+ _ToolbarPresenter* GetPresenter(void) const;
+
protected:
result SetPresenter(const _ToolbarPresenter& toolbarPresenter);
Tizen::Ui::_AccessibilityElement* __pTitleTextElement;
+ _IAccessibilityListener* __pAccessibilityListener;
+
static const float SENSITIVE = 0.08f;
};
Tizen::Base::String GetHint(void) const;
void SetStatus(const Tizen::Base::String& guide);
Tizen::Base::String GetStatus(void) const;
- void SetTrait(AccessibilityTraits trait);
- AccessibilityTraits GetTrait(void) const;
void SetTrait(const Tizen::Base::String& trait);
Tizen::Base::String GetTraitString(void) const;
void SetValue(const Tizen::Base::String& value);
void SetLabel(const Tizen::Base::String& label);
void SetHint(const Tizen::Base::String& hint);
void SetStatus(const Tizen::Base::String& status);
- void SetTrait(AccessibilityTraits trait);
void SetTrait(const Tizen::Base::String& trait);
void SetValue(const Tizen::Base::String& value); //variant gogogo
Tizen::Base::String GetLabel(void) const;
Tizen::Base::String GetHint(void) const;
Tizen::Base::String GetStatus(void) const;
- AccessibilityTraits GetTrait(void) const;
Tizen::Base::String GetTraitString(void) const;
Tizen::Base::String GetValue(void) const; //variant gogogo
namespace
{
-const int __BASIC__ = 1;
-const int __ACCESSIBILITY__ = 2;
-const int __BUTTON__ = 3;
-const int __CHECKBUTTON__ = 4;
-const int __COLORPICKER__ = 5;
-const int __CONTEXTMENU__ = 6;
-const int __DATETIMEBAR__ = 7;
-const int __DATETIMEPICKER__ = 8;
-const int __EDIT__ = 9;
-const int __EDITDATE__ = 10;
-const int __EDITTIME__ = 11;
-const int __FASTSCROLL__ = 12;
-const int __FOOTER__ = 13;
-const int __FORM__ = 14;
-const int __GALLERY__ = 15;
-const int __GROUPCONTAINER__ = 16;
-const int __HEADER__ = 17;
-const int __ICONLIST__ = 18;
-const int __INPUTPAD__ = 19;
-const int __LABEL__ = 20;
-const int __LIST__ = 21;
-const int __LISTVIEW__ = 22;
-const int __APPWIDGET__ = 23;
-const int __MESSAGEBOX__ = 24;
-const int __OPTIONMENU__ = 25;
-const int __OVERLAYPANEL__ = 26;
-const int __PANEL__ = 27;
-const int __POPUP__ = 28;
-const int __PROGRESS__ = 29;
-const int __RADIOGROUP__ = 30;
-const int __SCROLL__ = 31;
-const int __SEARCHBAR__ = 32;
-const int __SLIDER__ =33;
-const int __SPLITPANEL__ = 34;
-const int __TABBAR__ = 35;
-const int __TAB__ = 36;
-const int __TABLEVIEW__ = 37;
-const int __TOKENEDIT__ = 38;
-const int __FOCUSUI__ = 39;
+struct TypeDefined
+{
+static const int __BASIC__ = 1;
+static const int __ACCESSIBILITY__ = 2;
+static const int __BUTTON__ = 3;
+static const int __CHECKBUTTON__ = 4;
+static const int __COLORPICKER__ = 5;
+static const int __CONTEXTMENU__ = 6;
+static const int __DATETIMEBAR__ = 7;
+static const int __DATETIMEPICKER__ = 8;
+static const int __EDIT__ = 9;
+static const int __EDITDATE__ = 10;
+static const int __EDITTIME__ = 11;
+static const int __FASTSCROLL__ = 12;
+static const int __FOOTER__ = 13;
+static const int __FORM__ = 14;
+static const int __GALLERY__ = 15;
+static const int __GROUPCONTAINER__ = 16;
+static const int __HEADER__ = 17;
+static const int __ICONLIST__ = 18;
+static const int __INPUTPAD__ = 19;
+static const int __LABEL__ = 20;
+static const int __LIST__ = 21;
+static const int __LISTVIEW__ = 22;
+static const int __APPWIDGET__ = 23;
+static const int __MESSAGEBOX__ = 24;
+static const int __OPTIONMENU__ = 25;
+static const int __OVERLAYPANEL__ = 26;
+static const int __PANEL__ = 27;
+static const int __POPUP__ = 28;
+static const int __PROGRESS__ = 29;
+static const int __RADIOGROUP__ = 30;
+static const int __SCROLL__ = 31;
+static const int __SEARCHBAR__ = 32;
+static const int __SLIDER__ =33;
+static const int __SPLITPANEL__ = 34;
+static const int __TABBAR__ = 35;
+static const int __TAB__ = 36;
+static const int __TABLEVIEW__ = 37;
+static const int __TOKENEDIT__ = 38;
+static const int __FOCUSUI__ = 39;
- struct _TYPE_RESOURCE
+ struct TypeResource
{
static const int _COLOR_ = 0x00010000;
static const int _IMAGE_ = 0x00020000;
static const int _FIXED_VALUE_ = 0x00050000;
static const int _ANIMATION_ = 0x00060000;
};
+};
}
#define DECLARE_UI_CONFIG(x) \
AddConfig(table, mode, GetAPIVersion());\
return true;\
};\
- static const int _VALUE_ = __##x##__ << 24;
+ static const int _VALUE_ = TypeDefined::__##x##__ << 24;
#define DECLARE_END_UI_CONFIG(X) };}}}
-#define DECLARE_COLOR_CONFIG(id,value) static const int id##_COLOR = _VALUE_ + _TYPE_RESOURCE::_COLOR_ + value;
-#define DECLARE_IMAGE_CONFIG(id,value) static const int id##_IMAGE = _VALUE_ + _TYPE_RESOURCE::_IMAGE_ + value;
-#define DECLARE_SHAPE_CONFIG(id,value) static const int id##_SHAPE = _VALUE_ + _TYPE_RESOURCE::_SHAPE_ + value;
-#define DECLARE_DIMENSION_CONFIG(id,value) static const int id##_DIMENSION = _VALUE_ + _TYPE_RESOURCE::_DIMENSION_ + value;
-#define DECLARE_FIXED_VALUE_CONFIG(id,value) static const int id##_FIXED_VALUE = _VALUE_ + _TYPE_RESOURCE::_FIXED_VALUE_ + value;
-#define DECLARE_ANIMATION_CONFIG(id,value) static const int id##_ANIMATION = _VALUE_ + _TYPE_RESOURCE::_ANIMATION_ + value;
+#define DECLARE_COLOR_CONFIG(id,value) static const int id##_COLOR = _VALUE_ + TypeDefined::TypeResource::_COLOR_ + value;
+#define DECLARE_IMAGE_CONFIG(id,value) static const int id##_IMAGE = _VALUE_ + TypeDefined::TypeResource::_IMAGE_ + value;
+#define DECLARE_SHAPE_CONFIG(id,value) static const int id##_SHAPE = _VALUE_ + TypeDefined::TypeResource::_SHAPE_ + value;
+#define DECLARE_DIMENSION_CONFIG(id,value) static const int id##_DIMENSION = _VALUE_ + TypeDefined::TypeResource::_DIMENSION_ + value;
+#define DECLARE_FIXED_VALUE_CONFIG(id,value) static const int id##_FIXED_VALUE = _VALUE_ + TypeDefined::TypeResource::_FIXED_VALUE_ + value;
+#define DECLARE_ANIMATION_CONFIG(id,value) static const int id##_ANIMATION = _VALUE_ + TypeDefined::TypeResource::_ANIMATION_ + value;
#define START_UI_CONFIG(control)\
DECLARE_SHAPE_CONFIG(HANDLE_THREE_DIGIT_TEXT_SIZE, 6);
DECLARE_SHAPE_CONFIG(BAR_HEIGHT, 7);
DECLARE_SHAPE_CONFIG(BAR_LEFT_MARGIN, 8);
- DECLARE_SHAPE_CONFIG(BAR_TOP_MARGIN, 9);
+ DECLARE_SHAPE_CONFIG(TITLE_TEXT_POSITION_Y, 9);
DECLARE_SHAPE_CONFIG(BAR_OFFSET, 10);
DECLARE_SHAPE_CONFIG(ICON_WIDTH, 11);
DECLARE_SHAPE_CONFIG(ICON_HEIGHT, 12);
DECLARE_COLOR_CONFIG(BG_SELECTED, 2);
DECLARE_COLOR_CONFIG(TEXT_NORMAL, 3);
DECLARE_COLOR_CONFIG(TEXT_SELECTED, 4);
+ DECLARE_COLOR_CONFIG(BG_FOCUS, 5);
DECLARE_IMAGE_CONFIG(BG_NORMAL, 1);
DECLARE_IMAGE_CONFIG(BG_NORMAL_EFFECT, 2);
DECLARE_IMAGE_CONFIG(BG_PRESSED_EFFECT, 3);
+ DECLARE_IMAGE_CONFIG(BG_FOCUS, 4);
+ DECLARE_IMAGE_CONFIG(BG_FOCUS_EFFECT, 5);
DECLARE_SHAPE_CONFIG(LEFT_MARGIN, 1);
DECLARE_SHAPE_CONFIG(RIGHT_MARGIN, 2);
DECLARE_SHAPE_CONFIG(TOP_MARGIN, 3);
ADD_COLOR_CONFIG(HANDLE_BG_NORMAL, $W0641);
ADD_COLOR_CONFIG(HANDLE_BG_PRESSED, $W0641P);
ADD_COLOR_CONFIG(HANDLE_BG_DISABLED, $W0641D);
- ADD_COLOR_CONFIG(HANDLE_BG_HIGHLIGHTED, $W0641);
+ ADD_COLOR_CONFIG(HANDLE_BG_HIGHLIGHTED, $W161);
ADD_COLOR_CONFIG(HANDLE_NUMBER_TEXT_DISABLED, $W0611D);
ADD_COLOR_CONFIG(HANDLE_NUMBER_TEXT_NORMAL, $W0611);
ADD_IMAGE_CONFIG(HANDLE_BG_NORMAL, #00_slider_handle.png);
ADD_IMAGE_CONFIG(HANDLE_BG_PRESSED, #00_slider_handle.png);
ADD_IMAGE_CONFIG(HANDLE_BG_DISABLED, #00_slider_handle.png);
- ADD_IMAGE_CONFIG(HANDLE_BG_HIGHLIGHTED, #00_slider_handle.png);
+ ADD_IMAGE_CONFIG(HANDLE_BG_HIGHLIGHTED, #00_slider_handle_focus.png);
ADD_IMAGE_CONFIG(HANDLE_BG_EFFECT_NORMAL, #00_slider_handle_ef.png);
ADD_IMAGE_CONFIG(HANDLE_BG_EFFECT_PRESSED, #00_slider_handle_ef_press.png);
ADD_SHAPE_CONFIG(BAR_HEIGHT, 36);
ADD_SHAPE_CONFIG(BAR_LEFT_MARGIN_WITH_ICON, 26);
ADD_SHAPE_CONFIG(BAR_LEFT_MARGIN, 36);
- ADD_SHAPE_CONFIG(BAR_TOP_MARGIN, 16);
ADD_SHAPE_CONFIG(BAR_OFFSET, 9);
ADD_SHAPE_CONFIG(ICON_WIDTH, 72);
ADD_SHAPE_CONFIG(ICON_RIGHT_MARGIN, 16);
ADD_SHAPE_CONFIG(TITLE_TEXT_POSITION_X, 12);
+ ADD_SHAPE_CONFIG(TITLE_TEXT_POSITION_Y, 16);
ADD_SHAPE_CONFIG(TITLE_TEXT_SIZE, 32);
ADD_SHAPE_CONFIG(TITLE_TEXT_HEIGHT, 49);
ADD_COLOR_CONFIG(BG_SELECTED, $W0713);
ADD_COLOR_CONFIG(TEXT_NORMAL, $F011L10);
ADD_COLOR_CONFIG(TEXT_SELECTED, $F011L10);
+ ADD_COLOR_CONFIG(BG_FOCUS, $W0715);
ADD_IMAGE_CONFIG(BG_NORMAL, #00_contacts_button_bg.#.png);
ADD_IMAGE_CONFIG(BG_NORMAL_EFFECT, #00_contacts_button_bg_ef.#.png);
ADD_IMAGE_CONFIG(BG_PRESSED_EFFECT, #00_contacts_button_bg_press_ef.#.png);
+ ADD_IMAGE_CONFIG(BG_FOCUS, #00_contacts_button_focus.#.png);
+ ADD_IMAGE_CONFIG(BG_FOCUS_EFFECT, #00_contacts_button_focus_ef.#.png);
START_UI_CONFIG_MODE(720x1280);
{