File indexing completed on 2024-04-28 17:04:37

0001 /*****************************************************************************
0002  *   Copyright 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 __QTCURVE_CONFIG_H__
0024 #define __QTCURVE_CONFIG_H__
0025 
0026 class KConfig;
0027 
0028 namespace QtCurve {
0029 namespace KWin {
0030 
0031 class QtCurveConfig {
0032 public:
0033     enum Size {
0034         BORDER_NONE = 0,
0035         BORDER_NO_SIDES,
0036         BORDER_TINY,
0037         BORDER_NORMAL,
0038         BORDER_LARGE,
0039         BORDER_VERY_LARGE,
0040         BORDER_HUGE,
0041         BORDER_VERY_HUGE,
0042         BORDER_OVERSIZED
0043     };
0044 
0045     enum Shade
0046     {
0047         SHADE_NONE,
0048         SHADE_DARK,
0049         SHADE_LIGHT,
0050         SHADE_SHADOW
0051     };
0052 
0053     QtCurveConfig()               { defaults(); }
0054 
0055     void defaults();
0056     void load(const KConfig *cfg, const char *grp=0L);
0057     void save(KConfig *cfg, const char *grp=0L);
0058 
0059     Size  borderSize() const        { return (Size)m_borderSize; }
0060     bool  roundBottom() const       { return m_roundBottom; }
0061     Shade outerBorder() const       { return m_outerBorder; }
0062     Shade innerBorder() const       { return m_innerBorder; }
0063     bool  borderlessMax() const     { return m_borderlessMax; }
0064     bool  customShadows() const     { return m_customShadows; }
0065     bool  grouping() const          { return m_grouping; }
0066     int   titleBarPad() const       { return m_titleBarPad; }
0067     int   opacity(bool a) const     { return a ? m_activeOpacity : m_inactiveOpacity; }
0068     bool  opaqueBorder() const      { return m_opaqueBorder; }
0069     int   edgePad() const           { return m_edgePad; }
0070     void  setBorderSize(Size v)     { m_borderSize=v; }
0071     void  setRoundBottom(bool v)    { m_roundBottom=v; }
0072     void  setOuterBorder(Shade v)   { m_outerBorder=v; }
0073     void  setInnerBorder(Shade v)   { m_innerBorder=v; }
0074     void  setBorderlessMax(bool v)  { m_borderlessMax=v; }
0075     void  setCustomShadows(bool v)  { m_customShadows=v; }
0076     void  setGrouping(bool v)       { m_grouping=v; }
0077     void  setTitleBarPad(int v)     { m_titleBarPad=v; }
0078     void  setOpacity(int v, bool a) { a ? m_activeOpacity=v : m_inactiveOpacity=v; }
0079     void  setOpaqueBorder(bool v)   { m_opaqueBorder=v; }
0080     void  setEdgePad(int v)         { m_edgePad=v; }
0081 
0082     bool operator==(const QtCurveConfig &o) const
0083     {
0084         return m_borderSize==o.m_borderSize &&
0085                m_roundBottom==o.m_roundBottom &&
0086                m_outerBorder==o.m_outerBorder &&
0087                m_innerBorder==o.m_innerBorder &&
0088                m_borderlessMax==o.m_borderlessMax &&
0089                m_customShadows==o.m_customShadows &&
0090                m_grouping==o.m_grouping &&
0091                m_titleBarPad==o.m_titleBarPad &&
0092                m_activeOpacity==o.m_activeOpacity &&
0093                m_inactiveOpacity==o.m_inactiveOpacity &&
0094                m_opaqueBorder==o.m_opaqueBorder &&
0095                m_edgePad==o.m_edgePad;
0096     }
0097 
0098     bool operator!=(const QtCurveConfig &o) const { return !(*this==o); }
0099 
0100     private:
0101 
0102     int   m_borderSize,
0103           m_activeOpacity,
0104           m_inactiveOpacity;
0105     bool  m_roundBottom,
0106           m_borderlessMax,
0107           m_customShadows,
0108           m_grouping,
0109           m_opaqueBorder;
0110     Shade m_outerBorder,
0111           m_innerBorder;
0112     int   m_titleBarPad,
0113           m_edgePad;
0114 };
0115 
0116 }
0117 }
0118 
0119 #endif