propertyeditor.h
Go to the documentation of this file.00001 /*************************************************************************** 00002 * Copyright (C) 2002-2004 by Alexander Dymo * 00003 * cloudtemple@mskat.net * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU Library General Public License as * 00007 * published by the Free Software Foundation; either version 2 of the * 00008 * License, or (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU Library General Public * 00016 * License along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 #ifndef PROPERTYEDITOR_H 00021 #define PROPERTYEDITOR_H 00022 00023 #include <klistview.h> 00024 00025 #include "propertylist.h" 00026 00027 class QPushButton; 00028 class QGridLayout; 00029 00030 namespace PropertyLib{ 00031 00032 class PropertyItem; 00033 class PropertyGroupItem; 00034 class PropertyWidget; 00035 class Property; 00036 class MultiProperty; 00037 struct Machine; 00038 00052 class PropertyEditor: public KListView{ 00053 Q_OBJECT 00054 public: 00056 PropertyEditor(QWidget *parent = 0, const char *name = 0); 00057 ~PropertyEditor(); 00058 00062 Machine *machine(MultiProperty *property); 00063 00064 public slots: 00066 void populateProperties(PropertyList *list); 00068 void clearProperties(); 00070 void clearMachineCache(); 00071 00072 protected slots: 00074 void propertyValueChanged(Property* property); 00076 void propertyChanged(MultiProperty *property, const QVariant &value); 00077 00079 void slotClicked(QListViewItem* item); 00080 void updateEditorSize(); 00081 00083 void undo(); 00084 00085 protected: 00086 void editItem(QListViewItem*, int); 00087 void hideEditor(); 00088 void showEditor(PropertyItem *item); 00089 void placeEditor(PropertyItem *item); 00090 PropertyWidget *prepareEditor(PropertyItem *item); 00091 00092 void addGroup(const QString &name); 00093 void addProperty(PropertyGroupItem *group, const QString &name); 00094 void addProperty(const QString &name); 00095 void addChildProperties(PropertyItem *parent); 00096 00097 private: 00098 PropertyList *m_list; 00099 PropertyList m_detailedList; 00100 00101 //machines cache for property types, machines will be deleted 00102 QMap<int, Machine* > m_registeredForType; 00103 00104 PropertyItem *m_currentEditItem; 00105 PropertyWidget *m_currentEditWidget; 00106 QWidget *m_currentEditArea; 00107 QGridLayout *m_currentEditLayout; 00108 00109 bool m_doubleClickForEdit; 00110 QListViewItem* m_lastClickedItem; 00111 00112 QPushButton *m_undoButton; 00113 00114 friend class PropertyItem; 00115 }; 00116 00117 } 00118 00119 #endif