1 #ifndef DALI_TOOLKIT_TEXT_CONTROLLER_RELAYOUTER_H
2 #define DALI_TOOLKIT_TEXT_CONTROLLER_RELAYOUTER_H
5 * Copyright (c) 2020 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.
22 #include <dali/public-api/actors/actor-enumerations.h>
23 #include <dali/public-api/math/vector2.h>
24 #include <dali/public-api/math/vector3.h>
27 #include <dali-toolkit/internal/text/text-controller.h>
39 * Contains all the relayouting related methods for Text::Controller
41 struct Controller::Relayouter
44 * @brief Called by the Controller to retrieve the natural size.
46 * @param[in] controller A reference to the controller class
49 static Vector3 GetNaturalSize(Controller& controller);
52 * @brief Called by the Controller to check if the text fits.
54 * @param[in] controller A reference to the controller class
55 * @param[in] pointSize The point size
56 * @param[in] layoutSize The layout size
59 static bool CheckForTextFit(Controller& controller, float pointSize, const Size& layoutSize);
62 * @brief Calculates the point size for text for given layout()
64 * @param[in] controller A reference to the controller class
65 * @param[in] layoutSize The layout size
67 static void FitPointSizeforLayout(Controller& controller, const Size& layoutSize);
70 * @brief Called by the Controller to get the height for a particular width.
72 * @param[in] controller A reference to the controller class
73 * @param[in] width The width we want the height for
76 static float GetHeightForWidth(Controller& controller, float width);
79 * @brief Called by the Controller to do the relayout itself.
81 * @param[in] controller A reference to the controller class
82 * @param[in] size The size to set
83 * @param[in] layoutDirection The layout direction
86 static Controller::UpdateTextType Relayout(Controller& controller, const Size& size, Dali::LayoutDirection::Type layoutDirection);
89 * @brief Called by the Controller to do certain operations when relayouting.
91 * @param[in] controller A reference to the controller class
92 * @param[in] size The size to set
93 * @param[in] operationsRequired The operations we need to do
94 * @param[in/out] layoutSize The Layout size which can be updated depending on the result of the performed operations
97 static bool DoRelayout(Controller& controller, const Size& size, OperationsMask operationsRequired, Size& layoutSize );
100 * @brief Called by the Controller to calculate the veritcal offset give the control size.
102 * @param[in] controller A reference to the controller class
103 * @param[in] controlSize The control size
105 static void CalculateVerticalOffset(Controller& controller, const Size& controlSize);
110 } // namespace Toolkit
114 #endif // DALI_TOOLKIT_TEXT_CONTROLLER_RELAYOUTER_H