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/devel-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::OnInitialize()
88 virtual void OnInitialize() override;
91 * @copydoc Control::OnRelayout()
93 void OnRelayout( const Vector2& size, RelayoutContainer& container ) override;
99 * It initializes Alignment members.
101 Alignment( Toolkit::Alignment::Type horizontal, Toolkit::Alignment::Type vertical );
104 * A reference counted object may only be deleted by calling Unreference()
106 virtual ~Alignment();
111 Alignment(const Alignment&);
112 Alignment& operator=(const Alignment&);
115 Toolkit::Alignment::Type mHorizontal; ///< Type of alignment.
116 Toolkit::Alignment::Type mVertical; ///< Type of alignment.
117 Toolkit::Alignment::Scaling mScaling; ///< Stores the geometry scaling.
118 Toolkit::Alignment::Padding mPadding; ///< Stores the padding values.
121 } // namespace Internal
124 // Helpers for public-api forwarding methods
126 inline Toolkit::Internal::Alignment& GetImpl( Toolkit::Alignment& alignment )
128 DALI_ASSERT_ALWAYS( alignment );
130 Dali::RefObject& handle = alignment.GetImplementation();
132 return static_cast<Toolkit::Internal::Alignment&>( handle );
135 inline const Toolkit::Internal::Alignment& GetImpl( const Toolkit::Alignment& alignment )
137 DALI_ASSERT_ALWAYS( alignment );
139 const Dali::RefObject& handle = alignment.GetImplementation();
141 return static_cast<const Toolkit::Internal::Alignment&>( handle );
144 } // namespace Toolkit
148 #endif // DALI_TOOLKIT_INTERNAL_ALIGNMENT_H