POI: AGL LifeCycle Management
[apps/agl-service-windowmanager.git] / client / qlibwindowmanager.h
1 /*
2  * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
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 QLIBWINDOWMANAGER_H
18 #define QLIBWINDOWMANAGER_H
19 #include <libwindowmanager.h>
20 #include <functional>
21  #include <QObject>
22  #include <QUrl>
23  #include <QVariant>
24  #include <string>
25  #include <vector>
26
27 class QLibWindowmanager : public QObject{
28 Q_OBJECT
29 public:
30     explicit QLibWindowmanager(QObject *parent = nullptr);
31     ~QLibWindowmanager();
32
33     QLibWindowmanager(const QLibWindowmanager &) = delete;
34     QLibWindowmanager &operator=(const QLibWindowmanager &) = delete;
35
36 public:
37     using handler_fun = std::function<void(const char *)>;
38
39     enum QEventType {
40        Event_Active = 1,
41        Event_Inactive,
42
43        Event_Visible,
44        Event_Invisible,
45
46        Event_SyncDraw,
47        Event_FlushDraw,
48     };
49
50     static QLibWindowmanager &instance();
51
52     int init(int port, char const *token);
53
54     // WM API
55     int requestSurface(const char *label);
56     int activateSurface(const char *label);
57     int deactivateSurface(const char *label);
58     int endDraw(const char *label);
59     void set_event_handler(enum QEventType et, handler_fun f);
60
61 public slots:
62     void slotActivateSurface();
63     
64 private:
65     LibWindowmanager* wm;
66     std::string applabel;
67     std::vector<int> surfaceIDs; 
68 };
69 #endif // LIBWINDOWMANAGER_H