(ScrollView) Moved constraint related behaviour into a new class
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / scrollable / scroll-view / scroll-view-impl-constraints.h
1 #ifndef DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_CONSTRAINTS_H
2 #define DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_CONSTRAINTS_H
3
4 /*
5  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/animation/constraint.h>
23
24 namespace Dali
25 {
26 namespace Toolkit
27 {
28 namespace Internal
29 {
30
31 class ScrollView;
32
33 /// Sets up and owns the Constraints used by the ScrollView class
34 class ScrollViewConstraints
35 {
36 public:
37
38   ScrollViewConstraints() = default;  ///< Default Constructor
39   ~ScrollViewConstraints() = default; ///< Default Non-Virtual Destructor
40
41   // Not copyable or moveable
42   ScrollViewConstraints(const ScrollViewConstraints&) = delete;
43   ScrollViewConstraints(ScrollViewConstraints&&) = delete;
44   ScrollViewConstraints& operator=(const ScrollViewConstraints&) = delete;
45   ScrollViewConstraints& operator=(ScrollViewConstraints&&) = delete;
46
47   /**
48    * Updates the main internal scroll constraints with new ruler and domain values
49    *
50    * @param[in] scrollView A reference to the scroll view object
51    */
52   void UpdateMainInternalConstraint(Internal::ScrollView& scrollView);
53
54   /**
55    * Enables/disables the overshoot constraints
56    *
57    * @param[in] scrollView A reference to the scroll view object
58    * @param[in] enabled whether to enable or disable the overshoot constraints
59    */
60   void SetOvershootConstraintsEnabled(ScrollView& scrollView, bool enabled);
61
62   /**
63    * Sets internal constraints for this ScrollView.
64    * Many of these internal constraints are based on properties within ScrollView.
65    *
66    * @param[in] scrollView A reference to the scroll view object
67    */
68   void SetInternalConstraints(ScrollView& scrollView);
69
70 public:
71
72   Constraint mScrollMainInternalPrePositionConstraint;
73   Constraint mScrollMainInternalPositionConstraint;
74   Constraint mScrollMainInternalOvershootXConstraint;
75   Constraint mScrollMainInternalOvershootYConstraint;
76   Constraint mScrollMainInternalDeltaConstraint;
77   Constraint mScrollMainInternalFinalConstraint;
78   Constraint mScrollMainInternalRelativeConstraint;
79   Constraint mScrollMainInternalDomainConstraint;
80   Constraint mScrollMainInternalPrePositionMaxConstraint;
81 };
82
83 } // namespace Internal
84
85 } // namespace Toolkit
86
87 } // namespace Dali
88
89 #endif // DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_CONSTRAINTS_H