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/logical-model-impl.h>
27 #include <dali-toolkit/internal/text/spannable/spans/base-span-impl.h>
28 #include <dali/public-api/math/vector4.h>
38 class ForegroundColorSpan;
39 using ForegroundColorSpanPtr = IntrusivePtr<ForegroundColorSpan>;
42 * @copydoc Dali::Toolkit::Text::ForegroundColorSpan
44 class ForegroundColorSpan : public BaseSpan
48 * @brief Creates a new ForegroundColorSpan object.
50 static Dali::Toolkit::Text::ForegroundColorSpan New(Vector4 color);
55 ForegroundColorSpan();
57 ForegroundColorSpan(const ForegroundColorSpan&) = delete; ///< Deleted copy constructor
58 ForegroundColorSpan(ForegroundColorSpan&&) = delete; ///< Deleted move constructor
59 ForegroundColorSpan& operator=(const ForegroundColorSpan&) = delete; ///< Deleted copy assignment operator
60 ForegroundColorSpan& operator=(ForegroundColorSpan&&) = delete; ///< Deleted move assignment operator
65 * A reference counted object may only be deleted by calling Unreference()
67 ~ForegroundColorSpan() override;
71 * @copydoc Dali::Toolkit::Text::ForegroundColorSpan::GetForegroundColor()
73 const Vector4 GetForegroundColor() const;
76 * @copydoc Dali::Toolkit::Text::ForegroundColorSpan::IsForegroundColorDefined()
78 bool IsForegroundColorDefined() const;
80 public: //Methods. Not intended for application developers
82 * @brief Set the foreground-color.
84 * @param[in] color The foreground-color.
86 void SetForegroundColor(Vector4 color);
88 public: //Methods for internal only
90 * @copydoc Dali::Toolkit::Text::BaseSpan::CreateStyleCharacterRun
92 void CreateStyleCharacterRun(IntrusivePtr<LogicalModel>& logicalModel, const Dali::Toolkit::Text::Range& range) const override;
96 std::unique_ptr<Impl> mImpl{nullptr};
98 }; // class ForegroundColorSpan
100 } // namespace Internal
102 // Helpers for public-api forwarding methods
104 inline Internal::ForegroundColorSpan& GetImplementation(Dali::Toolkit::Text::ForegroundColorSpan& foregroundColorSpan)
106 DALI_ASSERT_ALWAYS(foregroundColorSpan && "foregroundColorSpan handle is empty");
108 BaseObject& object = foregroundColorSpan.GetBaseObject();
110 return static_cast<Internal::ForegroundColorSpan&>(object);
113 inline const Internal::ForegroundColorSpan& GetImplementation(const Dali::Toolkit::Text::ForegroundColorSpan& foregroundColorSpan)
115 DALI_ASSERT_ALWAYS(foregroundColorSpan && "foregroundColorSpan handle is empty");
117 const BaseObject& object = foregroundColorSpan.GetBaseObject();
119 return static_cast<const Internal::ForegroundColorSpan&>(object);
124 } // namespace Toolkit
128 #endif // DALI_TOOLKIT_INTERNAL_TEXT_FOREGROUND_COLOR_SPAN_IMPL_H