Lomiri
ScreenAttached.h
1 /*
2  * Copyright (C) 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 SCREENATTACHED_H
18 #define SCREENATTACHED_H
19 
20 #include "Screen.h"
21 
22 #include <QQmlEngine>
23 #include <QtQml>
24 
25 class QQuickWindow;
26 
27 class ScreenAttached : public Screen
28 {
29  Q_OBJECT
30 public:
31  ScreenAttached(QObject* owner);
32 
33  WorkspaceModel* workspaces() const override;
34  Workspace *currentWorkspace() const override;
35  void setCurrentWorkspace(Workspace* workspace) override;
36 
37 private Q_SLOTS:
38  void windowChanged(QQuickWindow*);
39  void screenChanged(QScreen*);
40  void screenChanged2(Screen* screen);
41 
42 private:
43  QPointer<Screen> m_screen;
44  QQuickWindow* m_window;
45 };
46 
47 class WMScreen : public QObject
48 {
49  Q_OBJECT
50 public:
51  static ScreenAttached *qmlAttachedProperties(QObject *owner);
52 };
53 
54 QML_DECLARE_TYPEINFO(WMScreen, QML_HAS_ATTACHED_PROPERTIES)
55 
56 #endif // SCREENATTACHED_H