1 #ifndef DALI_TOOLKIT_INTERNAL_TEXT_CONTROLS_COMMON_TEXT_UTILS_H
2 #define DALI_TOOLKIT_INTERNAL_TEXT_CONTROLS_COMMON_TEXT_UTILS_H
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 #include <dali-toolkit/devel-api/controls/text-controls/text-anchor-devel.h>
20 #include <dali-toolkit/internal/text/decorator/text-decorator.h>
21 #include <dali-toolkit/internal/text/rendering/text-renderer.h>
22 #include <dali-toolkit/internal/text/text-controller.h>
23 #include <dali-toolkit/public-api/controls/control.h>
24 #include <dali-toolkit/public-api/controls/text-controls/text-editor.h>
25 #include <dali/public-api/actors/actor.h>
27 #include <dali/public-api/common/vector-wrapper.h>
29 namespace Dali::Toolkit::Internal
35 * Common method to render text, setting up background, foreground actors with decorators/stencil.
36 * @param[in] textActor The TextEditor or TextField
37 * @param[in] renderer pointer to the text renderer
38 * @param[in] controller pointer to the text controller
39 * @param[in] decorator pointer to the text decorator
40 * @param[in,out] alignmentOffset Alignment offset
41 * @param[in,out] renderableActor Actor for rendering text
42 * @param[in,out] backgroundActor Actor for rendering background
43 * @param[in,out] stencil Clipping actor
44 * @param[in,out] clippingDecorationActors Clipping decoration actors
45 * @param[in,out] anchorActors Anchor actors
46 * @param[in] updateTextType How the text has been updated
48 static void RenderText(
50 Text::RendererPtr renderer,
51 Text::ControllerPtr controller,
52 Text::DecoratorPtr decorator,
53 float& alignmentOffset,
54 Actor& renderableActor,
55 Actor& backgroundActor,
56 Toolkit::Control& stencil,
57 std::vector<Actor>& clippingDecorationActors,
58 std::vector<Toolkit::TextAnchor>& anchorActors,
59 Text::Controller::UpdateTextType updateTextType);
62 * Common method to synchronize TextAnchor actors with Anchor objects in text's logical model.
63 * @param[in] parent The actor that is a parent of anchor actors
64 * @param[in] controller pointer to the text controller
65 * @param[in,out] anchorActors Anchor actors
67 static void SynchronizeTextAnchorsInParent(
69 Text::ControllerPtr controller,
70 std::vector<Toolkit::TextAnchor>& anchorActors);
73 } // namespace Dali::Toolkit::Internal
75 #endif //DALI_TOOLKIT_INTERNAL_TEXT_CONTROLS_COMMON_TEXT_UTILS_H