(Text Controller) Remove meaningless check to see if an unsigned int is positive...
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-model.cpp
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali-toolkit/internal/text/text-model.h>
20
21 namespace Dali
22 {
23
24 namespace Toolkit
25 {
26
27 namespace Text
28 {
29
30 ModelPtr Model::New()
31 {
32   return ModelPtr( new Model() );
33 }
34
35 const Size& Model::GetControlSize() const
36 {
37   return mVisualModel->mControlSize;
38 }
39
40 const Size& Model::GetLayoutSize() const
41 {
42   return mVisualModel->GetLayoutSize();
43 }
44
45 const Vector2& Model::GetScrollPosition() const
46 {
47   return mScrollPosition;
48 }
49
50 Layout::HorizontalAlignment Model::GetHorizontalAlignment() const
51 {
52   return mHorizontalAlignment;
53 }
54
55 Layout::VerticalAlignment Model::GetVerticalAlignment() const
56 {
57   return mVerticalAlignment;
58 }
59
60 bool Model::IsTextElideEnabled() const
61 {
62   return mElideEnabled;
63 }
64
65 Length Model::GetNumberOfLines() const
66 {
67   return mVisualModel->mLines.Count();
68 }
69
70 const LineRun* const Model::GetLines() const
71 {
72   return mVisualModel->mLines.Begin();
73 }
74
75 Length Model::GetNumberOfGlyphs() const
76 {
77   return mVisualModel->mGlyphs.Count();
78 }
79
80 const GlyphInfo* const Model::GetGlyphs() const
81 {
82   return mVisualModel->mGlyphs.Begin();
83 }
84
85 const Vector2* const Model::GetLayout() const
86 {
87   return mVisualModel->mGlyphPositions.Begin();
88 }
89
90 const Vector4* const Model::GetColors() const
91 {
92   return mVisualModel->mColors.Begin();
93 }
94
95 const ColorIndex* const Model::GetColorIndices() const
96 {
97   return mVisualModel->mColorIndices.Begin();
98 }
99
100 const Vector4& Model::GetDefaultColor() const
101 {
102   return mVisualModel->mTextColor;
103 }
104
105 Model::Model()
106 : mLogicalModel(),
107   mVisualModel(),
108   mScrollPosition(),
109   mScrollPositionLast(),
110   mHorizontalAlignment( Layout::HORIZONTAL_ALIGN_BEGIN ),
111   mVerticalAlignment( Layout::VERTICAL_ALIGN_TOP ),
112   mAlignmentOffset( 0.0f ),
113   mElideEnabled( false )
114 {
115   mLogicalModel = LogicalModel::New();
116   mVisualModel = VisualModel::New();
117 }
118
119 Model::~Model()
120 {
121 }
122
123 } // namespace Text
124
125 } // namespace Toolkit
126
127 } // namespace Dali