00001 /* 00002 Situare - A location system for Facebook 00003 Copyright (C) 2010 Ixonos Plc. Authors: 00004 00005 Pekka Nissinen - pekka.nissinen@ixonos.com 00006 Kaj Wallin - kaj.wallin@ixonos.com 00007 00008 Situare is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU General Public License 00010 version 2 as published by the Free Software Foundation. 00011 00012 Situare is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with Situare; if not, write to the Free Software 00019 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 00020 USA. 00021 */ 00022 00023 #ifndef ZOOMBUTTONPANEL_H 00024 #define ZOOMBUTTONPANEL_H 00025 00026 #include <QGraphicsItem> 00027 #include <QGridLayout> 00028 #include <QTimer> 00029 #include <QWidget> 00030 00031 #include "zoombutton.h" 00032 00039 class ZoomButtonPanel : public QWidget 00040 { 00041 Q_OBJECT 00042 00043 public: 00049 ZoomButtonPanel(QWidget *parent = 0); 00050 00051 /******************************************************************************* 00052 * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS 00053 ******************************************************************************/ 00054 protected: 00060 void mouseMoveEvent(QMouseEvent *event); 00061 00067 void mousePressEvent(QMouseEvent *event); 00068 00074 void mouseReleaseEvent(QMouseEvent *event); 00075 00082 void paintEvent(QPaintEvent *event); 00083 00084 /******************************************************************************* 00085 * MEMBER FUNCTIONS AND SLOTS 00086 ******************************************************************************/ 00087 public: 00093 const ZoomButton* zoomInButton() const; 00094 00100 const ZoomButton* zoomOutButton() const; 00101 00102 public slots: 00106 void disableZoomInButton(); 00107 00111 void disableZoomOutButton(); 00112 00116 void resetButtons(); 00117 00121 void setDraggable(bool mode, QPoint eventPosition = QPoint(0,0)); 00122 00128 void screenResized(const QSize &size); 00129 00130 private slots: 00134 void forceMouseRelease(); 00135 00139 void timerExpired(); 00140 00141 /****************************************************************************** 00142 * SIGNALS 00143 ******************************************************************************/ 00144 signals: 00148 void draggingModeTriggered(); 00149 00150 /******************************************************************************* 00151 * DATA MEMBERS 00152 ******************************************************************************/ 00153 private: 00154 bool m_isDraggable; 00155 bool m_zoomInMode; 00156 bool m_zoomOutMode; 00157 00158 QGridLayout m_panelLayout; 00159 00160 QPoint m_dragPosition; 00161 00162 QSize m_screenSize; 00163 00164 QTimer *m_dragStartTimer; 00165 QTimer *m_forceReleaseTimer; 00166 00167 ZoomButton *m_zoomInButton; 00168 ZoomButton *m_zoomOutButton; 00169 }; 00170 00171 #endif // ZOOMBUTTONPANEL_H