Spannable-Core: Add SpannableString and ForegroundColorSpan
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / text / spans / foreground-color-span.cpp
1 /*
2  * Copyright (c) 2022 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/devel-api/text/spans/foreground-color-span.h>
20
21 // INTERNAL INCLUDES
22 #include <dali-toolkit/internal/text/spannable/spans/foreground-color-span-impl.h>
23
24 namespace Dali
25 {
26 namespace Toolkit
27 {
28 namespace Text
29 {
30 ForegroundColorSpan ForegroundColorSpan::New(Vector4 color)
31 {
32   return Internal::ForegroundColorSpan::New(color);
33 }
34
35 ForegroundColorSpan::ForegroundColorSpan(Internal::ForegroundColorSpan* internal)
36 : BaseSpan(internal)
37 {
38 }
39
40 ForegroundColorSpan::ForegroundColorSpan() = default;
41
42 ForegroundColorSpan::ForegroundColorSpan(const ForegroundColorSpan& rhs) = default;
43
44 ForegroundColorSpan::ForegroundColorSpan(ForegroundColorSpan&& rhs) = default;
45
46 ForegroundColorSpan& ForegroundColorSpan::operator=(const ForegroundColorSpan& rhs) = default;
47
48 ForegroundColorSpan& ForegroundColorSpan::operator=(ForegroundColorSpan&& rhs) = default;
49
50 ForegroundColorSpan::~ForegroundColorSpan() = default;
51
52 //Methods
53 const Vector4 ForegroundColorSpan::GetForegroundColor() const
54 {
55   return GetImplementation(*this).GetForegroundColor();
56 }
57
58 bool ForegroundColorSpan::IsForegroundColorDefined() const
59 {
60   return GetImplementation(*this).IsForegroundColorDefined();
61 }
62
63 ForegroundColorSpan ForegroundColorSpan::DownCast(BaseHandle handle)
64 {
65   return ForegroundColorSpan(dynamic_cast<Dali::Toolkit::Text::Internal::ForegroundColorSpan*>(handle.GetObjectPtr()));
66 }
67
68 } // namespace Text
69
70 } // namespace Toolkit
71
72 } // namespace Dali