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,
23 #ifndef EXTENDEDLISTITEM_H
24 #define EXTENDEDLISTITEM_H
28 class ExtendedListItemStore;
31 * @brief Base class for extended list items.
33 * @author Jussi Laitinen - jussi.laitinen (at) ixonos.com
35 class ExtendedListItem : public ListItem
41 * Sets item size and creates sub item store list.
48 * Deletes sub item stores and sub item store list.
50 virtual ~ExtendedListItem();
52 /*******************************************************************************
53 * MEMBER FUNCTIONS AND SLOTS
54 ******************************************************************************/
57 * @brief Adds sub item.
59 * Sub item area is defined by sub item text width.
60 * @param text sub item text
61 * @param icon sub item icon, optional
63 void addSubItem(const QString &text, const QPixmap &icon = QPixmap());
66 * @brief Clears sub items.
68 * Clears sub items' list and deletes items. Sets item default and
69 * extended height to default values.
74 * @brief Sets item selected.
76 * @param selected true if selected, false otherwise
78 void setSelected(bool selected);
81 * @brief Sets sub items' text width.
83 * @param width sub item width
85 void setSubitemTextWidth(int width);
88 * @brief Toggles selection.
90 * @return true if selection was toggled, false otherwise
92 bool toggleSelection();
96 * @brief Returns text's bounding rect.
98 * Takes into account line breaks in text.
100 * @param text text which rect is calculated
102 QRect boundingRect(const QString &text);
105 * @brief Calculates text rects.
107 * Rect width is defined by sub item text width.
108 * @param text text which rect is calculated
111 QRect calculateExpandedTextRect(const QString &text);
113 /******************************************************************************
115 ******************************************************************************/
117 bool m_selected; ///< Selected flag
118 int m_expandedHeight; ///< Item expanded height
119 int m_normalHeight; ///< Item normal height
120 int m_subItemTextWidth; ///< Sub items' text wdith
122 QList<ExtendedListItemStore *> *m_subItemStoreList; ///< ExtendedListItemStore list
125 #endif // EXTENDEDLISTITEM_H