Add unreleased controls logs for debugging
[platform/framework/native/uifw.git] / src / ui / inc / FUi_ControlManager.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_ControlManager.h
20  * @brief       This is the header file for the _ControlManager class.
21  *
22  * This header file contains the declarations of the %_ControlManager class.
23  */
24
25 #ifndef _FUI_INTERNAL_CONTROL_MANAGER_H_
26 #define _FUI_INTERNAL_CONTROL_MANAGER_H_
27
28 #include <unique_ptr.h>
29 #include <FBaseColIListT.h>
30 #include <FBaseColHashMapT.h>
31 #include <FGrp_CoordinateSystem.h>
32 #include <FSysISettingEventListener.h>
33 #include "FUi_Types.h"
34
35 namespace Tizen { namespace Base { namespace Collection
36 {
37 template<class T> class LinkedListT;
38 }}} // Tizen::Base::Collection
39
40 namespace Tizen { namespace Ui
41 {
42
43 class _Window;
44 class _IWindow;
45 class _IUiEventListener;
46 class _TouchGestureDetector;
47 class _IControlManagerEventListener;
48
49 class _OSP_EXPORT_ _ControlManager
50         :       public Tizen::System::ISettingEventListener
51 {
52 public:
53 // Initialize, Access, Release
54         static void Initialize(void);
55         static void Release(void);
56         static _ControlManager* GetInstance(void);
57         static void InitInstance(void);
58
59 // Control Handle Management
60         _ControlHandle Register(_Control* pObject);
61         _Control* Release(const _ControlHandle& handle);
62         _Control* GetObject(const _ControlHandle& handle);
63         const _Control* GetObject(const _ControlHandle& handle) const;
64         int GetUsedHandleCount(void) const;
65
66 // Operations
67         _Window* GetWindow(int index) const;
68         int GetWindowCount(void) const;
69         _Window* GetTopWindow(void) const;
70         _Window* GetTopVisibleWindow(void) const;
71         _Window* GetTopVisibleWindowAt(const Tizen::Graphics::Point& point) const;
72         bool IsWindowOnTop(const _Window& window) const;
73         bool IsWindowAttached(const _Window& window) const;
74         result OpenWindow(_Window& window, bool invalidate);
75         result CloseWindow(_Window& window);
76
77 // For control list
78         _Control* GetControl(int index) const;
79         int GetControlCount(void) const;
80
81 // Orientation
82         _ControlOrientation GetOrientation(void) const;
83         void SetOrientation(_ControlOrientation orientation);
84
85 // Screen Rotation
86         _ControlRotation GetScreenRotation(void) const;
87
88 // Informations
89         Tizen::Graphics::Dimension GetScreenSize(void) const;
90         Tizen::Graphics::FloatDimension GetScreenSizeF(void) const;
91         void SetScreenDpi(int dpi);
92         int GetScreenDpi(void) const;
93
94 // Font
95         result SetDefaultFont(const Tizen::Base::String& appFontName);
96         Tizen::Base::String GetDefaultFont(void);
97         bool IsDefaultFontChanged(void) const;
98         bool IsSystemFontChanged(void) const;
99         void SetDefaultFontChangeState(bool isDefaultFontChanged);
100         result SetDefaultFontFromFile(const Tizen::Base::String& fileName);
101         Tizen::Base::String GetDefaultFontFile(void) const;
102
103 // Coordinate system info
104         bool IsCoordinateSystemLogical(void) const;
105         int GetCoordinateSystem(void) const;
106         Tizen::Graphics::_BaseScreenSize GetLogicalBaseScreenSize(void) const;
107
108 // Focus
109         _Control* GetFocusControl(void) const;
110         void SetFocusControl(const _Control& control, bool on = true);
111         bool TakeFocusFromControl(const _Control& control);
112
113 // Queries
114         _Control* GetTopmostTouchedControl(const Tizen::Graphics::Point& point);
115         _Window* GetCurrentFrame(void) const;
116         bool IsFrameActivated(void) const;
117
118 // Global Gesture
119         result AddGestureDetector(const _TouchGestureDetector& gesture);
120         result RemoveGestureDetector(const _TouchGestureDetector& gesture);
121         Tizen::Base::Collection::IListT<_TouchGestureDetector*>* GetGestureDetectorList(void) const;
122         int GetGestureMaxTimeDuration(void) const;
123
124 // Do not use. System only.
125         void SetOrientationStatus(_ControlRotation orientationStatus);
126         _ControlRotation GetOrientationStatus(void) const;
127         void RotateScreen(const _Control& control, _ControlRotation screenRotation);
128         void OnScreenRotated(int rotation);
129         void OnWindowRotated(int rotation);
130         void SetTouchedWindow(unsigned int window);
131         _Window* GetTouchedWindow(void) const;
132         result MoveWindowToTop(const _Window& window);
133         result MoveWindowToBottom(const _Window& window);
134         void SetClipboardOwner(_Window* pOwner);
135         _Window* GetClipboardOwner(void) const;
136
137         result AddControlManagerEventListener(_IControlManagerEventListener& listener);
138         result RemoveControlManagerEventListener(_IControlManagerEventListener& listener);
139
140         _Window* GetAllWindow(int index) const;
141         int GetAllWindowCount(void) const;
142         result DetachAllWindow(_Window& window);
143
144 private:
145         ~_ControlManager(void);
146         _ControlManager(void);
147         _ControlManager(const _ControlManager&);
148         _ControlManager& operator =(const _ControlManager&);
149
150 // Coordinate system info
151          result GetAppCoordinateSystem(bool& isCoordinateSystemLogical, int& logicalCoordinateSystemInt, Tizen::Graphics::_BaseScreenSize& logicalBaseScreenSize);
152
153         result AttachWindow(_Window& window);
154         result InsertWindowToBottom(_Window& window);
155         result InsertWindowAfter(const _Window& targetWindow, _Window& window);
156         result InsertWindowBefore(const _Window& targetWindow, _Window& window);
157         result DetachWindow(_Window& window);
158         void DetachAllWindows(void);
159
160         result MoveWindowAfter(const _Window& targetWindow, const _Window& window);
161         result MoveWindowBefore(const _Window& targetWindow, const _Window& window);
162
163         result ActivateWindow(_Window& window, bool invalidate);
164
165         result CallOnAttachingToMainTree(_Control& control);
166         result CallOnPreAttachedToMainTree(_Control& control);
167         result CallOnAttachedToMainTree(_Control& control);
168         result CallOnDetachingFromMainTree(_Control& control);
169         void CallControlManagerEventListener(void);
170
171         virtual void OnSettingChanged(Tizen::Base::String& key);
172
173 private:
174         Tizen::Base::_ObjectManagerT <_Control> __objectManager;
175         Tizen::Base::Collection::LinkedListT<_Window*>* __pWindowList;
176         Tizen::Base::Collection::LinkedListT<_Window*>* __pAllWindowList;
177         Tizen::Base::Collection::LinkedListT<_Control*>* __pAllControlList;
178
179         bool __isCoordinateSystemLogical;
180         int __logicalCoordinateSystem;
181         Tizen::Graphics::_BaseScreenSize __logicalBaseScreenSize;
182         Tizen::Base::Collection::LinkedListT<_Window*>* __pSystemWindowList;
183         _Control* __pFocusControl;
184         _ControlRotation __screenRotation;
185         _ControlRotation __orientationStatus;
186         _ControlOrientation __orientation;
187         _Window* __pCurrentFrame;
188         Tizen::Base::Collection::IListT<_TouchGestureDetector*>* __pGestureList;
189         int __gestureMaxDuration;
190         unsigned int __touchedWindow;
191         bool __isDefaultFontChanged;
192         bool __isSystemFontChanged;
193         Tizen::Base::String __defaultFontName;
194         Tizen::Base::String __defaultFontFileName;
195         static _ControlManager* __pInstance;
196         int __screenDpi;
197         _Window* __pClipboardOwner;
198         std::unique_ptr<Tizen::Base::Collection::IListT<_IControlManagerEventListener*> > __pControlManagerEventListenerList;
199 }; // _ControlManager
200
201 }} // Tizen::Ui
202
203 #endif // _FUI_INTERNAL_CONTROL_MANAGER_H_