Fixed FacebookLoginBrowser::destroyed() signal handling
[situare] / src / ui / panelcontextbuttonbar.h
1 /*
2     Situare - A location system for Facebook
3     Copyright (C) 2010  Ixonos Plc. Authors:
4
5         Pekka Nissinen - pekka.nissinen@ixonos.com
6
7     Situare is free software; you can redistribute it and/or
8     modify it under the terms of the GNU General Public License
9     version 2 as published by the Free Software Foundation.
10
11     Situare is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with Situare; if not, write to the Free Software
18     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
19     USA.
20 */
21
22 #ifndef PANELCONTEXTBUTTONBAR_H
23 #define PANELCONTEXTBUTTONBAR_H
24
25 #include <QWidget>
26
27 class QState;
28
29 /**
30  * @brief Base class for panel context button bar
31  *
32  * @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
33  */
34 class PanelContextButtonBar : public QWidget
35 {
36     Q_OBJECT
37
38 public:
39     /**
40      * @brief Constructor
41      *
42      * @param parent Parent
43      */
44     PanelContextButtonBar(QWidget *parent = 0);
45
46 /*******************************************************************************
47  * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
48  ******************************************************************************/
49 protected:
50     /**
51      * @brief Draws the bar
52      *
53      * @param event Paint event
54      */
55     void paintEvent(QPaintEvent *event);
56
57 /*******************************************************************************
58  * MEMBER FUNCTIONS AND SLOTS
59  ******************************************************************************/
60 public:
61     /**
62      * @brief Hides the context button bar
63      */
64     void hideContextButtonBar();
65
66     /**
67      * @brief Returns the current state of the context button bar
68      *
69      * @return Current state
70      */
71     bool isBarVisible() const;
72
73     /**
74      * @brief Moves the context button bar to desired position
75      *
76      * @param x Horizontal position
77      * @param y Vertical position
78      */
79     void move(int x, int y);
80
81     /**
82      * @brief Sets the context buttons to the context button bar
83      *
84      * @param contextButtons Pointer to context buttons
85      */
86     void setContextButtons(QWidget *contextButtons);
87
88     /**
89      * @brief Shows the context button bar
90      */
91     void showContextButtonBar();
92
93 private slots:
94     /**
95      * @brief Internal slot used to set the context button bar state
96      */
97     void contextButtonBarStateChanged();
98
99 /*******************************************************************************
100  * SIGNALS
101  ******************************************************************************/
102 signals:
103     /**
104      * @brief Signal that is sent when context button bar is hidden
105      */
106     void barHidden();
107
108     /**
109      * @brief Signal that is sent when context button bar is visible
110      */
111     void barVisible();
112
113     /**
114      * @brief This signal is called when context button bar needs to be repositioned
115      */
116     void positionChangeRequested();
117
118     /**
119      * @brief Signal that is sent when the context button bar state must be changed
120      */
121     void toggleState();
122
123 /*******************************************************************************
124  * DATA MEMBERS
125  ******************************************************************************/
126 private:
127     bool m_visible;             ///< Current state of the context button bar
128
129     QPixmap m_barTile;          ///< Pixmap for button bar
130     QPixmap m_barTop;           ///< Pixmap for button bar top
131
132     QRect m_barRect;            ///< Rect for the button bar
133
134     QState *m_stateHidden;      ///< State of the hidden context button bar
135     QState *m_stateVisible;     ///< State of the visible context button bar
136
137     QWidget *m_contextButtons;  ///< Widget for context buttons
138 };
139
140 #endif // PANELCONTEXTBUTTONBAR_H