1 /* 2 * This file is part of Licq, an instant messaging client for UNIX. 3 * Copyright (C) 1999-2011 Licq developers <licq-dev@googlegroups.com> 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 26 namespace Licq 27 { 28 class UserEvent; 29 } 30 31 namespace LicqQtGui 32 { 33 class MessageListItem : public QTreeWidgetItem 34 { 35 public: 36 MessageListItem(const Licq::UserEvent* theMsg, QTreeWidget* parent); 37 ~MessageListItem(void); 38 void MarkRead(); 39 void SetEventLine(); 40 msg()41 Licq::UserEvent* msg() { return myMsg; } isUnread()42 bool isUnread() const { return myUnread; } 43 44 private: 45 bool myUnread; 46 Licq::UserEvent* myMsg; 47 }; 48 49 class MessageList : public QTreeWidget 50 { 51 Q_OBJECT 52 public: 53 MessageList (QWidget* parent = 0); 54 Licq::UserEvent* currentMsg(); 55 QSize sizeHint() const; 56 int getNumUnread() const; 57 MessageListItem* getNextUnread(); 58 59 signals: 60 void sizeChange(int, int, int); 61 62 private: 63 virtual void resizeEvent(QResizeEvent* e); 64 virtual bool event(QEvent* event); 65 void drawRow(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const; 66 void SetEventLines(); 67 }; 68 69 } // namespace LicqQtGui 70 71 #endif 72