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

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 QTCURVETOGGLEBUTTON_H
0024 #define QTCURVETOGGLEBUTTON_H
0025 
0026 #include <kcommondecoration.h>
0027 
0028 class QStyle;
0029 
0030 namespace QtCurve {
0031 namespace KWin {
0032 
0033 class QtCurveClient;
0034 
0035 class QtCurveToggleButton: public KCommonDecorationButton {
0036 public:
0037     QtCurveToggleButton(bool menubar, QtCurveClient *parent);
0038     ~QtCurveToggleButton() { }
0039 
0040     void reset(unsigned long changed);
0041     QtCurveClient * client() { return m_client; }
0042 
0043     protected:
0044 
0045     void paintEvent(QPaintEvent *);
0046 
0047     private:
0048 
0049     void enterEvent(QEvent *e);
0050     void leaveEvent(QEvent *e);
0051     void drawButton(QPainter *painter);
0052     void updateMask();
0053 
0054     private:
0055 
0056     QtCurveClient *m_client;
0057     bool          isMenuBar,
0058                   m_hover;
0059 };
0060 
0061 }
0062 }
0063 
0064 #endif