Added new scalable panels, deleted obsolite bitmaps and made some minor cosmetic...
[situare] / src / ui / panelsliderbar.h
1 /*
2     Situare - A location system for Facebook
3     Copyright (C) 2010  Ixonos Plc. Authors:
4
5         Kaj Wallin - kaj.wallin@ixonos.com
6         Pekka Nissinen - pekka.nissinen@ixonos.com
7
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.
11
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.
16
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,
20     USA.
21 */
22
23 #ifndef PANELSLIDERBAR_H
24 #define PANELSLIDERBAR_H
25
26 #include <QMouseEvent>
27 #include <QPaintEvent>
28 #include <QPixmap>
29 #include <QRect>
30 #include <QWidget>
31
32 #include "panelcommon.h"
33
34 /**
35  * @brief Generic class for panel slider bars
36  *
37  * @author Kaj Wallin - kaj.wallin (at) ixonos.com
38  * @author Pekka Nissinen - pekka.nissinen@ixonos.com
39  *
40  * @class PanelSliderBar panelsliderbar.h "ui/panelsliderbar.h"
41  */
42 class PanelSliderBar : public QWidget
43 {
44     Q_OBJECT
45
46 public:
47     /**
48      * @brief Constructor
49      *
50      * @param parent Parent
51      * @param side Qstring for the sliderbar location. Accepts "LEFT" and "RIGHT"
52      */
53     PanelSliderBar(QWidget *parent, Side side);
54
55 /*******************************************************************************
56  * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
57  ******************************************************************************/
58 protected:
59     /**
60      * @brief Draws the slider
61      *
62      * @param * QPaintEvent unused
63      */
64     void paintEvent(QPaintEvent *);
65
66     /**
67      * @brief Mouse release event used to expand/collapse the panel
68      *
69      * @param * Event
70      *
71      * @sa clicked
72      */
73     void mouseReleaseEvent(QMouseEvent *);
74
75 /*******************************************************************************
76  * MEMBER FUNCTIONS AND SLOTS
77  ******************************************************************************/
78 public slots:
79     /**
80      * @brief Slot to redraw the slider bar after window resize event
81      *
82      * @param size Size of the new window
83      */
84     void resizeSliderBar(const QSize &size);
85
86 /*******************************************************************************
87  * SIGNALS
88  ******************************************************************************/
89 signals:
90     /**
91      * @brief Signal that is emitted the slider bar is clicked
92      *
93      * @sa mouseReleaseEvent
94      */
95     void clicked();
96
97 /*******************************************************************************
98  * DATA MEMBERS
99  ******************************************************************************/
100 private:
101     QPixmap m_menuDropShadowTile;   ///< Pixmap for menu drop shadow
102     QPixmap m_sliderButton;         ///< Pixmap for panel sliding bar button
103     QPixmap m_sliderButtonArrow;    ///< Pixmap for panel sliding bar button arrow
104     QPixmap m_sliderTile;           ///< Pixmap for panel sliding bar
105     QRect m_bottomRect;             ///< Rect for slider bar bottom
106     QRect m_buttonRect;             ///< Rect for slider bar button
107     QRect m_topRect;                ///< Rect for slider bar top
108     QRegion m_sliderRegion;         ///< Region of the slider bar
109 };
110 #endif // PANELSLIDERBAR_H