Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / inc / FUi_Window.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_Window.h
19  * @brief       This is the header file for the _Window class.
20  *
21  * This header file contains the declarations of the %_Window class.
22  */
23
24 #ifndef _FUI_INTERNAL_WINDOW_H_
25 #define _FUI_INTERNAL_WINDOW_H_
26
27 #include <FUiWindow.h>
28 #include "FUi_Control.h"
29
30 namespace Tizen { namespace Ui { namespace Animations {
31 class DisplayContext;
32 // #if defined(MULTI_WINDOW)
33 class _RootVisualElement;
34 class _NativeLayer;
35 // #endif
36 }}} // Tizen::Ui::Animations
37
38 namespace Tizen { namespace Ui
39 {
40
41 class _IWindowDelegate
42 {
43 public:
44         virtual ~_IWindowDelegate(void){}
45
46         virtual void OnActivated(void) = 0;
47         virtual void OnNativeWindowActivated(void) = 0;
48         virtual void OnDeactivated(void) = 0;
49 }; // _IWindowDelegate
50
51 class _OSP_EXPORT_ _Window // Temp: export only for test
52         : public _Control
53         , public _IWindowDelegate
54         , virtual public Tizen::Base::Runtime::IEventListener
55         , virtual public _IUiEventListener
56         , virtual public _IUiEventPreviewer
57 {
58 public:
59         static _Window* CreateWindowN(void);
60         virtual ~_Window(void);
61         void SetWindowDelegate(_IWindowDelegate& delegate);
62         void ResetWindowDelegate(void);
63         virtual bool IsActivatedOnOpen(void) const;
64         bool IsAttached(void) const;
65         bool IsActivated(void) const;
66         WindowState GetWindowState(void) const;
67         void SetWindowState(WindowState windowState);
68         result Open(bool drawAndShow = true);
69         void Close(void);
70         _Control* GetOwner(void) const;
71         void SetOwner(_Control* pOwner);
72 #if defined(MULTI_WINDOW)
73         result CreateRootVisualElement(void);
74         virtual result CreateLayer(void);
75 #endif
76
77         virtual bool IsFocusableDescendant(const _Control* pFocus) const;
78
79 // Callbacks
80         virtual void OnActivated(void);
81         virtual void OnNativeWindowActivated(void);
82         virtual void OnDeactivated(void);
83         virtual void OnVisibleStateChanged(void);
84         virtual bool OnNotifiedN(const Tizen::Ui::_Control& source, Tizen::Base::Collection::IList* pArgs);
85 #if defined(MULTI_WINDOW)
86         virtual result OnBoundsChanging(const Tizen::Graphics::Rectangle& bounds);
87         virtual result OnAttachingToMainTree(const _Control* pParent);
88         virtual result OnDetachingFromMainTree(void);
89
90         virtual bool IsLayoutChangable(void) const;
91 #endif
92
93 #if defined(MULTI_WINDOW)
94         void SetActivationEnabled(bool enable);
95         bool IsActivationEnabled(void);
96
97         Tizen::Ui::Animations::_RootVisualElement* GetRootVisualElement(void) const;
98 #else
99         virtual Tizen::Ui::Animations::_RootVisualElement* GetRootVisualElement(void) const;
100 #endif
101         NativeWindowHandle GetNativeHandle(void) const;
102
103         // Internal: Only necessary for implementing _Window. Never override this callback except for _Window.
104         virtual void OnChangeLayout(_ControlOrientation orientation);
105
106         Tizen::Ui::Animations::DisplayContext* GetDisplayContext(void) const;
107
108         result SetZOrderGroup(int windowZOrderGroup);
109         bool IsSystemWindow(void) const;
110
111 protected:
112         _Window(void);
113         _IWindowDelegate& GetWindowDelegate(void) const;
114         virtual Tizen::Base::String GetDescription(void) const;
115
116 #if defined(MULTI_WINDOW)
117         void SetRootVisualElement(const Tizen::Ui::Animations::_RootVisualElement& rootVisualElement);
118 #endif
119
120         void SetSystemWindow(bool systemWindow);
121
122 private:
123         _Window(const _Window& rhs);
124         _Window& operator =(const _Window& rhs);
125
126         void Activate(void);
127         void Deactivate(void);
128
129 private:
130         WindowState __windowState;
131         _Control* __pOwner;
132         _IWindowDelegate* __pWindowDelegate;
133         bool __activated;
134         bool __destroying;
135
136         Tizen::Ui::Animations::_RootVisualElement* __pRootVisualElement;
137         Tizen::Ui::Animations::_NativeLayer* __pLayer;
138
139         mutable Tizen::Ui::Animations::DisplayContext* __pDisplayContext;
140         bool __systemWindow;
141         bool __isOpened;
142         bool __isInitialized;
143
144         friend class _ControlManager;
145 }; // _Window
146
147 }} // Tizen::Ui
148
149 #endif // _FUI_INTERNAL_WINDOW_H_