1 #ifndef DALI_TOOLKIT_INTERNAL_ALIGNMENT_H
2 #define DALI_TOOLKIT_INTERNAL_ALIGNMENT_H
5 * Copyright (c) 2021 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/controls/alignment/alignment.h>
23 #include <dali-toolkit/internal/controls/control/control-data-impl.h>
24 #include <dali-toolkit/public-api/controls/control-impl.h>
35 * Alignment is a control to position and resize actors inside other container actors.
36 * @see Dali::Toolkit::Alignment for more details.
38 class Alignment : public Control
42 * Create an initialized Alignment.
43 * @param type Type of alignment.
44 * @return A handle to a newly allocated Dali resource.
46 static Toolkit::Alignment New(Toolkit::Alignment::Type horizontal, Toolkit::Alignment::Type vertical);
49 * @copydoc Dali::Toolkit::Alignment::SetAlignmentType()
51 void SetAlignmentType(Toolkit::Alignment::Type type);
54 * @copydoc Dali::Toolkit::Alignment::GetAlignmentType()
56 Toolkit::Alignment::Type GetAlignmentType() const;
59 * @copydoc Dali::Toolkit::Alignment::SetScaling()
61 void SetScaling(Toolkit::Alignment::Scaling scaling);
64 * @copydoc Dali::Toolkit::Alignment::GetScaling()
66 Toolkit::Alignment::Scaling GetScaling() const;
69 * @copydoc Dali::Toolkit::Alignment::SetPadding()
71 void SetPadding(const Toolkit::Alignment::Padding& padding);
74 * @copydoc Dali::Toolkit::Alignment::GetPadding()
76 const Toolkit::Alignment::Padding& GetPadding() const;
78 private: // From Control
80 * @copydoc Control::OnInitialize()
82 virtual void OnInitialize() override;
85 * @copydoc Control::OnRelayout()
87 void OnRelayout(const Vector2& size, RelayoutContainer& container) override;
92 * It initializes Alignment members.
94 Alignment(Toolkit::Alignment::Type horizontal, Toolkit::Alignment::Type vertical);
97 * A reference counted object may only be deleted by calling Unreference()
103 Alignment(const Alignment&);
104 Alignment& operator=(const Alignment&);
107 Toolkit::Alignment::Type mHorizontal; ///< Type of alignment.
108 Toolkit::Alignment::Type mVertical; ///< Type of alignment.
109 Toolkit::Alignment::Scaling mScaling; ///< Stores the geometry scaling.
110 Toolkit::Alignment::Padding mPadding; ///< Stores the padding values.
113 } // namespace Internal
115 // Helpers for public-api forwarding methods
117 inline Toolkit::Internal::Alignment& GetImpl(Toolkit::Alignment& alignment)
119 DALI_ASSERT_ALWAYS(alignment);
121 Dali::RefObject& handle = alignment.GetImplementation();
123 return static_cast<Toolkit::Internal::Alignment&>(handle);
126 inline const Toolkit::Internal::Alignment& GetImpl(const Toolkit::Alignment& alignment)
128 DALI_ASSERT_ALWAYS(alignment);
130 const Dali::RefObject& handle = alignment.GetImplementation();
132 return static_cast<const Toolkit::Internal::Alignment&>(handle);
135 } // namespace Toolkit
139 #endif // DALI_TOOLKIT_INTERNAL_ALIGNMENT_H