1 #ifndef DALI_TOOLKIT_TEXT_VIEW_H
2 #define DALI_TOOLKIT_TEXT_VIEW_H
5 * Copyright (c) 2022 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-toolkit/internal/text/logical-model-impl.h>
23 #include <dali-toolkit/internal/text/text-view-interface.h>
24 #include <dali-toolkit/internal/text/visual-model-impl.h>
33 * @brief View provides an interface between the Text layout engine and rendering back-end.
35 class View : public ViewInterface
39 * @brief Create a new instance of a View.
44 * @brief Virtual destructor.
49 * @brief Set the visual model.
51 * @param[in] visualModel The visual model used by the View.
53 void SetVisualModel(VisualModelPtr visualModel);
56 * @brief Set the logical model.
58 * @param[in] logicalModel The logical model used by the View.
60 void SetLogicalModel(LogicalModelPtr logicalModel);
63 * @copydoc Dali::Toolkit::Text::ViewInterface::GetControlSize()
65 const Vector2& GetControlSize() const override;
68 * @copydoc Dali::Toolkit::Text::ViewInterface::GetLayoutSize()
70 const Vector2& GetLayoutSize() const override;
73 * @copydoc Dali::Toolkit::Text::ViewInterface::GetNumberOfGlyphs()
75 Length GetNumberOfGlyphs() const override;
78 * @copydoc Dali::Toolkit::Text::ViewInterface::GetGlyphs()
80 virtual Length GetGlyphs(GlyphInfo* glyphs,
81 Vector2* glyphPositions,
83 GlyphIndex glyphIndex,
84 Length numberOfGlyphs) const;
87 * @copydoc Dali::Toolkit::Text::ViewInterface::GetColors()
89 const Vector4* const GetColors() const override;
92 * @copydoc Dali::Toolkit::Text::ViewInterface::GetColorIndices()
94 const ColorIndex* const GetColorIndices() const override;
97 * @copydoc Dali::Toolkit::Text::ViewInterface::GetBackgroundColors()
99 const Vector4* const GetBackgroundColors() const override;
102 * @copydoc Dali::Toolkit::Text::ViewInterface::GetBackgroundColorIndices()
104 const ColorIndex* const GetBackgroundColorIndices() const override;
107 * @copydoc Dali::Toolkit::Text::ViewInterface::IsMarkupBackgroundColorSet()
109 bool const IsMarkupBackgroundColorSet() const;
112 * @copydoc Dali::Toolkit::Text::ViewInterface::GetTextColor()
114 const Vector4& GetTextColor() const override;
117 * @copydoc Dali::Toolkit::Text::ViewInterface::GetShadowOffset()
119 const Vector2& GetShadowOffset() const override;
122 * @copydoc Dali::Toolkit::Text::ViewInterface::GetShadowColor()
124 const Vector4& GetShadowColor() const override;
127 * @copydoc Dali::Toolkit::Text::ViewInterface::GetUnderlineColor()
129 const Vector4& GetUnderlineColor() const override;
132 * @copydoc Dali::Toolkit::Text::ViewInterface::IsUnderlineEnabled()
134 bool IsUnderlineEnabled() const override;
137 * @copydoc Dali::Toolkit::Text::ViewInterface::GetHyphens()
139 const GlyphInfo* GetHyphens() const override;
142 * @copydoc Dali::Toolkit::Text::ViewInterface::GetHyphens()
144 const Length* GetHyphenIndices() const override;
147 * @copydoc Dali::Toolkit::Text::ViewInterface::GetHyphens()
149 Length GetHyphensCount() const override;
152 * @copydoc Dali::Toolkit::Text::ViewInterface::GetUnderlineHeight()
154 float GetUnderlineHeight() const override;
157 * @copydoc Dali::Toolkit::Text::ViewInterface::GetUnderlineType()
159 Text::Underline::Type GetUnderlineType() const override;
162 * @copydoc Dali::Toolkit::Text::ViewInterface::GetDashedUnderlineWidth()
164 float GetDashedUnderlineWidth() const override;
167 * @copydoc Dali::Toolkit::Text::ViewInterface::GetDashedUnderlineGap()
169 float GetDashedUnderlineGap() const override;
172 * @copydoc Dali::Toolkit::Text::ViewInterface::GetNumberOfUnderlineRuns()
174 Length GetNumberOfUnderlineRuns() const override;
177 * @copydoc Dali::Toolkit::Text::ViewInterface::GetUnderlineRuns()
179 virtual void GetUnderlineRuns(GlyphRun* underlineRuns,
180 UnderlineRunIndex index,
181 Length numberOfRuns) const;
184 * @copydoc Dali::Toolkit::Text::ViewInterface::GetOutlineColor()
186 const Vector4& GetOutlineColor() const override;
189 * @copydoc Dali::Toolkit::Text::ViewInterface::GetOutlineWidth()
191 uint16_t GetOutlineWidth() const override;
194 * @copydoc Dali::Toolkit::Text::ViewInterface::GetEllipsisPosition()
196 DevelText::EllipsisPosition::Type GetEllipsisPosition() const override;
199 * @copydoc Dali::Toolkit::Text::ViewInterface::IsTextElideEnabled()
201 bool IsTextElideEnabled() const override;
204 * @copydoc Dali::Toolkit::Text::ViewInterface::GetStartIndexOfElidedGlyphs()
206 GlyphIndex GetStartIndexOfElidedGlyphs() const override;
209 * @copydoc Dali::Toolkit::Text::ViewInterface::GetEndIndexOfElidedGlyphs()
211 GlyphIndex GetEndIndexOfElidedGlyphs() const override;
214 * @copydoc Dali::Toolkit::Text::ViewInterface::GetFirstMiddleIndexOfElidedGlyphs()
216 GlyphIndex GetFirstMiddleIndexOfElidedGlyphs() const override;
219 * @copydoc Dali::Toolkit::Text::ViewInterface::GetSecondMiddleIndexOfElidedGlyphs()
221 GlyphIndex GetSecondMiddleIndexOfElidedGlyphs() const override;
224 * @copydoc Dali::Toolkit::Text::ViewInterface::GetStrikethroughColor()
226 const Vector4& GetStrikethroughColor() const override;
229 * @copydoc Dali::Toolkit::Text::ViewInterface::IsStrikethroughEnabled()
231 bool IsStrikethroughEnabled() const override;
234 * @copydoc Dali::Toolkit::Text::ViewInterface::GetStrikethroughHeight()
236 float GetStrikethroughHeight() const override;
239 * @copydoc Dali::Toolkit::Text::ViewInterface::GetNumberOfStrikethroughRuns()
241 Length GetNumberOfStrikethroughRuns() const;
244 * @copydoc Dali::Toolkit::Text::ViewInterface::GetStrikethroughRuns()
246 void GetStrikethroughRuns(StrikethroughGlyphRun* strikethroughRuns,
247 StrikethroughRunIndex index,
248 Length numberOfRuns) const;
251 * @copydoc Dali::Toolkit::Text::ViewInterface::GetCharacterSpacing()
253 const float GetCharacterSpacing() const override;
256 * @copydoc Dali::Toolkit::Text::ViewInterface::GetTextBuffer()
258 const Character* GetTextBuffer() const override;
261 * @copydoc Dali::Toolkit::Text::ViewInterface::GetGlyphsToCharacters()
263 const Vector<CharacterIndex>& GetGlyphsToCharacters() const override;
267 View(const View& handle);
270 View& operator=(const View& handle);
278 } // namespace Toolkit
282 #endif // DALI_TOOLKIT_TEXT_VIEW_H