Lomiri
ScreenWindow.h
1 /*
2  * Copyright (C) 2016-2017 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License version 3, as published by
6  * the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10  * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef LOMIRI_SCREENWINDOW_H
18 #define LOMIRI_SCREENWINDOW_H
19 
20 #include <QQuickWindow>
21 #include <QPointer>
22 
23 #include "Screen.h"
24 
25 class ScreenAdapter;
26 
27 /*
28  * ScreenWindow - wrapper of QQuickWindow to enable QML to specify destination screen.
29 **/
30 class ScreenWindow : public QQuickWindow
31 {
32  Q_OBJECT
33  Q_PROPERTY(ConcreteScreen *screen READ screenWrapper WRITE setScreenWrapper NOTIFY screenWrapperChanged)
34  Q_PROPERTY(int winId READ winId CONSTANT)
35 public:
36  explicit ScreenWindow(QQuickWindow *parent = 0);
37  ~ScreenWindow();
38 
39  ConcreteScreen *screenWrapper() const;
40  void setScreenWrapper(ConcreteScreen *screen);
41 
42 Q_SIGNALS:
43  void screenWrapperChanged(ConcreteScreen* screen);
44 
45 private:
46  QPointer<ConcreteScreen> m_screen;
47 };
48 
49 #endif // LOMIRI_SCREENWINDOW_H