multiproperty.h
Go to the documentation of this file.00001 /*************************************************************************** 00002 * Copyright (C) 2004 by Alexander Dymo <cloudtemple@mskat.net> * 00003 * * 00004 * This program is free software; you can redistribute it and/or modify * 00005 * it under the terms of the GNU Library General Public License as * 00006 * published by the Free Software Foundation; either version 2 of the * 00007 * License, or (at your option) any later version. * 00008 * * 00009 * This program is distributed in the hope that it will be useful, * 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00012 * GNU General Public License for more details. * 00013 * * 00014 * You should have received a copy of the GNU Library General Public * 00015 * License along with this program; if not, write to the * 00016 * Free Software Foundation, Inc., * 00017 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00018 ***************************************************************************/ 00019 #ifndef MULTIPROPERTY_H 00020 #define MULTIPROPERTY_H 00021 00022 #include <qptrlist.h> 00023 #include <qmap.h> 00024 #include <qvariant.h> 00025 00026 #include "property.h" 00027 #include "childproperty.h" 00028 00029 namespace PropertyLib{ 00030 00031 class PropertyList; 00032 00049 class MultiProperty 00050 { 00051 public: 00053 MultiProperty(Property *prop); 00055 MultiProperty(PropertyList *propertyList); 00057 MultiProperty(PropertyList *propertyList, Property *prop); 00058 ~MultiProperty(); 00059 00061 bool operator ==(const MultiProperty &prop) const; 00063 bool operator ==(const Property &prop) const; 00064 00066 void addProperty(Property *prop); 00068 void removeProperty(Property *prop); 00070 void addProperty(MultiProperty *prop); 00072 void removeProperty(MultiProperty *prop); 00073 00075 QString name() const; 00077 int type() const; 00079 QVariant value() const; 00081 QString description() const; 00083 bool readOnly() const; 00085 bool visible() const; 00087 QMap<QString, QVariant> valueList() const; 00088 00090 void setValue(const QVariant& value); 00094 void setValue(const QVariant& value, bool emitChange); 00096 void setDescription(const QString &description); 00098 void setValueList(const QMap< QString, QVariant >& valueList); 00099 00101 QVariant findValueDescription() const; 00103 QVariant findValueDescription(QVariant val) const; 00104 00106 bool valid() const; 00107 00109 void undo(); 00110 00112 QValueList<ChildProperty> details; 00113 00114 private: 00115 QPtrList<Property> list; 00116 00117 PropertyList *m_propertyList; 00118 00119 friend class PropertyList; 00120 friend class PropertyBuffer; 00121 }; 00122 00123 } 00124 00125 #endif