1 #ifndef DALI_TOOLKIT_INTERNAL_TEXT_STRIKETHROUGH_SPAN_IMPL_H
2 #define DALI_TOOLKIT_INTERNAL_TEXT_STRIKETHROUGH_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/strikethrough-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 StrikethroughSpan;
40 using StrikethroughSpanPtr = IntrusivePtr<StrikethroughSpan>;
43 * @copydoc Dali::Toolkit::Text::StrikethroughSpan
46 class StrikethroughSpan : public BaseSpan
50 * @brief Creates a new StrikethroughSpan object.
52 * @return A new StrikethroughSpan object.
54 static Dali::Toolkit::Text::StrikethroughSpan New();
57 * @brief Creates a new StrikethroughSpan object.
59 * @param[in] color The color of line.
60 * @param[in] height The height of line.
62 * @return A new StrikethroughSpan object.
64 static Dali::Toolkit::Text::StrikethroughSpan New(Vector4 color, float height);
70 StrikethroughSpan(const StrikethroughSpan&) = delete; ///< Deleted copy constructor
71 StrikethroughSpan(StrikethroughSpan&&) = delete; ///< Deleted move constructor
72 StrikethroughSpan& operator=(const StrikethroughSpan&) = delete; ///< Deleted copy assignment operator
73 StrikethroughSpan& operator=(StrikethroughSpan&&) = delete; ///< Deleted move assignment operator
78 * A reference counted object may only be deleted by calling Unreference()
80 ~StrikethroughSpan() override;
84 * @copydoc Dali::Toolkit::Text::StrikethroughSpan::GetColor()
86 const Vector4 GetColor() const;
89 * @copydoc Dali::Toolkit::Text::StrikethroughSpan::IsColorDefined()
91 bool IsColorDefined() const;
94 * @copydoc Dali::Toolkit::Text::StrikethroughSpan::GetHeight()
96 const float GetHeight() const;
99 * @copydoc Dali::Toolkit::Text::StrikethroughSpan::IsHeightDefined()
101 bool IsHeightDefined() const;
103 public: //Methods. Not intended for application developers
105 * @brief Set the color of underline.
107 * @param[in] color The color of line.
109 void SetColor(const Vector4& color);
112 * @brief Set the height of underline.
114 * @param[in] height The height of line.
116 void SetHeight(const float& height);
118 public: //Methods for internal only
120 * @copydoc Dali::Toolkit::Text::BaseSpan::CreateStyleCharacterRun
122 void CreateStyleCharacterRun(IntrusivePtr<LogicalModel>& logicalModel, const Dali::Toolkit::Text::Range& range) const override;
127 std::unique_ptr<Impl> mImpl{nullptr};
129 }; // class StrikethroughSpan
131 } // namespace Internal
133 // Helpers for public-api forwarding methods
135 inline Internal::StrikethroughSpan& GetImplementation(Dali::Toolkit::Text::StrikethroughSpan& foregroundColorSpan)
137 DALI_ASSERT_ALWAYS(foregroundColorSpan && "foregroundColorSpan handle is empty");
138 BaseObject& object = foregroundColorSpan.GetBaseObject();
139 return static_cast<Internal::StrikethroughSpan&>(object);
142 inline const Internal::StrikethroughSpan& GetImplementation(const Dali::Toolkit::Text::StrikethroughSpan& foregroundColorSpan)
144 DALI_ASSERT_ALWAYS(foregroundColorSpan && "foregroundColorSpan handle is empty");
145 const BaseObject& object = foregroundColorSpan.GetBaseObject();
146 return static_cast<const Internal::StrikethroughSpan&>(object);
151 } // namespace Toolkit
155 #endif // DALI_TOOLKIT_INTERNAL_TEXT_STRIKETHROUGH_SPAN_IMPL_H