Added missing comments to list classes.
[situare] / src / ui / listitem.h
1 /*
2    Situare - A location system for Facebook
3    Copyright (C) 2010  Ixonos Plc. Authors:
4
5        Jussi Laitinen - jussi.laitinen@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 LISTITEM_H
23 #define LISTITEM_H
24
25 #include <QListWidgetItem>
26
27 class User;
28
29 /**
30 * @brief Base class for list items.
31 *
32 * Stores item's name and image. Defines methods that sub
33 * classes have to implement.
34 */
35 class ListItem : public QListWidgetItem
36 {
37 public:
38     /**
39     * @brief Constructor.
40     */
41     ListItem();
42
43 /******************************************************************************
44 * MEMBER FUNCTIONS AND SLOTS
45 ******************************************************************************/
46     /**
47     * @brief Returns item's ID.
48     *
49     * @return item's ID
50     */
51     virtual QString id() const = 0;
52
53     /**
54     * @brief Returns item's image.
55     *
56     * @return image's pixmap
57     */
58     QPixmap image() const;
59
60     /**
61     * @brief Returns item's name.
62     *
63     * @return item's name
64     */
65     QString name() const;
66
67     /**
68     * @brief Sets item's image.
69     *
70     * @param image QPixmap
71     */
72     void setImage(const QPixmap &image);
73
74     /**
75     * @brief Sets item's name.
76     *
77     * @param name item's name
78     */
79     void setName(const QString &name);
80
81     /**
82     * @brief Sets item selected.
83     *
84     * @param selected true if selected, false otherwise
85     */
86     virtual void setSelected(bool selected) = 0;
87
88     /**
89     * @brief Toggles selection.
90     *
91     * @return true if selection was toggled, false otherwise
92     */
93     virtual bool toggleSelection() = 0;
94
95     /**
96     * @brief Returns item's coordinates.
97     *
98     * @return item's coordinates
99     */
100     virtual QPointF coordinates() = 0;
101
102 /*******************************************************************************
103  * DATA MEMBERS
104  ******************************************************************************/
105 private:
106     QPixmap m_image;    ///< Item's image
107     QString m_name;     ///< Item's name
108 };
109
110 #endif // LISTITEM_H