1 #ifndef DALI_TOOLKIT_INTERNAL_TEXT_BACKGROUND_COLOR_SPAN_IMPL_H
2 #define DALI_TOOLKIT_INTERNAL_TEXT_BACKGROUND_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/background-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 BackgroundColorSpan;
39 using BackgroundColorSpanPtr = IntrusivePtr<BackgroundColorSpan>;
42 * @copydoc Dali::Toolkit::Text::BackgroundColorSpan
44 class BackgroundColorSpan : public BaseSpan
48 * @brief Creates a new BackgroundColorSpan object.
50 static Dali::Toolkit::Text::BackgroundColorSpan New(const Vector4 &color);
55 BackgroundColorSpan();
57 ///< Deleted copy constructor
58 BackgroundColorSpan(const BackgroundColorSpan&) = delete;
60 ///< Deleted move constructor
61 BackgroundColorSpan(BackgroundColorSpan&&) = delete;
63 ///< Deleted copy assignment operator
64 BackgroundColorSpan& operator=(const BackgroundColorSpan&) = delete;
66 ///< Deleted move assignment operator
67 BackgroundColorSpan& operator=(BackgroundColorSpan&&) = delete;
72 * A reference counted object may only be deleted by calling Unreference()
74 ~BackgroundColorSpan() override;
78 * @copydoc Dali::Toolkit::Text::BackgroundColorSpan::GetBackgroundColor()
80 const Vector4 GetBackgroundColor() const;
83 * @copydoc Dali::Toolkit::Text::BackgroundColorSpan::IsBackgroundColorDefined()
85 bool IsBackgroundColorDefined() const;
87 public: //Methods. Not intended for application developers
89 * @brief Set the background-color.
91 * @param[in] color The background-color.
93 void SetBackgroundColor(const Vector4 &color);
95 public: //Methods for internal only
97 * @copydoc Dali::Toolkit::Text::BaseSpan::CreateStyleCharacterRun
99 void CreateStyleCharacterRun(IntrusivePtr<LogicalModel>& logicalModel, const Dali::Toolkit::Text::Range& range) const override;
103 std::unique_ptr<Impl> mImpl{nullptr};
105 }; // class BackgroundColorSpan
107 } // namespace Internal
109 // Helpers for public-api forwarding methods
111 inline Internal::BackgroundColorSpan& GetImplementation(Dali::Toolkit::Text::BackgroundColorSpan& BackgroundColorSpan)
113 DALI_ASSERT_ALWAYS(BackgroundColorSpan && "BackgroundColorSpan handle is empty");
115 BaseObject& object = BackgroundColorSpan.GetBaseObject();
117 return static_cast<Internal::BackgroundColorSpan&>(object);
120 inline const Internal::BackgroundColorSpan& GetImplementation(const Dali::Toolkit::Text::BackgroundColorSpan& BackgroundColorSpan)
122 DALI_ASSERT_ALWAYS(BackgroundColorSpan && "BackgroundColorSpan handle is empty");
124 const BaseObject& object = BackgroundColorSpan.GetBaseObject();
126 return static_cast<const Internal::BackgroundColorSpan&>(object);
131 } // namespace Toolkit
135 #endif // DALI_TOOLKIT_INTERNAL_TEXT_BACKGROUND_COLOR_SPAN_IMPL_H