1 #ifndef DALI_TOOLKIT_TEXT_FOREGROUND_COLOR_SPAN_H
2 #define DALI_TOOLKIT_TEXT_FOREGROUND_COLOR_SPAN_H
5 * Copyright (c) 2022 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-toolkit/devel-api/text/spans/base-span.h>
23 #include <dali/public-api/math/vector4.h>
31 namespace Internal DALI_INTERNAL
33 class ForegroundColorSpan;
37 * @brief ForegroundColorSpan is a handle to an object that specifies the foreground-color for range of characters.
39 class DALI_TOOLKIT_API ForegroundColorSpan : public BaseSpan
43 * @brief Create an initialized ForegroundColorSpan.
45 * @param[in] color The foreground color.
47 * @return A handle to a newly allocated Dali resource
49 static ForegroundColorSpan New(Vector4 color);
52 * @brief Creates an uninitialized ForegroundColorSpan handle.
54 * Calling member functions with an uninitialized ForegroundColorSpan handle is not allowed.
56 ForegroundColorSpan();
59 * @brief Copy constructor.
60 * @param[in] rhs A reference to the copied handle
62 ForegroundColorSpan(const ForegroundColorSpan& rhs);
65 * @brief Move constructor.
66 * @param[in] rhs A reference to the handle to move
68 ForegroundColorSpan(ForegroundColorSpan&& rhs);
71 * @brief Assignment operator.
72 * @param[in] rhs A reference to the copied handle
73 * @return A reference to this
75 ForegroundColorSpan& operator=(const ForegroundColorSpan& rhs);
78 * @brief Move assignment operator.
79 * @param[in] rhs A reference to the moved handle
80 * @return A reference to this
82 ForegroundColorSpan& operator=(ForegroundColorSpan&& rhs);
85 * @brief Non virtual destructor.
87 ~ForegroundColorSpan();
90 * @brief Downcasts to a ForegroundColorSpan handle.
91 * If handle is not a ForegroundColorSpan, the returned handle is left uninitialized.
93 * @param[in] handle Handle to an object
94 * @return ForegroundColorSpan handle or an uninitialized handle
96 static ForegroundColorSpan DownCast(BaseHandle handle);
100 * @brief Retrive the foreground-color.
102 * @return A foreground-color value.
104 const Vector4 GetForegroundColor() const;
107 * @brief Retrieve whether the foreground-color is defined.
109 * @return The return is true if foreground-color is defined, otherwise false.
111 bool IsForegroundColorDefined() const;
113 public: // Not intended for application developers
116 * @brief This constructor is used internally to Create an initialized ForegroundColorSpan handle.
118 * @param[in] colorSpan Pointer to internal ForegroundColorSpan
120 explicit DALI_INTERNAL ForegroundColorSpan(Internal::ForegroundColorSpan* colorSpan);
126 } // namespace Toolkit
130 #endif // DALI_TOOLKIT_TEXT_FOREGROUND_COLOR_SPAN_H