7762ba1aaa7f01ac87a1529cb0e2dfe115a2cfca
[platform/framework/native/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 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                FUi_EcoreEvas.h
20  * @brief               This is the header file for the _EcoreEvas class.
21  *
22  * This header file contains the declarations of the %_EcoreEvas class.
23  */
24
25 #ifndef _FUI_INTERNAL_ECORE_EVAS_H_
26 #define _FUI_INTERNAL_ECORE_EVAS_H_
27
28 #include <Ecore_Evas.h>
29 #include <Ecore.h>
30 #include <Ecore_X.h>
31 #include <FBaseErrorDefine.h>
32 #include <FBaseObject.h>
33 #include "FUi_Types.h"
34
35 namespace Tizen { namespace App
36 {
37 class _IActiveWindowEventListener;
38 }} // Tizen::App
39
40 namespace Tizen { namespace Graphics
41 {
42 class Rectangle;
43 class FloatRectangle;
44 }} // Tizen::Graphics
45
46 namespace Tizen { namespace Ui { namespace Animations
47 {
48 class _RootVisualElement;
49 class _NativeLayer;
50 class _EflLayer;
51 }}} // Tizen::Ui::Animations
52
53
54 namespace Tizen { namespace Ui
55 {
56 enum _ClipFormat
57 {
58         _CLIP_FORMAT_TARGETS = -1,
59         _CLIP_FORMAT_NONE = 0x00,
60         _CLIP_FORMAT_TEXT = 0x01,
61         _CLIP_FORMAT_MARKUP = 0x02,
62         _CLIP_FORMAT_IMAGE = 0x04,
63         _CLIP_FORMAT_VCARD = 0x08,
64         _CLIP_FORMAT_HTML = 0x10,
65 };
66
67 enum _IndicatorOpacity
68 {
69         _INDICATOR_OPACITY_UNKNOWN,
70         _INDICATOR_OPACITY_OPAQUE,
71         _INDICATOR_OPACITY_TRANSLUCENT,
72         _INDICATOR_OPACITY_TRANSPARENT,
73 };
74
75 enum _WindowLevel
76 {
77         _WINDOW_LEVEL_UNKNOWN,
78         _WINDOW_LEVEL_NORMAL,
79         _WINDOW_LEVEL_NOTIFICATION_MIDDLE,
80         _WINDOW_LEVEL_NOTIFICATION_HIGH,
81 };
82
83 enum _RenderBackend
84 {
85         _RENDER_BACKEND_DEFAULT,
86         _RENDER_BACKEND_SW,
87         _RENDER_BACKEND_GL,
88 };
89
90 class _Control;
91 class _Window;
92 class _ActiveWindowEvent;
93
94 class _OSP_EXPORT_ _EcoreEvas
95         : public Tizen::Base::Object
96 {
97 public:
98         static _EcoreEvas* CreateInstanceN(void);
99         virtual ~_EcoreEvas(void);
100
101         unsigned int GetActiveWindow(void);
102         int GetProcessId(unsigned int window);
103         void SetRenderBackend(_RenderBackend backend);
104         _RenderBackend GetRenderBackend(void);
105         void SetOwner(NativeWindowHandle ownee, NativeWindowHandle owner);
106         void SetOwner(const _Window& ownee, const _Control& owner);
107
108         void ActivateWindow(const _Window& window);
109         void MinimizeWindow(_Window& window);
110
111         void RotateWindow(const _Window& window, int orientation, bool rotateEvas = true);
112         int GetWindowRotation(const _Window& window);
113         void SetWindowPreferredRotation(const _Window& window, int rotation);
114         void SetWindowAvailabledRotation(const _Window& window, int* rotations, unsigned int count);
115         void RegisterWindowStateCallback(const _Window& window);
116         void SetWindowRotationBounds(const _Window& window, int rotation, const Tizen::Graphics::Rectangle& bounds);
117         void SetWindowRotationBounds(const _Window& window, int rotation, const Tizen::Graphics::FloatRectangle& bounds);
118
119         void SetWindowType(const _Window& window, int winType);
120         result SetFloatingMode(const _Window& window, bool enable);
121         bool GetFloatingMode(const _Window& window) const;
122         void SetWindowActivationEnabled(const _Window& window, bool enable);
123         bool IsWindowActivationEnabled(const _Window& window);
124         void SetWindowLevel(const _Window& window, _WindowLevel level);
125         _WindowLevel GetWindowLevel(const _Window& window) const;
126         void SetWindowBounds(const _Window& window, const Tizen::Graphics::Rectangle& bounds);
127         void SetWindowBounds(const _Window& window, const Tizen::Graphics::FloatRectangle& bounds);
128         void SetWindowVisibleState(const _Window& window, bool visibleState);
129         void AllowSetWindowBounds(bool allow);
130         bool IsWindowVisible(const _Window& window);
131
132         result SetEventPropagation(const _Control& control, bool enable);
133         result SetFocus(const _Control& control, bool focus);
134
135         result SetIndicatorShowState(const _Window& window, bool showState);
136         bool GetIndicatorShowState(const _Window& window) const;
137
138         result CopyClip(_ClipFormat format, const char* pChar);
139         bool RetrieveClipN(int index, int* format, char** pData);
140         int GetClipCount(void) const;
141         bool GetSelectedCbhmItem(Ecore_X_Atom* pDataType, char** pBuffer) const;
142         void OpenClipboard(unsigned long clipFormats);
143         void CloseClipboard(void);
144         bool IsClipboardOpened(void);
145
146         bool IsAccessibilityScreenReaderActivated(void);
147
148         // [ToDo] Remove API
149         bool GetFloatingMode(void) const;
150         Tizen::Graphics::Rectangle GetIndicatorBounds(const _Window& window) const;
151         result SetIndicatorOpacity(const _Window& window, _IndicatorOpacity opacity);
152         _IndicatorOpacity GetIndicatorOpacity(const _Window& window) const;
153         void AddActiveWindowEventListener(const Tizen::App::_IActiveWindowEventListener& listener);
154         void RemoveActiveWindowEventListener(const Tizen::App::_IActiveWindowEventListener& listener);
155         Tizen::Ui::Animations::_RootVisualElement* GetRootVisualElement(void)const;
156         void SetFrame(const _Control& control);
157         const _Control* GetFrame(void) const;
158         Evas* GetEvas(void) const;
159         Ecore_Evas* GetEcoreEvas(void) const;
160         Evas_Object* GetWindowObject(void) const;
161         Ecore_X_Window GetXWindow(void) const;
162         void SetQuickPanelScrollEnabled(const _Window& window, bool enable);
163         bool IsQuickPanelScrollEnabled(const _Window& window);
164
165 private:
166         Tizen::Ui::Animations::_EflLayer* GetEflLayer(const _Window& window) const;
167         _EcoreEvas(void);
168
169         result InitializeAtomList(void);
170         bool IsValidClipFormat(_ClipFormat clipFormat);
171         Ecore_X_Window GetCbhmWindow(void) const;
172         bool SendCbhmMessage(Ecore_X_Window xwin, const char* pMsg);
173         bool SetCbhmItem(Ecore_X_Window xwin, Ecore_X_Atom dataType, char* pItemData);
174         void* GetCbhmReply(Ecore_X_Window xwin, Ecore_X_Atom property, Ecore_X_Atom* pDataType, int* pNum) const;
175         int GetCbhmItemCount(void) const;
176         bool GetCbhmItem(int index, Ecore_X_Atom* pDataType, char** pBuffer) const;
177
178         _EcoreEvas(const _EcoreEvas& rhs);
179         _EcoreEvas& operator =(const _EcoreEvas& rhs);
180
181 private:
182         Ecore_Event_Handler* __pWindowVisibilityChanged;
183         Ecore_Event_Handler* __pWindowPropertyChanged;
184         Ecore_Event_Handler* __pWindowShown;
185         Ecore_Event_Handler* __pClientMessageReceived;
186         Ecore_Event_Handler* __pClearClip;
187         Ecore_Event_Handler* __pNotifyClip;
188         Ecore_Event_Handler* __pClipboardClosed;
189
190         Evas* __pEvas;
191         Evas_Object* __pForegroundWindow;
192         const _Control* __pFrame;
193         bool __changeBounds;
194         bool __openClipboard;
195 }; // _EcoreEvas
196
197 }} // Tizen::Ui
198
199 #endif // _FUI_INTERNAL_ECORE_EVAS_H_