[Release] wrt_0.8.166 for tizen_2.1 branch
[platform/framework/web/wrt.git] / src / wrt-client / window_data.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS,
12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *    See the License for the specific language governing permissions and
14  *    limitations under the License.
15  */
16 /**
17  * @file        window_data.h
18  * @author      Jaroslaw Osmanski (j.osmanski@samsung.com)
19  * @version     1.0
20  * @brief       Window data header file.
21  */
22
23 #ifndef WINDOW_INITIALIZE_H_
24 #define WINDOW_INITIALIZE_H_
25
26 #include <dpl/framework_efl.h>
27
28 #include <vector>
29 #include <string>
30 #include <dpl/noncopyable.h>
31
32 /*
33  * Current layout structure
34  *
35  * m_win (elm_win)
36  *      m_platform_layout (elm_layout)
37  *          m_navigation (elm_navigation)
38  *              m_user_layout (elm_layout)
39  *                  widget_area (elm_webview)
40  *
41  */
42
43 class WindowData : private DPL::Noncopyable
44 {
45   private:
46     typedef void (*CallbackType)(
47         void* data, Evas_Object* obj, void* event_info);
48     typedef void (*EvasCallbackType)(
49         void* data, Evas* evas, Evas_Object* obj, void* event_info);
50
51     struct EventWithFunction
52     {
53         CallbackType function;
54         std::string eventName;
55         EventWithFunction(CallbackType a_function,
56                           const char * a_eventName) :
57             function(a_function),
58             eventName(a_eventName)
59         {}
60     };
61     typedef std::vector<EventWithFunction> EventWithFunctionVector;
62
63   public:
64     Evas_Object* m_win;
65     Evas_Object* m_user_layout;
66
67     explicit WindowData(unsigned long pid, bool manualInit = false);
68     virtual ~WindowData();
69
70     void init();
71     void setEvasObjectForLayout(Evas_Object* evas_object);
72     void unsetEvasObjectForLayout();
73     void addNaviBackButtonCallback(
74         const char* event,
75         CallbackType callback,
76         const void* data);
77     void* delNaviBackButtonCallback(
78         const char* event,
79         CallbackType callBack);
80     void addFloatBackButtonCallback(
81         const char* event,
82         CallbackType callback,
83         const void* data);
84     void* delFloatBackButtonCallback(
85         const char* event,
86         CallbackType callBack);
87     void userlayoutCallbackAdd(
88         const Evas_Callback_Type event,
89         EvasCallbackType callback,
90         const void* data);
91     void* userlayoutCallbackDel(
92         const Evas_Callback_Type event,
93         EvasCallbackType callback);
94     void emitSignalForUserLayout(
95         const char* emission,
96         const char* source);
97
98     void setViewMode(
99         bool fullscreen,
100         bool backbutton);
101
102     void toggleFullscreen(bool fullscreen);
103     static void winProfileChangedCallback(void *data,
104                                           Evas_Object * obj,
105                                           void *event_info);
106
107   protected:
108     Evas_Object* m_conformant;
109     Evas_Object* m_platform_layout;
110     Evas_Object* m_navigation;
111     Evas_Object* m_naviBackButton;
112     Evas_Object* m_floatBackButton;
113     bool m_fullscreen;
114     bool m_initialized;
115
116     Evas_Object* createWindow(unsigned long pid);
117     Evas_Object* createPlatformLayout(Evas_Object* parent);
118     Evas_Object* createNavigationBar(Evas_Object* parent);
119     Evas_Object* createUserLayout(Evas_Object* parent);
120     Evas_Object* createConformant(Evas_Object* parent);
121
122     void alignProgressPosition();
123     void toggleIndicator(bool fullscreen);
124     void createFloatBackButton();
125     void setDesktopIcon();
126 };
127
128 #endif /* WINDOW_INITIALIZE_H_ */