File indexing completed on 2025-03-16 05:05:13
0001 /* 0002 SPDX-FileCopyrightText: 2020 Michail Vourlakos <mvourlakos@gmail.com> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #ifndef PLASMATHEMEEXTENDEDPANELBACKGROUND_H 0007 #define PLASMATHEMEEXTENDEDPANELBACKGROUND_H 0008 0009 // Qt 0010 #include <QObject> 0011 0012 // Plasma 0013 #include <Plasma> 0014 #include <Plasma/FrameSvg> 0015 0016 namespace Latte { 0017 namespace PlasmaExtended { 0018 class Theme; 0019 } 0020 } 0021 0022 namespace Latte { 0023 namespace PlasmaExtended { 0024 0025 class PanelBackground: public QObject 0026 { 0027 Q_OBJECT 0028 Q_PROPERTY(int paddingTop READ paddingTop NOTIFY paddingsChanged) 0029 Q_PROPERTY(int paddingLeft READ paddingLeft NOTIFY paddingsChanged) 0030 Q_PROPERTY(int paddingBottom READ paddingBottom NOTIFY paddingsChanged) 0031 Q_PROPERTY(int paddingRight READ paddingRight NOTIFY paddingsChanged) 0032 Q_PROPERTY(int shadowSize READ shadowSize NOTIFY shadowSizeChanged) 0033 0034 Q_PROPERTY(int roundness READ roundness NOTIFY roundnessChanged) 0035 0036 Q_PROPERTY(float maxOpacity READ maxOpacity NOTIFY maxOpacityChanged) 0037 0038 Q_PROPERTY(QColor shadowColor READ shadowColor NOTIFY shadowColorChanged) 0039 0040 public: 0041 PanelBackground(Plasma::Types::Location edge, Theme *parent); 0042 ~PanelBackground(); 0043 0044 int paddingTop() const; 0045 int paddingLeft() const; 0046 int paddingBottom() const; 0047 int paddingRight() const; 0048 int shadowSize() const; 0049 0050 int roundness() const; 0051 0052 float maxOpacity() const; 0053 0054 QColor shadowColor() const; 0055 0056 public slots: 0057 void update(); 0058 0059 signals: 0060 void paddingsChanged(); 0061 void roundnessChanged(); 0062 void shadowColorChanged(); 0063 void shadowSizeChanged(); 0064 void maxOpacityChanged(); 0065 0066 private: 0067 bool hasMask(Plasma::Svg *svg) const; 0068 0069 QString prefixed(const QString &id); 0070 QString element(Plasma::Svg *svg, const QString &id); 0071 0072 void updateMaxOpacity(Plasma::Svg *svg); 0073 void updatePaddings(Plasma::Svg *svg); 0074 void updateRoundness(Plasma::Svg *svg); 0075 void updateShadow(Plasma::Svg *svg); 0076 0077 void updateRoundnessFromMask(Plasma::Svg *svg); 0078 void updateRoundnessFromShadows(Plasma::Svg *svg); 0079 void updateRoundnessFallback(Plasma::Svg *svg); 0080 0081 private: 0082 int m_paddingTop{0}; 0083 int m_paddingLeft{0}; 0084 int m_paddingBottom{0}; 0085 int m_paddingRight{0}; 0086 0087 int m_shadowSize{0}; 0088 int m_roundness{0}; 0089 0090 float m_maxOpacity{1.0}; 0091 0092 QColor m_shadowColor; 0093 0094 Plasma::Types::Location m_location{Plasma::Types::BottomEdge}; 0095 0096 Theme *m_parentTheme{nullptr}; 0097 }; 0098 0099 } 0100 } 0101 0102 #endif