kexi

widgetpropertyset.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>
00003    Copyright (C) 2004-2005 Jaroslaw Staniek <js@iidea.pl>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library 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 GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef KFD_WIDGETPROPERTYSET_H
00022 #define KFD_WIDGETPROPERTYSET_H
00023 
00024 #include <qobject.h>
00025 #include <qstrlist.h>
00026 
00027 #include <koproperty/set.h>
00028 #include <koproperty/property.h>
00029 
00030 class QMetaObject;
00031 class QWidget;
00032 
00033 namespace KFormDesigner {
00034 
00035 class FormManager;
00036 class ObjectTreeItem;
00037 class WidgetPropertySetPrivate;
00038 class WidgetInfo;
00039 class CommandGroup;
00040 
00041 class KFORMEDITOR_EXPORT WidgetPropertySet : public QObject
00042 {
00043     Q_OBJECT
00044 
00045     public:
00046         WidgetPropertySet(QObject *parent);
00047         ~WidgetPropertySet();
00048 
00049 //      FormManager* manager();
00050 
00051         KoProperty::Property&  operator[](const QCString &name);
00052 
00053         KoProperty::Property&  property(const QCString &name);
00054 
00055         bool  contains(const QCString &property);
00056 
00059         void  addPropertyCaption(const QCString &property, const QString &caption);
00060 
00061         void  addValueCaption(const QCString &value, const QString &caption);
00062 
00063     public slots:
00067         void setSelectedWidget(QWidget *w, bool add=false);
00068 
00071         void slotPropertyChanged(KoProperty::Set& set, KoProperty::Property& property);
00072 
00074         void slotPropertyReset(KoProperty::Set& set, KoProperty::Property& property);
00075 
00077         void slotWidgetDestroyed();
00078 
00079 //      void setPropertyValueInDesignMode(QWidget* widget, const QMap<QCString, QVariant> &propValues,
00080         void createPropertyCommandsInDesignMode(QWidget* widget, const QMap<QCString, 
00081             QVariant> &propValues, CommandGroup *group, bool addToActiveForm = true,
00082             bool execFlagForSubCommands = false);
00083 
00084     signals:
00088         void widgetPropertyChanged(QWidget *w, const QCString &property, const QVariant &v);
00089 
00093         void widgetNameChanged(const QCString &oldname, const QCString &newname);
00094 
00095     protected:
00097         void addWidget(QWidget *w);
00098 
00101         void createPropertiesForWidget(QWidget *w);
00102 
00105         KoProperty::Property::ListData* createValueList(WidgetInfo *winfo, const QStringList &list);
00106 
00109         void  updatePropertyValue(ObjectTreeItem *tree, const char *property);
00110 
00113         KoProperty::Set*  set();
00114 
00116         void clearSet(bool dontSignalShowPropertySet = false);
00117 
00120         void saveModifiedProperties();
00121 
00124         bool isNameValid(const QString &name);
00125 
00127         void saveEnabledProperty(bool value);
00128 
00132         bool eventFilter(QObject *o, QEvent *ev);
00133 
00136         void setUndoing(bool isUndoing);
00137 
00138         bool isUndoing();
00139 
00143         bool isPropertyVisible(const QCString &property, bool isTopLevel, 
00144             const QCString &classname=QCString());
00145 
00146         // Following functions are used to create special types of properties, different
00147         // from Q_PROPERTY
00150         void createAlignProperty(const QMetaProperty *meta, QWidget *obj);
00151 
00154         void saveAlignProperty(const QString &property);
00155 
00157         void createLayoutProperty(ObjectTreeItem *item);
00158 
00161         void saveLayoutProperty(const QString &property, const QVariant &value);
00162 
00163         // Some i18n functions
00165         void initPropertiesDescription();
00166 
00169         QString propertyCaption(const QCString &name);
00170 
00172         QString valueCaption(const QCString &name);
00173 
00176         //QStringList captionForList(const QStringList &list);
00177 
00178     private:
00179         WidgetPropertySetPrivate *d;
00180 
00181     friend class FormManager;
00182     friend class PropertyCommand;
00183     friend class LayoutPropertyCommand;
00184     friend class GeometryPropertyCommand;
00185 };
00186 
00187 }
00188 
00189 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys