Merged with latest master
[situare] / src / ui / zoombuttonpanel.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 ZOOMBUTTONPANEL_H
23 #define ZOOMBUTTONPANEL_H
24
25 #include <QWidget>
26 #include <QPaintEvent>
27 #include <QGridLayout>
28 #include <QGraphicsItem>
29
30 #include "imagebutton.h"
31
32 /**
33  * @brief Panel for zoom buttons
34  *
35  * @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
36  */
37 class ZoomButtonPanel : public QWidget
38 {
39     Q_OBJECT
40
41 public:
42     /**
43      * @brief Constructor
44      *
45      * @param parent Parent
46      * @param x Panel x coordinate
47      * @param y Panel y coordinate
48      */
49     ZoomButtonPanel(QWidget *parent = 0, int x = 0, int y = 0);
50
51 /*******************************************************************************
52  * MEMBER FUNCTIONS AND SLOTS
53  ******************************************************************************/
54 public slots:
55     /**
56      * @brief Disables the Zoom In button
57      */
58     void disableZoomInButton();
59
60     /**
61      * @brief Disables the Zoom Out button
62      */
63     void disableZoomOutButton();
64
65     /**
66      * @brief Reset Zoom button states to normal
67      */
68     void resetButtons();
69
70 protected:
71     void mouseMoveEvent(QMouseEvent *event);
72     void mousePressEvent(QMouseEvent *event);
73     void mouseReleaseEvent(QMouseEvent *event);
74
75 private:
76     QPoint dragPosition;
77
78 /*******************************************************************************
79  * DATA MEMBERS
80  ******************************************************************************/
81 public:
82     ImageButton *m_zoomInButton;     ///< Button for zoom in
83     ImageButton *m_zoomOutButton;    ///< Button for zoom out
84
85 private:
86     QGridLayout m_panelLayout;  ///< Panel layout
87     int m_x;                    ///< Panel x coordinate
88     int m_y;                    ///< Panel y coordinate
89 };
90
91 #endif // ZOOMBUTTONPANEL_H