lib

editor.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_PROPERTYEDITOR_H
00023 #define KPROPERTY_PROPERTYEDITOR_H
00024 
00025 #include <qguardedptr.h>
00026 #include "koproperty_global.h"
00027 
00028 #ifdef QT_ONLY
00029 #include <qlistview.h>
00030 #else
00031 #include <klistview.h>
00032 //#define QListView KListView
00033 #endif
00034 
00035 class QSize;
00036 
00037 namespace KoProperty {
00038 
00039 class EditorPrivate;
00040 class Property;
00041 class Set;
00042 class Widget;
00043 class EditorItem;
00044 
00046 
00061 class KOPROPERTY_EXPORT Editor : public KListView
00062 {
00063     Q_OBJECT
00064 
00065     public:
00073         Editor(QWidget *parent=0, bool autoSync=true, const char *name=0);
00074 
00075         virtual ~Editor();
00076 
00077         virtual QSize sizeHint() const;
00078         virtual void setFocus();
00079 
00080     public slots:
00084         void changeSet(Set *set, bool preservePrevSelection=false);
00085 
00090         void clear(bool editorOnly = false);
00091 
00093         void acceptInput();
00094 
00095     signals:
00097         void propertySetChanged(KoProperty::Set *set);
00098 
00099     protected slots:
00101         void slotPropertyChanged(KoProperty::Set& set, KoProperty::Property& property);
00102 
00103         void slotPropertyReset(KoProperty::Set& set, KoProperty::Property& property);
00104 
00106         void slotWidgetValueChanged(Widget* widget);
00107 
00110         void slotWidgetAcceptInput(Widget *widget);
00111 
00113         void slotWidgetRejectInput(Widget *widget);
00114 
00116         void slotSetWillBeCleared();
00117 
00119         void slotSetWillBeDeleted();
00120 
00124         void slotClicked(QListViewItem *item);
00125 
00127         void undo();
00128 
00129         void updateEditorGeometry(bool forceUndoButtonSettings = false, bool undoButtonVisible = false);
00130         void updateEditorGeometry(EditorItem *item, Widget* widget, bool forceUndoButtonSettings = false, bool undoButtonVisible = false);
00131 
00132         void hideEditor();
00133 
00134         void slotCollapsed(QListViewItem *item);
00135         void slotExpanded(QListViewItem *item);
00136         void slotColumnSizeChanged(int section);
00137         void slotColumnSizeChanged(int section, int oldSize, int newSize);
00138         void slotCurrentChanged(QListViewItem *item);
00139         void changeSetLater();
00140         void selectItemLater();
00141     protected:
00145         Widget *createWidgetForProperty(Property *property, bool changeWidgetProperty=true);
00146 
00148         void clearWidgetCache();
00149 
00150         void fill();
00151         void addItem(const QCString &name, EditorItem *parent);
00152 
00153         void showUndoButton( bool show );
00154 
00155         virtual void resizeEvent(QResizeEvent *ev);
00156         virtual bool eventFilter( QObject * watched, QEvent * e );
00157         bool handleKeyPress(QKeyEvent* ev);
00158 
00159         virtual bool event( QEvent * e );
00160         void updateFont();
00161 
00162         virtual void contentsMousePressEvent( QMouseEvent * e );
00163 
00164     private:
00165         EditorPrivate *d;
00166 
00167     friend class EditorItem;
00168     friend class Widget;
00169 };
00170 
00171 }
00172 
00173 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys