Bug Fix for : TIVI-1843, TIVI-1820, TIVI-1786.
[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        x,
82                     int        y,
83                     int        w,
84                     int        h,
85                     const char *resizeAnimation,
86                     int        resizeAnimationTime,
87                     const char *moveAnimation,
88                     int        moveAnimationTime);
89
90     int setGeometry(int        surfaceid,
91                     const char *zone,
92                     const char *resizeAnimation,
93                     int        resizeAnimationTime,
94                     const char *moveAnimation,
95                     int        moveAnimationTime);
96
97     int raise(int surfaceid,
98              const char  *animation,
99              int         animationTime);
100
101     int lower(int surfaceid, const char *animation, int animationTime);
102
103     int setWindowLayer(int surfaceid, int layerid);
104
105     int showLayer(int displayid, int layerid);
106
107     int hideLayer(int displayid, int layerid);
108
109     int active(int surfaceid, int target);
110
111     int mapSurface(int surfaceid, int framerate);
112
113     int unmapSurface(int surfaceid);
114
115     //
116     virtual void createdCB(void *data,
117                            struct ico_window_mgr *ico_window_mgr,
118                            uint32_t surfaceid,
119                            const char *winname,
120                            int32_t pid,
121                            const char *appid);
122
123     virtual void nameCB(void *data,
124                         struct ico_window_mgr *ico_window_mgr,
125                         uint32_t surfaceid,
126                         const char *winname);
127
128     virtual void destroyedCB(void *data,
129                              struct ico_window_mgr *ico_window_mgr,
130                              uint32_t surfaceid);
131
132     virtual void visibleCB(void *data,
133                            struct ico_window_mgr *ico_window_mgr,
134                            uint32_t surfaceid,
135                            int32_t visible,
136                            int32_t raise,
137                            int32_t hint);
138
139     virtual void configureCB(void *data,
140                              struct ico_window_mgr *ico_window_mgr,
141                              uint32_t surfaceid,
142                              uint32_t node,
143                              uint32_t layer,
144                              int32_t x,
145                              int32_t y,
146                              int32_t width,
147                              int32_t height,
148                              int32_t hint);
149
150     virtual void activeCB(void *data,
151                           struct ico_window_mgr *ico_window_mgr,
152                           uint32_t surfaceid,
153                           int32_t active);
154
155     virtual void layerVisibleCB(void *data,
156                                 struct ico_window_mgr *ico_window_mgr,
157                                 uint32_t layer,
158                                 int32_t visible);
159
160     virtual void appSurfacesCB(void *data,
161                                struct ico_window_mgr *ico_window_mgr,
162                                const char *appid,
163                                struct wl_array *surfaces);
164
165     virtual void mapSurfaceCB(void *data,
166                               struct ico_window_mgr *ico_window_mgr,
167                               int32_t event,
168                               uint32_t surfaceid,
169                               uint32_t type,
170                               uint32_t target,
171                               int32_t width,
172                               int32_t height,
173                               int32_t stride,
174                               uint32_t format);
175
176     virtual void outputGeometryCB(void *data,
177                                   struct wl_output *wl_output,
178                                   int32_t x,
179                                   int32_t y,
180                                   int32_t physical_width,
181                                   int32_t physical_height,
182                                   int32_t subpixel,
183                                   const char *make,
184                                   const char *model,
185                                   int32_t transform);
186
187     virtual void outputModeCB(void *data,
188                               struct wl_output *wl_output,
189                               uint32_t flags,
190                               int32_t width,
191                               int32_t height,
192                               int32_t refresh);
193
194 private:
195     // assignment operator
196     CicoSCWindowController& operator=(const CicoSCWindowController &object);
197
198     // copy constructor
199     CicoSCWindowController(const CicoSCWindowController &object);
200
201     // find window object by surface id
202     CicoSCWindow* findWindow(int surfaceid);
203
204     // find layer object by display id and layer id
205     CicoSCLayer* findLayer(int displayid, int layerid);
206
207     // fine display zone by id
208     const CicoSCDisplayZone * findDisplayZone(int zoneid);
209
210     int notifyResourceManager(int        surfaceid,
211                               const char *zone,
212                               const char *animation,
213                               int        animationTime);
214
215 private:
216     CicoSCResourceManager *m_resMgr;
217
218     // window object list
219     map<unsigned int, CicoSCWindow*> m_windowList;
220
221     // display object list
222     vector<CicoSCDisplay*>   m_displayList;
223
224     //
225     unsigned int m_physicalDisplayTotal;
226
227 };
228 #endif  // __CICO_SC_WINDOW_CONTROLLER_H__
229 // vim:set expandtab ts=4 sw=4: