cf0f81fb7fa660132817dbed79212145d71ad6b0
[profile/ivi/ico-uxf-homescreen.git] / lib / system-controller / CicoSCWindowController.h
1 /*
2  * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
3  *
4  * This program is licensed under the terms and conditions of the
5  * Apache License, version 2.0.  The full text of the Apache License is at
6  * http://www.apache.org/licenses/LICENSE-2.0
7  *
8  */
9
10 //==========================================================================
11 /**
12  *  @file   CicoSCWindowController.h
13  *
14  *  @brief  This file is definition of CicoSCWindowController class
15  */
16 //==========================================================================
17 #ifndef __CICO_SC_WINDOW_CONTROLLER_H__
18 #define __CICO_SC_WINDOW_CONTROLLER_H__
19
20 #include <vector>
21 #include <map>
22
23 using namespace std;
24
25 #include "CicoSCWlWinMgrIF.h"
26
27 //==========================================================================
28 //  Forward declaration
29 //==========================================================================
30 class CicoSCCommand;
31 class CicoSCDisplay;
32 class CicoSCLayer;
33 class CicoSCDisplayZone;
34 class CicoSCWindow;
35 class CicoSCResourceManager;
36
37 //--------------------------------------------------------------------------
38 /**
39  *  @brief  This class is controller of window
40  */
41 //--------------------------------------------------------------------------
42 class CicoSCWindowController : public CicoSCWlWinMgrIF
43 {
44 public:
45     // default constructor
46     CicoSCWindowController();
47
48     // copy constructor
49     virtual ~CicoSCWindowController();
50
51     int initDB(void);
52
53     void handleCommand(const CicoSCCommand * cmd);
54
55     //
56     void setResourceManager(CicoSCResourceManager *resMgr);
57
58     int show(int         surfaceid,
59              const char  *animation,
60              int         animationTime);
61
62     int hide(int         surfaceid,
63              const char  *animation,
64              int         animationTime);
65
66     int resize(int        surfaceid,
67                int        w,
68                int        h,
69                const char *animation,
70                int        animationTime);
71
72     int move(int        surfaceid,
73              int        nodeid,
74              int        x,
75              int        y,
76              const char *animation,
77              int        animationTime);
78
79     int setGeometry(int        surfaceid,
80                     int        nodeid,
81                     int        layerid,
82                     int        x,
83                     int        y,
84                     int        w,
85                     int        h,
86                     const char *resizeAnimation,
87                     int        resizeAnimationTime,
88                     const char *moveAnimation,
89                     int        moveAnimationTime);
90
91     int setGeometry(int        surfaceid,
92                     const char *zone,
93                     int        layerid,
94                     const char *resizeAnimation,
95                     int        resizeAnimationTime,
96                     const char *moveAnimation,
97                     int        moveAnimationTime);
98
99     int raise(int surfaceid,
100              const char  *animation,
101              int         animationTime);
102
103     int lower(int surfaceid, const char *animation, int animationTime);
104
105     int setWindowLayer(int surfaceid, int layerid);
106
107     int showLayer(int displayid, int layerid);
108
109     int hideLayer(int displayid, int layerid);
110
111     int active(int surfaceid, int target);
112
113     int setmapBuffer(const char *shmname, int bufsize, int bufnum);
114
115     int mapSurface(int surfaceid, int framerate);
116
117     int unmapSurface(int surfaceid);
118
119     int getDisplayedWindow(int zoneid);
120
121     int setAttributes(int surfaceid);
122
123     //
124     virtual void createdCB(void *data,
125                            struct ico_window_mgr *ico_window_mgr,
126                            uint32_t surfaceid,
127                            const char *winname,
128                            int32_t pid,
129                            const char *appid,
130                            int32_t layertype);
131
132     virtual void nameCB(void *data,
133                         struct ico_window_mgr *ico_window_mgr,
134                         uint32_t surfaceid,
135                         const char *winname);
136
137     virtual void destroyedCB(void *data,
138                              struct ico_window_mgr *ico_window_mgr,
139                              uint32_t surfaceid);
140
141     virtual void visibleCB(void *data,
142                            struct ico_window_mgr *ico_window_mgr,
143                            uint32_t surfaceid,
144                            int32_t visible,
145                            int32_t raise,
146                            int32_t hint);
147
148     virtual void configureCB(void *data,
149                              struct ico_window_mgr *ico_window_mgr,
150                              uint32_t surfaceid,
151                              uint32_t node,
152                              int32_t layertype,
153                              uint32_t layer,
154                              int32_t x,
155                              int32_t y,
156                              int32_t width,
157                              int32_t height,
158                              int32_t hint);
159
160     virtual void activeCB(void *data,
161                           struct ico_window_mgr *ico_window_mgr,
162                           uint32_t surfaceid,
163                           int32_t active);
164
165     virtual void layerVisibleCB(void *data,
166                                 struct ico_window_mgr *ico_window_mgr,
167                                 uint32_t layer,
168                                 int32_t visible);
169
170     virtual void appSurfacesCB(void *data,
171                                struct ico_window_mgr *ico_window_mgr,
172                                const char *appid,
173                                struct wl_array *surfaces);
174
175     virtual void mapSurfaceCB(void *data,
176                               struct ico_window_mgr *ico_window_mgr,
177                               int32_t event,
178                               uint32_t surfaceid,
179                               uint32_t type,
180                               uint32_t target,
181                               int32_t width,
182                               int32_t height,
183                               int32_t stride,
184                               uint32_t format);
185
186     virtual void outputGeometryCB(void *data,
187                                   struct wl_output *wl_output,
188                                   int32_t x,
189                                   int32_t y,
190                                   int32_t physical_width,
191                                   int32_t physical_height,
192                                   int32_t subpixel,
193                                   const char *make,
194                                   const char *model,
195                                   int32_t transform);
196
197     virtual void outputModeCB(void *data,
198                               struct wl_output *wl_output,
199                               uint32_t flags,
200                               int32_t width,
201                               int32_t height,
202                               int32_t refresh);
203
204 private:
205     // assignment operator
206     CicoSCWindowController& operator=(const CicoSCWindowController &object);
207
208     // copy constructor
209     CicoSCWindowController(const CicoSCWindowController &object);
210
211     // find window object by surface id
212     CicoSCWindow* findWindow(int surfaceid);
213
214     // find layer object by display id and layer id
215     CicoSCLayer* findLayer(int displayid, int layerid);
216
217     // fine display zone by id
218     const CicoSCDisplayZone * findDisplayZone(int zoneid);
219
220     int notifyResourceManager(int        surfaceid,
221                               const char *zone,
222                               int        layerid,
223                               const char *animation,
224                               int        animationTime);
225
226 private:
227     // resource manager instance
228     CicoSCResourceManager *m_resMgr;
229
230     // window object list
231     map<unsigned int, CicoSCWindow*> m_windowList;
232
233     // display object list
234     vector<CicoSCDisplay*> m_displayList;
235
236     // total of physical display 
237     unsigned int m_physicalDisplayTotal;
238
239 };
240 #endif  // __CICO_SC_WINDOW_CONTROLLER_H__
241 // vim:set expandtab ts=4 sw=4: