Documentation
[situare] / src / ui / panelbase.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         Sami Rämö - sami.ramo@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 PANELBASE_H
24 #define PANELBASE_H
25
26 #include <QWidget>
27
28 class QHBoxLayout;
29 class QListWidgetItem;
30 class QVBoxLayout;
31
32 class ImageButton;
33
34 /**
35  * @brief Base class for panels
36  *
37  * @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
38  * @author Sami Rämö - sami.ramo (at) ixonos.com
39  */
40 class PanelBase : public QWidget
41 {
42     Q_OBJECT
43
44 public:
45     /**
46      * @brief Constructor
47      *
48      * @param parent Parent
49      */
50     PanelBase(QWidget *parent = 0);
51
52 /*******************************************************************************
53  * MEMBER FUNCTIONS AND SLOTS
54  ******************************************************************************/
55 public:
56     /**
57      * @brief Getter for the generic panel related context buttons
58      *
59      * @returns Pointer to context buttons widget
60      */
61     QWidget* genericPanelButtons() const;
62
63     /**
64      * @brief Getter for the list item related context buttons
65      *
66      * @returns Pointer to context buttons widget
67      */
68     QWidget* itemButtons() const;
69
70 protected slots:
71     /**
72      * @brief Call when there is a change in list item selection
73      *
74      * Emits listItemSelectionChanged(bool). Parameter is true if any item is selected.
75      */
76     void onListItemSelectionChanged();
77
78 /*******************************************************************************
79  * SIGNALS
80  ******************************************************************************/
81 signals:
82     /**
83      * @brief Signal for requesting a panel to be opened
84      *
85      * @param widget Pointer to the widget that emitted the signal
86      */
87     void openPanelRequested(QWidget *widget);
88
89     /**
90      * @brief Emitted when there is a change in list item selection
91      *
92      * @param itemIsSelected True if any item is selected.
93      */
94     void listItemSelectionChanged(bool itemIsSelected);
95
96 /*******************************************************************************
97  * DATA MEMBERS
98  ******************************************************************************/
99 protected:
100     QVBoxLayout *m_genericButtonsLayout;    ///< Layout for generic context buttons
101     QHBoxLayout *m_itemButtonsLayout;       ///< Layout for item related context buttons
102
103 private:
104     QWidget *m_genericButtons;              ///< Widget for generic context buttons
105     QWidget *m_itemButtons;                 ///< Widget for item related context buttons
106 };
107 #endif // PANELBASE_H