/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
constexpr float MAX_FLOAT = std::numeric_limits<float>::max();
-const char* EMPTY_STRING = "";
+const char* EMPTY_STRING = "";
const char* MIME_TYPE_TEXT_PLAIN = "text/plain;charset=utf-8";
} // namespace
if(mModel->mLogicalModel->mColorRuns.Count() > anchor.colorRunIndex)
{
ColorRun& colorRun = *(mModel->mLogicalModel->mColorRuns.Begin() + anchor.colorRunIndex);
- colorRun.color = mAnchorColor;
- updateNeeded = true;
+ colorRun.color = mAnchorColor;
+ updateNeeded = true;
}
if(mModel->mLogicalModel->mUnderlinedCharacterRuns.Count() > anchor.underlinedCharacterRunIndex)
{
UnderlinedCharacterRun& underlineRun = *(mModel->mLogicalModel->mUnderlinedCharacterRuns.Begin() + anchor.underlinedCharacterRunIndex);
- underlineRun.properties.color = mAnchorColor;
- updateNeeded = true;
+ underlineRun.properties.color = mAnchorColor;
+ updateNeeded = true;
}
}
else if(!anchor.isMarkupClickedColorSet && anchor.isClicked)
if(mModel->mLogicalModel->mColorRuns.Count() > anchor.colorRunIndex)
{
ColorRun& colorRun = *(mModel->mLogicalModel->mColorRuns.Begin() + anchor.colorRunIndex);
- colorRun.color = mAnchorClickedColor;
- updateNeeded = true;
+ colorRun.color = mAnchorClickedColor;
+ updateNeeded = true;
}
if(mModel->mLogicalModel->mUnderlinedCharacterRuns.Count() > anchor.underlinedCharacterRunIndex)
{
UnderlinedCharacterRun& underlineRun = *(mModel->mLogicalModel->mUnderlinedCharacterRuns.Begin() + anchor.underlinedCharacterRunIndex);
- underlineRun.properties.color = mAnchorClickedColor;
- updateNeeded = true;
+ underlineRun.properties.color = mAnchorClickedColor;
+ updateNeeded = true;
}
}
}
{
bool decoratorEditable = editable && mIsUserInteractionEnabled;
mEventData->mDecorator->SetEditable(decoratorEditable);
+ mEventData->mDecoratorUpdated = true;
+ RequestRelayout();
}
}
}
else
{
Length textLength = mModel->mVisualModel->mCharactersToGlyph.Count();
- cursorIndex = cursorIndex + numberOfCharacters > textLength ? textLength : cursorIndex + numberOfCharacters;
+ cursorIndex = cursorIndex + numberOfCharacters > textLength ? textLength : cursorIndex + numberOfCharacters;
}
// Will update the cursor hook position.
{
bool editable = mEventData->mEditingEnabled && enabled;
mEventData->mDecorator->SetEditable(editable);
+ mEventData->mDecoratorUpdated = true;
+ RequestRelayout();
}
}
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/object/property-notification.h>
#include <dali/public-api/rendering/geometry.h>
#include <dali/public-api/rendering/renderer.h>
+#include <dali/public-api/size-negotiation/relayout-container.h>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
* Relayout of the decorations owned by the decorator.
* @param[in] size The Size of the UI control the decorator is adding it's decorations to.
*/
- void Relayout(const Vector2& size)
+ void Relayout(const Vector2& size, RelayoutContainer& container)
{
mControlSize = size;
{
mPrimaryCursor.SetProperty(Actor::Property::POSITION, Vector2(cursor.position.x, cursor.position.y));
mPrimaryCursor.SetProperty(Actor::Property::SIZE, Size(mCursorWidth, cursor.cursorHeight));
+
+ container.Add(mPrimaryCursor, Size(mCursorWidth, cursor.cursorHeight));
}
mPrimaryCursor.SetProperty(Actor::Property::VISIBLE, mPrimaryCursorVisible && mCursorBlinkStatus);
}
{
mSecondaryCursor.SetProperty(Actor::Property::POSITION, Vector2(cursor.position.x, cursor.position.y));
mSecondaryCursor.SetProperty(Actor::Property::SIZE, Size(mCursorWidth, cursor.cursorHeight));
+
+ container.Add(mSecondaryCursor, Size(mCursorWidth, cursor.cursorHeight));
}
mSecondaryCursor.SetProperty(Actor::Property::VISIBLE, mSecondaryCursorVisible && mCursorBlinkStatus);
}
grabHandle.horizontallyVisible = ((mControlSize.width - (grabHandle.position.x + floor(0.5f * mCursorWidth)) > -Math::MACHINE_EPSILON_1000) &&
(grabHandle.position.x > -Math::MACHINE_EPSILON_1000));
grabHandle.verticallyVisible = ((fabsf(mControlSize.height - grabHandle.lineHeight) - grabHandle.position.y > -Math::MACHINE_EPSILON_1000) &&
- (grabHandle.position.y + grabHandle.lineHeight > -Math::MACHINE_EPSILON_1000));
+ (grabHandle.position.y + grabHandle.lineHeight > -Math::MACHINE_EPSILON_1000));
const bool isVisible = grabHandle.horizontallyVisible && grabHandle.verticallyVisible && (!mHidePrimaryCursorAndGrabHandle);
if(isVisible)
if(!mCopyPastePopup.actor)
{
mCopyPastePopup.actor = TextSelectionPopup::New(&mTextSelectionPopupCallbackInterface);
- #ifdef DECORATOR_DEBUG
+#ifdef DECORATOR_DEBUG
mCopyPastePopup.actor.SetProperty(Dali::Actor::Property::NAME, "mCopyPastePopup");
- #endif
+#endif
mCopyPastePopup.actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
mCopyPastePopup.actor.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
mCopyPastePopup.actor.OnRelayoutSignal().Connect(this, &Decorator::Impl::SetPopupPosition); // Position popup after size negotiation
void ApplyDisplacement(HandleImpl& handle, float yLocalPosition)
{
- if( handle.actor )
+ if(handle.actor)
{
float adjustedDisplacementX = 0.0f;
float adjustedDisplacementY = 0.0f;
- if (mSmoothHandlePanEnabled)
+ if(mSmoothHandlePanEnabled)
{
adjustedDisplacementX = CalculateAdjustedDisplacement(handle.position.x, handle.grabDisplacementX, mControlSize.x);
adjustedDisplacementY = CalculateAdjustedDisplacement(handle.position.y, handle.grabDisplacementY, (mControlSize.y - handle.lineHeight));
WorldToLocalCoordinatesBoundingBox(mImpl->mBoundingBox, boundingBox);
}
-void Decorator::Relayout(const Vector2& size)
+void Decorator::Relayout(const Vector2& size, RelayoutContainer& container)
{
- mImpl->Relayout(size);
+ mImpl->Relayout(size, container);
}
void Decorator::UpdatePositions(const Vector2& scrollOffset)
SetPopupActive(false);
}
}
-
- mImpl->Relayout(mImpl->mControlSize);
}
/** Handles **/
#define DALI_TOOLKIT_TEXT_DECORATOR_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// EXTERNAL INCLUDES
#include <dali/public-api/common/intrusive-ptr.h>
#include <dali/public-api/math/rect.h>
-#include <dali/public-api/object/ref-object.h>
#include <dali/public-api/object/property-map.h>
+#include <dali/public-api/object/ref-object.h>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup.h>
* @brief The decorator waits until a relayout before creating actors etc.
*
* @param[in] size The size of the parent control after size-negotiation.
+ * @param[in,out] container The control should add actors to this container that it is not able
+ * to allocate a size for.
*/
- void Relayout(const Dali::Vector2& size);
+ void Relayout(const Dali::Vector2& size, RelayoutContainer& container);
/**
* @brief Updates the decorator's actor positions after scrolling.