Fluid
Loading...
Searching...
No Matches
windowdecoration.h
Go to the documentation of this file.
1/*
2 * This file is part of Fluid.
3 *
4 * Copyright (C) 2018 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
5 *
6 * $BEGIN_LICENSE:MPL2$
7 *
8 * This Source Code Form is subject to the terms of the Mozilla Public
9 * License, v. 2.0. If a copy of the MPL was not distributed with this
10 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
11 *
12 * $END_LICENSE$
13 */
14
15#pragma once
16
17#include <QObject>
18#include <QColor>
19#include <QWindow>
20#include <QQmlParserStatus>
21#include <QtQml/qqmlregistration.h>
22class WindowDecoration : public QObject, public QQmlParserStatus
23{
24 Q_OBJECT
25 Q_PROPERTY(QWindow *window READ window WRITE setWindow NOTIFY windowChanged)
26 Q_PROPERTY(Theme theme READ theme WRITE setTheme NOTIFY themeChanged)
27 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
28 Q_INTERFACES(QQmlParserStatus)
29 QML_ELEMENT
30public:
31 enum Theme {
33 Dark
34 };
35 Q_ENUM(Theme)
36
37 explicit WindowDecoration(QObject *parent = nullptr);
38
39 QWindow *window() const;
40 void setWindow(QWindow *window);
41
42 Theme theme() const;
43 void setTheme(Theme theme);
44
45 QColor color() const;
46 void setColor(const QColor &color);
47
48 void classBegin() override;
49 void componentComplete() override;
50
51Q_SIGNALS:
55
56protected:
57 bool eventFilter(QObject *object, QEvent *event) override;
58
59private:
60 QWindow *m_window;
61 Theme m_theme;
62 QColor m_color;
63
64private Q_SLOTS:
65 void updateDecorationColor();
66#ifdef FLUID_ENABLE_WAYLAND
67 void setServerSideDecorationColor();
68#endif
69};
70
Definition windowdecoration.h:23
QColor color
Definition windowdecoration.h:27
Theme theme
Definition windowdecoration.h:26
void setColor(const QColor &color)
Definition windowdecoration.cpp:75
Theme
Definition windowdecoration.h:31
@ Dark
Definition windowdecoration.h:33
@ Light
Definition windowdecoration.h:32
void setWindow(QWindow *window)
Definition windowdecoration.cpp:45
bool eventFilter(QObject *object, QEvent *event) override
Definition windowdecoration.cpp:102
void classBegin() override
Definition windowdecoration.cpp:86
void componentComplete() override
Definition windowdecoration.cpp:90
QWindow * window
Definition windowdecoration.h:25
void setTheme(Theme theme)
Definition windowdecoration.cpp:59