Include <string> to compensate for core inclusion cleanup
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / relayout-controller-impl.h
1 #ifndef __DALI_TOOLKIT_INTERNAL_RELAYOUT_CONTROLLER_IMPL_H__
2 #define __DALI_TOOLKIT_INTERNAL_RELAYOUT_CONTROLLER_IMPL_H__
3
4 /*
5  * Copyright (c) 2014 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/common/vector-wrapper.h>
23 #include <dali/public-api/object/base-object.h>
24
25 // INTERNAL INCLUDES
26 #include <dali-toolkit/public-api/controls/control.h>
27 #include <dali-toolkit/public-api/controls/control-impl.h>
28 #include "relayout-controller.h"
29
30 namespace Dali
31 {
32
33 namespace Toolkit
34 {
35
36 namespace Internal
37 {
38
39 class RelayoutController;
40
41 typedef std::pair< Dali::Toolkit::Control, Vector2 > ControlSizePair;
42 typedef std::vector< ControlSizePair > ControlStack;
43
44 /**
45  * @copydoc Toolkit::Internal::RelayoutController
46  */
47 class RelayoutControllerImpl : public Dali::BaseObject, public ConnectionTracker
48 {
49 public:
50
51   /**
52    * Constructor.
53    * We should only create a unique instance.
54    * @param relayoutFlag to avoid unnecessary calls inside a single frame
55    */
56   RelayoutControllerImpl( bool& relayoutFlag );
57
58
59   /**
60    * Destructor
61    */
62   virtual ~RelayoutControllerImpl();
63
64   /**
65    * Request for relayout.
66    */
67   void Request();
68
69 private:
70
71   /**
72    * Relayouts controls inside actor tree from bottom to top.
73    */
74   void Relayout();
75
76   /**
77    * Resets the relayout controller.
78    */
79   void Reset();
80
81   /**
82    * Disconnect the Relayout() method from the Stage::EventProcessingFinishedSignal().
83    */
84   void Disconnect();
85
86   // Undefined
87   RelayoutControllerImpl(const RelayoutControllerImpl&);
88   RelayoutControllerImpl& operator=(const RelayoutControllerImpl&);
89
90 private:
91
92   bool& mRelayoutFlag;               ///< reference to relayout flag to avoid unnecessary calls
93   ControlStack mControlStack;        ///< stack for relayouting
94   ActorSizeContainer mSizecontainer; ///< size container
95   bool mRelayoutConnection:1;        ///< Whether EventProcessingFinishedSignal signal is connected.
96
97 };
98
99 } // namespace Internal
100
101
102 inline Internal::RelayoutControllerImpl& GetImpl(Dali::Toolkit::Internal::RelayoutController& obj)
103 {
104   DALI_ASSERT_ALWAYS(obj);
105
106   Dali::BaseObject& handle = obj.GetBaseObject();
107
108   return static_cast<Internal::RelayoutControllerImpl&>(handle);
109 }
110
111 inline const Internal::RelayoutControllerImpl& GetImpl(const Dali::Toolkit::Internal::RelayoutController& obj)
112 {
113   DALI_ASSERT_ALWAYS(obj);
114
115   const Dali::BaseObject& handle = obj.GetBaseObject();
116
117   return static_cast<const Internal::RelayoutControllerImpl&>(handle);
118 }
119
120 } // namespace Toolkit
121
122 } // namespace Dali
123
124 #endif // __DALI_TOOLKIT_INTERNAL_RELAYOUT_CONTROLLER_IMPL_H__