KDevelop API Documentation

property.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2002-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 PROPERTY_H
00020 #define PROPERTY_H
00021 
00022 #include <qvariant.h>
00023 
00024 #include <qmap.h>
00025 
00026 class QWidget;
00027 class QString;
00028 
00029 namespace PropertyLib{
00030 
00061 class Property {
00062 public:
00065     enum PropertyType {
00066         //standard supported QVariant types
00067         Invalid = QVariant::Invalid        ,
00068         Map = QVariant::Map                ,
00069         List = QVariant::List              ,       
00070         String = QVariant::String          ,
00071         StringList = QVariant::StringList  ,
00072         Font = QVariant::Font              ,
00073         Pixmap = QVariant::Pixmap          ,
00074         //@todo implement QVariant::Brush
00075         Rect = QVariant::Rect              ,
00076         Size = QVariant::Size              ,
00077         Color = QVariant::Color            ,
00078         //@todo implement QVariant::Palette
00079         //@todo implement QVariant::ColorGroup
00080         //@todo implement QVariant::IconSet
00081         Point = QVariant::Point            ,
00082         //@todo implement QVariant::Image
00083         Integer = QVariant::Int            ,
00084         //@todo implement QVariant::UInt
00085         Boolean = QVariant::Bool           ,
00086         Double = QVariant::Double          ,
00087         //@todo implement QVariant::CString
00088         //@todo implement QVariant::PointArray
00089         //@todo implement QVariant::Region
00090         //@todo implement QVariant::Bitmap
00091         Cursor = QVariant::Cursor          ,
00092         SizePolicy = QVariant::SizePolicy  ,
00093         Date = QVariant::Date              ,
00094         //@todo implement QVariant::Time
00095         DateTime = QVariant::DateTime      ,
00096         //@todo implement QVariant::ByteArray
00097         //@todo implement QVariant::BitArray
00098         //@todo implement QVariant::KeySequence
00099         //@todo implement QVariant::Pen
00100         //@todo implement QVariant::Long
00101         //@todo implement QVariant::LongLong
00102         //@todo implement QVariant::ULongLong
00103         
00104 
00105         //predefined custom types
00106         ValueFromList = 2000               ,
00107         Symbol = 2001                      ,
00108         FontName = 2002                    ,
00109         FileURL = 2003                     ,
00110         DirectoryURL = 2004                ,
00111 
00112         UserDefined = 3000                 
00113     };
00114 
00116     Property() {}
00118     Property(int type, const QString &name, const QString &description,
00119         const QVariant &value = QVariant(), bool save = true, bool readOnly = false);
00121     Property(const QString &name, const QMap<QString, QVariant> &v_valueList,
00122         const QString &description, const QVariant &value = QVariant(), bool save = true, bool readOnly = false);
00123     virtual ~Property();
00124 
00125     virtual bool operator<(const Property &prop) const;
00126 
00128     virtual QString name() const;
00130     virtual void setName(const QString &name);
00132     virtual int type() const;
00134     virtual void setType(int type);
00136     virtual QVariant value() const;
00138     virtual void setValue(const QVariant &value, bool rememberOldValue = true);
00140     virtual QString description() const;
00142     virtual void setDescription(const QString &description);
00145     virtual void setValueList(const QMap<QString, QVariant> &list);
00147     QMap<QString, QVariant> valueList;
00148 
00152     virtual bool allowSaving() const;
00154     virtual bool readOnly() const;
00156     virtual bool visible() const;
00158     virtual void setVisible(const bool visible);
00159     
00161     virtual QVariant oldValue() const;
00162     
00163 private:
00164 //    Property(Property &property) {};
00165 //    void operator=(Property &property) {};
00166 
00167     int m_type;
00168     QString m_name;
00169     QString m_description;
00170     QVariant m_value;
00171     QVariant m_oldValue;
00172     bool m_save;
00173     bool m_readOnly;
00174     bool m_visible;
00175 };
00176 
00177 }
00178 
00179 #endif
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Feb 22 09:22:37 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003