| 1 | /* |
|---|
| 2 | * This file is part of Licq, an instant messaging client for UNIX. |
|---|
| 3 | * Copyright (C) 1999-2006 Licq developers |
|---|
| 4 | * |
|---|
| 5 | * Licq is free software; you can redistribute it and/or modify |
|---|
| 6 | * it under the terms of the GNU General Public License as published by |
|---|
| 7 | * the Free Software Foundation; either version 2 of the License, or |
|---|
| 8 | * (at your option) any later version. |
|---|
| 9 | * |
|---|
| 10 | * Licq is distributed in the hope that it will be useful, |
|---|
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | * GNU General Public License for more details. |
|---|
| 14 | * |
|---|
| 15 | * You should have received a copy of the GNU General Public License |
|---|
| 16 | * along with Licq; if not, write to the Free Software |
|---|
| 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|---|
| 18 | */ |
|---|
| 19 | |
|---|
| 20 | #ifndef MESSAGELIST_H |
|---|
| 21 | #define MESSAGELIST_H |
|---|
| 22 | |
|---|
| 23 | #include <QTreeWidget> |
|---|
| 24 | |
|---|
| 25 | class QTextCodec; |
|---|
| 26 | |
|---|
| 27 | class CUserEvent; |
|---|
| 28 | |
|---|
| 29 | namespace LicqQtGui |
|---|
| 30 | { |
|---|
| 31 | class MessageListItem : public QTreeWidgetItem |
|---|
| 32 | { |
|---|
| 33 | public: |
|---|
| 34 | MessageListItem(const CUserEvent* theMsg, QTextCodec* codec, QTreeWidget* parent); |
|---|
| 35 | ~MessageListItem(void); |
|---|
| 36 | void MarkRead(); |
|---|
| 37 | void SetEventLine(); |
|---|
| 38 | |
|---|
| 39 | CUserEvent* msg() { return myMsg; } |
|---|
| 40 | bool isUnread() const { return myUnread; } |
|---|
| 41 | |
|---|
| 42 | private: |
|---|
| 43 | bool myUnread; |
|---|
| 44 | CUserEvent* myMsg; |
|---|
| 45 | QTextCodec* myCodec; |
|---|
| 46 | }; |
|---|
| 47 | |
|---|
| 48 | class MessageList : public QTreeWidget |
|---|
| 49 | { |
|---|
| 50 | Q_OBJECT |
|---|
| 51 | public: |
|---|
| 52 | MessageList (QWidget* parent = 0); |
|---|
| 53 | CUserEvent* currentMsg(); |
|---|
| 54 | QSize sizeHint() const; |
|---|
| 55 | int getNumUnread() const; |
|---|
| 56 | MessageListItem* getNextUnread(); |
|---|
| 57 | |
|---|
| 58 | signals: |
|---|
| 59 | void sizeChange(int, int, int); |
|---|
| 60 | |
|---|
| 61 | private: |
|---|
| 62 | virtual void resizeEvent(QResizeEvent* e); |
|---|
| 63 | virtual bool event(QEvent* event); |
|---|
| 64 | void drawRow(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const; |
|---|
| 65 | void SetEventLines(); |
|---|
| 66 | }; |
|---|
| 67 | |
|---|
| 68 | } // namespace LicqQtGui |
|---|
| 69 | |
|---|
| 70 | #endif |
|---|