1 #ifndef DALI_TOOLKIT_INTERNAL_TEXT_CHARACTER_SPACING_SPAN_IMPL_H
2 #define DALI_TOOLKIT_INTERNAL_TEXT_CHARACTER_SPACING_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/character-spacing-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 CharacterSpacingSpan;
39 using CharacterSpacingSpanPtr = IntrusivePtr<CharacterSpacingSpan>;
42 * @copydoc Dali::Toolkit::Text::CharacterSpacingSpan
44 class CharacterSpacingSpan : public BaseSpan
48 * @brief Creates a new CharacterSpacingSpan object.
50 static Dali::Toolkit::Text::CharacterSpacingSpan New(const float& value);
55 CharacterSpacingSpan();
57 CharacterSpacingSpan(const CharacterSpacingSpan&) = delete; ///< Deleted copy constructor
58 CharacterSpacingSpan(CharacterSpacingSpan&&) = delete; ///< Deleted move constructor
59 CharacterSpacingSpan& operator=(const CharacterSpacingSpan&) = delete; ///< Deleted copy assignment operator
60 CharacterSpacingSpan& operator=(CharacterSpacingSpan&&) = delete; ///< Deleted move assignment operator
65 * A reference counted object may only be deleted by calling Unreference()
67 ~CharacterSpacingSpan() override;
71 * @copydoc Dali::Toolkit::Text::CharacterSpacingSpan::GetCharacterSpacing()
73 const float GetCharacterSpacing() const;
76 * @copydoc Dali::Toolkit::Text::CharacterSpacingSpan::IsCharacterSpacingDefined()
78 bool IsCharacterSpacingDefined() const;
80 public: //Methods. Not intended for application developers
82 * @brief Set the CharacterSpacing.
84 * @param[in] value The CharacterSpacing.
86 void SetCharacterSpacing(const float& value);
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 CharacterSpacingSpan
100 } // namespace Internal
102 // Helpers for public-api forwarding methods
104 inline Internal::CharacterSpacingSpan& GetImplementation(Dali::Toolkit::Text::CharacterSpacingSpan& characterSpacingSpan)
106 DALI_ASSERT_ALWAYS(characterSpacingSpan && "CharacterSpacingSpan handle is empty");
108 BaseObject& object = characterSpacingSpan.GetBaseObject();
110 return static_cast<Internal::CharacterSpacingSpan&>(object);
113 inline const Internal::CharacterSpacingSpan& GetImplementation(const Dali::Toolkit::Text::CharacterSpacingSpan& CharacterSpacingSpan)
115 DALI_ASSERT_ALWAYS(CharacterSpacingSpan && "CharacterSpacingSpan handle is empty");
117 const BaseObject& object = CharacterSpacingSpan.GetBaseObject();
119 return static_cast<const Internal::CharacterSpacingSpan&>(object);
124 } // namespace Toolkit
128 #endif // DALI_TOOLKIT_INTERNAL_TEXT_CHARACTER_SPACING_SPAN_IMPL_H