8c8f63c19f58433db9812eced3b554b3151fd1e8
[staging/HomeScreen.git] / WindowManager / src / windowmanager.hpp
1 /*
2  * Copyright (C) 2016 Mentor Graphics Development (Deutschland) GmbH
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 #ifndef WINDOWMANAGER_HPP
18 #define WINDOWMANAGER_HPP
19
20 #include <QObject>
21 #include <QList>
22 #include <QMap>
23
24 #include "windowmanager_adaptor.h"
25
26
27 #ifdef HAVE_IVI_LAYERMANAGEMENT_API
28 #include <ilm/ilm_control.h>
29 #endif
30
31 class WindowManager : public QObject
32 {
33     Q_OBJECT
34
35 public:
36     explicit WindowManager(QObject *parent = 0);
37     ~WindowManager();
38
39     void start();
40 private:
41     WindowmanagerAdaptor *mp_windowManagerAdaptor;
42     QList<Layout> m_layouts;
43     QList<int> m_appSurfaces;
44     QMap<int, unsigned int> *mp_layoutAreaToSurfaceIdAssignment;
45
46     int m_currentLayout;
47
48     int m_screenId;
49     unsigned int m_screenWidth;
50     unsigned int m_screenHeight;
51
52     int* m_showLayers;
53     int getLayerRenderOrder(t_ilm_layer id_array[]);
54
55     void dumpScene();
56
57 #ifdef HAVE_IVI_LAYERMANAGEMENT_API
58     void createNewLayer(int layerId);
59     void addSurfaceToLayer(int surfaceId, int layerId);
60 #endif
61     void updateScreen();
62
63
64 public:
65     static void* myThis;
66
67 #ifdef HAVE_IVI_LAYERMANAGEMENT_API
68     // for general notifications
69     void notificationFunc_non_static(ilmObjectType object,
70                                         t_ilm_uint id,
71                                         t_ilm_bool created);
72     static void notificationFunc_static(ilmObjectType object,
73                                         t_ilm_uint id,
74                                         t_ilm_bool created,
75                                         void* user_data);
76
77
78     // for surface notifications
79     void surfaceCallbackFunction_non_static(t_ilm_surface surface,
80                                         struct ilmSurfaceProperties* surfaceProperties,
81                                         t_ilm_notification_mask mask);
82     static void surfaceCallbackFunction_static(t_ilm_surface surface,
83                                         struct ilmSurfaceProperties* surfaceProperties,
84                                         t_ilm_notification_mask mask);
85
86 #endif
87 public slots:
88
89
90 // from windowmanager_adaptor.h
91 public: // PROPERTIES
92     Q_PROPERTY(int layoutId READ layoutId)
93     int layoutId() const;
94
95     Q_PROPERTY(QString layoutName READ layoutName)
96     QString layoutName() const;
97
98 public Q_SLOTS: // METHODS
99     int addLayout(int layoutId, const QString &layoutName, const QList<LayoutArea> &surfaceAreas);
100     int deleteLayoutById(int layoutId);
101     QList<Layout> getAllLayouts();
102     QList<int> getAllSurfacesOfProcess(int pid);
103     QList<int> getAvailableLayouts(int numberOfAppSurfaces);
104     QList<int> getAvailableSurfaces();
105     QString getLayoutName(int layoutId);
106     void hideLayer(int layer);
107     int setLayoutById(int layoutId);
108     int setLayoutByName(const QString &layoutName);
109     int setSurfaceToLayoutArea(int surfaceId, int layoutAreaId);
110     void showLayer(int layer);
111
112 Q_SIGNALS: // SIGNALS
113     void surfaceVisibilityChanged(int surfaceId, bool visible);
114 };
115
116
117 #endif // WINDOWMANAGER_HPP