Back to index

kdeartwork  4.3.2
Button.h
Go to the documentation of this file.
00001 /*
00002   RISC OS KWin client
00003 
00004   Copyright 2000
00005     Rik Hemsley <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., 51 Franklin Street, Fifth Floor,
00020   Boston, MA 02110-1301, USA.
00021 */
00022 
00023 #ifndef RISC_OS_BUTTON_H
00024 #define RISC_OS_BUTTON_H
00025 
00026 #include <qpixmap.h>
00027 #include <qwidget.h>
00028 //Added by qt3to4:
00029 #include <QMouseEvent>
00030 #include <QPaintEvent>
00031 #include <klocale.h>
00032 #include <kdecoration.h>
00033 
00034 namespace RiscOS
00035 {
00036 
00037 class Button : public QWidget
00038 {
00039    Q_OBJECT
00040 
00041    public:
00042 
00043       enum Type { Lower, Close, Iconify, Maximise, Sticky, Help };
00044 
00045       enum Alignment { Left, Right };
00046 
00047       Button(QWidget *parent, const QString &tip,
00048              const Qt::MouseButtons realizeButton = Qt::LeftButton);
00049       virtual ~Button();
00050 
00051       void setAlignment(Alignment);
00052 
00053       Alignment alignment() const;
00054 
00055    protected slots:
00056 
00057       void setActive(bool);
00058 
00059    protected:
00060 
00061       void paintEvent(QPaintEvent *);
00062 
00063       void mousePressEvent(QMouseEvent *);
00064       void mouseReleaseEvent(QMouseEvent *);
00065       void mouseMoveEvent(QMouseEvent *) { /* Empty. */ }
00066 
00067       void setPixmap(const QPixmap &);
00068 
00069       Qt::MouseButtons realizeButtons_;
00070       Qt::MouseButton lastButton_;
00071 
00072    private:
00073 
00074       Alignment   alignment_;
00075       bool        down_;
00076       bool        active_;
00077       QPixmap     aPixmap_, iPixmap_;
00078 };
00079 
00080 } // End namespace
00081 
00082 #endif
00083 
00084 // vim:ts=2:sw=2:tw=78