00001 /* 00002 Situare - A location system for Facebook 00003 Copyright (C) 2010 Ixonos Plc. Authors: 00004 00005 Pekka Nissinen - pekka.nissinen@ixonos.com 00006 00007 Situare is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU General Public License 00009 version 2 as published by the Free Software Foundation. 00010 00011 Situare is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with Situare; if not, write to the Free Software 00018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 00019 USA. 00020 */ 00021 00022 #ifndef IMAGEBUTTON_H 00023 #define IMAGEBUTTON_H 00024 00025 #include <QIcon> 00026 #include <QString> 00027 #include <QWidget> 00028 #include <QPushButton> 00029 #include <QMouseEvent> 00030 #include <QPaintEvent> 00031 00037 class ImageButton : public QPushButton 00038 { 00039 Q_OBJECT 00040 00041 public: 00049 ImageButton(QWidget *parent = 0, QString normalIconPictureFileName = "", 00050 QString selectedIconPictureFileName = ""); 00051 00052 /******************************************************************************* 00053 * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS 00054 ******************************************************************************/ 00055 protected: 00061 void mousePressEvent(QMouseEvent *event); 00062 00068 void mouseReleaseEvent(QMouseEvent *event); 00069 00076 void paintEvent(QPaintEvent *event); 00077 00078 /******************************************************************************* 00079 * MEMBER FUNCTIONS AND SLOTS 00080 ******************************************************************************/ 00081 public: 00087 void setButtonIcon(const QPixmap &image); 00088 00094 void setMode(QIcon::Mode mode); 00095 00101 QIcon::Mode mode(); 00102 00103 private: 00110 void initButton(const QSize &size, const QIcon &icon); 00111 00112 /******************************************************************************* 00113 * DATA MEMBERS 00114 ******************************************************************************/ 00115 protected: 00116 QIcon::Mode m_buttonMode; 00117 }; 00118 00119 #endif // IMAGEBUTTON_H