2 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali-toolkit/internal/text/text-model.h>
32 return ModelPtr( new Model() );
35 const Size& Model::GetControlSize() const
37 return mVisualModel->mControlSize;
40 const Size& Model::GetLayoutSize() const
42 return mVisualModel->GetLayoutSize();
45 const Vector2& Model::GetScrollPosition() const
47 return mScrollPosition;
50 Layout::HorizontalAlignment Model::GetHorizontalAlignment() const
52 return mHorizontalAlignment;
55 Layout::VerticalAlignment Model::GetVerticalAlignment() const
57 return mVerticalAlignment;
60 bool Model::IsTextElideEnabled() const
65 Length Model::GetNumberOfLines() const
67 return mVisualModel->mLines.Count();
70 const LineRun* const Model::GetLines() const
72 return mVisualModel->mLines.Begin();
75 Length Model::GetNumberOfScripts() const
77 return mLogicalModel->mScriptRuns.Count();
80 const ScriptRun* const Model::GetScriptRuns() const
82 return mLogicalModel->mScriptRuns.Begin();
85 Length Model::GetNumberOfGlyphs() const
87 return mVisualModel->mGlyphs.Count();
90 const GlyphInfo* const Model::GetGlyphs() const
92 return mVisualModel->mGlyphs.Begin();
95 const Vector2* const Model::GetLayout() const
97 return mVisualModel->mGlyphPositions.Begin();
100 const Vector4* const Model::GetColors() const
102 return mVisualModel->mColors.Begin();
105 const ColorIndex* const Model::GetColorIndices() const
107 return mVisualModel->mColorIndices.Begin();
110 const Vector4& Model::GetDefaultColor() const
112 return mVisualModel->mTextColor;
115 const Vector2& Model::GetShadowOffset() const
117 return mVisualModel->mShadowOffset;
120 const Vector4& Model::GetShadowColor() const
122 return mVisualModel->mShadowColor;
125 const Vector4& Model::GetUnderlineColor() const
127 return mVisualModel->GetUnderlineColor();
130 bool Model::IsUnderlineEnabled() const
132 return mVisualModel->IsUnderlineEnabled();
135 float Model::GetUnderlineHeight() const
137 return mVisualModel->GetUnderlineHeight();
140 Length Model::GetNumberOfUnderlineRuns() const
142 return mVisualModel->GetNumberOfUnderlineRuns();
145 void Model::GetUnderlineRuns( GlyphRun* underlineRuns, UnderlineRunIndex index, Length numberOfRuns ) const
147 mVisualModel->GetUnderlineRuns( underlineRuns, index, numberOfRuns );
150 const Vector4& Model::GetOutlineColor() const
152 return mVisualModel->GetOutlineColor();
155 float Model::GetOutlineWidth() const
157 return mVisualModel->GetOutlineWidth();
164 mScrollPositionLast(),
165 mHorizontalAlignment( Layout::HORIZONTAL_ALIGN_BEGIN ),
166 mVerticalAlignment( Layout::VERTICAL_ALIGN_TOP ),
167 mLineWrapMode( Layout::LineWrap::WORD ),
168 mAlignmentOffset( 0.0f ),
169 mElideEnabled( false )
171 mLogicalModel = LogicalModel::New();
172 mVisualModel = VisualModel::New();
181 } // namespace Toolkit