kexi

widgetpropertyset.h
1/* This file is part of the KDE project
2 Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>
3 Copyright (C) 2004-2006 Jaroslaw Staniek <js@iidea.pl>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19*/
20
21#ifndef KFD_WIDGETPROPERTYSET_H
22#define KFD_WIDGETPROPERTYSET_H
23
24#include <tqobject.h>
25#include <tqstrlist.h>
26
27#include <koproperty/set.h>
28#include <koproperty/property.h>
29
30class TQMetaObject;
31class TQWidget;
32
33namespace KFormDesigner {
34
35class FormManager;
36class ObjectTreeItem;
37class WidgetPropertySetPrivate;
38class WidgetInfo;
39class CommandGroup;
40
41class KFORMEDITOR_EXPORT WidgetPropertySet : public TQObject
42{
43 TQ_OBJECT
44
45
46 public:
47 WidgetPropertySet(TQObject *parent);
48 ~WidgetPropertySet();
49
50// FormManager* manager();
51
52 KoProperty::Property& operator[](const TQCString &name);
53
54 KoProperty::Property& property(const TQCString &name);
55
56 bool contains(const TQCString &property);
57
60 void addPropertyCaption(const TQCString &property, const TQString &caption);
61
62 void addValueCaption(const TQCString &value, const TQString &caption);
63
64 public slots:
73 void setSelectedWidget(TQWidget *w, bool add = false, bool forceReload = false,
74 bool moreWillBeSelected = false);
75
76 void setSelectedWidgetWithoutReload(TQWidget *w, bool add = false, bool moreWillBeSelected = false) {
77 setSelectedWidget(w, add, false, moreWillBeSelected);
78 }
79
82 void slotPropertyChanged(KoProperty::Set& set, KoProperty::Property& property);
83
85 void slotPropertyReset(KoProperty::Set& set, KoProperty::Property& property);
86
88 void slotWidgetDestroyed();
89
90// void setPropertyValueInDesignMode(TQWidget* widget, const TQMap<TQCString, TQVariant> &propValues,
91 void createPropertyCommandsInDesignMode(TQWidget* widget, const TQMap<TQCString,
92 TQVariant> &propValues, CommandGroup *group, bool addToActiveForm = true,
93 bool execFlagForSubCommands = false);
94
95 signals:
99 void widgetPropertyChanged(TQWidget *w, const TQCString &property, const TQVariant &v);
100
104 void widgetNameChanged(const TQCString &oldname, const TQCString &newname);
105
106 protected:
108 void addWidget(TQWidget *w);
109
112 void createPropertiesForWidget(TQWidget *w);
113
116 KoProperty::Property::ListData* createValueList(WidgetInfo *winfo, const TQStringList &list);
117
120 void updatePropertyValue(ObjectTreeItem *tree, const char *property, const TQMetaProperty *meta = 0);
121
124 KoProperty::Set* set();
125
127 void clearSet(bool dontSignalShowPropertySet = false);
128
131 void saveModifiedProperties();
132
135 bool isNameValid(const TQString &name);
136
138 void saveEnabledProperty(bool value);
139
143 bool eventFilter(TQObject *o, TQEvent *ev);
144
147 void setUndoing(bool isUndoing);
148
149 bool isUndoing();
150
154 bool isPropertyVisible(const TQCString &property, bool isTopLevel,
155 const TQCString &classname=TQCString());
156
157 // Following functions are used to create special types of properties, different
158 // from TQ_PROPERTY
159
165 void createAlignProperty(const TQMetaProperty *meta, TQWidget *widget, TQWidget *subwidget);
166
169 void saveAlignProperty(const TQString &property);
170
172 void createLayoutProperty(ObjectTreeItem *item);
173
176 void saveLayoutProperty(const TQString &property, const TQVariant &value);
177
178 // Some i18n functions
180 void initPropertiesDescription();
181
184 TQString propertyCaption(const TQCString &name);
185
187 TQString valueCaption(const TQCString &name);
188
191 //TQStringList captionForList(const TQStringList &list);
192
194 void emitWidgetPropertyChanged(TQWidget *w, const TQCString& property, const TQVariant& value);
195
196 private:
197 WidgetPropertySetPrivate *d;
198
199 friend class FormManager;
200 friend class PropertyCommand;
201 friend class LayoutPropertyCommand;
202 friend class GeometryPropertyCommand;
203};
204
205}
206
207#endif
A class to manage (create/load/save) Forms.
Definition formmanager.h:73
An item representing a widget Holds the properties of a widget (classname, name, parent,...
Definition objecttree.h:59
This class holds properties of widget classes provided by a factory.