00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef KPROPERTY_PROPERTYEDITOR_H
00023 #define KPROPERTY_PROPERTYEDITOR_H
00024
00025 #include <QPointer>
00026
00027 #include <QMouseEvent>
00028 #include <QResizeEvent>
00029 #include <QKeyEvent>
00030 #include <QEvent>
00031 #include <QByteArray>
00032 #include "koproperty_global.h"
00033
00034 #include <k3listview.h>
00035
00036 class QSize;
00037
00038 namespace KoProperty {
00039
00040 class EditorPrivate;
00041 class Property;
00042 class Set;
00043 class Widget;
00044 class EditorItem;
00045
00047
00068 class KOPROPERTY_EXPORT Editor : public K3ListView
00069 {
00070 Q_OBJECT
00071
00072 public:
00080 Editor(QWidget *parent=0, bool autoSync=true, const char *name=0);
00081
00082 virtual ~Editor();
00083
00084 virtual QSize sizeHint() const;
00085 virtual void setFocus();
00086 virtual void setSorting( int column, bool ascending = true );
00087
00088 public slots:
00093 void changeSet(Set *set, bool preservePrevSelection = false);
00094
00099 void changeSet(Set *set, const QByteArray& propertyToSelect);
00100
00105 void clear(bool editorOnly = false);
00106
00108 void acceptInput();
00109
00110 signals:
00112 void propertySetChanged(KoProperty::Set *set);
00113
00114 protected slots:
00116 void slotPropertyChanged(KoProperty::Set& set, KoProperty::Property& property);
00117
00118 void slotPropertyReset(KoProperty::Set& set, KoProperty::Property& property);
00119
00121 void slotWidgetValueChanged(Widget* widget);
00122
00125 void slotWidgetAcceptInput(Widget *widget);
00126
00128 void slotWidgetRejectInput(Widget *widget);
00129
00131 void slotSetWillBeCleared();
00132
00134 void slotSetWillBeDeleted();
00135
00139 void slotClicked(Q3ListViewItem *item);
00140
00142 void undo();
00143
00144 void updateEditorGeometry(bool forceUndoButtonSettings = false, bool undoButtonVisible = false);
00145 void updateEditorGeometry(EditorItem *item, Widget* widget, bool forceUndoButtonSettings = false, bool undoButtonVisible = false);
00146 void updateGroupLabelsPosition();
00147
00148 void hideEditor();
00149
00150 void slotCollapsed(Q3ListViewItem *item);
00151 void slotExpanded(Q3ListViewItem *item);
00152 void slotColumnSizeChanged(int section);
00153 void slotColumnSizeChanged(int section, int oldSize, int newSize);
00154 void slotCurrentChanged(Q3ListViewItem *item);
00155 void changeSetLater();
00156 void selectItemLater();
00157 protected:
00161 Widget *createWidgetForProperty(Property *property, bool changeWidgetProperty=true);
00162
00164 void clearWidgetCache();
00165
00166 void fill();
00167 void addItem(const QByteArray &name, EditorItem *parent);
00168
00169 void showUndoButton( bool show );
00170
00171 virtual void resizeEvent(QResizeEvent *ev);
00172 virtual bool eventFilter( QObject * watched, QEvent * e );
00173 bool handleKeyPress(QKeyEvent* ev);
00174
00175 virtual bool event( QEvent * e );
00176 void updateFont();
00177
00178 virtual void contentsMousePressEvent( QMouseEvent * e );
00179
00181 void changeSetInternal(Set *set, bool preservePrevSelection,
00182 const QByteArray& propertyToSelect);
00183
00184 private:
00185 EditorPrivate *d;
00186
00187 friend class EditorItem;
00188 friend class Widget;
00189 };
00190
00191 }
00192
00193 #endif