1 #ifndef DALI_TOOLKIT_INTERNAL_ALIGNMENT_H
2 #define DALI_TOOLKIT_INTERNAL_ALIGNMENT_H
5 * Copyright (c) 2019 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/public-api/controls/control-impl.h>
23 #include <dali-toolkit/public-api/controls/alignment/alignment.h>
24 #include <dali-toolkit/internal/controls/control/control-data-impl.h>
38 * Alignment is a control to position and resize actors inside other container actors.
39 * @see Dali::Toolkit::Alignment for more details.
41 class Alignment : public Control
46 * Create an initialized Alignment.
47 * @param type Type of alignment.
48 * @return A handle to a newly allocated Dali resource.
50 static Toolkit::Alignment New( Toolkit::Alignment::Type horizontal, Toolkit::Alignment::Type vertical );
53 * @copydoc Dali::Toolkit::Alignment::SetAlignmentType()
55 void SetAlignmentType( Toolkit::Alignment::Type type );
58 * @copydoc Dali::Toolkit::Alignment::GetAlignmentType()
60 Toolkit::Alignment::Type GetAlignmentType() const;
63 * @copydoc Dali::Toolkit::Alignment::SetScaling()
65 void SetScaling( Toolkit::Alignment::Scaling scaling );
68 * @copydoc Dali::Toolkit::Alignment::GetScaling()
70 Toolkit::Alignment::Scaling GetScaling() const;
73 * @copydoc Dali::Toolkit::Alignment::SetPadding()
75 void SetPadding( const Toolkit::Alignment::Padding& padding );
78 * @copydoc Dali::Toolkit::Alignment::GetPadding()
80 const Toolkit::Alignment::Padding& GetPadding() const;
83 private: // From Control
86 * @copydoc Control::OnRelayout()
88 virtual void OnRelayout( const Vector2& size, RelayoutContainer& container );
94 * It initializes Alignment members.
96 Alignment( Toolkit::Alignment::Type horizontal, Toolkit::Alignment::Type vertical );
99 * A reference counted object may only be deleted by calling Unreference()
101 virtual ~Alignment();
106 Alignment(const Alignment&);
107 Alignment& operator=(const Alignment&);
110 Toolkit::Alignment::Type mHorizontal; ///< Type of alignment.
111 Toolkit::Alignment::Type mVertical; ///< Type of alignment.
112 Toolkit::Alignment::Scaling mScaling; ///< Stores the geometry scaling.
113 Toolkit::Alignment::Padding mPadding; ///< Stores the padding values.
116 } // namespace Internal
119 // Helpers for public-api forwarding methods
121 inline Toolkit::Internal::Alignment& GetImpl( Toolkit::Alignment& alignment )
123 DALI_ASSERT_ALWAYS( alignment );
125 Dali::RefObject& handle = alignment.GetImplementation();
127 return static_cast<Toolkit::Internal::Alignment&>( handle );
130 inline const Toolkit::Internal::Alignment& GetImpl( const Toolkit::Alignment& alignment )
132 DALI_ASSERT_ALWAYS( alignment );
134 const Dali::RefObject& handle = alignment.GetImplementation();
136 return static_cast<const Toolkit::Internal::Alignment&>( handle );
139 } // namespace Toolkit
143 #endif // DALI_TOOLKIT_INTERNAL_ALIGNMENT_H