lib

editoritem.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>
00003    Copyright (C) 2004 Alexander Dymo <cloudtemple@mskat.net>
00004    Copyright (C) 2004-2005 Jaroslaw Staniek <js@iidea.pl>
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public
00008    License as published by the Free Software Foundation; either
00009    version 2 of the License, or (at your option) any later version.
00010 
00011    This library 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 GNU
00014    Library General Public License for more details.
00015 
00016    You should have received a copy of the GNU Library General Public License
00017    along with this library; see the file COPYING.LIB.  If not, write to
00018    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019  * Boston, MA 02110-1301, USA.
00020 */
00021 
00022 #ifndef KPROPERTY_PROPERTYEDITORITEM_H
00023 #define KPROPERTY_PROPERTYEDITORITEM_H
00024 
00025 #include "koproperty_global.h"
00026 #ifdef QT_ONLY
00027 #include <qlistview.h>
00028 #else
00029 #include <klistview.h>
00030 //#define KListViewItem QListViewItem
00031 #endif
00032 
00033 #define KPROPEDITOR_ITEM_MARGIN 2
00034 #define KPROPEDITOR_ITEM_BORDER_COLOR QColor(200,200,200) 
00035 
00036 template<class U> class QAsciiDict;
00037 
00038 
00039 namespace KoProperty {
00040 
00041 class EditorItemPrivate;
00042 class Property;
00043 class Editor;
00044 
00051 class EditorItem : public KListViewItem
00052 {
00053     public:
00054         typedef QAsciiDict<EditorItem> Dict;
00055 
00059         EditorItem(Editor *editor, EditorItem *parent, Property *property,
00060             QListViewItem *after=0);
00061 
00063         EditorItem(KListView *parent);
00064         EditorItem(EditorItem *parent, const QString &text);
00065 
00066         virtual ~EditorItem();
00067 
00069         Property* property();
00070 
00071     protected:
00075         virtual void paintCell(QPainter *p, const QColorGroup & cg, int column, int width, int align);
00076 
00080         virtual void paintBranches(QPainter *p, const QColorGroup &cg, int w, int y, int h);
00081 
00082         virtual void paintFocus(QPainter * p, const QColorGroup & cg, const QRect & r);
00083 
00084         virtual int compare( QListViewItem *i, int col, bool ascending ) const;
00085 
00086         virtual void setHeight( int height );
00087 
00088     protected:
00089         EditorItemPrivate *d;
00090 };
00091 
00093 class EditorGroupItem : public EditorItem
00094 {
00095     public:
00096         EditorGroupItem(EditorItem *parent, const QString &text);
00097         virtual ~EditorGroupItem();
00098 
00099     protected:
00101         virtual void paintCell(QPainter *p, const QColorGroup & cg, int column, int width, int align);
00102         virtual void setup();
00103 };
00104 
00106 class EditorDummyItem : public EditorItem
00107 {
00108     public:
00109         EditorDummyItem(KListView *parent);
00110         virtual ~EditorDummyItem();
00111 
00112     protected:
00113         virtual void setup();
00114         /*virtual void paintCell(QPainter *p, const QColorGroup & cg, int column, int width, int align);
00115         virtual void paintFocus(QPainter * p, const QColorGroup & cg, const QRect & r);*/
00116 };
00117 
00118 }
00119 
00120 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys