Tizen 2.1 base
[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 * @file                 FUi_ContainerImpl.h
19 * @brief                This is the header file for the _ContainerImp interface.
20 *
21 * This header file contains the declarations of the %_ContainerImp interface.
22 */
23
24 #ifndef _FUI_INTERNAL_CONTAINER_IMPL_H_
25 #define _FUI_INTERNAL_CONTAINER_IMPL_H_
26
27 #include <FUiContainer.h>
28 #include "FUi_ControlImpl.h"
29 #include "FUi_SharedPtr.h"
30
31 namespace Tizen { namespace Ui
32 {
33
34 class _LayoutImpl;
35
36 class _OSP_EXPORT_ _ContainerImpl
37         : public _ControlImpl
38 {
39 public:
40 // Life Cycle
41         void Initialize(Control* pPublic, _Control* pCore, const Layout* pPublicPortraitLayout, const Layout* pPublicLandscapeLayout);
42         static _ContainerImpl* CreateContainerImplN(Container* pPublic);
43         static _ContainerImpl* CreateContainerImplN(Container* pPublic, const Tizen::Graphics::Rectangle& bounds, const Layout* pPublicPortraitLayout, const Layout* pPublicLandscapeLayout, bool resizable, bool movable);
44         virtual ~_ContainerImpl(void);
45
46         static _ContainerImpl* GetInstance(Container& container);
47         static const _ContainerImpl* GetInstance(const Container& container);
48 //Operation
49         // [ToDo] Must consider transforOwnership flags.
50         result AddChild(_ControlImpl* pChild, bool transferOwnership = true);
51         result RemoveChild(_ControlImpl* pChild, bool deallocate = true);
52         result RemoveChild(int index);
53         void RemoveAllChildren(bool detachSystemChild = true);
54         result MoveChildToTop(const _ControlImpl& child);
55         result MoveChildBefore(const _ControlImpl& targetChild, const _ControlImpl& child);
56
57 // Z-Order
58         result SetControlAlwaysOnTop(Control& control, bool alwaysOnTop);
59         result SetControlAlwaysAtBottom(Control& control, bool alwaysAtBottom);
60         bool IsControlAlwaysAtBottom(const Control& control) const;
61         bool IsControlAlwaysOnTop(const Control& control) const;
62
63 // Getters/Setters
64         virtual const char* GetPublicClassName(void) const;
65         virtual const Container& GetPublic(void) const;
66         virtual Container& GetPublic(void);
67
68         Tizen::Base::Collection::IList* GetChildrenPublic(void) const;
69         _ControlImpl* GetChild(int index) const;
70
71         _ControlImpl* SearchControlByName(const Tizen::Base::String& name, bool recursive, bool searchMyself = false) const;
72
73         int GetChildIndex(const _ControlImpl* pChild) const;
74         int GetChildCount(void) const;
75
76         // [ToDo] It's returning public class instance. OK?
77         Layout* GetPublicPortraitLayoutN(void) const;
78         Layout* GetPublicLandscapeLayoutN(void) const;
79         Layout* GetPublicLayoutN(void) const;
80
81         result SetChildAt(const _ControlImpl* pChild, int index);
82         bool IsAncestorOf(const _ControlImpl* pChild) const;
83
84 // Internal Callbacks
85         virtual void OnDraw(void);
86         virtual void OnChangeLayout(_ControlOrientation orientation);
87         virtual void OnVisibleStateChanging(void);
88         virtual void OnVisibleStateChanged(void);
89         virtual result OnBoundsChanging(const Tizen::Graphics::Rectangle& bounds);
90         virtual void OnBoundsChanged(void);
91         virtual void OnEvaluateSize(Tizen::Graphics::Dimension& evaluatedSize);
92
93         void CallOnDraw(void);
94
95 protected:
96         _ContainerImpl(Control* pPublic, _Control* pCore, const Layout* pPublicPortraitLayout = null, const Layout* pPublicLandscapeLayout = null);
97         _ContainerImpl(Control* pPublic, _Control* pCore, const Tizen::Graphics::Rectangle& bounds, const Layout* pPublicPortraitLayout, const Layout* pPublicLandscapeLayout, bool resizable, bool movable);
98
99 private:
100         _ContainerImpl(const _ContainerImpl& rhs);
101         _ContainerImpl& operator =(const _ContainerImpl& rhs);
102
103         virtual bool IsChildAttachable(_ControlImpl& child) const;
104         result SetLayout(_Control& core, _ControlOrientation orientation, const Layout* pPublicLayout);
105
106 private:
107         Tizen::Base::Collection::LinkedList __controlPublics;
108         _SharedPtr <Tizen::Ui::_LayoutImpl> __portraitLayout;
109         _SharedPtr <Tizen::Ui::_LayoutImpl> __landscapeLayout;
110 }; // _ContainerImpl
111
112 }} // Tizen::Ui
113
114 #endif // _FUI_INTERNAL_CONTAINER_IMPL_H_