Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / inc / FUi_EcoreEvas.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_EcoreEvas.h
19  * @brief               This is the header file for the _EcoreEvas class.
20  *
21  * This header file contains the declarations of the %_EcoreEvas class.
22  */
23 #ifndef _FUI_INTERNAL_ECORE_EVAS_H_
24 #define _FUI_INTERNAL_ECORE_EVAS_H_
25
26 #include <Ecore_Evas.h>
27 #include <Ecore.h>
28 #include <Ecore_X.h>
29 #include <FBaseErrorDefine.h>
30 #include <FBaseObject.h>
31 #include "FUi_Types.h"
32
33 namespace Tizen { namespace App
34 {
35 class _IActiveWindowEventListener;
36 }} // Tizen::App
37
38 namespace Tizen { namespace Graphics
39 {
40 class Rectangle;
41 }} // Tizen::Graphics
42
43 namespace Tizen { namespace Ui { namespace Animations
44 {
45 class _RootVisualElement;
46 class _NativeLayer;
47 class _EflLayer;
48 }}} // Tizen::Ui::Animations
49
50
51 namespace Tizen { namespace Ui
52 {
53 enum _ClipFormat
54 {
55         _CLIP_FORMAT_TARGETS = -1,
56         _CLIP_FORMAT_NONE = 0x00,
57         _CLIP_FORMAT_TEXT = 0x01,
58         _CLIP_FORMAT_MARKUP = 0x02,
59         _CLIP_FORMAT_IMAGE = 0x04,
60         _CLIP_FORMAT_VCARD = 0x08,
61         _CLIP_FORMAT_HTML = 0x10,
62 };
63
64 enum _IndicatorOpacity
65 {
66         _INDICATOR_OPACITY_UNKNOWN,
67         _INDICATOR_OPACITY_OPAQUE,
68         _INDICATOR_OPACITY_TRANSLUCENT,
69         _INDICATOR_OPACITY_TRANSPARENT,
70 };
71
72 enum _WindowLevel
73 {
74         _WINDOW_LEVEL_UNKNOWN,
75         _WINDOW_LEVEL_NORMAL,
76         _WINDOW_LEVEL_NOTIFICATION_MIDDLE,
77         _WINDOW_LEVEL_NOTIFICATION_HIGH,
78 };
79
80 enum _RenderBackend
81 {
82         _RENDER_BACKEND_DEFAULT,
83         _RENDER_BACKEND_SW,
84         _RENDER_BACKEND_GL,
85 };
86
87 class _Control;
88 class _Window;
89 class _ActiveWindowEvent;
90
91 class _OSP_EXPORT_ _EcoreEvas
92         : public Tizen::Base::Object
93 {
94 public:
95         static _EcoreEvas* CreateInstanceN(void);
96
97         virtual ~_EcoreEvas(void);
98
99         void RotateWindow(int orientation);
100         void RotateWindow(const _Window& window, int orientation);
101
102         bool GetFloatingMode(void) const;
103         bool GetFloatingMode(const _Window& window) const;
104
105         void AddActiveWindowEventListener(const Tizen::App::_IActiveWindowEventListener& listener);
106         void RemoveActiveWindowEventListener(const Tizen::App::_IActiveWindowEventListener& listener);
107         void FireActiveWindowEvent(unsigned int xid, int pid, char* pAppName);
108         unsigned int GetActiveWindow(void);
109
110         int GetProcessId(unsigned int window);
111         void SetOwner(NativeWindowHandle ownee, NativeWindowHandle owner);
112         void ActivateWindow(const _Window& window);
113
114         void SetRenderBackend(_RenderBackend backend);
115         _RenderBackend GetRenderBackend(void);
116
117 #if !defined(MULTI_WINDOW)
118         result CopyClip(_ClipFormat format, const char* pChar);
119         bool RetrieveClipN(int index, int* format, char** pData);
120         int GetClipCount(void) const;
121         void OpenClipboard(unsigned long clipFormats);
122         void CloseClipboard(void);
123         bool IsClipboardOpened(void);
124
125         result SetEventPropagation(const _Control& control, bool enable);
126         result SetFocus(const _Control& control, bool focus);
127
128         result SetIndicatorShowState(bool showState);
129         bool GetIndicatorShowState(void) const;
130         Tizen::Graphics::Rectangle GetIndicatorBounds(void) const;
131         result SetIndicatorOpacity(_IndicatorOpacity opacity);
132         _IndicatorOpacity GetIndicatorOpacity(void) const;
133
134         result SetFloatingMode(bool enable);
135
136         void SetFrame(const _Control& control);
137         const _Control* GetFrame(void) const;
138
139         void SetWindowLevel(_WindowLevel level);
140         _WindowLevel GetWindowLevel(void) const;
141
142         void SetWindowAlwaysOnTop(bool alwaysOnTop);
143         void SetWindowAlwaysAtBottom(bool alwaysAtBottom);
144
145         void BringWindowToTop(void);
146         void BringWindowToBottom(void);
147
148
149         void SetWindowBounds(const Tizen::Graphics::Rectangle& bounds);
150         void SetWindowVisibleState(bool visibleState);
151
152         Evas* GetEvas(void) const;
153         Ecore_Evas* GetEcoreEvas(void) const;
154         Evas_Object* GetWindowObject(void) const;
155         Ecore_X_Window GetXWindow(void) const;
156
157         Tizen::Ui::Animations::_RootVisualElement* GetRootVisualElement(void)const;
158
159         void AllowSetWindowBounds(bool allow);
160 #else
161         result CopyClip(_ClipFormat format, const char* pChar);
162         bool RetrieveClipN(int index, int* format, char** pData);
163         int GetClipCount(void) const;
164         void OpenClipboard(unsigned long clipFormats);
165         void CloseClipboard(void);
166         bool IsClipboardOpened(void);
167
168         result SetEventPropagation(const _Control& control, bool enable);
169         result SetFocus(const _Control& control, bool focus);
170
171         result SetIndicatorShowState(const _Window& window, bool showState);
172         bool GetIndicatorShowState(const _Window& window) const;
173         Tizen::Graphics::Rectangle GetIndicatorBounds(const _Window& window) const;
174         result SetIndicatorOpacity(const _Window& window, _IndicatorOpacity opacity);
175         _IndicatorOpacity GetIndicatorOpacity(const _Window& window) const;
176
177         void SetWindowActivationEnabled(const _Window& window, bool enable);
178         bool IsWindowActivationEnabled(const _Window& window);
179
180         result SetFloatingMode(const _Window& window, bool enable);
181
182         void SetFrame(const _Control& control);
183         const _Control* GetFrame(void) const;
184
185         void SetWindowLevel(const _Window& window, _WindowLevel level);
186         _WindowLevel GetWindowLevel(const _Window& window) const;
187
188         void SetWindowBounds(const _Window& window, const Tizen::Graphics::Rectangle& bounds);
189         void SetWindowVisibleState(const _Window& window, bool visibleState);
190
191         void SetOwner(const _Window& ownee, const _Control& owner);
192
193         int GetWindowRotation(const _Window& window);
194
195         Evas* GetEvas(void) const;
196         Ecore_Evas* GetEcoreEvas(void) const;
197         Evas_Object* GetWindowObject(void) const;
198         Ecore_X_Window GetXWindow(void) const;
199
200         Tizen::Ui::Animations::_RootVisualElement* GetRootVisualElement(void)const;
201
202         void AllowSetWindowBounds(bool allow);
203 #endif
204
205         bool GetSelectedCbhmItem(Ecore_X_Atom* pDataType, char** pBuffer) const;
206
207         //[Accessibility]
208         bool IsAccessibilityScreenReaderActivated(void);
209
210 private:
211         result CreateWindow(void);
212
213         result InitializeAtomList(void);
214         bool IsValidClipFormat(_ClipFormat clipFormat);
215         Ecore_X_Window GetCbhmWindow(void) const;
216         bool SendCbhmMessage(Ecore_X_Window xwin, const char* pMsg);
217         bool SetCbhmItem(Ecore_X_Window xwin, Ecore_X_Atom dataType, char* pItemData);
218         void* GetCbhmReply(Ecore_X_Window xwin, Ecore_X_Atom property, Ecore_X_Atom* pDataType, int* pNum) const;
219         int GetCbhmItemCount(void) const;
220         bool GetCbhmItem(int index, Ecore_X_Atom* pDataType, char** pBuffer) const;
221
222         Tizen::Ui::Animations::_EflLayer* GetEflLayer(const _Window& window) const;
223
224         _EcoreEvas(void);
225         _EcoreEvas(const _EcoreEvas& rhs);
226         _EcoreEvas& operator =(const _EcoreEvas& rhs);
227
228 private:
229         Evas* __pEvas;
230         Evas_Object* __pForegroundWindow;
231         const _Control* __pFrame;
232
233         Ecore_Event_Handler* __pXWindowVisibility;
234         Ecore_Event_Handler* __pClientMessageHandler;
235
236         Ecore_Event_Handler* __pClearClip;
237         Ecore_Event_Handler* __pNotifyClip;
238         Ecore_Event_Handler* __pClipboardClosed;
239
240         Ecore_Event_Handler* __pWindowPropertyChanged;
241         _ActiveWindowEvent* __pActiveWindowEvent;
242         int __count;
243
244         Tizen::Ui::Animations::_RootVisualElement* __pRootVE;
245         Tizen::Ui::Animations::_NativeLayer* __pLayer;
246
247         bool __changeBounds;
248         bool __openClipboard;
249 }; // _EcoreEvas
250
251 }} // Tizen::Ui
252
253 #endif // _FUI_INTERNAL_ECORE_EVAS_H_