Applets
notifierview.h
Go to the documentation of this file.00001 /* Copyright 2007 by Alexis Ménard <darktears31@gmail.com> 00002 00003 This library is free software; you can redistribute it and/or 00004 modify it under the terms of the GNU Library General Public 00005 License as published by the Free Software Foundation; either 00006 version 2 of the License, or (at your option) any later version. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 */ 00018 #ifndef NOTIFIERVIEW_H 00019 #define NOTIFIERVIEW_H 00020 00021 // Qt 00022 #include <QTreeView> 00023 00024 class QModelIndex; 00025 00026 namespace Notifier 00027 { 00032 class NotifierView : public QTreeView 00033 { 00034 Q_OBJECT 00035 00036 public: 00041 NotifierView(QWidget *parent = 0); 00042 00046 virtual ~NotifierView(); 00047 00051 void calculateRects(); 00052 00053 protected: 00058 void resizeEvent(QResizeEvent * event); 00059 00064 void mouseMoveEvent(QMouseEvent *event); 00065 00070 void mousePressEvent(QMouseEvent *event); 00071 00076 void leaveEvent(QEvent *event); 00077 00082 QModelIndex moveCursor(CursorAction cursorAction,Qt::KeyboardModifiers ); 00083 00088 void paintEvent(QPaintEvent *event); 00089 00096 void paintHeaderItem(QPainter &painter,const QRect &itemRect,const QModelIndex &index); 00097 00104 void paintItem(QPainter &painter,const QRect &itemRect,const QModelIndex &index); 00105 00111 QModelIndex indexAt(const QPoint& point) const; 00112 00113 static const int HEADER_LEFT_MARGIN = 5; 00114 static const int HEADER_TOP_MARGIN = 5; 00115 static const int HEADER_HEIGHT = 35; 00116 static const int COLUMN_EJECT_MARGIN = 5; 00117 static const int COLUMN_EJECT_SIZE = 50; 00118 static const int TOP_OFFSET = 5; 00119 00120 private: 00122 QPersistentModelIndex m_hoveredIndex; 00123 QHash<QModelIndex,QRect> itemRects; 00124 }; 00125 00126 } 00127 #endif // NOTIFIERVIEW_H