Revert " modify license, permission and remove ^M char"
[framework/osp/uifw.git] / src / ui / inc / FUi_ContainerImpl.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://floralicense.org/license/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19 * @file                 FUi_ContainerImpl.h
20 * @brief                This is the header file for the _ContainerImp interface.
21 *
22 * This header file contains the declarations of the %_ContainerImp interface.
23 */
24
25 #ifndef _FUI_INTERNAL_CONTAINER_IMPL_H_
26 #define _FUI_INTERNAL_CONTAINER_IMPL_H_
27
28 #include <FBaseColArrayList.h>
29 #include <FUiContainer.h>
30 #include "FUi_ControlImpl.h"
31 #include "FUi_SharedPtr.h"
32
33 namespace Tizen { namespace Ui
34 {
35
36 class _LayoutImpl;
37
38 class _OSP_EXPORT_ _ContainerImpl
39         : public _ControlImpl
40 {
41 public:
42 // Life Cycle
43         void Initialize(Control* pPublic, _Control* pCore, const Layout* pPublicPortraitLayout, const Layout* pPublicLandscapeLayout);
44         static _ContainerImpl* CreateContainerImplN(Container* pPublic);
45         static _ContainerImpl* CreateContainerImplN(Container* pPublic, const Tizen::Graphics::Rectangle& bounds, const Layout* pPublicPortraitLayout, const Layout* pPublicLandscapeLayout, bool resizable, bool movable);
46         static _ContainerImpl* CreateContainerImplN(Container* pPublic, const Tizen::Graphics::FloatRectangle& bounds, const Layout* pPublicPortraitLayout, const Layout* pPublicLandscapeLayout, bool resizable, bool movable);
47         virtual ~_ContainerImpl(void);
48
49         static _ContainerImpl* GetInstance(Container& container);
50         static const _ContainerImpl* GetInstance(const Container& container);
51 //Operation
52         // [ToDo] Must consider transforOwnership flags.
53         virtual result Destroy(void);
54         result AddChild(_ControlImpl* pChild, bool transferOwnership = true);
55         result RemoveControl(_ControlImpl* pChild, bool deallocate = true);
56         result RemoveChild(_ControlImpl* pChild, bool deallocate = true);
57         result RemoveControl(int index);
58         result RemoveChild(int index);
59         void DeleteAllChildren(_ContainerImpl* pChild, bool detachSystemChild = true, Tizen::Base::Collection::ArrayList* pChildrenList = null);
60         void RemoveAllChildren(bool detachSystemChild = true, bool callOnDetachingFromMainTree = false);
61         result MoveChildToTop(const _ControlImpl& child);
62         result MoveChildBefore(const _ControlImpl& targetChild, const _ControlImpl& child);
63
64 // Z-Order
65         result SetControlAlwaysOnTop(Control& control, bool alwaysOnTop);
66         result SetControlAlwaysAtBottom(Control& control, bool alwaysAtBottom);
67         bool IsControlAlwaysAtBottom(const Control& control) const;
68         bool IsControlAlwaysOnTop(const Control& control) const;
69
70 // Getters/Setters
71         virtual const char* GetPublicClassName(void) const;
72         virtual const Container& GetPublic(void) const;
73         virtual Container& GetPublic(void);
74
75         Tizen::Base::Collection::IList* GetChildrenPublic(void) const;
76         _ControlImpl* GetChild(int index) const;
77
78         _ControlImpl* SearchControlByName(const Tizen::Base::String& name, bool recursive, bool searchMyself = false) const;
79
80         int GetChildIndex(const _ControlImpl* pChild) const;
81         int GetChildCount(void) const;
82
83         // [ToDo] It's returning public class instance. OK?
84         Layout* GetPublicPortraitLayoutN(void) const;
85         Layout* GetPublicLandscapeLayoutN(void) const;
86         Layout* GetPublicLayoutN(void) const;
87
88         result SetChildAt(const _ControlImpl* pChild, int index);
89         bool IsAncestorOf(const _ControlImpl* pChild) const;
90
91 // Internal Callbacks
92         virtual void OnDraw(void);
93         virtual void OnChangeLayout(_ControlOrientation orientation);
94         virtual void OnVisibleStateChanging(void);
95         virtual void OnVisibleStateChanged(void);
96         virtual result OnBoundsChanging(const Tizen::Graphics::Rectangle& bounds);
97         virtual result OnBoundsChanging(const Tizen::Graphics::FloatRectangle& bounds);
98         virtual void OnBoundsChanged(void);
99         virtual void OnEvaluateSize(Tizen::Graphics::Dimension& evaluatedSize);
100         virtual bool OnEvaluateSize(Tizen::Graphics::FloatDimension& evaluatedSize);
101
102         void CallOnDraw(void);
103
104 protected:
105         _ContainerImpl(Control* pPublic, _Control* pCore, const Layout* pPublicPortraitLayout = null, const Layout* pPublicLandscapeLayout = null);
106         _ContainerImpl(Control* pPublic, _Control* pCore, const Tizen::Graphics::Rectangle& bounds, const Layout* pPublicPortraitLayout, const Layout* pPublicLandscapeLayout, bool resizable, bool movable);
107         _ContainerImpl(Control* pPublic, _Control* pCore, const Tizen::Graphics::FloatRectangle& bounds, const Layout* pPublicPortraitLayout, const Layout* pPublicLandscapeLayout, bool resizable, bool movable);
108
109 private:
110         _ContainerImpl(const _ContainerImpl& rhs);
111         _ContainerImpl& operator =(const _ContainerImpl& rhs);
112
113         virtual bool IsChildAttachable(_ControlImpl& child) const;
114         result SetLayout(_Control& core, _ControlOrientation orientation, const Layout* pPublicLayout);
115
116 private:
117         Tizen::Base::Collection::LinkedList __controlPublics;
118         _SharedPtr <Tizen::Ui::_LayoutImpl> __portraitLayout;
119         _SharedPtr <Tizen::Ui::_LayoutImpl> __landscapeLayout;
120 }; // _ContainerImpl
121
122 }} // Tizen::Ui
123
124 #endif // _FUI_INTERNAL_CONTAINER_IMPL_H_