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-2006 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:
00072         void setSelectedWidget(QWidget *w, bool add = false, bool forceReload = false,
00073             bool moreWillBeSelected = false);
00074 
00075         void setSelectedWidgetWithoutReload(QWidget *w, bool add = false, bool moreWillBeSelected = false) {
00076             setSelectedWidget(w, add, false, moreWillBeSelected);
00077         }
00078 
00081         void slotPropertyChanged(KoProperty::Set& set, KoProperty::Property& property);
00082 
00084         void slotPropertyReset(KoProperty::Set& set, KoProperty::Property& property);
00085 
00087         void slotWidgetDestroyed();
00088 
00089 //      void setPropertyValueInDesignMode(QWidget* widget, const QMap<QCString, QVariant> &propValues,
00090         void createPropertyCommandsInDesignMode(QWidget* widget, const QMap<QCString, 
00091             QVariant> &propValues, CommandGroup *group, bool addToActiveForm = true,
00092             bool execFlagForSubCommands = false);
00093 
00094     signals:
00098         void widgetPropertyChanged(QWidget *w, const QCString &property, const QVariant &v);
00099 
00103         void widgetNameChanged(const QCString &oldname, const QCString &newname);
00104 
00105     protected:
00107         void addWidget(QWidget *w);
00108 
00111         void createPropertiesForWidget(QWidget *w);
00112 
00115         KoProperty::Property::ListData* createValueList(WidgetInfo *winfo, const QStringList &list);
00116 
00119         void  updatePropertyValue(ObjectTreeItem *tree, const char *property, const QMetaProperty *meta = 0);
00120 
00123         KoProperty::Set*  set();
00124 
00126         void clearSet(bool dontSignalShowPropertySet = false);
00127 
00130         void saveModifiedProperties();
00131 
00134         bool isNameValid(const QString &name);
00135 
00137         void saveEnabledProperty(bool value);
00138 
00142         bool eventFilter(QObject *o, QEvent *ev);
00143 
00146         void setUndoing(bool isUndoing);
00147 
00148         bool isUndoing();
00149 
00153         bool isPropertyVisible(const QCString &property, bool isTopLevel, 
00154             const QCString &classname=QCString());
00155 
00156         // Following functions are used to create special types of properties, different
00157         // from Q_PROPERTY
00158 
00164         void createAlignProperty(const QMetaProperty *meta, QWidget *widget, QWidget *subwidget);
00165 
00168         void saveAlignProperty(const QString &property);
00169 
00171         void createLayoutProperty(ObjectTreeItem *item);
00172 
00175         void saveLayoutProperty(const QString &property, const QVariant &value);
00176 
00177         // Some i18n functions
00179         void initPropertiesDescription();
00180 
00183         QString propertyCaption(const QCString &name);
00184 
00186         QString valueCaption(const QCString &name);
00187 
00190         //QStringList captionForList(const QStringList &list);
00191 
00193         void emitWidgetPropertyChanged(QWidget *w, const QCString& property, const QVariant& value);
00194 
00195     private:
00196         WidgetPropertySetPrivate *d;
00197 
00198     friend class FormManager;
00199     friend class PropertyCommand;
00200     friend class LayoutPropertyCommand;
00201     friend class GeometryPropertyCommand;
00202 };
00203 
00204 }
00205 
00206 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys