00001 /* 00002 Situare - A location system for Facebook 00003 Copyright (C) 2010 Ixonos Plc. Authors: 00004 00005 Katri Kaikkonen - katri.kaikkonen@ixonos.com 00006 Kaj Wallin - kaj.wallin@ixonos.com 00007 Sami Rämö - sami.ramo@ixonos.com 00008 00009 Situare is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU General Public License 00011 version 2 as published by the Free Software Foundation. 00012 00013 Situare is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with Situare; if not, write to the Free Software 00020 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 00021 USA. 00022 */ 00023 00024 #ifndef INDICATORBUTTON_H 00025 #define INDICATORBUTTON_H 00026 00027 #include <QMouseEvent> 00028 #include <QTimer> 00029 #include <QToolButton> 00030 00038 class IndicatorButton : public QToolButton 00039 { 00040 Q_OBJECT 00041 00042 public: 00048 IndicatorButton(QWidget *parent = 0); 00049 00053 ~IndicatorButton(); 00054 00055 /******************************************************************************* 00056 * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS 00057 ******************************************************************************/ 00058 protected: 00064 void mousePressEvent(QMouseEvent *event); 00065 00071 void mouseReleaseEvent(QMouseEvent *event); 00072 00079 void paintEvent(QPaintEvent *event); 00080 00081 /******************************************************************************* 00082 * MEMBER FUNCTIONS AND SLOTS 00083 ******************************************************************************/ 00084 public slots: 00088 const QPoint& eventPosition(); 00089 00098 void setDirection(qreal direction, bool draw); 00099 00100 /******************************************************************************* 00101 * SIGNALS 00102 ******************************************************************************/ 00103 signals: 00109 void autoCenteringTriggered(bool enabled); 00110 00111 /******************************************************************************* 00112 * DATA MEMBERS 00113 ******************************************************************************/ 00114 private: 00115 bool m_drawTriangle; 00116 00117 qreal m_direction; 00118 00119 QColor *m_normalColor; 00120 00121 QLinearGradient *m_selectedGradient; 00122 00123 QPixmap m_indicatorLeds[2]; 00124 00125 QPoint m_dragPosition; 00126 QPoint m_eventPosition; 00127 }; 00128 00129 #endif // INDICATORBUTTON_H