1 #ifndef DALI_TOOLKIT_TEXT_VIEW_MODEL_H
2 #define DALI_TOOLKIT_TEXT_VIEW_MODEL_H
5 * Copyright (c) 2016 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/common/dali-vector.h>
25 #include <dali-toolkit/internal/text/text-model-interface.h>
37 * @brief Responsible of creating and store temporary modifications of the text model.
38 * i.e. The elide of text.
40 class ViewModel : public ModelInterface
46 * Keeps the pointer to the text's model. It initializes all the members of the class to their defaults.
48 * @param[in] model Pointer to the text's model interface.
50 ViewModel( const ModelInterface* const model );
53 * @brief Virtual destructor.
55 * It's a default destructor.
60 * @copydoc ModelInterface::GetControlSize()
62 virtual const Size& GetControlSize() const;
65 * @copydoc ModelInterface::GetLayoutSize()
67 virtual const Size& GetLayoutSize() const;
70 * @copydoc ModelInterface::GetScrollPosition()
72 virtual const Vector2& GetScrollPosition() const;
75 * @copydoc ModelInterface::GetHorizontalAlignment()
77 virtual Layout::HorizontalAlignment GetHorizontalAlignment() const;
80 * @copydoc ModelInterface::GetVerticalAlignment()
82 virtual Layout::VerticalAlignment GetVerticalAlignment() const;
85 * @copydoc ModelInterface::IsTextElideEnabled()
87 virtual bool IsTextElideEnabled() const;
90 * @copydoc ModelInterface::GetNumberOfLines()
92 virtual Length GetNumberOfLines() const;
95 * @copydoc ModelInterface::GetLines()
97 virtual const LineRun* const GetLines() const;
100 * @copydoc ModelInterface::GetNumberOfGlyphs()
102 virtual Length GetNumberOfGlyphs() const;
105 * @copydoc ModelInterface::GetGlyphs()
107 virtual const GlyphInfo* const GetGlyphs() const;
110 * @copydoc ModelInterface::GetLayout()
112 virtual const Vector2* const GetLayout() const;
115 * @copydoc ModelInterface::GetColors()
117 virtual const Vector4* const GetColors() const;
120 * @copydoc ModelInterface::GetColorIndices()
122 virtual const ColorIndex* const GetColorIndices() const;
125 * @copydoc ModelInterface::GetDefaultColor()
127 virtual const Vector4& GetDefaultColor() const;
130 * @brief Does the text elide.
132 * It stores a copy of the visible glyphs and removes as many glyphs as needed
133 * from the last visible line to add the ellipsis glyph.
135 * It stores as well a copy of the positions for each visible glyph.
140 const ModelInterface* const mModel; ///< Pointer to the text's model.
141 Vector<GlyphInfo> mElidedGlyphs; ///< Stores the glyphs of the elided text.
142 Vector<Vector2> mElidedLayout; ///< Stores the positions of each glyph of the elided text.
143 bool mIsTextElided : 1; ///< Whether the text has been elided.
148 } // namespace Toolkit
152 #endif // DALI_TOOLKIT_TEXT_VIEW_MODEL_H