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/bounded-paragraph-run.h>
23 #include <dali-toolkit/internal/text/logical-model-impl.h>
24 #include <dali-toolkit/internal/text/text-view-interface.h>
25 #include <dali-toolkit/internal/text/visual-model-impl.h>
34 * @brief View provides an interface between the Text layout engine and rendering back-end.
36 class View : public ViewInterface
40 * @brief Create a new instance of a View.
45 * @brief Virtual destructor.
50 * @brief Set the visual model.
52 * @param[in] visualModel The visual model used by the View.
54 void SetVisualModel(VisualModelPtr visualModel);
57 * @brief Set the logical model.
59 * @param[in] logicalModel The logical model used by the View.
61 void SetLogicalModel(LogicalModelPtr logicalModel);
64 * @copydoc Dali::Toolkit::Text::ViewInterface::GetControlSize()
66 const Vector2& GetControlSize() const override;
69 * @copydoc Dali::Toolkit::Text::ViewInterface::GetLayoutSize()
71 const Vector2& GetLayoutSize() const override;
74 * @copydoc Dali::Toolkit::Text::ViewInterface::GetNumberOfGlyphs()
76 Length GetNumberOfGlyphs() const override;
79 * @copydoc Dali::Toolkit::Text::ViewInterface::GetGlyphs()
81 virtual Length GetGlyphs(GlyphInfo* glyphs,
82 Vector2* glyphPositions,
84 GlyphIndex glyphIndex,
85 Length numberOfGlyphs) const;
88 * @copydoc Dali::Toolkit::Text::ViewInterface::GetColors()
90 const Vector4* GetColors() const override;
93 * @copydoc Dali::Toolkit::Text::ViewInterface::GetColorIndices()
95 const ColorIndex* GetColorIndices() const override;
98 * @copydoc Dali::Toolkit::Text::ViewInterface::GetBackgroundColors()
100 const Vector4* GetBackgroundColors() const override;
103 * @copydoc Dali::Toolkit::Text::ViewInterface::GetBackgroundColorIndices()
105 const ColorIndex* GetBackgroundColorIndices() const override;
108 * @copydoc Dali::Toolkit::Text::ViewInterface::IsMarkupBackgroundColorSet()
110 bool IsMarkupBackgroundColorSet() const;
113 * @copydoc Dali::Toolkit::Text::ViewInterface::GetTextColor()
115 const Vector4& GetTextColor() const override;
118 * @copydoc Dali::Toolkit::Text::ViewInterface::GetShadowOffset()
120 const Vector2& GetShadowOffset() const override;
123 * @copydoc Dali::Toolkit::Text::ViewInterface::GetShadowColor()
125 const Vector4& GetShadowColor() const override;
128 * @copydoc Dali::Toolkit::Text::ViewInterface::GetUnderlineColor()
130 const Vector4& GetUnderlineColor() const override;
133 * @copydoc Dali::Toolkit::Text::ViewInterface::IsUnderlineEnabled()
135 bool IsUnderlineEnabled() const override;
138 * @copydoc Dali::Toolkit::Text::ViewInterface::IsMarkupUnderlineSet()
140 bool IsMarkupUnderlineSet() const;
143 * @copydoc Dali::Toolkit::Text::ViewInterface::GetHyphens()
145 const GlyphInfo* GetHyphens() const override;
148 * @copydoc Dali::Toolkit::Text::ViewInterface::GetHyphens()
150 const Length* GetHyphenIndices() const override;
153 * @copydoc Dali::Toolkit::Text::ViewInterface::GetHyphens()
155 Length GetHyphensCount() const override;
158 * @copydoc Dali::Toolkit::Text::ViewInterface::GetUnderlineHeight()
160 float GetUnderlineHeight() const override;
163 * @copydoc Dali::Toolkit::Text::ViewInterface::GetUnderlineType()
165 Text::Underline::Type GetUnderlineType() const override;
168 * @copydoc Dali::Toolkit::Text::ViewInterface::GetDashedUnderlineWidth()
170 float GetDashedUnderlineWidth() const override;
173 * @copydoc Dali::Toolkit::Text::ViewInterface::GetDashedUnderlineGap()
175 float GetDashedUnderlineGap() const override;
178 * @copydoc Dali::Toolkit::Text::ViewInterface::GetNumberOfUnderlineRuns()
180 Length GetNumberOfUnderlineRuns() const override;
183 * @copydoc Dali::Toolkit::Text::ViewInterface::GetUnderlineRuns()
185 virtual void GetUnderlineRuns(UnderlinedGlyphRun* underlineRuns,
186 UnderlineRunIndex index,
187 Length numberOfRuns) const;
190 * @copydoc Dali::Toolkit::Text::ViewInterface::GetOutlineColor()
192 const Vector4& GetOutlineColor() const override;
195 * @copydoc Dali::Toolkit::Text::ViewInterface::GetOutlineWidth()
197 uint16_t GetOutlineWidth() const override;
200 * @copydoc Dali::Toolkit::Text::ViewInterface::GetEllipsisPosition()
202 DevelText::EllipsisPosition::Type GetEllipsisPosition() const override;
205 * @copydoc Dali::Toolkit::Text::ViewInterface::IsTextElideEnabled()
207 bool IsTextElideEnabled() const override;
210 * @copydoc Dali::Toolkit::Text::ViewInterface::GetStartIndexOfElidedGlyphs()
212 GlyphIndex GetStartIndexOfElidedGlyphs() const override;
215 * @copydoc Dali::Toolkit::Text::ViewInterface::GetEndIndexOfElidedGlyphs()
217 GlyphIndex GetEndIndexOfElidedGlyphs() const override;
220 * @copydoc Dali::Toolkit::Text::ViewInterface::GetFirstMiddleIndexOfElidedGlyphs()
222 GlyphIndex GetFirstMiddleIndexOfElidedGlyphs() const override;
225 * @copydoc Dali::Toolkit::Text::ViewInterface::GetSecondMiddleIndexOfElidedGlyphs()
227 GlyphIndex GetSecondMiddleIndexOfElidedGlyphs() const override;
230 * @copydoc Dali::Toolkit::Text::ViewInterface::GetStrikethroughColor()
232 const Vector4& GetStrikethroughColor() const override;
235 * @copydoc Dali::Toolkit::Text::ViewInterface::IsStrikethroughEnabled()
237 bool IsStrikethroughEnabled() const override;
240 * @copydoc Dali::Toolkit::Text::ViewInterface::IsMarkupStrikethroughSet()
242 bool IsMarkupStrikethroughSet() const;
245 * @copydoc Dali::Toolkit::Text::ViewInterface::GetStrikethroughHeight()
247 float GetStrikethroughHeight() const override;
250 * @copydoc Dali::Toolkit::Text::ViewInterface::GetNumberOfStrikethroughRuns()
252 Length GetNumberOfStrikethroughRuns() const;
255 * @copydoc Dali::Toolkit::Text::ViewInterface::GetStrikethroughRuns()
257 void GetStrikethroughRuns(StrikethroughGlyphRun* strikethroughRuns,
258 StrikethroughRunIndex index,
259 Length numberOfRuns) const;
262 * @copydoc Dali::Toolkit::Text::ViewInterface::GetNumberOfBoundedParagraphRuns()
264 virtual Length GetNumberOfBoundedParagraphRuns() const;
267 * @copydoc Dali::Toolkit::Text::ViewInterface::GetBoundedParagraphRuns()
269 virtual const Vector<BoundedParagraphRun>& GetBoundedParagraphRuns() const;
272 * @copydoc Dali::Toolkit::Text::ViewInterface::GetNumberOfCharacterSpacingGlyphRuns()
274 Length GetNumberOfCharacterSpacingGlyphRuns() const override;
277 * @copydoc Dali::Toolkit::Text::ViewInterface::GetCharacterSpacingGlyphRuns()
279 const Vector<CharacterSpacingGlyphRun>& GetCharacterSpacingGlyphRuns() const override;
282 * @copydoc Dali::Toolkit::Text::ViewInterface::GetCharacterSpacing()
284 float GetCharacterSpacing() const override;
287 * @copydoc Dali::Toolkit::Text::ViewInterface::GetTextBuffer()
289 const Character* GetTextBuffer() const override;
292 * @copydoc Dali::Toolkit::Text::ViewInterface::GetGlyphsToCharacters()
294 const Vector<CharacterIndex>& GetGlyphsToCharacters() const override;
298 View(const View& handle);
301 View& operator=(const View& handle);
309 } // namespace Toolkit
313 #endif // DALI_TOOLKIT_TEXT_VIEW_H