File indexing completed on 2024-05-19 09:43:13
0001 /***************************************************************************** 0002 * Copyright 2007 - 2010 Craig Drummond <craig.p.drummond@gmail.com> * 0003 * Copyright 2013 - 2015 Yichao Yu <yyc1992@gmail.com> * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU Lesser General Public License as * 0007 * published by the Free Software Foundation; either version 2.1 of the * 0008 * License, or (at your option) version 3, or any later version accepted * 0009 * by the membership of KDE e.V. (or its successor approved by the * 0010 * membership of KDE e.V.), which shall act as a proxy defined in * 0011 * Section 6 of version 3 of the license. * 0012 * * 0013 * This program is distributed in the hope that it will be useful, * 0014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 0016 * Lesser General Public License for more details. * 0017 * * 0018 * You should have received a copy of the GNU Lesser General Public * 0019 * License along with this library. If not, * 0020 * see <http://www.gnu.org/licenses/>. * 0021 *****************************************************************************/ 0022 0023 #ifndef __QTCURVESHADOWCONFIGURATION_H__ 0024 #define __QTCURVESHADOWCONFIGURATION_H__ 0025 0026 #include <QPalette> 0027 #ifdef midColor 0028 #undef midColor 0029 #endif 0030 0031 class KConfig; 0032 0033 namespace QtCurve { 0034 namespace KWin { 0035 0036 class ShadowConfig { 0037 public: 0038 enum ColorType { 0039 CT_FOCUS = 0, 0040 CT_HOVER = 1, 0041 CT_SELECTION = 2, 0042 CT_TITLEBAR = 3, 0043 CT_GRAY = 4, 0044 CT_CUSTOM = 5 0045 }; 0046 0047 enum ShadowType { 0048 SH_ACTIVE = 0, 0049 SH_INACTIVE = 1 0050 }; 0051 0052 enum { 0053 MIN_SIZE = 10, 0054 MAX_SIZE = 100, 0055 MIN_OFFSET = 0, 0056 MAX_OFFSET = 20 0057 }; 0058 0059 ShadowConfig(QPalette::ColorGroup); 0060 0061 void defaults(); 0062 void load(KConfig *cfg); 0063 void save(KConfig *cfg); 0064 0065 QPalette::ColorGroup colorGroup() const { return m_colorGroup; } 0066 int shadowSize() const { return m_size; } 0067 void setShadowSize(int v) { m_size = v; } 0068 int horizontalOffset() const { return m_hOffset; } 0069 void setHorizontalOffset(int v) { m_hOffset = v; } 0070 int verticalOffset() const { return m_vOffset; } 0071 void setVerticalOffset(int v) { m_vOffset = v; } 0072 void setColor(const QColor &c) { m_color=c; } 0073 const QColor & color() const { return m_color; } 0074 ColorType colorType() const { return (ColorType)m_colorType; } 0075 void setColorType(ColorType ct); 0076 ShadowType shadowType() const { return (ShadowType)m_shadowType; } 0077 void setShadowType(ShadowType st) { m_shadowType=st; } 0078 0079 // Keep compatible with Oxygen Shadow Cache code... 0080 const QColor & innerColor() const { return m_color; } 0081 const QColor & midColor() const { return m_color; } 0082 const QColor & outerColor() const { return m_color; } 0083 0084 bool operator == (const ShadowConfig& other) const 0085 { 0086 return m_colorGroup == other.m_colorGroup && 0087 m_size == other.m_size && 0088 m_hOffset == other.m_hOffset && 0089 m_vOffset == other.m_vOffset && 0090 m_color == other.m_color && 0091 m_shadowType == other.m_shadowType; 0092 } 0093 0094 private: 0095 QPalette::ColorGroup m_colorGroup; 0096 int m_size, 0097 m_hOffset, 0098 m_vOffset, 0099 m_colorType, 0100 m_shadowType; 0101 QColor m_color; 0102 }; 0103 0104 } 0105 } 0106 0107 #endif