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-2006 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 #include <klistview.h>
00027 
00028 #define KPROPEDITOR_ITEM_MARGIN 2
00029 #define KPROPEDITOR_ITEM_BORDER_COLOR QColor(200,200,200) 
00030 
00031 template<class U> class QAsciiDict;
00032 class QLabel;
00033 
00034 namespace KoProperty {
00035 
00036 class EditorItemPrivate;
00037 class Property;
00038 class Editor;
00039 class GroupWidget;
00040 
00047 class EditorItem : public KListViewItem
00048 {
00049     public:
00050         typedef QAsciiDict<EditorItem> Dict;
00051 
00055         EditorItem(Editor *editor, EditorItem *parent, Property *property,
00056             QListViewItem *after=0);
00057 
00059         EditorItem(KListView *parent);
00060         EditorItem(EditorItem *parent, const QString &text);
00061         EditorItem(EditorItem *parent, EditorItem *after, const QString &text);
00062 
00063         virtual ~EditorItem();
00064 
00066         Property* property();
00067 
00068     protected:
00072         virtual void paintCell(QPainter *p, const QColorGroup & cg, int column, int width, int align);
00073 
00077         virtual void paintBranches(QPainter *p, const QColorGroup &cg, int w, int y, int h);
00078 
00079         virtual void paintFocus(QPainter * p, const QColorGroup & cg, const QRect & r);
00080 
00081         virtual int compare( QListViewItem *i, int col, bool ascending ) const;
00082 
00083         virtual void setHeight( int height );
00084 
00085     protected:
00086         EditorItemPrivate *d;
00087 };
00088 
00090 class EditorGroupItem : public EditorItem
00091 {
00092     public:
00093         EditorGroupItem(EditorItem *parent, EditorItem *after, const QString &text, 
00094             const QString &icon, int sortOrder);
00095         EditorGroupItem(EditorItem *parent, const QString &text, 
00096             const QString &icon, int sortOrder);
00097         virtual ~EditorGroupItem();
00098 
00099 //      void  setLabel(QLabel *label) { m_label = label; }
00100         QWidget*  label() const;
00101 
00102     protected:
00103         virtual void init(const QString &icon);
00104 
00106         virtual void paintCell(QPainter *p, const QColorGroup & cg, int column, int width, int align);
00107         virtual void setup();
00108         virtual int compare( QListViewItem *i, int col, bool ascending ) const;
00109 
00110         GroupWidget *m_label;
00111         int m_sortOrder;
00112 };
00113 
00115 class EditorDummyItem : public EditorItem
00116 {
00117     public:
00118         EditorDummyItem(KListView *parent);
00119         virtual ~EditorDummyItem();
00120 
00121     protected:
00122         virtual void setup();
00123         /*virtual void paintCell(QPainter *p, const QColorGroup & cg, int column, int width, int align);
00124         virtual void paintFocus(QPainter * p, const QColorGroup & cg, const QRect & r);*/
00125 };
00126 
00127 }
00128 
00129 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys