}
int
-_EditPresenter::GetCursorPositionAt(const Point& touchPoint) const
-{
- Point cursorPoint;
- int cursorPos = -1;
-
- Rectangle textObjectBounds = _CoordinateSystemUtils::ConvertToInteger(__textObjectBounds);
- Rectangle textBoxBounds = _CoordinateSystemUtils::ConvertToInteger(__textBoxBounds);
-
- if (!(__pEdit->GetEditStyle() & EDIT_STYLE_TOKEN) == false)
- {
- if (IsTextBlockedInTokenEdit())
- {
- textObjectBounds = GetTextBounds();
- }
- }
-
- if (textObjectBounds.Contains(touchPoint))
- {
- cursorPoint.x = touchPoint.x - textObjectBounds.x;
- cursorPoint.y = touchPoint.y - textObjectBounds.y;
- }
- else if (textBoxBounds.Contains(touchPoint))
- {
- if (touchPoint.y <= textObjectBounds.y)
- {
- cursorPoint.y = textObjectBounds.y + 1;
- }
- else if (touchPoint.y >= (textObjectBounds.y + textObjectBounds.height))
- {
- cursorPoint.y = textObjectBounds.y + textObjectBounds.height - 1;
- }
- else
- {
- cursorPoint.y = touchPoint.y;
- }
-
- if (touchPoint.x <= textObjectBounds.x)
- {
- cursorPoint.x = textObjectBounds.x + 1;
- }
- else if (touchPoint.x >= (textObjectBounds.x + textObjectBounds.width))
- {
- cursorPoint.x = textObjectBounds.x + textObjectBounds.width - 1;
- }
- else
- {
- cursorPoint.x = touchPoint.x;
- }
- cursorPoint.y -= textObjectBounds.y;
- cursorPoint.x -= textObjectBounds.x;
- }
- else
- {
- return cursorPos;
- }
-
- cursorPos = __pTextObject->GetTextIndexFromPosition(cursorPoint.x, cursorPoint.y);
-
- return cursorPos;
-}
-
-int
_EditPresenter::GetCursorPositionAt(const FloatPoint& touchPoint) const
{
FloatPoint cursorPoint;
}
result
-_EditPresenter::CalculateCursorBounds(const Rectangle& textBounds, Rectangle& cursorBounds, int cursorPos)
-{
- int cursorWidth = 0;
- int cursorHeight = 0;
- int cursorAbsX = 0;
- int cursorAbsY = 0;
- int cursorRelativeX = 0;
- int cursorRelativeY = 0;
-
- __pTextObject->SetBounds(textBounds);
-
- if (cursorPos == -1)
- {
- cursorPos = __pTextObject->GetCursorIndex();
- }
-
- if (__pTextObject->GetTextPositionInfoAt(cursorPos, cursorWidth, cursorHeight, cursorAbsX, cursorAbsY, cursorRelativeX, cursorRelativeY) != E_SUCCESS)
- {
- return E_SYSTEM;
- }
-
- cursorBounds.x = cursorRelativeX;
- cursorBounds.y = cursorRelativeY;
- GET_SHAPE_CONFIG(EDIT::CURSOR_WIDTH, __pEdit->GetOrientation(), cursorBounds.width);
- cursorBounds.height = cursorHeight;
-
- if (cursorBounds.y == 0)
- {
- cursorBounds.y = _CoordinateSystemUtils::ConvertToInteger(__textObjectBounds.y);
- }
-
- if (cursorBounds.height == 0)
- {
- cursorBounds.height = _CoordinateSystemUtils::ConvertToInteger(__textObjectBounds.height);
- }
-
- if (cursorBounds.height == 0)
- {
- return E_SYSTEM;
- }
-
- if (cursorBounds.y < textBounds.y)
- {
- int cursorHeightDiff = textBounds.y - cursorBounds.y;
- cursorBounds.y = textBounds.y;
- cursorBounds.height -= cursorHeightDiff;
- }
-
- if (cursorBounds.y + cursorBounds.height > textBounds.y + textBounds.height)
- {
- int cursorHeightDiff = cursorBounds.y + cursorBounds.height - textBounds.y - textBounds.height - 1;
- cursorBounds.height -= cursorHeightDiff;
- }
-
- if (cursorBounds.x == textBounds.x + textBounds.width)
- {
- cursorBounds.x -= 1;
- }
- else if (cursorBounds.x > textBounds.x + textBounds.width)
- {
- cursorBounds.x = textBounds.x + textBounds.width;
- return E_SYSTEM;
- }
-
- if (__pTextObject->GetBlock() == false)
- {
- cursorBounds.x -= 1;
- if (cursorBounds.x < textBounds.x)
- {
- cursorBounds.x = textBounds.x;
- }
- }
-
- GET_SHAPE_CONFIG(EDIT::CURSOR_WIDTH, __pEdit->GetOrientation(), cursorBounds.width);
-
- return E_SUCCESS;
-}
-
-result
_EditPresenter::ScrollContents(float moveY)
{
int moveLine = 0;
}
result
-_EditPresenter::CalculateAbsoluteCursorBounds(int index, Rectangle& absCursorBounds)
-{
- int cursorAbsX = 0;
- int cursorAbsY = 0;
- int cursorWidth = 0;
- int cursorHeight = 0;
- int cursorRelativeX = 0;
- int cursorRelativeY = 0;
-
- Rectangle absBounds = __pEdit->GetAbsoluteBounds();
-
- __pTextObject->SetBounds(GetTextBounds());
- if (__pTextObject->GetTextPositionInfoAt(index, cursorWidth, cursorHeight, cursorAbsX, cursorAbsY, cursorRelativeX, cursorRelativeY) != E_SUCCESS)
- {
- return E_SYSTEM;
- }
-
- absCursorBounds.x = absBounds.x + cursorRelativeX;
-
- if (__pEdit->GetEditStyle() & EDIT_STYLE_SINGLE_LINE)
- {
- Rectangle tempBounds;
- GetCursorBounds(true, tempBounds);
- absCursorBounds.y = tempBounds.y;
- }
- else
- {
- absCursorBounds.y = absBounds.y + cursorRelativeY;
- }
-
- absCursorBounds.width = cursorWidth;
-
- if (cursorHeight > 0)
- {
- absCursorBounds.height = cursorHeight;
- }
- else
- {
- absCursorBounds.height = __pTextObject->GetLineHeightAt(0);
- }
-
- return E_SUCCESS;
-}
-
-result
-_EditPresenter::GetCursorBounds(bool isAbsRect, Rectangle& cursorBounds)
-{
- if (__isInitialized == false)
- {
- return E_SYSTEM;
- }
-
- CalculateCursorBounds(GetTextBounds(), cursorBounds);
-
- if (isAbsRect)
- {
- Rectangle absBounds = __pEdit->GetAbsoluteBounds();
- cursorBounds.x += absBounds.x;
- cursorBounds.y += absBounds.y;
- }
-
- return E_SUCCESS;
-}
-
-result
_EditPresenter::CalculateAbsoluteCursorBounds(int index, FloatRectangle& absCursorBounds)
{
float cursorAbsX = 0.0f;
__pTextObject->SetBounds(GetTextBoundsF());
if (index != __cursorPos)
{
- if (__pTextObject->GetTextPositionInfoAt(index, cursorWidth, cursorHeight, cursorAbsX, cursorAbsY, cursorRelativeX, cursorRelativeY) != E_SUCCESS)
- {
- return E_SYSTEM;
- }
+ if (__pTextObject->GetTextPositionInfoAt(index, cursorWidth, cursorHeight, cursorAbsX, cursorAbsY, cursorRelativeX, cursorRelativeY) != E_SUCCESS)
+ {
+ return E_SYSTEM;
+ }
}
else
{
}
result
-_EditPresenter::GetKeypadBounds(Rectangle& bounds) const
-{
- if (__pInputConnection == null)
- {
- return E_SYSTEM;
- }
-
- bounds = __pInputConnection->GetInputPanelBounds();
-
- _CoordinateSystem* pCoordSystem = _CoordinateSystem::GetInstance();
- SysTryReturnResult(NID_UI_CTRL, pCoordSystem, E_SYSTEM, "[EDIT] Coordinate system load failed.");
-
- _ICoordinateSystemTransformer* pXformer = pCoordSystem->GetInverseTransformer();
- SysTryReturnResult(NID_UI_CTRL, pXformer, E_SYSTEM, "[EDIT] Coordinate system load failed.");
-
- bounds = pXformer->Transform(bounds);
-
- return E_SUCCESS;
-}
-
-result
_EditPresenter::GetKeypadBounds(FloatRectangle& bounds) const
{
if (__pInputConnection == null)
}
result
-_EditPresenter::DrawCursor(Canvas& canvas, Rectangle& cursorBounds, bool isCursorOpaque)
-{
- result r = E_SUCCESS;
-
- if (__isCursorDisabled == false)
- {
- Color cursorColor;
- GET_COLOR_CONFIG(EDIT::CURSOR_NORMAL, cursorColor);
-
- if (__isCursorInitialized)
- {
- cursorBounds.SetPosition(0, 0);
-
- if (canvas.GetBackgroundColor() != cursorColor)
- {
- canvas.FillRectangle(cursorColor, cursorBounds);
- }
-
- if (isCursorOpaque)
- {
- __pCursorVisualElement->SetOpacity(1.0f);
- }
- else
- {
- __pCursorVisualElement->SetOpacity(0);
- }
- }
- else
- {
- cursorBounds.SetPosition(0, 0);
-
- canvas.FillRectangle(cursorColor, cursorBounds);
- __isCursorInitialized = true;
-
- }
- }
- else
- {
- __pCursorVisualElement->SetOpacity(0);
- }
-
- return r;
-}
-
-result
_EditPresenter::DrawCursor(Canvas& canvas, FloatRectangle& cursorBounds, bool isCursorOpaque)
{
result r = E_SUCCESS;
return height;
}
-int
-_EditPresenter::CalculateFlexibleHeight(void)
-{
- int height = 0;
- int expectedEditHeight = __pTextObject->GetTotalHeight() + _CoordinateSystemUtils::ConvertToInteger(__verticalMargin);
- int lineCount = __pTextObject->GetTotalLineCount();
-
- if (__pTextObject->GetTotalHeight())
- {
- if ((lineCount >= MAX_LINE_NUMBER) && (GetMaxLineCount() > MAX_LINE_NUMBER))
- {
- height = MAX_LINE_NUMBER * __pTextObject->GetLineHeightAt(0) + _CoordinateSystemUtils::ConvertToInteger(__verticalMargin);
- return height;
- }
-
- int maxHeight = _CoordinateSystemUtils::ConvertToInteger(CalculateMaximumFlexibleHeight());
-
- //If InitialBounds is more than expectedEdit height, set flexible height as initial height
- if (expectedEditHeight < _CoordinateSystemUtils::ConvertToInteger(__initialBounds.height))
- {
- height = _CoordinateSystemUtils::ConvertToInteger(__initialBounds.height);
- }
- else if (expectedEditHeight >= maxHeight)
- {
- height = maxHeight;
- }
- else
- {
- height = expectedEditHeight;
- }
- }
- else
- {
- height = _CoordinateSystemUtils::ConvertToInteger(__initialBounds.height);
- }
-
- return height;
-}
-
result
_EditPresenter::AdjustFlexibleHeight(void)
{
// get edit height
FloatRectangle bounds = __pEdit->GetBoundsF();
- float calculateHeight = CalculateFlexibleHeight();
+ float calculateHeight = CalculateFlexibleHeightF();
if (bounds.height != calculateHeight)
{
}
result
-_EditPresenter::SetFlexBounds(const Rectangle& bounds)
-{
- result r = E_SUCCESS;
-
- _ExpandableEditAreaEventStatus expandableEditAreaStatus = _EXPANDABLE_EDITAREA_EVENT_ADDED;
- if (__pEdit->GetBounds().height > bounds.height)
- {
- expandableEditAreaStatus = _EXPANDABLE_EDITAREA_EVENT_REMOVED;
- }
- else if (__pEdit->GetBounds().height < bounds.height)
- {
- expandableEditAreaStatus = _EXPANDABLE_EDITAREA_EVENT_ADDED;
- }
-
- _VisualElement* pVisualElement = __pEdit->GetVisualElement();
- SysTryReturnResult(NID_UI_CTRL, pVisualElement, E_SYSTEM, "A system error has occurred. Unable to get root visual element.");
-
- pVisualElement->SetAnimationProvider(__pEditVEDelegator);
- pVisualElement->SetImplicitAnimationEnabled(true);
-
- if (!((__pEdit->GetEditStyle() & EDIT_STYLE_FLEXIBLE) == false))
- {
- __updateInitialBounds = false;
- }
-
- __pEdit->SetBounds(bounds);
- __updateInitialBounds = true;
-
- Resize();
-
- __pEdit->Invalidate();
-
- __prevTotalTextHeight = _CoordinateSystemUtils::ConvertToFloat(__pTextObject->GetTotalHeight());
- __pEdit->SendExpandableEditAreaEvent(expandableEditAreaStatus);
-
- pVisualElement->SetImplicitAnimationEnabled(false);
-
- return r;
-}
-
-result
_EditPresenter::SetFlexBounds(const FloatRectangle& bounds)
{
result r = E_SUCCESS;
}
bool
-_EditPresenter::SetKeypadBounds(const Rectangle& bounds)
-{
- __keypadBounds.x = _CoordinateSystemUtils::ConvertToFloat(bounds.x);
- __keypadBounds.y = _CoordinateSystemUtils::ConvertToFloat(bounds.y);
- __keypadBounds.width = _CoordinateSystemUtils::ConvertToFloat(bounds.width);
- __keypadBounds.height = _CoordinateSystemUtils::ConvertToFloat(bounds.height);
- return true;
-}
-
-bool
_EditPresenter::SetKeypadBounds(const FloatRectangle& bounds)
{
__keypadBounds.x = bounds.x;
return;
}
-void
-_EditPresenter::SetScrollBarBounds(const Rectangle& bounds)
-{
- __scrollBarBounds = _CoordinateSystemUtils::ConvertToFloat(bounds);
-
- return;
-}
-
FloatRectangle
_EditPresenter::GetDisplayScrollBoundsF(void) const
{
return __scrollBarBounds;
}
-Rectangle
-_EditPresenter::GetDisplayScrollBounds(void) const
-{
- return _CoordinateSystemUtils::ConvertToInteger(__scrollBarBounds);
-}
-
FloatRectangle
_EditPresenter::GetInitialBoundsF(void) const
{
return __initialBounds;
}
-Rectangle
-_EditPresenter::GetInitialBounds(void) const
-{
- return _CoordinateSystemUtils::ConvertToInteger(__initialBounds);
-}
-
void
_EditPresenter::SetPreviousScrollBarPosition(int position)
{
return __isCopyPasteManagerExist;
}
-Rectangle
-_EditPresenter::GetTextAreaBounds(void) const
-{
- return _CoordinateSystemUtils::ConvertToInteger(__textObjectBounds);
-}
-
FloatRectangle
_EditPresenter::GetTextAreaBoundsF(void) const
{
return __textObjectBounds;
}
-Rectangle
-_EditPresenter::GetTitleBounds(void) const
-{
- return _CoordinateSystemUtils::ConvertToInteger(__titleBounds);
-}
-
FloatRectangle
_EditPresenter::GetTitleBoundsF(void) const
{
return __titleBounds;
}
-Rectangle
-_EditPresenter::GetClearIconBounds(void) const
-{
- return _CoordinateSystemUtils::ConvertToInteger(__clearIconBounds);
-}
-
FloatRectangle
_EditPresenter::GetClearIconBoundsF(void) const
{
virtual void OnClipboardPopupClosed(const ClipboardItem* pClipboardItem);
virtual result SetInitialBounds(void);
virtual result Draw(Tizen::Graphics::Canvas& canvas);
- virtual result DrawCursor(Tizen::Graphics::Canvas& canvas, Tizen::Graphics::Rectangle& cursorRect, bool isCursorOpaque);
virtual result DrawCursor(Tizen::Graphics::Canvas& canvas, Tizen::Graphics::FloatRectangle& cursorRect, bool isCursorOpaque);
virtual result DrawScrollBar(void);
virtual bool OnFocusGained(void);
result SetCursorPosition(int position,int rowIndex, int columnIndex);
void SetClientBounds(void);
result SetEllipsisPosition(EllipsisPosition position);
- virtual result SetFlexBounds(const Tizen::Graphics::Rectangle& bounds);
virtual result SetFlexBounds(const Tizen::Graphics::FloatRectangle& bounds);
virtual result SetTextSize(const int size);
virtual result SetTextSize(const float size);
result SetKeypadCommandButton(CommandButtonPosition position, const Tizen::Base::String& text, int actionId);
_Toolbar* GetKeypadCommandButton(void) const;
result SetKeypadCommandButtonVisible(bool visible);
- bool SetKeypadBounds(const Tizen::Graphics::Rectangle& bounds);
bool SetKeypadBounds(const Tizen::Graphics::FloatRectangle& bounds);
result SetText(const Tizen::Base::String& text);
result SetTextAlignment(HorizontalAlignment alignment);
EditInputModeCategory GetCurrentInputModeCategory(void) const;
result GetCurrentLanguage(Tizen::Locales::LanguageCode& language) const;
void GetCurrentTextRange(int& start, int& end) const;
- int GetCursorPositionAt(const Tizen::Graphics::Point& touchPoint) const;
int GetCursorPositionAt(const Tizen::Graphics::FloatPoint& touchPoint) const;
int GetCursorPositionAt(const Tizen::Graphics::FloatPoint& touchPoint, int& rowIndex, int& columnIndex, bool isMoving = false);
virtual bool IsTextBlockedInTokenEdit(void) const;
int GetCursorPosition(void) const;
- result GetCursorBounds(bool isAbsRect, Tizen::Graphics::Rectangle& cursorBounds);
result GetCursorBounds(bool isAbsRect, Tizen::Graphics::FloatRectangle& cursorBounds);
EllipsisPosition GetEllipsisPosition(void) const;
Tizen::Graphics::Font* GetFont(void) const;
float GetTextSizeF(void) const;
unsigned long GetInputModeCategory(void) const;
CoreKeypadAction GetKeypadAction(void) const;
- result GetKeypadBounds(Tizen::Graphics::Rectangle& bounds) const;
result GetKeypadBounds(Tizen::Graphics::FloatRectangle& bounds) const;
float GetClipboardHeight(void) const;
bool CheckKeypadExist(_ControlOrientation orientation);
result AppendCharacter(const Tizen::Base::Character& character);
result AppendText(const Tizen::Base::String& text);
result BeginTextBlock(void);
- result CalculateAbsoluteCursorBounds(int index, Tizen::Graphics::Rectangle& absCursorBounds);
result CalculateAbsoluteCursorBounds(int index, Tizen::Graphics::FloatRectangle& absCursorBounds);
result CalculateAbsoluteCursorBounds(int rowIndex, int columnIndex, FloatRectangle& absCursorBounds);
virtual result ChangeLayout(_ControlOrientation orientation);
result Resize(void);
result ShowKeypad(bool focus = true);
result StartFlickAnimation(const Tizen::Graphics::FloatPoint& flickPosition, int flickTime);
- Tizen::Graphics::Rectangle GetTextAreaBounds(void) const;
Tizen::Graphics::FloatRectangle GetTextAreaBoundsF(void) const;
- Tizen::Graphics::Rectangle GetTitleBounds(void) const;
Tizen::Graphics::FloatRectangle GetTitleBoundsF(void) const;
- Tizen::Graphics::Rectangle GetClearIconBounds(void) const;
Tizen::Graphics::FloatRectangle GetClearIconBoundsF(void) const;
void FinishTextComposition(void);
void InitializeCopyPasteManager(void);
virtual Tizen::Graphics::Rectangle GetTextBounds(void) const;
virtual Tizen::Graphics::FloatRectangle GetTextBoundsF(void) const;
result InitializeCursor(void);
- result CalculateCursorBounds(const Tizen::Graphics::Rectangle& textBounds, Tizen::Graphics::Rectangle& cursorBounds, int curPos = -1);
result CalculateCursorBounds(const Tizen::Graphics::FloatRectangle& textBounds, Tizen::Graphics::FloatRectangle& cursorBounds, int curPos = -1);
result CalculateCursorBounds(const Tizen::Graphics::FloatRectangle& textBounds, Tizen::Graphics::FloatRectangle& cursorBounds, int rowIndex, int columnIndex);
virtual void ResetTextBounds(void){}
result StartCursorTimer(void);
virtual void OnCursorTimerExpired(void);
virtual result SetModel(const _EditModel& editModel);
- virtual int CalculateFlexibleHeight(void);
virtual float CalculateFlexibleHeightF(void);
void SetCursorEnabled(bool enable);
bool IsCursorEnabled(void) const;
void SetScrollBarVisible(bool enable);
- void SetScrollBarBounds(const Tizen::Graphics::Rectangle& bounds);
void SetScrollBarBounds(const Tizen::Graphics::FloatRectangle& bounds);
- Tizen::Graphics::Rectangle GetDisplayScrollBounds(void) const;
Tizen::Graphics::FloatRectangle GetDisplayScrollBoundsF(void) const;
- Tizen::Graphics::Rectangle GetInitialBounds(void) const;
Tizen::Graphics::FloatRectangle GetInitialBoundsF(void) const;
void SetPreviousScrollBarPosition(int position);
void SetPreviousScrollBarPosition(float position);