Mixxx

/home/maxime/Projets/Mixxx/1.10/mixxx/src/widget/wpushbutton.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           wpushbutton.h  -  description
00003                              -------------------
00004     begin                : Fri Jun 21 2002
00005     copyright            : (C) 2002 by Tue & Ken Haste Andersen
00006     email                : haste@diku.dk
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef WPUSHBUTTON_H
00019 #define WPUSHBUTTON_H
00020 
00021 #include "wwidget.h"
00022 #include <qpainter.h>
00023 #include <qpixmap.h>
00024 #include <qstring.h>
00025 #include <QPaintEvent>
00026 #include <QMouseEvent>
00027 #include <QFocusEvent>
00028 
00033 class WPushButton : public WWidget
00034 {
00035     Q_OBJECT
00036   public:
00037     WPushButton(QWidget *parent=0);
00038     ~WPushButton();
00039     void setup(QDomNode node);
00040 
00041     // Sets the number of states associated with this button, and removes
00042     // associated pixmaps.
00043     void setStates(int iStatesW);
00044 
00045     // Associates a pixmap of a given state of the button with the widget
00046     void setPixmap(int iState, bool bPressed, const QString &filename);
00047 
00048     // Associates a background pixmap with the widget. This is only needed if
00049     // the button pixmaps contains alpha channel values.
00050     void setPixmapBackground(const QString &filename);
00051 
00052   public slots:
00053     void setValue(double);
00054 
00055   protected:
00056     virtual void paintEvent(QPaintEvent *);
00057     virtual void mousePressEvent(QMouseEvent *e);
00058     virtual void mouseReleaseEvent(QMouseEvent *e);
00059     virtual void focusOutEvent(QFocusEvent* e);
00060 
00061     // True, if the button is currently pressed
00062     bool m_bPressed;
00063 
00064   private:
00065     bool m_bLeftClickForcePush, m_bRightClickForcePush;
00066     // Number of states associated with this button
00067     int m_iNoStates;
00068     // Array of associated pixmaps
00069     QPixmap **m_pPixmaps;
00070     // Associated background pixmap
00071     QPixmap *m_pPixmapBack;
00072 };
00073 
00074 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines