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
26 #include <QGraphicsItem>
27 #include <QGridLayout>
31 #include "zoombutton.h"
34 * @brief Panel for zoom buttons
36 * @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
37 * @author Kaj Wallin - kaj.wallin (at) ixonos.com
39 class ZoomButtonPanel : public QWidget
47 * @param parent Parent
49 ZoomButtonPanel(QWidget *parent = 0);
51 /*******************************************************************************
52 * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
53 ******************************************************************************/
56 * @brief Move event for the zoom button panel
60 void mouseMoveEvent(QMouseEvent *event);
63 * @brief Press event for the zoom button panel
67 void mousePressEvent(QMouseEvent *event);
70 * @brief Event handler for mouse release events
72 * @param event Mouse event
74 void mouseReleaseEvent(QMouseEvent *event);
77 * @brief Event handler for paint events
80 * @param event Paint event
82 void paintEvent(QPaintEvent *event);
84 /*******************************************************************************
85 * MEMBER FUNCTIONS AND SLOTS
86 ******************************************************************************/
89 * @brief Getter for the zoom in button
91 * @return Pointer to the zoomInButton
93 const ZoomButton* zoomInButton() const;
96 * @brief Getter for the zoom out button
98 * @return Pointer to the zoomOutButton
100 const ZoomButton* zoomOutButton() const;
104 * @brief Disables the zoom in button
106 void disableZoomInButton();
109 * @brief Disables the zoom out button
111 void disableZoomOutButton();
114 * @brief Reset zoom button states to normal
119 * @brief Toggle zoom panel draggability
121 void setDraggable(bool mode, QPoint eventPosition = QPoint(0,0));
124 * @brief Slot to redraw the panel after window resize event
126 * @param size Size of the new screen
128 void screenResized(const QSize &size);
132 * @brief Safeguard slot to release mouse grab if something goes horribly wrong
134 void forceMouseRelease();
137 * @brief Slot that handles drag initialization once timer has timed out
141 /******************************************************************************
143 ******************************************************************************/
146 * @brief Dragging mode triggered.
148 void draggingModeTriggered();
150 /*******************************************************************************
152 ******************************************************************************/
154 bool m_isDraggable; ///< Boolean for tracking the draggability state
155 bool m_zoomInMode; ///< Boolean for storing zoom in button mode before dragging
156 bool m_zoomOutMode; ///< Boolean for storing zoom out button mode before dragging
158 QGridLayout m_panelLayout; ///< Panel layout
160 QPoint m_dragPosition; ///< Location from where the widget is grabbed
162 QSize m_screenSize; ///< Store for the screen size
164 QTimer *m_dragStartTimer; ///< Timer to init draggability of the zoom panel
165 QTimer *m_forceReleaseTimer; ///< Timer to run forceMouseRelease;
167 ZoomButton *m_zoomInButton; ///< Button for zoom in
168 ZoomButton *m_zoomOutButton; ///< Button for zoom out
171 #endif // ZOOMBUTTONPANEL_H