[Release] wrt_0.8.274
[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 #include <dpl/fast_delegate.h>
28
29 #include <string>
30 #include <list>
31 #include <map>
32 #include <dpl/noncopyable.h>
33
34 enum class Layer {
35     WINDOW      = 0,
36     CONFORMANT  = 1,
37     TOP_LAYOUT  = 2,
38     NAVIFRAME   = 3,
39     MAIN_LAYOUT = 4,
40     FOCUS       = 5,
41     PROGRESSBAR = 6
42 };
43
44 class WindowData : private DPL::Noncopyable
45 {
46   public:
47     typedef DPL::FastDelegate0<void> CtxpopupCallbackType;
48     struct CtxpopupItemData {
49         std::string text;
50         std::string iconPath;
51         CtxpopupCallbackType function;
52         CtxpopupItemData(std::string t,
53                          std::string p,
54                          CtxpopupCallbackType f) :
55             text(t),
56             iconPath(p),
57             function(f)
58         {}
59     };
60     typedef std::list<CtxpopupItemData> CtxpopupItemDataList;
61
62     explicit WindowData(unsigned long pid, bool manualInit = false);
63     virtual ~WindowData();
64
65     void init();
66     void postInit();
67     bool initScreenReaderSupport(bool isSupportAccessibility);
68
69     Evas_Object* getEvasObject(Layer layer);
70     void setWebview(Evas_Object* evas_object);
71     void unsetWebview();
72
73     void smartCallbackAdd(
74         Layer layer,
75         const char* event,
76         Evas_Smart_Cb callback,
77         const void* data);
78     void smartCallbackDel(
79         Layer layer,
80         const char* event,
81         Evas_Smart_Cb callback);
82     void signalEmit(Layer layer, const char* emission, const char* source);
83
84     void setViewMode(bool fullscreen, bool backbutton);
85     void setOrientation(int angle);
86     void toggleFullscreen(bool fullscreen);
87     void showCtxpopup(void);
88     void setCtxpopupItemData(CtxpopupItemDataList data);
89     void updateProgress(double value);
90
91   private:
92     Evas_Object* m_win;
93     Evas_Object* m_conformant;
94     Evas_Object* m_topLayout;
95     Evas_Object* m_naviframe;
96     Evas_Object* m_mainLayout;
97     Evas_Object* m_focus;
98     Evas_Object* m_progressbar;
99     Evas_Object* m_ctxpopup;
100     bool m_initialized;
101     bool m_currentViewModeFullScreen;
102     CtxpopupItemDataList m_ctxpopupItemDataList;
103
104     typedef std::map<Layer, Evas_Object*> EvasObjectData;
105     typedef std::map<Layer, Evas_Object*>::iterator EvasObjectDataIt;
106     EvasObjectData m_evasObjectData;
107     void setEvasObjectData(Layer layer, Evas_Object* obj);
108
109     Evas_Object* createWindow(unsigned long pid);
110     Evas_Object* createConformant(Evas_Object* parent);
111     Evas_Object* createTopLayout(Evas_Object* parent);
112     Evas_Object* createNaviframe(Evas_Object* parent);
113     Evas_Object* createMainLayout(Evas_Object* parent);
114     Evas_Object* createFocus(Evas_Object* parent);
115     Evas_Object* createProgressBar(Evas_Object* window, Evas_Object* parent);
116     Evas_Object* createCtxPopup(Evas_Object* parent);
117
118     void toggleIndicator(bool fullscreen);
119     static void ctxpopupItemCallback(void* data,
120                                      Evas_Object* obj,
121                                      void* eventInfo);
122     static void ctxpopupDismissedCallback(void* data,
123                                           Evas_Object* obj,
124                                           void* eventInfo);
125     static void winDeleteRequestCallback(void* data,
126                                          Evas_Object* obj,
127                                          void* eventInfo);
128     static void winProfileChangedCallback(void* data,
129                                           Evas_Object* obj,
130                                           void* eventInfo);
131     static Eina_Bool naviframeItemPopCallback(void *data,
132                                           Elm_Object_Item *it);
133
134  };
135
136 #endif /* WINDOW_INITIALIZE_H_ */