kpilot Library API Documentation

listCat.h

00001 #ifndef LISTCAT_H 00002 #define LISTCAT_H 00003 /* listCat.h KPilot 00004 ** 00005 ** Copyright (C) 2000-2001 by Adriaan de Groot 00006 ** 00007 ** This is a specialization of KListView to allow the user to 00008 ** DnD a fixed set of objects into a fixed set of categories 00009 ** (categories set at construction time). 00010 */ 00011 00012 /* 00013 ** This program is free software; you can redistribute it and/or modify 00014 ** it under the terms of the GNU General Public License as published by 00015 ** the Free Software Foundation; either version 2 of the License, or 00016 ** (at your option) any later version. 00017 ** 00018 ** This program is distributed in the hope that it will be useful, 00019 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00021 ** GNU General Public License for more details. 00022 ** 00023 ** You should have received a copy of the GNU General Public License 00024 ** along with this program in a file called COPYING; if not, write to 00025 ** the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 00026 ** MA 02111-1307, USA. 00027 */ 00028 00029 /* 00030 ** Bug reports and questions can be sent to kde-pim@kde.org 00031 */ 00032 00033 #include <qstringlist.h> 00034 #include <qlistview.h> 00035 00036 #include <klistview.h> 00037 00062 class ListCategorizer : public KListView 00063 { 00064 Q_OBJECT 00065 00066 public: 00074 ListCategorizer(QWidget *parent, 00075 const char *name = 0); 00083 ListCategorizer(const QStringList& categories, 00084 bool startOpen, 00085 QWidget *parent, 00086 const char *name = 0); 00087 00093 void addCategories(const QStringList&); 00103 QListViewItem *addCategory(const QString& name, 00104 const QString& description = QString::null); 00109 QStringList categories() const 00110 { 00111 return listSiblings(firstChild()); 00112 } ; 00113 00122 QListViewItem *addItem(const QString& category, 00123 const QString& name, 00124 const QString& description = QString::null); 00133 QStringList items(const QString& category,int column=0) const 00134 { 00135 return listSiblings(findCategory(category),column); 00136 } 00137 00144 QListViewItem *findCategory(const QString& categoryName) const; 00155 QStringList listSiblings(const QListViewItem *p,int column=0) const; 00156 00163 bool startOpen() const { return fStartOpen; } ; 00169 void setStartOpen(bool b) { fStartOpen=b; } ; 00170 00171 protected: 00175 virtual bool acceptDrag (QDropEvent* event) const; 00179 virtual void startDrag(); 00183 virtual void contentsDropEvent (QDropEvent*); 00184 00185 00186 00187 private: 00192 void setupWidget(); 00193 00194 bool fStartOpen:1; 00195 } ; 00196 00197 00198 class RichListViewItem : public QListViewItem 00199 { 00200 public: 00201 RichListViewItem(QListViewItem *parent, 00202 QString, 00203 int); 00204 virtual ~RichListViewItem(); 00205 00206 virtual void paintCell(QPainter *, 00207 const QColorGroup &, 00208 int column, 00209 int width, 00210 int alignment); 00211 00212 virtual void setup(); 00213 00214 bool isRich(int c) const { return fIsRich[c]; } ; 00215 void setRich(int c,bool b) { fIsRich[c]=b; } ; 00216 00217 protected: 00218 void computeHeight(int c); 00219 00220 protected: 00221 bool *fIsRich; 00222 QRect *fRect; 00223 int fColumns; 00224 00225 } ; 00226 00227 #endif
KDE Logo
This file is part of the documentation for kpilot Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jul 28 23:57:49 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003