DALI_TOOLKIT_API void RequestAsyncNaturalSize(TextLabel textLabel);
/**
+ * @brief Requests asynchronous computation of the height of the text based on the given width.
+ *
+ * @param[in] textLabel The instance of TextLabel.
+ * @param[in] width The width of text to compute.
+ */
+DALI_TOOLKIT_API void RequestAsyncHeightForWidth(TextLabel textLabel, float width);
+
+/**
* @brief Anchor clicked signal type.
*
* @note Signal
using AsyncNaturalSizeComputedSignalType = Signal<void(TextLabel, float, float)>;
/**
+ * @brief Async height for width computed signal type.
+ *
+ * @note Signal
+ * - float : computed width.
+ * - float : computed height.
+ */
+using AsyncHeightForWidthComputedSignalType = Signal<void(TextLabel, float, float)>;
+
+/**
* @brief This signal is emitted when the anchor is clicked.
*
* A callback of the following type may be connected:
*/
DALI_TOOLKIT_API AsyncNaturalSizeComputedSignalType& AsyncNaturalSizeComputedSignal(TextLabel textLabel);
+/**
+ * @brief This signal is emitted when the async height for width computed.
+ *
+ * A callback of the following type may be connected:
+ * @code
+ * void YourCallbackName(TextLabel textLabel);
+ * @endcode
+ * @param[in] textLabel The instance of TextLabel.
+ * @return The signal to connect to.
+ */
+DALI_TOOLKIT_API AsyncHeightForWidthComputedSignalType& AsyncHeightForWidthComputedSignal(TextLabel textLabel);
+
} // namespace DevelTextLabel
} // namespace Toolkit
DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION(Toolkit, TextLabel, "textColorBlue", TEXT_COLOR_BLUE, TEXT_COLOR, 2)
DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION(Toolkit, TextLabel, "textColorAlpha", TEXT_COLOR_ALPHA, TEXT_COLOR, 3)
-DALI_SIGNAL_REGISTRATION(Toolkit, TextLabel, "anchorClicked", SIGNAL_ANCHOR_CLICKED)
-DALI_SIGNAL_REGISTRATION(Toolkit, TextLabel, "textFitChanged", SIGNAL_TEXT_FIT_CHANGED)
-DALI_SIGNAL_REGISTRATION(Toolkit, TextLabel, "asyncTextRendered", SIGNAL_ASYNC_TEXT_RENDERED)
-DALI_SIGNAL_REGISTRATION(Toolkit, TextLabel, "asyncNaturalSizeComputed", SIGNAL_ASYNC_NATURAL_SIZE_COMPUTED)
+DALI_SIGNAL_REGISTRATION(Toolkit, TextLabel, "anchorClicked", SIGNAL_ANCHOR_CLICKED )
+DALI_SIGNAL_REGISTRATION(Toolkit, TextLabel, "textFitChanged", SIGNAL_TEXT_FIT_CHANGED )
+DALI_SIGNAL_REGISTRATION(Toolkit, TextLabel, "asyncTextRendered", SIGNAL_ASYNC_TEXT_RENDERED )
+DALI_SIGNAL_REGISTRATION(Toolkit, TextLabel, "asyncNaturalSizeComputed", SIGNAL_ASYNC_NATURAL_SIZE_COMPUTED )
+DALI_SIGNAL_REGISTRATION(Toolkit, TextLabel, "asyncHeightForWidthComputed", SIGNAL_ASYNC_HEIGHT_FOR_WIDTH_COMPUTED)
DALI_TYPE_REGISTRATION_END()
// clang-format on
labelImpl.AsyncNaturalSizeComputedSignal().Connect(tracker, functor);
}
}
+ else if(0 == strcmp(signalName.c_str(), SIGNAL_ASYNC_HEIGHT_FOR_WIDTH_COMPUTED))
+ {
+ if(label)
+ {
+ Internal::TextLabel& labelImpl(GetImpl(label));
+ labelImpl.AsyncHeightForWidthComputedSignal().Connect(tracker, functor);
+ }
+ }
else
{
// signalName does not match any signal
return mAsyncNaturalSizeComputedSignal;
}
+DevelTextLabel::AsyncHeightForWidthComputedSignalType& TextLabel::AsyncHeightForWidthComputedSignal()
+{
+ return mAsyncHeightForWidthComputedSignal;
+}
+
void TextLabel::OnInitialize()
{
Actor self = Self();
case Async::COMPUTE_HEIGHT_FOR_WIDTH:
{
- // TODO
+ DALI_LOG_RELEASE_INFO("Height for width : %f, %f\n", renderInfo.renderedSize.width, renderInfo.renderedSize.height);
+ EmitAsyncHeightForWidthComputedSignal(renderInfo.renderedSize.width, renderInfo.renderedSize.height);
}
break;
mAsyncNaturalSizeComputedSignal.Emit(handle, width + (padding.start + padding.end), height + (padding.top + padding.bottom));
}
+void TextLabel::EmitAsyncHeightForWidthComputedSignal(float width, float height)
+{
+ Dali::Toolkit::TextLabel handle(GetOwner());
+ Extents padding;
+ padding = Self().GetProperty<Extents>(Toolkit::Control::Property::PADDING);
+ mAsyncHeightForWidthComputedSignal.Emit(handle, width, height + (padding.top + padding.bottom));
+}
+
void TextLabel::OnAccessibilityStatusChanged()
{
CommonTextUtils::SynchronizeTextAnchorsInParent(Self(), mController, mAnchorActors);
TextVisual::RequestAsyncSizeComputation(mVisual, parameters);
}
+void TextLabel::RequestAsyncHeightForWidth(float width)
+{
+ Actor self = Self();
+ Extents padding(0u, 0u, 0u, 0u);
+ Vector2 contentSize(width, 0.0f);
+ Dali::LayoutDirection::Type layoutDirection = mController->GetLayoutDirection(self);
+
+ AsyncTextParameters parameters = GetAsyncTextParameters(contentSize, padding, layoutDirection);
+ parameters.requestType = Async::COMPUTE_HEIGHT_FOR_WIDTH;
+
+ TextVisual::RequestAsyncSizeComputation(mVisual, parameters);
+}
+
void TextLabel::RequestAsyncRenderWithFixedSize(float width, float height)
{
DALI_LOG_RELEASE_INFO("Request size : %f, %f\n", width, height);
DevelTextLabel::AsyncNaturalSizeComputedSignalType& AsyncNaturalSizeComputedSignal();
/**
+ * @copydoc Dali::Toollkit::TextLabel::AsyncHeightForWidthComputedSignal()
+ */
+ DevelTextLabel::AsyncHeightForWidthComputedSignalType& AsyncHeightForWidthComputedSignal();
+
+ /**
* Connects a callback function with the object's signals.
* @param[in] object The object providing the signal.
* @param[in] tracker Used to disconnect the signal.
*/
void RequestAsyncNaturalSize();
+ /**
+ * @brief Requests asynchronous computation of the height of the text based on the given width.
+ * @param[in] width The width of text to compute.
+ */
+ void RequestAsyncHeightForWidth(float width);
+
private: // From Control
/**
*/
void EmitAsyncNaturalSizeComputedSignal(float width, float height);
+ /**
+ * @brief Emits AsyncHeightForWidthComputed signal.
+ */
+ void EmitAsyncHeightForWidthComputedSignal(float width, float height);
+
void OnAccessibilityStatusChanged();
private: // Data
Toolkit::DevelTextLabel::TextFitChangedSignalType mTextFitChangedSignal;
Toolkit::DevelTextLabel::AsyncTextRenderedSignalType mAsyncTextRenderedSignal;
Toolkit::DevelTextLabel::AsyncNaturalSizeComputedSignalType mAsyncNaturalSizeComputedSignal;
+ Toolkit::DevelTextLabel::AsyncHeightForWidthComputedSignalType mAsyncHeightForWidthComputedSignal;
+
std::string mLocale;
Vector2 mSize;