KWin
Loading...
Searching...
No Matches
auroraetheme.h
Go to the documentation of this file.
1/*
2 Library for Aurorae window decoration themes.
3 SPDX-FileCopyrightText: 2009, 2010, 2012 Martin Gräßlin <mgraesslin@kde.org>
4
5 SPDX-License-Identifier: GPL-2.0-or-later
6
7*/
8
9#pragma once
10
11// #include "libaurorae_export.h"
12
13#include <QObject>
14
15#include <QLoggingCategory>
16
17#include <KDecoration2/DecorationButton>
18
19Q_DECLARE_LOGGING_CATEGORY(AURORAE)
20
21class KConfig;
22
23namespace Aurorae
24{
25class AuroraeThemePrivate;
26class ThemeConfig;
27
41
48
49class /*LIBAURORAE_EXPORT*/ AuroraeTheme : public QObject
50{
51 Q_OBJECT
52 Q_PROPERTY(int borderLeft READ leftBorder NOTIFY borderSizesChanged)
53 Q_PROPERTY(int borderRight READ rightBorder NOTIFY borderSizesChanged)
54 Q_PROPERTY(int borderTop READ topBorder NOTIFY borderSizesChanged)
55 Q_PROPERTY(int borderBottom READ bottomBorder NOTIFY borderSizesChanged)
60 Q_PROPERTY(int paddingLeft READ paddingLeft NOTIFY themeChanged)
61 Q_PROPERTY(int paddingRight READ paddingRight NOTIFY themeChanged)
62 Q_PROPERTY(int paddingTop READ paddingTop NOTIFY themeChanged)
63 Q_PROPERTY(int paddingBottom READ paddingBottom NOTIFY themeChanged)
64 Q_PROPERTY(QString themeName READ themeName NOTIFY themeChanged)
65 Q_PROPERTY(int buttonHeight READ buttonHeight NOTIFY themeChanged)
66 Q_PROPERTY(int buttonWidth READ buttonWidth NOTIFY themeChanged)
74 Q_PROPERTY(int buttonWidthHelp READ buttonWidthHelp NOTIFY themeChanged)
75 Q_PROPERTY(int buttonWidthMenu READ buttonWidthMenu NOTIFY themeChanged)
77 Q_PROPERTY(int buttonSpacing READ buttonSpacing NOTIFY themeChanged)
78 Q_PROPERTY(int buttonMarginTop READ buttonMarginTop NOTIFY themeChanged)
81 Q_PROPERTY(int animationTime READ animationTime NOTIFY themeChanged)
82 Q_PROPERTY(int titleEdgeLeft READ titleEdgeLeft NOTIFY themeChanged)
83 Q_PROPERTY(int titleEdgeRight READ titleEdgeRight NOTIFY themeChanged)
84 Q_PROPERTY(int titleEdgeTop READ titleEdgeTop NOTIFY themeChanged)
89 Q_PROPERTY(int titleBorderLeft READ titleBorderLeft NOTIFY themeChanged)
90 Q_PROPERTY(int titleHeight READ titleHeight NOTIFY themeChanged)
91 Q_PROPERTY(QString decorationPath READ decorationPath NOTIFY themeChanged)
92 Q_PROPERTY(QString minimizeButtonPath READ minimizeButtonPath NOTIFY themeChanged)
93 Q_PROPERTY(QString maximizeButtonPath READ maximizeButtonPath NOTIFY themeChanged)
94 Q_PROPERTY(QString restoreButtonPath READ restoreButtonPath NOTIFY themeChanged)
95 Q_PROPERTY(QString closeButtonPath READ closeButtonPath NOTIFY themeChanged)
99 Q_PROPERTY(QString shadeButtonPath READ shadeButtonPath NOTIFY themeChanged)
100 Q_PROPERTY(QString helpButtonPath READ helpButtonPath NOTIFY themeChanged)
101 Q_PROPERTY(QColor activeTextColor READ activeTextColor NOTIFY themeChanged)
102 Q_PROPERTY(QColor inactiveTextColor READ inactiveTextColor NOTIFY themeChanged)
103 Q_PROPERTY(Qt::Alignment horizontalAlignment READ alignment NOTIFY themeChanged)
104 Q_PROPERTY(Qt::Alignment verticalAlignment READ verticalAlignment NOTIFY themeChanged)
105public:
106 explicit AuroraeTheme(QObject *parent = nullptr);
107 ~AuroraeTheme() override;
108 // TODO: KSharedConfigPtr
109 void loadTheme(const QString &name, const KConfig &config);
110 bool isValid() const;
111 const QString &themeName() const;
112 int leftBorder() const;
113 int rightBorder() const;
114 int topBorder() const;
115 int bottomBorder() const;
116 int leftBorderMaximized() const;
117 int rightBorderMaximized() const;
118 int topBorderMaximized() const;
119 int bottomBorderMaximized() const;
120 int paddingLeft() const;
121 int paddingRight() const;
122 int paddingTop() const;
123 int paddingBottom() const;
124 int buttonWidth() const;
127 int buttonWidthClose() const;
131 int buttonWidthShade() const;
132 int buttonWidthHelp() const;
133 int buttonWidthMenu() const;
135 int buttonHeight() const;
136 int buttonSpacing() const;
137 int buttonMarginTop() const;
139 int animationTime() const;
140 int titleEdgeLeft() const;
141 int titleEdgeRight() const;
142 int titleEdgeTop() const;
146 int titleBorderLeft() const;
147 int titleBorderRight() const;
148 int titleHeight() const;
149 QString decorationPath() const;
150 QString minimizeButtonPath() const;
151 QString maximizeButtonPath() const;
152 QString restoreButtonPath() const;
153 QString closeButtonPath() const;
154 QString allDesktopsButtonPath() const;
155 QString keepAboveButtonPath() const;
156 QString keepBelowButtonPath() const;
157 QString shadeButtonPath() const;
158 QString helpButtonPath() const;
159 QColor activeTextColor() const;
160 QColor inactiveTextColor() const;
161 Qt::Alignment alignment() const;
162 Qt::Alignment verticalAlignment() const;
167 void titleEdges(int &left, int &top, int &right, int &bottom, bool maximized) const;
168 void setCompositingActive(bool active);
169 bool isCompositingActive() const;
170
174 bool hasButton(AuroraeButtonType button) const;
175 void setBorderSize(KDecoration2::BorderSize size);
181 void setButtonSize(KDecoration2::BorderSize size);
182 qreal buttonSizeFactor() const;
183
185
186 void setTabDragMimeType(const QString &mime);
187 const QString &tabDragMimeType() const;
188
189 // TODO: move to namespace
190 static QLatin1String mapButtonToName(AuroraeButtonType type);
191
192public Q_SLOTS:
193 void loadTheme(const QString &name);
194
195Q_SIGNALS:
199
200private:
205 void borders(int &left, int &top, int &right, int &bottom, bool maximized) const;
210 void padding(int &left, int &top, int &right, int &bottom) const;
211
212 const std::unique_ptr<AuroraeThemePrivate> d;
213};
214
215} // namespace
const QString & tabDragMimeType() const
Qt::Alignment horizontalAlignment
static QLatin1String mapButtonToName(AuroraeButtonType type)
int rightBorderMaximized() const
bool hasButton(AuroraeButtonType button) const
int bottomBorderMaximized() const
Qt::Alignment verticalAlignment
bool isCompositingActive() const
void titleEdges(int &left, int &top, int &right, int &bottom, bool maximized) const
void setCompositingActive(bool active)
void setButtonSize(KDecoration2::BorderSize size)
void setTabDragMimeType(const QString &mime)
int leftBorderMaximized() const
void loadTheme(const QString &name, const KConfig &config)
void setBorderSize(KDecoration2::BorderSize size)
int topBorderMaximized() const
DecorationPosition decorationPosition() const
Qt::Alignment alignment() const
@ DecorationBottom
@ DecorationRight
@ DecorationLeft
@ DecorationTop
@ AllDesktopsButton
@ KeepAboveButton
@ KeepBelowButton
@ MaximizeButton
@ RestoreButton
@ MinimizeButton
@ AppMenuButton
#define private
#define explicit