lib
customproperty.h
00001 /* This file is part of the KDE project 00002 Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library 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 GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 * Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef KPROPERTY_CUSTOMPROPERTY_H 00021 #define KPROPERTY_CUSTOMPROPERTY_H 00022 00023 #include "koproperty_global.h" 00024 00025 class QVariant; 00026 00027 namespace KoProperty { 00028 00029 class Property; 00030 00032 00040 class KOPROPERTY_EXPORT CustomProperty 00041 { 00042 public: 00043 CustomProperty(Property *parent); 00044 virtual ~CustomProperty(); 00045 00052 virtual void setValue(const QVariant &value, bool rememberOldValue) = 0; 00053 00057 virtual QVariant value() const = 0; 00058 00063 virtual bool handleValue() const { return false; } 00064 00065 protected: 00066 Property *m_property; 00067 00070 void emitPropertyChanged(); 00071 }; 00072 00074 class KOPROPERTY_EXPORT SizeCustomProperty : public CustomProperty 00075 { 00076 public: 00077 SizeCustomProperty(Property *parent); 00078 ~SizeCustomProperty(); 00079 00080 void setValue(const QVariant &value, bool rememberOldValue); 00081 QVariant value() const; 00082 bool handleValue() const; 00083 }; 00084 00086 class KOPROPERTY_EXPORT PointCustomProperty : public CustomProperty 00087 { 00088 public: 00089 PointCustomProperty(Property *parent); 00090 ~PointCustomProperty(); 00091 00092 void setValue(const QVariant &value, bool rememberOldValue); 00093 QVariant value() const; 00094 bool handleValue() const; 00095 }; 00096 00098 class KOPROPERTY_EXPORT RectCustomProperty : public CustomProperty 00099 { 00100 public: 00101 RectCustomProperty(Property *parent); 00102 ~RectCustomProperty(); 00103 00104 void setValue(const QVariant &value, bool rememberOldValue); 00105 QVariant value() const; 00106 bool handleValue() const; 00107 }; 00108 00110 class KOPROPERTY_EXPORT SizePolicyCustomProperty : public CustomProperty 00111 { 00112 public: 00113 SizePolicyCustomProperty(Property *parent); 00114 ~SizePolicyCustomProperty(); 00115 00116 void setValue(const QVariant &value, bool rememberOldValue); 00117 QVariant value() const; 00118 bool handleValue() const; 00119 }; 00120 00121 } 00122 00123 #endif