2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Jussi Laitinen - jussi.laitinen@ixonos.com
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.
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.
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,
25 #include <QListWidgetItem>
28 * @brief Base class for list items.
30 * Stores item's name and image and includes method to shorten texts.
32 * @author Jussi Laitinen - jussi.laitinen (at) ixonos.com
34 class ListItem : public QListWidgetItem
44 * @brief Defines text size.
46 enum TextSize{TEXT_SIZE_NORMAL, TEXT_SIZE_SMALL};
48 /******************************************************************************
49 * MEMBER FUNCTIONS AND SLOTS
50 ******************************************************************************/
52 * @brief Returns item's title.
54 * @return item's title
56 QString title() const;
59 * @brief Sets item's image.
61 * @param image QPixmap
63 void setImage(const QPixmap &image);
66 * @brief Sets item's title.
68 * @param name item's title
70 void setTitle(const QString &name);
73 * @brief Sets item selected.
75 * @param selected true if selected, false otherwise
77 virtual void setSelected(bool selected) = 0;
80 * @brief Sets item size.
82 * @param size item size
84 void setSize(const QSize &size);
87 * @brief Shortens text defined by text width.
89 * @param text text to be shortened
90 * @param textWidth the width the text can use
91 * @param textSize which text size to use
92 * @return shortened text
94 QString shortenText(const QString &text, int textWidth, TextSize textSize);
97 * @brief Toggles selection.
99 * @return true if selection was toggled, false otherwise
101 virtual bool toggleSelection() = 0;
103 /*******************************************************************************
105 ******************************************************************************/
107 QPixmap m_image; ///< Item's image
108 QString m_name; ///< Item's name