, __pTokenBgBitmap(null)
, __pTokenBgNormalEffectBitmap(null)
, __pTokenBgPressedEffectBitmap(null)
+ , __pTokenBgReplacementFocusBitmap(null)
+ , __pTokenBgFocusEffectBitmap(null)
, __pressedTokenIndex(-1)
, __isEditingToken(false)
, __editingTokenIndex(-1)
, __isAnimationInProgress(false)
, __focusOutIndex(-1)
, __accessibilityElements()
+ , __focusedTokenIndex(-1)
+ , __drawFocusState(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, leftMargin);
GET_SHAPE_CONFIG(TOKENEDIT::RIGHT_MARGIN, orientation, rightMargin);
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 = leftMargin;
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;
}
float tokenTextLeftMargin = 0.0f;
float tokenVerticalSpacing = 0.0f;
bool isCustomBitmap = false;
+ bool isCustomFocusBitmap = false;
SysTryReturn(NID_UI_CTRL, __pTokenEdit != null, false, E_SYSTEM, "[E_SYSTEM] A system error has occurred. The _Token instance is null.");
GET_SHAPE_CONFIG(TOKENEDIT::TOKEN_VERTICAL_SPACING, orientation, tokenVerticalSpacing);
isCustomBitmap = IS_CUSTOM_BITMAP(TOKENEDIT::BG_NORMAL);
+ isCustomFocusBitmap = IS_CUSTOM_BITMAP(TOKENEDIT::BG_FOCUS);
+
+
+ if (__drawFocusState)
+ {
+ __pTokenEdit->RefreshFocusUi();
+ }
if (count == -1)
{
}
}
+ if (__focusedTokenIndex == i && __drawFocusState && (!__isEditingToken))
+ {
+ if (__pTokenBgReplacementFocusBitmap)
+ {
+ if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*__pTokenBgReplacementFocusBitmap))
+ {
+ pTokenCanvas->DrawNinePatchedBitmap(tokenRect, *__pTokenBgReplacementFocusBitmap);
+ }
+ else
+ {
+ pTokenCanvas->DrawBitmap(tokenRect, *__pTokenBgReplacementFocusBitmap);
+ }
+ }
+
+ if (__pTokenBgFocusEffectBitmap && (!isCustomFocusBitmap))
+ {
+ if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*__pTokenBgFocusEffectBitmap))
+ {
+ pTokenCanvas->DrawNinePatchedBitmap(tokenRect, *__pTokenBgFocusEffectBitmap);
+ }
+ else
+ {
+ pTokenCanvas->DrawBitmap(tokenRect, *__pTokenBgFocusEffectBitmap);
+ }
+ }
+
+ }
+
pTokenElement->SetAnimationProvider(null);
if (pToken->isImplicitAnimation)
{
{
__pressedTokenIndex++;
}
+ else if ((__focusedTokenIndex >= index) && __drawFocusState)
+ {
+ __focusedTokenIndex++;
+ }
}
return r;
{
__pressedTokenIndex--;
}
+
+ if (__drawFocusState)
+ {
+ if (index == __focusedTokenIndex)
+ {
+ __focusedTokenIndex = -1;
+ StopCursorTimer();
+ SetCursorDisabled(false);
+ StartCursorTimer();
+ }
+ else if(index >= 0 && index < __focusedTokenIndex)
+ {
+ __focusedTokenIndex--;
+ }
+ }
}
else if (index == __pressedTokenIndex)
{
SetCursorDisabled(false);
StartCursorTimer();
}
+ else if ((index == __focusedTokenIndex) && __drawFocusState)
+ {
+ __focusedTokenIndex = -1;
+ StopCursorTimer();
+ SetCursorDisabled(false);
+ StartCursorTimer();
+ }
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 = AttachCursorToToken();
+ 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;
-
_EditPresenter::StopTitleSlidingTimer();
__isTitleSliding = false;
bool
_TokenEditPresenter::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
{
+ //Remove token focus on touch press
+ __focusedTokenIndex = -1;
+
int tokenIndex = GetTokenIndexFromCoordinate(_CoordinateSystemUtils::ConvertToInteger(touchinfo.GetCurrentPosition()));
__trackTokenIndex = tokenIndex;
void
_TokenEditPresenter::OnTextCommitted(const String& commitText)
{
- result r = E_SUCCESS;
char enterText[2] = {'\n', };
String enterTextComma(",");
String enterTextSemiColon(";");
+
+ //OnTextCommitted blocked for these cases
+ //1. Tab text not to be handled
+ //2. Token is focused
+ char tapText[2] = {'\t', };
+ if (commitText == tapText)
+ {
+ return;
+ }
+
if ((commitText == enterText) || (commitText == enterTextComma) || (commitText == enterTextSemiColon))
{
CoreKeypadAction keypadaction = GetKeypadAction();
if (__editingTokenIndex != -1)
{
- _VisualElement* pEditVisualElement = __pTokenEdit->GetVisualElement();
- SysTryReturnVoidResult(NID_UI_CTRL, pEditVisualElement != null, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to get root visual element.");
-
- _VisualElement* pCursorVisualElement = GetCursorVisualElement();
- SysTryReturnVoidResult(NID_UI_CTRL, pCursorVisualElement != null, E_SYSTEM, "[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(__editingTokenIndex));
-
- if (pToken)
- {
- pTokenVisualElement = pToken->GetVisualElement();
- SysTryReturnVoidResult(NID_UI_CTRL, pTokenVisualElement != null, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to get token visual element.");
-
- if (pCursorVisualElement->GetParent() != pEditVisualElement)
- {
- r = pCursorVisualElement->GetParent()->DetachChild(*pCursorVisualElement);
- SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
-
- r = pEditVisualElement->AttachChild(*pCursorVisualElement);
- SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
- }
- }
-
- String inputTokenString = GetText();
- String replacementString = inputTokenString;
- bool enable = false;
-
- __pTokenEdit->ProcessTokenFiltering(inputTokenString, replacementString, enable);
- if (enable)
- {
- inputTokenString = replacementString;
- }
-
- r = RemoveTokenAt(__editingTokenIndex);
- _EditPresenter::SetTextSize(__editContentFontSize);
- SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
-
- if (inputTokenString.GetLength() > 0)
- {
- r = InsertTokenAt(__editingTokenIndex, inputTokenString);
- SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
-
- pToken = static_cast< _Token* >(__pTokenList->GetAt(__editingTokenIndex));
- SysTryReturnVoidResult(NID_UI_CTRL, pToken != null, E_SYSTEM, "[E_SYSTEM] A system error has occurred. The _Token instance is null.");
-
- pToken->currTokenLength = inputTokenString.GetLength();
- }
-
- CalculateTokenPositionFromIndex(0);
- int lastTokenIndex = GetTokenCount() - 1;
- for (int i = 0; i < lastTokenIndex + 1; i++)
- {
- _Token* pToken = null;
- pToken = static_cast< _Token* >(__pTokenList->GetAt(i));
-
- if (pToken)
- {
- pToken->SetBounds(pToken->displayRect);
- }
- }
-
- AdjustFlexibleHeight();
- __pressedTokenIndex = -1;
- __isTokenEditingFinished = true;
- __editingTokenIndex = -1;
- __isEditingToken = false;
-
- CheckTokenScrolling();
- SetCursorDisabled(false);
-
- if (inputTokenString.GetLength() <= 0)
- {
- SysLog(NID_UI_CTRL, "[E_INVALID_ARG] Invalid argument is used. Token length is (%d)", inputTokenString.GetLength());
- }
-
+ ExitTokenEditingMode();
}
if (GetText().GetLength() > 0)
if (__isEditingToken == false)
{
__pressedTokenIndex = -1;
+ __focusedTokenIndex = -1;
SetCursorDisabled(false);
}
}
}
+ else if (__focusedTokenIndex != -1)
+ {
+ RemoveTokenAt(__focusedTokenIndex);
+ }
else
{
_VisualElement* pEditVisualElement = __pTokenEdit->GetVisualElement();
__pTokenEdit->Invalidate();
return;
}
+ else if (__focusedTokenIndex >= 0 && __editingTokenIndex < 0 && !__isEditingToken)
+ {
+ RemoveTokenAt(__focusedTokenIndex);
+ __pTokenEdit->Invalidate();
+ return;
+ }
//Backspace on Blocked text, delete full block
if (IsBlocked() == true)
return;
}
+result
+_TokenEditPresenter::AttachCursorToToken(void)
+{
+ result r = E_SUCCESS;
+
+ if (__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));
+ 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;
+}
+
+result
+_TokenEditPresenter::DetachCursorFromToken(void)
+{
+ result r = E_SUCCESS;
+
+ if (__pressedTokenIndex != -1)
+ {
+ _VisualElement* pEditVisualElement = __pTokenEdit->GetVisualElement();
+ SysTryReturnResult(NID_UI_CTRL, pEditVisualElement != null, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to get root visual element.");
+
+ _VisualElement* pCursorVisualElement = GetCursorVisualElement();
+ SysTryReturnResult(NID_UI_CTRL, pCursorVisualElement != null, E_SYSTEM, "[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 != null, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to get token visual element.");
+
+ if (pCursorVisualElement->GetParent() != pEditVisualElement)
+ {
+ r = pCursorVisualElement->GetParent()->DetachChild(*pCursorVisualElement);
+ SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pEditVisualElement->AttachChild(*pCursorVisualElement);
+ SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
+ }
+ }
+ }
+ return r;
+}
+
+void
+_TokenEditPresenter::ExitTokenEditingMode(void)
+{
+ result r = E_SUCCESS;
+
+ _VisualElement* pEditVisualElement = __pTokenEdit->GetVisualElement();
+ SysTryReturnVoidResult(NID_UI_CTRL, pEditVisualElement != null, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to get root visual element.");
+
+ _VisualElement* pCursorVisualElement = GetCursorVisualElement();
+ SysTryReturnVoidResult(NID_UI_CTRL, pCursorVisualElement != null, E_SYSTEM, "[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(__editingTokenIndex));
+
+ if (pToken)
+ {
+ pTokenVisualElement = pToken->GetVisualElement();
+ SysTryReturnVoidResult(NID_UI_CTRL, pTokenVisualElement != null, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to get token visual element.");
+
+ if (pCursorVisualElement->GetParent() != pEditVisualElement)
+ {
+ r = pCursorVisualElement->GetParent()->DetachChild(*pCursorVisualElement);
+ SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pEditVisualElement->AttachChild(*pCursorVisualElement);
+ SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
+ }
+ }
+
+ String inputTokenString = GetText();
+ String replacementString = inputTokenString;
+ bool enable = false;
+
+ __pTokenEdit->ProcessTokenFiltering(inputTokenString, replacementString, enable);
+ if (enable)
+ {
+ inputTokenString = replacementString;
+ }
+
+ r = RemoveTokenAt(__editingTokenIndex);
+
+ _EditPresenter::SetTextSize(__editContentFontSize);
+ SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ if (inputTokenString.GetLength() > 0)
+ {
+ r = InsertTokenAt(__editingTokenIndex, inputTokenString);
+ SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pToken = static_cast <_Token*>(__pTokenList->GetAt(__editingTokenIndex));
+ SysTryReturnVoidResult(NID_UI_CTRL, pToken != null, E_SYSTEM, "[E_SYSTEM] A system error has occurred. The _Token instance is null.");
+
+ pToken->currTokenLength = inputTokenString.GetLength();
+ }
+
+ CalculateTokenPositionFromIndex(0);
+ int lastTokenIndex = GetTokenCount() - 1;
+ for (int i = 0; i < lastTokenIndex + 1; i++)
+ {
+ _Token* pToken = null;
+ pToken = static_cast <_Token*>(__pTokenList->GetAt(i));
+
+ if (pToken)
+ {
+ pToken->SetBounds(pToken->displayRect);
+ }
+ }
+
+ AdjustFlexibleHeight();
+ __pressedTokenIndex = -1;
+ __isTokenEditingFinished = true;
+ __editingTokenIndex = -1;
+ __isEditingToken = false;
+
+ CheckTokenScrolling();
+ SetCursorDisabled(false);
+
+ if (inputTokenString.GetLength() <= 0)
+ {
+ SysLog(NID_UI_CTRL, "[E_INVALID_ARG] Invalid argument is used. Token length is (%d)", inputTokenString.GetLength());
+ }
+
+ return;
+}
+
bool
_TokenEditPresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
{
_KeyCode keyCode = keyInfo.GetKeyCode();
+ bool focusChanged = false;
+ int tokenCount = GetTokenCount();
+ int lastTokenIndex = tokenCount - 1;
if (IsUsbKeyboardConnected() && (keyInfo.GetKeyModifier() & _KEY_MODIFIER_CTRL))
{
}
}
+ if ((keyCode == _KEY_NUM_LEFT) || (keyCode == _KEY_LEFT))
+ {
+ if (__drawFocusState && (!__isEditingToken) && (tokenCount > 0))
+ {
+ if (__focusedTokenIndex == -1)
+ {
+ if (GetCursorPosition() == 0)
+ {
+ __focusedTokenIndex = lastTokenIndex;
+ if (GetTextLength() > 0)
+ {
+ MakeToken();
+ StopCursorTimer();
+ SetCursorDisabled(true);
+ __pTokenEdit->Invalidate();
+
+ StartCursorTimer();
+
+ return _EditPresenter::OnKeyPressed(source, keyInfo);
+ }
+ focusChanged = true;
+ }
+ }
+ else
+ {
+ __focusedTokenIndex--;
+ focusChanged = true;
+ }
+ }
+ }
+
+ if ((keyCode == _KEY_NUM_RIGHT) || (keyCode == _KEY_RIGHT))
+ {
+ if (__drawFocusState && (!__isEditingToken) && (tokenCount > 0))
+ {
+ if (__focusedTokenIndex != -1)
+ {
+ if (__focusedTokenIndex == lastTokenIndex)
+ {
+ __focusedTokenIndex = -1;
+ focusChanged = true;
+ }
+ else
+ {
+ __focusedTokenIndex++;
+ focusChanged = true;
+ }
+ }
+ }
+ }
+
+ if (focusChanged)
+ {
+ StopCursorTimer();
+ if (__focusedTokenIndex != -1)
+ {
+ SetCursorDisabled(true);
+ }
+ else
+ {
+ SetCursorDisabled(false);
+ }
+ StartCursorTimer();
+ ScrollToFocussedToken();
+ }
+
return _EditPresenter::OnKeyPressed(source, keyInfo);
}
return false;
}
+result
+_TokenEditPresenter::ScrollToFocussedToken(void)
+{
+ result r = E_SUCCESS;
+ 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)
+ {
+ //Focus bitmap to be reset when no token is focused.
+ DrawToken();
+ }
+ else
+ {
+ _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;
+}
+
+void
+_TokenEditPresenter::SetDrawFocusState(bool focusState)
+{
+ if (!focusState)
+ {
+ __focusedTokenIndex = -1;
+ }
+ __drawFocusState = focusState;
+
+ return;
+}
+
+int
+_TokenEditPresenter::GetFocusedTokenIndex(void) const
+{
+ return __focusedTokenIndex;
+}
+
+void
+_TokenEditPresenter::PrepareFocusUiMode(void)
+{
+ if (__editingTokenIndex != -1)
+ {
+ ExitTokenEditingMode();
+ }
+ else if (__pressedTokenIndex != -1)
+ {
+ __pressedTokenIndex = -1;
+ DetachCursorFromToken();
+ StopCursorTimer();
+ SetCursorDisabled(false);
+ __pTokenEdit->Invalidate();
+ StartCursorTimer();
+ }
+
+ return;
+}
+
}}} //Tizen::Ui::Controls