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-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_PROPERTYEDITOR_H
00023 #define KPROPERTY_PROPERTYEDITOR_H
00024 
00025 #include <qguardedptr.h>
00026 #include "koproperty_global.h"
00027 
00028 #include <klistview.h>
00029 
00030 class QSize;
00031 
00032 namespace KoProperty {
00033 
00034 class EditorPrivate;
00035 class Property;
00036 class Set;
00037 class Widget;
00038 class EditorItem;
00039 
00040 
00063 class KOPROPERTY_EXPORT Editor : public KListView
00064 {
00065     Q_OBJECT
00066 
00067     public:
00075         Editor(QWidget *parent=0, bool autoSync=true, const char *name=0);
00076 
00077         virtual ~Editor();
00078 
00079         virtual QSize sizeHint() const;
00080         virtual void setFocus();
00081         virtual void setSorting( int column, bool ascending = true );
00082 
00083     public slots:
00088         void changeSet(Set *set, bool preservePrevSelection = false);
00089 
00094         void changeSet(Set *set, const QCString& propertyToSelect);
00095 
00100         void clear(bool editorOnly = false);
00101 
00103         void acceptInput();
00104 
00105     signals:
00107         void propertySetChanged(KoProperty::Set *set);
00108 
00109     protected slots:
00111         void slotPropertyChanged(KoProperty::Set& set, KoProperty::Property& property);
00112 
00113         void slotPropertyReset(KoProperty::Set& set, KoProperty::Property& property);
00114 
00116         void slotWidgetValueChanged(Widget* widget);
00117 
00120         void slotWidgetAcceptInput(Widget *widget);
00121 
00123         void slotWidgetRejectInput(Widget *widget);
00124 
00126         void slotSetWillBeCleared();
00127 
00129         void slotSetWillBeDeleted();
00130 
00134         void slotClicked(QListViewItem *item);
00135 
00137         void undo();
00138 
00139         void updateEditorGeometry(bool forceUndoButtonSettings = false, bool undoButtonVisible = false);
00140         void updateEditorGeometry(EditorItem *item, Widget* widget, bool forceUndoButtonSettings = false, bool undoButtonVisible = false);
00141         void updateGroupLabelsPosition();
00142 
00143         void hideEditor();
00144 
00145         void slotCollapsed(QListViewItem *item);
00146         void slotExpanded(QListViewItem *item);
00147         void slotColumnSizeChanged(int section);
00148         void slotColumnSizeChanged(int section, int oldSize, int newSize);
00149         void slotCurrentChanged(QListViewItem *item);
00150         void changeSetLater();
00151         void selectItemLater();
00152     protected:
00156         Widget *createWidgetForProperty(Property *property, bool changeWidgetProperty=true);
00157 
00159         void clearWidgetCache();
00160 
00161         void fill();
00162         void addItem(const QCString &name, EditorItem *parent);
00163 
00164         void showUndoButton( bool show );
00165 
00166         virtual void resizeEvent(QResizeEvent *ev);
00167         virtual bool eventFilter( QObject * watched, QEvent * e );
00168         bool handleKeyPress(QKeyEvent* ev);
00169 
00170         virtual bool event( QEvent * e );
00171         void updateFont();
00172 
00173         virtual void contentsMousePressEvent( QMouseEvent * e );
00174 
00176         void changeSetInternal(Set *set, bool preservePrevSelection, 
00177             const QCString& propertyToSelect);
00178 
00179     private:
00180         EditorPrivate *d;
00181 
00182     friend class EditorItem;
00183     friend class Widget;
00184 };
00185 
00186 }
00187 
00188 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys