Fixed crash when KeyboardFocusManager clears the focus
[platform/core/uifw/dali-toolkit.git] / base / 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 Flora License, Version 1.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://floralicense.org/license/
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 #include <dali/dali.h>
21 #include "relayout-controller.h"
22
23 namespace Dali
24 {
25
26 namespace Toolkit
27 {
28
29 namespace Internal
30 {
31
32 class RelayoutController;
33
34 /**
35  * @copydoc Toolkit::Internal::RelayoutController
36  */
37 class RelayoutControllerImpl : public Dali::BaseObject, public ConnectionTracker
38 {
39 public:
40
41   /**
42    * Constructor.
43    * We should only create a unique instance.
44    */
45   RelayoutControllerImpl();
46
47
48   /**
49    * Destructor
50    */
51   virtual ~RelayoutControllerImpl();
52
53   /**
54    * Request for relayout.
55    */
56   void Request();
57
58 private:
59
60   /**
61    * Relayouts controls inside actor tree from bottom to top.
62    */
63   void Relayout();
64
65   /**
66    * Resets the relayout controller.
67    */
68   void Reset();
69
70   /**
71    * Disconnect the Relayout() method from the Stage::EventProcessingFinishedSignal().
72    */
73   void Disconnect();
74
75   // Undefined
76   RelayoutControllerImpl(const RelayoutControllerImpl&);
77   RelayoutControllerImpl& operator=(const RelayoutControllerImpl&);
78
79 private:
80
81   bool mRelayoutConnection:1; ///< Whether EventProcessingFinishedSignal signal is connected.
82 };
83
84 } // namespace Internal
85
86
87 inline Internal::RelayoutControllerImpl& GetImpl(Dali::Toolkit::Internal::RelayoutController& obj)
88 {
89   DALI_ASSERT_ALWAYS(obj);
90
91   Dali::BaseObject& handle = obj.GetBaseObject();
92
93   return static_cast<Internal::RelayoutControllerImpl&>(handle);
94 }
95
96 inline const Internal::RelayoutControllerImpl& GetImpl(const Dali::Toolkit::Internal::RelayoutController& obj)
97 {
98   DALI_ASSERT_ALWAYS(obj);
99
100   const Dali::BaseObject& handle = obj.GetBaseObject();
101
102   return static_cast<const Internal::RelayoutControllerImpl&>(handle);
103 }
104
105 } // namespace Toolkit
106
107 } // namespace Dali
108
109 #endif // __DALI_TOOLKIT_INTERNAL_RELAYOUT_CONTROLLER_IMPL_H__