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