#include <FGrp_TextTextSimple.h>
#include <FGrp_FontImpl.h>
#include "FUiAnim_VisualElement.h"
+#include "FUiAnim_ControlVisualElement.h"
+#include "FUiAnim_VisualElementImpl.h"
#include "FUi_UiTouchEvent.h"
#include "FUiCtrl_TokenEditPresenter.h"
#include "FUiCtrl_Scroll.h"
#include "FUi_AccessibilityElement.h"
#include "FUiAnim_VisualElementImpl.h"
+using namespace Tizen::Ui::Animations;
using namespace Tizen::Base;
using namespace Tizen::Base::Runtime;
using namespace Tizen::Media;
, __clientRect(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f))
, __initTextRect(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f))
, __isEditModeEnabled(true)
- , __pDescriptionTextVisualElement(null)
- , __pDescriptionTextTextObject(null)
+ , __pTitleTextVisualElement(null)
+ , __pFocusRingVisualElement(null)
+ , __pTitleTextObject(null)
, __isTokenEditingFinished(false)
, __prevScrollValue(0.0f)
, __scrollValue(0.0f)
, __isNeedToScroll(false)
, __maxScrollValue(0.0f)
, __autoShrink(false)
- , __descriptionText(String())
+ , __titleText(String())
, __isPopupVisible(false)
, __isLongPressed(false)
, __lineSpacing(0.0f)
, __animatingIndex(-1)
, __lastTokenIndex(-1)
, __pTimingFunction(null)
- , __descriptionTextRectForScroll(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f))
+ , __titleTextRectForScroll(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f))
, __previousTitleWidth(-1.0f)
, __isTokenEditPresenterInitialized(false)
, __isFocus(false)
}
result
-_TokenEditPresenter::InitializeDescriptionText(void)
+_TokenEditPresenter::InitializeTitleText(void)
{
result r = E_SUCCESS;
- float descriptionTextSize = 0.0f;
+ float titleTextSize = 0.0f;
Font* pFont = null;
float editFontSize = 0.0f;
- __pDescriptionTextTextObject = new (std::nothrow) TextObject();
- SysTryReturnResult(NID_UI_CTRL, __pDescriptionTextTextObject != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ __pTitleTextObject = new (std::nothrow) TextObject();
+ SysTryReturnResult(NID_UI_CTRL, __pTitleTextObject != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
// for default initialize.
- r = __pDescriptionTextTextObject->Construct();
+ r = __pTitleTextObject->Construct();
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
- r = __pDescriptionTextTextObject->SetAlignment(TEXT_OBJECT_ALIGNMENT_LEFT | TEXT_OBJECT_ALIGNMENT_MIDDLE);
+ r = __pTitleTextObject->SetAlignment(TEXT_OBJECT_ALIGNMENT_LEFT | TEXT_OBJECT_ALIGNMENT_MIDDLE);
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
- r = __pDescriptionTextTextObject->SetWrap(TEXT_OBJECT_WRAP_TYPE_NONE);
+ r = __pTitleTextObject->SetWrap(TEXT_OBJECT_WRAP_TYPE_NONE);
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
- GET_SHAPE_CONFIG(TOKENEDIT::DESCRIPTION_TEXT_SIZE, _CONTROL_ORIENTATION_PORTRAIT, descriptionTextSize);
+ GET_SHAPE_CONFIG(TOKENEDIT::DESCRIPTION_TEXT_SIZE, _CONTROL_ORIENTATION_PORTRAIT, titleTextSize);
pFont = GetFont();
SysTryCatch(NID_UI_CTRL, pFont != null, , r, "[%s] Propagating.", GetErrorMessage(r));
editFontSize = GetTextSize();
- (_FontImpl::GetInstance(*pFont))->SetSize(descriptionTextSize);
+ (_FontImpl::GetInstance(*pFont))->SetSize(titleTextSize);
- r = __pDescriptionTextTextObject->SetFont(pFont, 0, __pDescriptionTextTextObject->GetTextLength());
+ r = __pTitleTextObject->SetFont(pFont, 0, __pTitleTextObject->GetTextLength());
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
(_FontImpl::GetInstance(*pFont))->SetSize(editFontSize);
CATCH:
- delete __pDescriptionTextTextObject;
- __pDescriptionTextTextObject = null;
+ delete __pTitleTextObject;
+ __pTitleTextObject = null;
return r;
}
delete __pTokenBgHighlightedEffectBitmap;
__pTokenBgHighlightedEffectBitmap = null;
- if (__pDescriptionTextVisualElement != null)
+ if (__pTitleTextVisualElement != null)
+ {
+ __pTitleTextVisualElement->Destroy();
+ __pTitleTextVisualElement = null;
+ }
+
+ if (__pFocusRingVisualElement != null)
{
- __pDescriptionTextVisualElement->Destroy();
- __pDescriptionTextVisualElement = null;
+ __pFocusRingVisualElement->Destroy();
+ __pFocusRingVisualElement = null;
}
- delete __pDescriptionTextTextObject;
- __pDescriptionTextTextObject = null;
+ delete __pTitleTextObject;
+ __pTitleTextObject = null;
delete __pTimingFunction;
__pTimingFunction = null;
r = _EditPresenter::Initialize(control);
SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
- r = InitializeDescriptionText();
+ r = InitializeTitleText();
SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
TextObject* pTextObject = GetTextObject();
DrawScrollBar();
- if (__pDescriptionTextTextObject->GetTextLength() != 0)
+ if (__pTitleTextObject->GetTextLength() != 0)
{
- DrawDescriptionText();
+ DrawTitleText();
}
if (GetTokenCount() != 0)
float tokenHorizontalSpacing = 0.0f;
float tokenTextLeftMargin = 0.0f;
float tokenTextRightMargin = 0.0f;
- float descriptionTextRightMargin = 0.0f;
+ float titleTextRightMargin = 0.0f;
_ControlOrientation orientation = __pTokenEdit->GetOrientation();
GET_SHAPE_CONFIG(TOKENEDIT::LEFT_MARGIN, orientation, leftMargin);
GET_SHAPE_CONFIG(TOKENEDIT::TOKEN_HORIZONTAL_SPACING, orientation, tokenHorizontalSpacing);
GET_SHAPE_CONFIG(TOKENEDIT::TOKEN_TEXT_LEFT_MARGIN, orientation, tokenTextLeftMargin);
GET_SHAPE_CONFIG(TOKENEDIT::TOKEN_TEXT_RIGHT_MARGIN, orientation, tokenTextRightMargin);
- GET_SHAPE_CONFIG(TOKENEDIT::DESCRIPTION_TEXT_RIGHT_MARGIN, orientation, descriptionTextRightMargin);
+ GET_SHAPE_CONFIG(TOKENEDIT::DESCRIPTION_TEXT_RIGHT_MARGIN, orientation, titleTextRightMargin);
SysTryReturn(NID_UI_CTRL, startIndex >= 0 && startIndex <= tokenCount, E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. startIndex (%d) is not valid.", GetErrorMessage(E_INVALID_ARG), startIndex);
FloatRectangle tokenEditBounds = __pTokenEdit->GetBoundsF();
String titleText = __pTokenEdit->GetTitleText();
- if (!_FloatCompare(GetDescriptionTextRect().width, __previousTitleWidth))
+ if (!_FloatCompare(GetTitleTextRect().width, __previousTitleWidth))
{
- __descriptionTextRectForScroll = GetDescriptionTextRect();
- __previousTitleWidth = GetDescriptionTextRect().width;
+ __titleTextRectForScroll = GetTitleTextRect();
+ __previousTitleWidth = GetTitleTextRect().width;
}
bool findPrevTokenLoopFlag = true;
// TODO : description text (title style inner)
if (titleText.GetLength())
{
- pToken->displayRect.x = __descriptionTextRectForScroll.x + __descriptionTextRectForScroll.width + descriptionTextRightMargin;
- pToken->displayRect.y = __descriptionTextRectForScroll.y + __scrollValue;
+ pToken->displayRect.x = __titleTextRectForScroll.x + __titleTextRectForScroll.width + titleTextRightMargin;
+ pToken->displayRect.y = __titleTextRectForScroll.y + __scrollValue;
}
else // Set description text.
{
float tokenTextLeftMargin = 0.0f;
float tokenTextRightMargin = 0.0f;
float textBoundsAlignValue = 0.0f;
- float descriptionTextRightMargin = 0.0f;
+ float titleTextRightMargin = 0.0f;
_ControlOrientation orientation = GetEditView()->GetOrientation();
GET_SHAPE_CONFIG(TOKENEDIT::LEFT_MARGIN, orientation, leftMargin);
GET_SHAPE_CONFIG(TOKENEDIT::TOKEN_HORIZONTAL_SPACING, orientation, tokenHorizontalSpacing);
GET_SHAPE_CONFIG(TOKENEDIT::TOKEN_TEXT_LEFT_MARGIN, orientation, tokenTextLeftMargin);
GET_SHAPE_CONFIG(TOKENEDIT::TOKEN_TEXT_RIGHT_MARGIN, orientation, tokenTextRightMargin);
- GET_SHAPE_CONFIG(TOKENEDIT::DESCRIPTION_TEXT_RIGHT_MARGIN, orientation, descriptionTextRightMargin);
+ GET_SHAPE_CONFIG(TOKENEDIT::DESCRIPTION_TEXT_RIGHT_MARGIN, orientation, titleTextRightMargin);
float textObjectMaxHeight = GetMaxTextHeight();
textBoundsAlignValue = (tokenHeight - textObjectMaxHeight) / 2.0f;
{
if (__pTokenEdit->GetTitleText().GetLength())
{
- FloatRectangle descriptionTextRect = GetDescriptionTextRect();
- tokenTextRect.x = descriptionTextRect.x + descriptionTextRect.width + descriptionTextRightMargin;
+ FloatRectangle titleTextRect = GetTitleTextRect();
+ tokenTextRect.x = titleTextRect.x + titleTextRect.width + titleTextRightMargin;
}
else
{
}
result
-_TokenEditPresenter::SetDescriptionTextRect(const FloatRectangle& rect)
+_TokenEditPresenter::SetTitleTextRect(const FloatRectangle& rect)
{
result r = E_SUCCESS;
- __descriptionTextRect = rect;
+ __titleTextRect = rect;
return r;
}
FloatRectangle
-_TokenEditPresenter::GetDescriptionTextRect() const
+_TokenEditPresenter::GetTitleTextRect() const
{
- return __descriptionTextRect;
+ return __titleTextRect;
}
Rectangle
}
result
-_TokenEditPresenter::CalculateDescriptionTextRect(const String& descriptionText)
+_TokenEditPresenter::CalculateTitleTextRect(const String& titleText)
{
result r = E_SUCCESS;
GET_SHAPE_CONFIG(TOKENEDIT::TOKEN_TEXT_RIGHT_MARGIN, orientation, tokenTextRightMargin);
GET_SHAPE_CONFIG(TOKENEDIT::TOKEN_TITLE_RECT_WIDTH, orientation, tokenTitleWidth);
- int length = descriptionText.GetLength();
+ int length = titleText.GetLength();
FloatDimension textSize;
- wchar_t* pTempString = const_cast< wchar_t* >(descriptionText.GetPointer());
+ wchar_t* pTempString = const_cast< wchar_t* >(titleText.GetPointer());
- SysAssertf(__pDescriptionTextTextObject != null, "The TextObject instance is null.");
+ SysAssertf(__pTitleTextObject != null, "The TextObject instance is null.");
- __pDescriptionTextTextObject->RemoveAll(true);
+ __pTitleTextObject->RemoveAll(true);
pSimpleText = new (std::nothrow) TextSimple(pTempString, length, TEXT_ELEMENT_SOURCE_TYPE_INTERNAL);
- __pDescriptionTextTextObject->AppendElement(*pSimpleText);
+ __pTitleTextObject->AppendElement(*pSimpleText);
- textSize = __pDescriptionTextTextObject->GetTextExtentF(0, length);
- r = __pDescriptionTextTextObject->SetAlignment(TEXT_OBJECT_ALIGNMENT_CENTER | TEXT_OBJECT_ALIGNMENT_MIDDLE);
- r = __pDescriptionTextTextObject->SetWrap(TEXT_OBJECT_WRAP_TYPE_NONE);
+ textSize = __pTitleTextObject->GetTextExtentF(0, length);
+ r = __pTitleTextObject->SetAlignment(TEXT_OBJECT_ALIGNMENT_CENTER | TEXT_OBJECT_ALIGNMENT_MIDDLE);
+ r = __pTitleTextObject->SetWrap(TEXT_OBJECT_WRAP_TYPE_NONE);
- __descriptionTextRect.x = leftMargin + __pTokenEdit->GetHorizontalMarginF(EDIT_TEXT_LEFT_MARGIN);
- __descriptionTextRect.y = tokenTopMargin + __pTokenEdit->GetVerticalMarginF(EDIT_TEXT_TOP_MARGIN);
+ __titleTextRect.x = leftMargin + __pTokenEdit->GetHorizontalMarginF(EDIT_TEXT_LEFT_MARGIN);
+ __titleTextRect.y = tokenTopMargin + __pTokenEdit->GetVerticalMarginF(EDIT_TEXT_TOP_MARGIN);
if (textSize.width > tokenTitleWidth)
{
textSize.width = tokenTitleWidth;
- __pDescriptionTextTextObject->SetTextObjectEllipsisType(TEXT_OBJECT_ELLIPSIS_TYPE_TAIL);
+ __pTitleTextObject->SetTextObjectEllipsisType(TEXT_OBJECT_ELLIPSIS_TYPE_TAIL);
}
- __descriptionTextRect.width = tokenTextLeftMargin + textSize.width + tokenTextRightMargin;
- __descriptionTextRect.height = tokenHeight;
- __pDescriptionTextTextObject->SetBounds(__descriptionTextRect);
+ __titleTextRect.width = tokenTextLeftMargin + textSize.width + tokenTextRightMargin;
+ __titleTextRect.height = tokenHeight;
+ __pTitleTextObject->SetBounds(__titleTextRect);
- if (__pDescriptionTextTextObject->IsChanged())
+ if (__pTitleTextObject->IsChanged())
{
_EditPresenter::StopTitleSlidingTimer();
__isTitleSliding = false;
}
- r = __pDescriptionTextTextObject->Compose();
+ r = __pTitleTextObject->Compose();
return r;
}
}
bool
-_TokenEditPresenter::DrawDescriptionText(void)
+_TokenEditPresenter::DrawTitleText(void)
{
result r = E_SUCCESS;
- FloatRectangle tempDescriptionTextRect;
- FloatRectangle descriptionTextRect(__descriptionTextRect);
- Canvas* pDescriptionTextCanvas = null;
+ FloatRectangle tempTitleTextRect;
+ FloatRectangle titleTextRect(__titleTextRect);
+ Canvas* pTitleTextCanvas = null;
Font* pDescriptionFont = null;
TextObjectActionType titleAction;
_VisualElement* pRootElement = null;
- if (__pDescriptionTextTextObject->GetFont(0)->GetFaceName() != GetTitleFontFaceName())
+ if (__pTitleTextObject->GetFont(0)->GetFaceName() != GetTitleFontFaceName())
{
- float descriptionTextSize = 0.0f;
- GET_SHAPE_CONFIG(TOKENEDIT::DESCRIPTION_TEXT_SIZE, _CONTROL_ORIENTATION_PORTRAIT, descriptionTextSize);
+ float titleTextSize = 0.0f;
+ GET_SHAPE_CONFIG(TOKENEDIT::DESCRIPTION_TEXT_SIZE, _CONTROL_ORIENTATION_PORTRAIT, titleTextSize);
pDescriptionFont = GetFont();
if (pDescriptionFont != null)
{
float editFontSize = GetTextSize();
- (_FontImpl::GetInstance(*pDescriptionFont))->SetSize(descriptionTextSize);
+ (_FontImpl::GetInstance(*pDescriptionFont))->SetSize(titleTextSize);
- r = __pDescriptionTextTextObject->SetFont(pDescriptionFont, 0, __pDescriptionTextTextObject->GetTextLength());
+ r = __pTitleTextObject->SetFont(pDescriptionFont, 0, __pTitleTextObject->GetTextLength());
SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[%s] A system error has occurred. Failed to set the description text font.", GetErrorMessage(E_SYSTEM));
(_FontImpl::GetInstance(*pDescriptionFont))->SetSize(editFontSize);
pRootElement = __pTokenEdit->GetVisualElement();
SysTryCatch(NID_UI_CTRL, pRootElement, , E_SYSTEM, "[%s] A system error has occurred. Failed to get _TokenEdit visual element.", GetErrorMessage(E_SYSTEM));
- if (__pDescriptionTextVisualElement == null)
+ if (__pTitleTextVisualElement == null)
{
- __pDescriptionTextVisualElement = new (std::nothrow) _VisualElement();
- SysTryCatch(NID_UI_CTRL, __pDescriptionTextVisualElement, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- r = __pDescriptionTextVisualElement->Construct();
+ __pTitleTextVisualElement = new (std::nothrow) _VisualElement();
+ SysTryCatch(NID_UI_CTRL, __pTitleTextVisualElement, , E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ r = __pTitleTextVisualElement->Construct();
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] A system error has occurred. Failed to construct _VisualElement", GetErrorMessage(E_SYSTEM));
- __pDescriptionTextVisualElement->SetImplicitAnimationEnabled(false);
- __pDescriptionTextVisualElement->SetShowState(true);
+ __pTitleTextVisualElement->SetImplicitAnimationEnabled(false);
+ __pTitleTextVisualElement->SetShowState(true);
- r = pRootElement->AttachChild(*__pDescriptionTextVisualElement);
+ r = pRootElement->AttachChild(*__pTitleTextVisualElement);
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
}
- descriptionTextRect.y = __descriptionTextRectForScroll.y + __scrollValue;
- __pDescriptionTextVisualElement->SetBounds(descriptionTextRect);
- UpdateTitleAccessibilityBounds(descriptionTextRect); // Update title accessibility bounds to same as DescriptionTextVisualElement bounds
+ titleTextRect.y = __titleTextRectForScroll.y + __scrollValue;
+ __pTitleTextVisualElement->SetBounds(titleTextRect);
+ UpdateTitleAccessibilityBounds(titleTextRect); // Update title accessibility bounds to same as TitleTextVisualElement bounds
- pDescriptionTextCanvas = __pDescriptionTextVisualElement->GetCanvasN();
- SysTryCatch(NID_UI_CTRL, pDescriptionTextCanvas != null, , E_SYSTEM, "[%s] A system error has occurred. Failed to get canvas of description text _VisualElement instance.", GetErrorMessage(E_SYSTEM));
+ pTitleTextCanvas = __pTitleTextVisualElement->GetCanvasN();
+ SysTryCatch(NID_UI_CTRL, pTitleTextCanvas != null, , E_SYSTEM, "[%s] A system error has occurred. Failed to get canvas of description text _VisualElement instance.", GetErrorMessage(E_SYSTEM));
- tempDescriptionTextRect = __descriptionTextRect;
- tempDescriptionTextRect.x = 0.0f;
- tempDescriptionTextRect.y = 0.0f;
+ tempTitleTextRect = __titleTextRect;
+ tempTitleTextRect.x = 0.0f;
+ tempTitleTextRect.y = 0.0f;
- titleAction = __pDescriptionTextTextObject->GetAction();
+ titleAction = __pTitleTextObject->GetAction();
- pDescriptionTextCanvas->SetBackgroundColor(Color(0));
- pDescriptionTextCanvas->Clear();
- __pDescriptionTextTextObject->SetForegroundColor(__pTokenEdit->GetTitleTextColor(GetCurrentStatus()), 0, __pDescriptionTextTextObject->GetTextLength());
+ pTitleTextCanvas->SetBackgroundColor(Color(0));
+ pTitleTextCanvas->Clear();
+ __pTitleTextObject->SetForegroundColor(__pTokenEdit->GetTitleTextColor(GetCurrentStatus()), 0, __pTitleTextObject->GetTextLength());
if (IsFocused())
{
if (titleAction != TEXT_OBJECT_ACTION_TYPE_SLIDE_LEFT)
{
- __pDescriptionTextTextObject->SetAction(TEXT_OBJECT_ACTION_TYPE_SLIDE_LEFT);
- __pDescriptionTextTextObject->Compose();
+ __pTitleTextObject->SetAction(TEXT_OBJECT_ACTION_TYPE_SLIDE_LEFT);
+ __pTitleTextObject->Compose();
}
// Draw title text
- __pDescriptionTextTextObject->SetBounds(tempDescriptionTextRect);
- __pDescriptionTextTextObject->Draw(*_CanvasImpl::GetInstance(*pDescriptionTextCanvas));
+ __pTitleTextObject->SetBounds(tempTitleTextRect);
+ __pTitleTextObject->Draw(*_CanvasImpl::GetInstance(*pTitleTextCanvas));
if (!__isTitleSliding)
{
_EditPresenter::StopTitleSlidingTimer();
- if (__pDescriptionTextTextObject->IsActionOn())
+ if (__pTitleTextObject->IsActionOn())
{
_EditPresenter::StartTitleSlidingTimer();
__isTitleSliding = true;
{
if (titleAction != TEXT_OBJECT_ACTION_TYPE_ABBREV)
{
- __pDescriptionTextTextObject->SetAction(TEXT_OBJECT_ACTION_TYPE_ABBREV);
- __pDescriptionTextTextObject->Compose();
+ __pTitleTextObject->SetAction(TEXT_OBJECT_ACTION_TYPE_ABBREV);
+ __pTitleTextObject->Compose();
}
// Draw title text
- __pDescriptionTextTextObject->SetBounds(tempDescriptionTextRect);
- __pDescriptionTextTextObject->Draw(*_CanvasImpl::GetInstance(*pDescriptionTextCanvas));
+ __pTitleTextObject->SetBounds(tempTitleTextRect);
+ __pTitleTextObject->Draw(*_CanvasImpl::GetInstance(*pTitleTextCanvas));
}
- delete pDescriptionTextCanvas;
+ delete pTitleTextCanvas;
return true;
CATCH:
- if (__pDescriptionTextVisualElement != null)
+ if (__pTitleTextVisualElement != null)
{
- __pDescriptionTextVisualElement->Destroy();
- __pDescriptionTextVisualElement = null;
+ __pTitleTextVisualElement->Destroy();
+ __pTitleTextVisualElement = null;
}
return false;
InitializeTokenVisibilityAt(i);
}
- if (__pDescriptionTextTextObject->GetTextLength() != 0)
+ if (__pTitleTextObject->GetTextLength() != 0)
{
- __descriptionTextRect.y = __descriptionTextRectForScroll.y + __scrollValue;
+ __titleTextRect.y = __titleTextRectForScroll.y + __scrollValue;
}
__pTokenEdit->Invalidate();
InitializeTokenVisibilityAt(i);
}
- if (__pDescriptionTextTextObject->GetTextLength() != 0)
+ if (__pTitleTextObject->GetTextLength() != 0)
{
- __descriptionTextRect.y = __descriptionTextRectForScroll.y + __scrollValue;
+ __titleTextRect.y = __titleTextRectForScroll.y + __scrollValue;
}
__pTokenEdit->Invalidate();
}
void
-_TokenEditPresenter::SetDescriptionText(String descriptionText)
+_TokenEditPresenter::SetTitleText(String titleText)
{
- __descriptionText = descriptionText;
+ __titleText = titleText;
return;
}
String
-_TokenEditPresenter::GetDescriptionText(void) const
+_TokenEditPresenter::GetTitleText(void) const
{
- return __descriptionText;
+ return __titleText;
}
int
if (!__isFocus)
{
- __descriptionTextRect.y = __descriptionTextRectForScroll.y + __scrollValue;
+ __titleTextRect.y = __titleTextRectForScroll.y + __scrollValue;
__isFocus = true;
}
SetEditingTokenTextBounds(__editingTokenIndex, false);
- __descriptionTextRect.y = __descriptionTextRectForScroll.y + __scrollValue;
+ __titleTextRect.y = __titleTextRectForScroll.y + __scrollValue;
}
RemoveChildAccessibilityElements();
_TokenEditPresenter::OnTimerExpired(Timer& timer)
{
Timer* onTimer = &timer;
- Canvas* pDescriptionTextCanvas = null;
+ Canvas* pTitleTextCanvas = null;
if (onTimer == __pTitleSlidingTimer)
{
return;
}
- FloatRectangle tempDescriptionTextRect = __descriptionTextRect;
- tempDescriptionTextRect.x = 0.0f;
- tempDescriptionTextRect.y = 0.0f;
+ FloatRectangle tempTitleTextRect = __titleTextRect;
+ tempTitleTextRect.x = 0.0f;
+ tempTitleTextRect.y = 0.0f;
- pDescriptionTextCanvas = __pDescriptionTextVisualElement->GetCanvasN();
- SysTryReturnVoidResult(NID_UI_CTRL, pDescriptionTextCanvas, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ pTitleTextCanvas = __pTitleTextVisualElement->GetCanvasN();
+ SysTryReturnVoidResult(NID_UI_CTRL, pTitleTextCanvas, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- pDescriptionTextCanvas->SetBackgroundColor(Color(0));
- pDescriptionTextCanvas->Clear();
- __pDescriptionTextTextObject->SetBounds(tempDescriptionTextRect);
- __pDescriptionTextTextObject->DrawWithOffset(*_CanvasImpl::GetInstance(*pDescriptionTextCanvas));
- Rectangle descriptionTextRect = _CoordinateSystemUtils::ConvertToInteger(tempDescriptionTextRect);
- pDescriptionTextCanvas->Show(descriptionTextRect);
+ pTitleTextCanvas->SetBackgroundColor(Color(0));
+ pTitleTextCanvas->Clear();
+ __pTitleTextObject->SetBounds(tempTitleTextRect);
+ __pTitleTextObject->DrawWithOffset(*_CanvasImpl::GetInstance(*pTitleTextCanvas));
+ Rectangle titleTextRect = _CoordinateSystemUtils::ConvertToInteger(tempTitleTextRect);
+ pTitleTextCanvas->Show(titleTextRect);
- delete pDescriptionTextCanvas;
+ delete pTitleTextCanvas;
_EditPresenter::StartTitleSlidingTimer();
__isTitleSliding = true;
return E_SUCCESS;
}
+result
+_TokenEditPresenter::DrawFocusRing(Tizen::Graphics::Canvas& /*canvas*/)
+{
+ if (IsViewModeEnabled(false) || !__pTokenEdit->IsEnabled() || !IsCurrentFocused())
+ {
+ if (__pFocusRingVisualElement != null)
+ {
+ __pFocusRingVisualElement->Destroy();
+ __pFocusRingVisualElement = null;
+ }
+ return E_SUCCESS;
+ }
+
+ result r = E_SUCCESS;
+ Bitmap* pFocusRing = null;
+ Bitmap* pReplacementFocusRing = null;
+ Canvas* pCanvas = null;
+ Color color = __pTokenEdit->GetColor(EDIT_STATUS_HIGHLIGHTED);
+ _VisualElement* pControlVisualElement = __pTokenEdit->GetVisualElement();
+
+ if (IsCurrentFocused() && color.GetAlpha())
+ {
+ Color focusColor;
+ GET_COLOR_CONFIG(FOCUSUI::CONTENT_BG_HIGHLIGHTED, focusColor);
+ focusColor.SetAlpha(color.GetAlpha());
+
+ if (__pFocusRingVisualElement == null)
+ {
+ __pFocusRingVisualElement = new (std::nothrow) _VisualElement();
+ SysTryReturnResult(NID_UI_CTRL, __pFocusRingVisualElement != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
+
+ r = __pFocusRingVisualElement->Construct();
+ SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ _VisualElementImpl* pImpl = _VisualElementImpl::GetInstance(*__pFocusRingVisualElement);
+ SysTryCatch(NID_UI_CTRL, pImpl, r = GetLastResult(), r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pImpl->SetZOrderGroup(_ControlVisualElement::Z_ORDER_GROUP_CONTROL + 3);
+ SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pFocusRingVisualElement->SetImplicitAnimationEnabled(false);
+
+ pControlVisualElement->AttachChild(*__pFocusRingVisualElement);
+ }
+
+ r = GET_BITMAP_CONFIG_N(EDIT::BG_RING_FOCUSED, BITMAP_PIXEL_FORMAT_ARGB8888, pFocusRing);
+ SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ FloatRectangle editRect(0.0f, 0.0f, __pTokenEdit->GetBoundsF().width, __pTokenEdit->GetBoundsF().height);
+
+ pReplacementFocusRing= _BitmapImpl::GetColorReplacedBitmapN(*pFocusRing, Color::GetColor(COLOR_ID_MAGENTA), focusColor);
+ SysTryCatch(NID_UI_CTRL, pReplacementFocusRing, , r = GetLastResult(), "Unable to allocate text buffer.");
+
+ __pFocusRingVisualElement->SetBounds(editRect);
+
+ pCanvas = __pFocusRingVisualElement->GetCanvasN();
+ SysTryCatch(NID_UI_CTRL, pCanvas, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pCanvas->SetBackgroundColor(Color(0));
+ pCanvas->Clear();
+
+ if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pReplacementFocusRing))
+ {
+ pCanvas->DrawNinePatchedBitmap(editRect, *pReplacementFocusRing);
+ }
+
+ __pFocusRingVisualElement->SetShowState(true);
+
+ delete pFocusRing;
+ delete pReplacementFocusRing;
+ delete pCanvas;
+ }
+
+ return r;
+
+CATCH:
+ if (__pFocusRingVisualElement != null)
+ {
+ __pFocusRingVisualElement->Destroy();
+ __pFocusRingVisualElement = null;
+ }
+
+ delete pFocusRing;
+ delete pReplacementFocusRing;
+
+ return r;
+}
+
}}} //Tizen::Ui::Controls