2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Katri Kaikkonen - katri.kaikkonen@ixonos.com
6 Kaj Wallin - kaj.wallin@ixonos.com
7 Sami Rämö - sami.ramo@ixonos.com
9 Situare is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License
11 version 2 as published by the Free Software Foundation.
13 Situare is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with Situare; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
24 #ifndef INDICATORBUTTON_H
25 #define INDICATORBUTTON_H
27 #include <QMouseEvent>
29 #include <QToolButton>
33 * @brief Indicator button class
35 * @author Katri Kaikkonen - katri.kaikkonen (at) ixonos.com
36 * @author Sami Rämö - sami.ramo (at) ixonos.com
38 class IndicatorButton : public QToolButton
46 * @param parent Parent widget
48 IndicatorButton(QWidget *parent = 0);
55 /*******************************************************************************
56 * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
57 ******************************************************************************/
60 * @brief Event handler for mouse move events
62 * @param event Mouse event
64 void mouseMoveEvent(QMouseEvent *event);
67 * @brief Event handler for mouse press events
69 * @param event Mouse event
71 void mousePressEvent(QMouseEvent *event);
74 * @brief Event handler for mouse release events
76 * @param event Mouse event
78 void mouseReleaseEvent(QMouseEvent *event);
81 * @brief Event handler for paint events
83 * Paints the button and its icon
84 * @param event Paint event
86 void paintEvent(QPaintEvent *event);
88 /*******************************************************************************
89 * MEMBER FUNCTIONS AND SLOTS
90 ******************************************************************************/
93 * @brief Relative position of the event inside the widget
95 const QPoint& eventPosition();
98 * @brief Sets direction information for the distance indicator button
100 * Paints the button and its icon
102 * @param direction Direction to the GPS position (in degrees)
103 * @param draw True if direction triangle should be drawn
105 void setDirection(qreal direction, bool draw);
107 /*******************************************************************************
109 ******************************************************************************/
112 * @brief Automatic centering setting changed by user
114 * @param enabled True if automatic centering is enabled, otherwise false
116 void autoCenteringTriggered(bool enabled);
118 /*******************************************************************************
120 ******************************************************************************/
122 bool m_drawTriangle; ///< Should the direction triange be drawn
124 qreal m_direction; ///< Direction to the GPS position (in degrees)
126 QColor *m_normalColor; ///< Normal background color
128 QLinearGradient *m_selectedGradient; ///< Selected background
130 QPixmap m_indicatorLeds[2]; ///< Placeholder for images
132 QPoint m_dragPosition; ///< Location from where the widget is grabbed
133 QPoint m_eventPosition; ///< Position of mousePressEvent
136 #endif // INDICATORBUTTON_H