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);
76 /*******************************************************************************
77 * MEMBER FUNCTIONS AND SLOTS
78 ******************************************************************************/
81 * @brief Getter for the zoom in button
83 * @return Pointer to the zoomInButton
85 const ZoomButton* zoomInButton();
88 * @brief Getter for the zoom out button
90 * @return Pointer to the zoomOutButton
92 const ZoomButton* zoomOutButton();
96 * @brief Disables the zoom in button
98 void disableZoomInButton();
101 * @brief Disables the zoom out button
103 void disableZoomOutButton();
106 * @brief Reset zoom button states to normal
111 * @brief Toggle zoom panel draggability
113 void setDraggable(bool mode, QPoint eventPosition = QPoint(0,0));
116 * @brief Slot to redraw the panel after window resize event
118 * @param size Size of the new screen
120 void screenResized(const QSize &size);
124 * @brief Safeguard slot to release mouse grab if something goes horribly wrong
126 void forceMouseRelease();
129 * @brief Slot that handles drag initialization once timer has timed out
133 /*******************************************************************************
135 ******************************************************************************/
137 bool m_isDraggable; ///< Boolean for tracking the draggability state
139 QGridLayout m_panelLayout; ///< Panel layout
141 QPoint m_dragPosition; ///< Location from where the widget is grabbed
143 QIcon::Mode m_zoomInMode; ///< Store for zoom in button mode before dragging
144 QIcon::Mode m_zoomOutMode; ///< Store for zoom out button mode before dragging
146 QSize m_screenSize; ///< Store for the screen size
148 QTimer *m_dragStartTimer; ///< Timer to init draggability of the zoom panel
149 QTimer *m_forceReleaseTimer; ///< Timer to run forceMouseRelease;
151 ZoomButton *m_zoomInButton; ///< Button for zoom in
152 ZoomButton *m_zoomOutButton; ///< Button for zoom out
155 #endif // ZOOMBUTTONPANEL_H