1 #ifndef DALI_TOOLKIT_INTERNAL_TEXT_FOREGROUND_COLOR_SPAN_IMPL_H
2 #define DALI_TOOLKIT_INTERNAL_TEXT_FOREGROUND_COLOR_SPAN_IMPL_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/foreground-color-span.h>
26 #include <dali-toolkit/internal/text/spannable/spans/base-span-impl.h>
27 #include <dali/public-api/math/vector4.h>
37 class ForegroundColorSpan;
38 using ForegroundColorSpanPtr = IntrusivePtr<ForegroundColorSpan>;
41 * @copydoc Dali::Toolkit::Text::ForegroundColorSpan
43 class ForegroundColorSpan : public BaseSpan
47 * @brief Creates a new ForegroundColorSpan object.
49 static Dali::Toolkit::Text::ForegroundColorSpan New(Vector4 color);
54 ForegroundColorSpan();
56 ForegroundColorSpan(const ForegroundColorSpan&) = delete; ///< Deleted copy constructor
57 ForegroundColorSpan(ForegroundColorSpan&&) = delete; ///< Deleted move constructor
58 ForegroundColorSpan& operator=(const ForegroundColorSpan&) = delete; ///< Deleted copy assignment operator
59 ForegroundColorSpan& operator=(ForegroundColorSpan&&) = delete; ///< Deleted move assignment operator
64 * A reference counted object may only be deleted by calling Unreference()
66 ~ForegroundColorSpan() override;
70 * @copydoc Dali::Toolkit::Text::ForegroundColorSpan::GetForegroundColor()
72 const Vector4 GetForegroundColor() const;
75 * @copydoc Dali::Toolkit::Text::ForegroundColorSpan::IsForegroundColorDefined()
77 bool IsForegroundColorDefined() const;
79 public: //Methods. Not intended for application developers
81 * @brief Set the foreground-color.
83 * @param[in] color The foreground-color.
85 void SetForegroundColor(Vector4 color);
89 std::unique_ptr<Impl> mImpl{nullptr};
91 }; // class ForegroundColorSpan
93 } // namespace Internal
95 // Helpers for public-api forwarding methods
97 inline Internal::ForegroundColorSpan& GetImplementation(Dali::Toolkit::Text::ForegroundColorSpan& foregroundColorSpan)
99 DALI_ASSERT_ALWAYS(foregroundColorSpan && "foregroundColorSpan handle is empty");
101 BaseObject& object = foregroundColorSpan.GetBaseObject();
103 return static_cast<Internal::ForegroundColorSpan&>(object);
106 inline const Internal::ForegroundColorSpan& GetImplementation(const Dali::Toolkit::Text::ForegroundColorSpan& foregroundColorSpan)
108 DALI_ASSERT_ALWAYS(foregroundColorSpan && "foregroundColorSpan handle is empty");
110 const BaseObject& object = foregroundColorSpan.GetBaseObject();
112 return static_cast<const Internal::ForegroundColorSpan&>(object);
117 } // namespace Toolkit
121 #endif // DALI_TOOLKIT_INTERNAL_TEXT_FOREGROUND_COLOR_SPAN_IMPL_H