2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Pekka Nissinen - pekka.nissinen@ixonos.com
6 Kaj Wallin - kaj.wallin@ixonos.com
8 Situare is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 version 2 as published by the Free Software Foundation.
12 Situare is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Situare; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
23 #ifndef ZOOMBUTTONPANEL_H
24 #define ZOOMBUTTONPANEL_H
27 #include <QGridLayout>
28 #include <QGraphicsItem>
30 #include "zoombutton.h"
33 * @brief Panel for zoom buttons
35 * @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
36 * @author Kaj Wallin - kaj.wallin (at) ixonos.com
38 class ZoomButtonPanel : public QWidget
46 * @param parent Parent
47 * @param x Panel x coordinate
48 * @param y Panel y coordinate
50 ZoomButtonPanel(QWidget *parent = 0);
52 /*******************************************************************************
53 * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
54 ******************************************************************************/
57 * @brief Move event for the zoom button panel
61 void mouseMoveEvent(QMouseEvent *event);
64 * @brief Press event for the zoom button panel
68 void mousePressEvent(QMouseEvent *event);
71 * @brief Event handler for mouse release events
73 * @param event Mouse event
75 void mouseReleaseEvent(QMouseEvent *event);
77 /*******************************************************************************
78 * MEMBER FUNCTIONS AND SLOTS
79 ******************************************************************************/
82 * @brief Getter for the zoom in button
84 * @return Pointer to the zoomInButton
86 const ZoomButton* zoomInButton();
89 * @brief Getter for the zoom out button
91 * @return Pointer to the zoomOutButton
93 const ZoomButton* zoomOutButton();
97 * @brief Disables the zoom in button
99 void disableZoomInButton();
102 * @brief Disables the zoom out button
104 void disableZoomOutButton();
107 * @brief Reset zoom button states to normal
112 * @brief Toggle zoom panel draggability
114 void setDraggable(bool mode, QPoint eventPosition = QPoint(0,0));
117 * @brief Slot to redraw the panel after window resize event
119 * @param size Size of the new screen
121 void screenResized(const QSize &size);
125 * @brief Safeguard slot to release mouse grab if something goes horribly wrong
127 void forceMouseRelease();
130 * @brief Slot that handles drag initialization once timer has timed out
134 /*******************************************************************************
136 ******************************************************************************/
138 bool m_isDraggable; ///< Boolean for tracking the draggability state
140 QGridLayout m_panelLayout; ///< Panel layout
142 QPoint m_dragPosition; ///< Location from where the widget is grabbed
144 QIcon::Mode m_zoomInMode; ///< Store for zoom in button mode before dragging
145 QIcon::Mode m_zoomOutMode; ///< Store for zoom out button mode before dragging
147 QSize m_screenSize; ///< Store for the screen size
149 QTimer *m_dragStartTimer; ///< Timer to init draggability of the zoom panel
150 QTimer *m_forceReleaseTimer; ///< Timer to run forceMouseRelease;
152 ZoomButton *m_zoomInButton; ///< Button for zoom in
153 ZoomButton *m_zoomOutButton; ///< Button for zoom out
156 #endif // ZOOMBUTTONPANEL_H