kwin Library API Documentation

plastikbutton.h

00001 /* Plastik KWin window decoration
00002   Copyright (C) 2003 Sandro Giessl <ceebx@users.sourceforge.net>
00003 
00004   based on the window decoration "Web":
00005   Copyright (C) 2001 Rik Hemsley (rikkus) <rik@kde.org>
00006 
00007   This program is free software; you can redistribute it and/or
00008   modify it under the terms of the GNU General Public
00009   License as published by the Free Software Foundation; either
00010   version 2 of the License, or (at your option) any later version.
00011 
00012   This program is distributed in the hope that it will be useful,
00013   but WITHOUT ANY WARRANTY; without even the implied warranty of
00014   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015   General Public License for more details.
00016 
00017   You should have received a copy of the GNU General Public License
00018   along with this program; see the file COPYING.  If not, write to
00019   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00020   Boston, MA 02111-1307, USA.
00021  */
00022 
00023 #ifndef PLASTIKBUTTON_H
00024 #define PLASTIKBUTTON_H
00025 
00026 #include <qbutton.h>
00027 #include <qimage.h>
00028 #include "plastik.h"
00029 
00030 class QTimer;
00031 
00032 namespace KWinPlastik {
00033 
00034 class PlastikClient;
00035 
00036 class PlastikButton : public QButton
00037 {
00038     Q_OBJECT
00039 public:
00040     PlastikButton(PlastikClient *parent, const char *name, const QString &tip, ButtonType type, int size, bool toggle = false, int btns = LeftButton);
00041     ~PlastikButton();
00042 
00043     QSize sizeHint() const; 
00044     ButtonState lastMousePress() const { return m_lastMouse; }
00045     void reset() { repaint(false); }
00046     PlastikClient * client() { return m_client; }
00047     virtual void setOn(bool on);
00048     void setDeco();
00049     void setTipText(const QString &tip);
00050     void setSize(const int s);
00051 
00052 protected slots:
00053     void animate();
00054 
00055 private:
00056     void enterEvent(QEvent *e);
00057     void leaveEvent(QEvent *e);
00058     void mousePressEvent(QMouseEvent *e);
00059     void mouseReleaseEvent(QMouseEvent *e);
00060     void drawButton(QPainter *painter);
00061 
00062 private:
00063     PlastikClient *m_client;
00064     ButtonState m_lastMouse;
00065     int m_realizeButtons;
00066 
00067     int m_size;
00068 
00069     ButtonType m_type;
00070     QImage m_aDecoLight,m_iDecoLight,m_aDecoDark,m_iDecoDark;
00071     bool hover;
00072 
00073     QTimer *animTmr;
00074     uint animProgress;
00075 };
00076 
00077 } // namespace KWinPlastik
00078 
00079 #endif // PLASTIKBUTTON_H
KDE Logo
This file is part of the documentation for kwin Library Version 3.4.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jun 14 01:54:13 2006 by doxygen 1.4.4 written by Dimitri van Heesch, © 1997-2003