Fixed FacebookLoginBrowser::destroyed() signal handling
[situare] / src / ui / imagebutton.h
1 /*
2    Situare - A location system for Facebook
3    Copyright (C) 2010  Ixonos Plc. Authors:
4
5        Pekka Nissinen - pekka.nissinen@ixonos.com
6
7    Situare is free software; you can redistribute it and/or
8    modify it under the terms of the GNU General Public License
9    version 2 as published by the Free Software Foundation.
10
11    Situare is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with Situare; if not, write to the Free Software
18    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
19    USA.
20 */
21
22 #ifndef IMAGEBUTTON_H
23 #define IMAGEBUTTON_H
24
25 #include <QPushButton>
26
27 /**
28  * @brief A simple class for icon button
29  *
30  * @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
31  */
32 class ImageButton : public QPushButton
33 {
34     Q_OBJECT
35
36 public:
37     /**
38      * @brief Constructor
39      *
40      * @param normalIconPictureFileName Normal state icon image file name
41      * @param selectedIconPictureFileName Selected state icon image file name (optional)
42      * @param disabledIconPictureFileName Disabled state icon image file name (optional)
43      * @param parent Parent
44      */
45     ImageButton(const QString &normalIconPictureFileName = QString(),
46                 const QString &selectedIconPictureFileName = QString(),
47                 const QString &disabledIconPictureFileName = QString(), QWidget *parent = 0);
48
49 /*******************************************************************************
50  * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
51  ******************************************************************************/
52 protected:
53     /**
54      * @brief Event handler for paint events
55      *
56      * Paints the button and its icon
57      * @param event Paint event
58      */
59     void paintEvent(QPaintEvent *event);
60
61 /*******************************************************************************
62  * MEMBER FUNCTIONS AND SLOTS
63  ******************************************************************************/
64 public:
65     /**
66      * @brief Set button icon.
67      *
68      * @param image image pixmap
69      */
70     void setButtonIcon(const QPixmap &image);
71
72 private:
73     /**
74      * @brief Initializes the button by setting graphics and alpha mask
75      *
76      * @param size Size of the button icon
77      * @param icon Image icon
78      */
79     void initButton(const QSize &size, const QIcon &icon);
80 };
81
82 #endif // IMAGEBUTTON_H