kalarm Library API Documentation

alarmlistview.h

00001 /*
00002  *  alarmlistview.h  -  widget showing list of outstanding alarms
00003  *  Program:  kalarm
00004  *  (C) 2001, 2002 by David Jarvie  software@astrojar.org.uk
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019  */
00020 
00021 #ifndef ALARMLISTVIEW_H
00022 #define ALARMLISTVIEW_H
00023 
00024 #include "kalarm.h"
00025 
00026 #include <qmap.h>
00027 #include <klistview.h>
00028 
00029 #include "msgevent.h"
00030 using namespace KCal;
00031 
00032 
00033 class AlarmListViewItem;
00034 struct AlarmItemData
00035 {
00036                 KAlarmEvent event;
00037                 QString     messageText;       // message as displayed
00038                 QString     dateTimeText;      // date/time as displayed
00039                 QString     repeatText;        // repeat interval/type as displayed
00040                 int         messageWidth;      // width required to display 'messageText'
00041 };
00042 
00043 
00044 class AlarmListView : public KListView
00045 {
00046                 Q_OBJECT
00047         public:
00048                 enum { TIME_COLUMN, REPEAT_COLUMN, COLOUR_COLUMN, MESSAGE_COLUMN };
00049 
00050                 AlarmListView(QWidget* parent = 0L, const char* name = 0L);
00051                 virtual void         clear();
00052                 void                 refresh();
00053                 AlarmListViewItem*   addEntry(const KAlarmEvent&, bool setSize = false);
00054                 AlarmListViewItem*   updateEntry(AlarmListViewItem*, const KAlarmEvent& newEvent, bool setSize = false);
00055                 void                 deleteEntry(AlarmListViewItem*, bool setSize = false);
00056                 const KAlarmEvent    getEntry(AlarmListViewItem* item) const    { return getData(item)->event; }
00057                 AlarmListViewItem*   getEntry(const QString& eventID);
00058                 const AlarmItemData* getData(AlarmListViewItem*) const;
00059                 void                 resizeLastColumn();
00060                 int                  itemHeight();
00061                 bool                 drawMessageInColour() const                    { return drawMessageInColour_; }
00062                 void                 setDrawMessageInColour(bool inColour)      { drawMessageInColour_ = inColour; }
00063                 AlarmListViewItem*   selectedItem() const       { return (AlarmListViewItem*)KListView::selectedItem(); }
00064                 AlarmListViewItem*   currentItem() const        { return (AlarmListViewItem*)KListView::currentItem(); }
00065         signals:
00066                 void                 itemDeleted();
00067         private:
00068                 typedef QMap<AlarmListViewItem*, AlarmItemData> EntryMap;
00069                 EntryMap             entries;
00070                 int                  lastColumnHeaderWidth_;
00071                 bool                 drawMessageInColour_;
00072 };
00073 
00074 
00075 class AlarmListViewItem : public QListViewItem
00076 {
00077         public:
00078                 AlarmListViewItem(QListView* parent, const QString&, const QString&);
00079                 virtual void         paintCell(QPainter*, const QColorGroup&, int column, int width, int align);
00080                 AlarmListView*       alarmListView() const              { return (AlarmListView*)listView(); }
00081         private:
00082                 static QPixmap*      textIcon;
00083                 static QPixmap*      fileIcon;
00084                 static QPixmap*      commandIcon;
00085 };
00086 
00087 #endif // ALARMLISTVIEW_H
00088 
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sat Oct 18 02:47:26 2003 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001