Applied context restoring
[framework/osp/uifw.git] / src / ui / inc / FUiAnim_DisplayManager.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0/
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        FUiAnim_DisplayManager.h
20  * @brief       This is the header file for the _DisplayManager class.
21  *
22  * This header file contains the declarations of the _DisplayManager class.
23  */
24
25 #ifndef _FUI_ANIM_INTERNAL_DISPLAY_MANAGER_H_
26 #define _FUI_ANIM_INTERNAL_DISPLAY_MANAGER_H_
27
28 #include <FBaseColArrayList.h>
29
30 // Backend feature
31 #define VE_EFL
32 //#define VE_OPENGL
33 #define VE_VSYNC_UPDATE
34
35 namespace Tizen { namespace Ui { namespace Animations
36 {
37
38 class _RootVisualElement;
39
40 class _OSP_EXPORT_ _DisplayManager
41 {
42 public:
43         static _DisplayManager* GetInstance(void)
44         {
45                 return _DisplayManager::__pInstance;
46         }
47
48         static result CreateInstance(void);
49         static result ReleaseInstance(void);
50         static bool __wakeUpEventAdded;
51
52         // For restoring gl context
53         typedef void (*RestoreContextCallback)(void);
54         static void SetRestoreContextCallback(RestoreContextCallback pRestoreContextCallback);
55         static void RestoreContext(void);
56 public:
57         _RootVisualElement* CreateRoot(void);
58
59         result DestroyRoot(_RootVisualElement& root);
60
61         result RegisterRoot(_RootVisualElement& root);
62
63         result UnregisterRoot(_RootVisualElement& root);
64
65         int GetRootCount(void) const;
66
67         _RootVisualElement* GetRoot(int index) const;
68
69         void AddWakeUpEvent(void);
70         void RemoveWakeUpEvent(void);
71
72         bool Render(_RootVisualElement& root);
73         result PostRender(_RootVisualElement& root);
74         bool RenderAll(void);
75         result Flush(void);
76
77 private:
78         _DisplayManager(void);
79         virtual ~_DisplayManager(void);
80
81 private:
82         Tizen::Base::Collection::ArrayList __roots;
83
84         static int __eventType;
85         static void* __pWakeUpEventHandler;
86         static _DisplayManager* __pInstance;
87         static RestoreContextCallback __pRestoreContextCallback;
88 }; // _DisplayManager
89
90 }}} //namespace Tizen { namespace Ui { namespace Animations
91
92 #endif //_FUI_ANIM_INTERNAL_DISPLAY_MANAGER_H_