Changeset View
Changeset View
Standalone View
Standalone View
kcmkwin/kwinscreenedges/kwinscreenedge.h
- This file was added.
1 | /******************************************************************** | ||||
---|---|---|---|---|---|
2 | KWin - the KDE window manager | ||||
3 | This file is part of the KDE project. | ||||
4 | | ||||
5 | Copyright (C) 2009 Lucas Murray <lmurray@undefinedfire.com> | ||||
6 | Copyright (C) 2020 Cyril Rossi <cyril.rossi@enioka.com> | ||||
7 | | ||||
8 | This program is free software; you can redistribute it and/or modify | ||||
9 | it under the terms of the GNU General Public License as published by | ||||
10 | the Free Software Foundation; either version 2 of the License, or | ||||
11 | (at your option) any later version. | ||||
12 | | ||||
13 | This program is distributed in the hope that it will be useful, | ||||
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
16 | GNU General Public License for more details. | ||||
17 | | ||||
18 | You should have received a copy of the GNU General Public License | ||||
19 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||||
20 | *********************************************************************/ | ||||
21 | | ||||
22 | #ifndef __KWINSCREENEDGE_H__ | ||||
23 | #define __KWINSCREENEDGE_H__ | ||||
24 | | ||||
25 | #include <QWidget> | ||||
26 | | ||||
27 | #include "kwinglobals.h" | ||||
28 | | ||||
29 | namespace KWin | ||||
30 | { | ||||
31 | | ||||
32 | class Monitor; | ||||
33 | | ||||
34 | class KWinScreenEdge : public QWidget | ||||
35 | { | ||||
36 | Q_OBJECT | ||||
37 | | ||||
38 | public: | ||||
39 | explicit KWinScreenEdge(QWidget *parent = nullptr); | ||||
40 | ~KWinScreenEdge() override; | ||||
41 | | ||||
42 | void monitorHideEdge(ElectricBorder border, bool hidden); | ||||
43 | | ||||
44 | void monitorAddItem(const QString &item); | ||||
45 | void monitorItemSetEnabled(int index, bool enabled); | ||||
46 | | ||||
47 | QList<int> monitorCheckEffectHasEdge(int index) const; | ||||
48 | int selectedEdgeItem(ElectricBorder border) const; | ||||
49 | | ||||
50 | void monitorChangeEdge(ElectricBorder border, int index); | ||||
51 | void monitorChangeEdge(const QList<int> &borderList, int index); | ||||
52 | | ||||
53 | void monitorChangeDefaultEdge(ElectricBorder border, int index); | ||||
54 | void monitorChangeDefaultEdge(const QList<int> &borderList, int index); | ||||
55 | | ||||
56 | // revert to reference settings and assess for saveNeeded and default changed | ||||
57 | void reload(); | ||||
58 | // reset to default settings and assess for saveNeeded and default changed | ||||
59 | void setDefaults(); | ||||
60 | | ||||
61 | private Q_SLOTS: | ||||
62 | void onChanged(); | ||||
63 | void createConnection(); | ||||
64 | | ||||
65 | Q_SIGNALS: | ||||
66 | void saveNeededChanged(bool isNeeded); | ||||
67 | void defaultChanged(bool isDefault); | ||||
68 | | ||||
69 | private: | ||||
70 | virtual Monitor *monitor() const = 0; | ||||
71 | | ||||
72 | // internal use, assert if border equals ELECTRIC_COUNT or ElectricNone | ||||
73 | static int electricBorderToMonitorEdge(ElectricBorder border); | ||||
74 | static ElectricBorder monitorEdgeToElectricBorder(int edge); | ||||
75 | | ||||
76 | private: | ||||
77 | QHash<ElectricBorder, int> m_reference; // reference settings | ||||
78 | QHash<ElectricBorder, int> m_default; // default settings | ||||
79 | }; | ||||
80 | | ||||
81 | } // namespace | ||||
82 | | ||||
83 | #endif |