kexi

widgetlibrary.h
1/* This file is part of the KDE project
2 Copyright (C) 2003 Lucijan Busch <lucijan@gmx.at>
3 Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>
4 Copyright (C) 2004-2007 Jaroslaw Staniek <js@iidea.pl>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20*/
21
22#ifndef KFORMDESIGNERWIDGETLIBRARY_H
23#define KFORMDESIGNERWIDGETLIBRARY_H
24
25#include <tqobject.h>
26#include <tqmap.h>
27#include <tqdict.h>
28
29#include "widgetfactory.h"
30
31template<class type> class TQPtrList;
32template<class type> class TQValueVector;
33class TDEActionCollection;
34class TDEAction;
35class TQWidget;
36class TQPopupMenu;
37class TQVariant;
38class TQDomDocument;
39class TQDomElement;
40
41namespace KFormDesigner {
42
43class Container;
44class ObjectTreeItem;
45class WidgetLibraryPrivate;
46class WidgetPropertySet;
47
48typedef TQPtrList<TDEAction> ActionList;
49
56class KFORMEDITOR_EXPORT WidgetLibrary : public TQObject
57{
58 TQ_OBJECT
59
60
61 public:
69 WidgetLibrary(TQObject *parent=0, const TQStringList& supportedFactoryGroups = TQStringList());
70
71 virtual ~WidgetLibrary();
72
76 ActionList createWidgetActions(KXMLGUIClient* client, TDEActionCollection *parent,
77 TQObject *receiver, const char *slot);
78
79 void addCustomWidgetActions(TDEActionCollection *col);
80
81//old /**
82//old * creates the XML for widget actions
83//old */
84//old TQString createXML();
85
90 TQWidget *createWidget(const TQCString &classname, TQWidget *parent, const char *name, Container *c,
91 int options = WidgetFactory::DefaultOptions);
92
93 bool createMenuActions(const TQCString &c, TQWidget *w, TQPopupMenu *menu,
94 KFormDesigner::Container *container);
95
104 const TQCString &classname, TQWidget* parent, const TQPoint& pos);
105
106 TQString internalProperty(const TQCString& classname, const TQCString& property);
107
108 TQString displayName(const TQCString &classname);
109 TQString namePrefix(const TQCString &classname);
110 TQString textForWidgetName(const TQCString &name, const TQCString &className);
111
115 TQCString classNameForAlternate(const TQCString &classname);
116 TQString iconName(const TQCString &classname);
117 TQString includeFileName(const TQCString &classname);
118 TQString savingName(const TQCString &classname);
119
120 bool startEditing(const TQCString &classname, TQWidget *w, Container *container);
121 bool previewWidget(const TQCString &classname, TQWidget *widget, Container *container);
122 bool clearWidgetContent(const TQCString &classname, TQWidget *w);
123
124 bool saveSpecialProperty(const TQCString &classname, const TQString &name,
125 const TQVariant &value, TQWidget *w, TQDomElement &parentNode, TQDomDocument &parent);
126 bool readSpecialProperty(const TQCString &classname, TQDomElement &node, TQWidget *w,
127 ObjectTreeItem *item);
128 bool isPropertyVisible(const TQCString &classname, TQWidget *w,
129 const TQCString &property, bool multiple = false, bool isTopLevel = false);
130
131 TQValueList<TQCString> autoSaveProperties(const TQCString &classname);
132
133 WidgetInfo* widgetInfoForClassName(const char* classname);
134
135 WidgetFactory* factoryForClassName(const char* className);
136
137 WidgetFactory* factory(const char* factoryName) const;
138
143 bool advancedPropertiesVisible() const;
144
146 void setAdvancedPropertiesVisible(bool set);
147
156 TQString propertyDescForName(WidgetInfo *winfo, const TQCString& propertyName);
157
164 TQString propertyDescForValue(WidgetInfo *winfo, const TQCString& name);
165
167 void setPropertyOptions( WidgetPropertySet &list, const WidgetInfo& winfo, TQWidget* w );
168
171 bool propertySetShouldBeReloadedAfterPropertyChange(const TQCString& classname, TQWidget *w,
172 const TQCString& property);
173
174 signals:
175 void prepareInsert(const TQCString &c);
176
179 void widgetCreated(TQWidget *widget);
180
181 protected:
187
188#if 0 //UNIMPLEMENTED
196 void setFilter(const TQRegExp &expr);
197#endif
198
202 void lookupFactories();
203
207 void loadFactories();
208
209 WidgetLibraryPrivate *d;
210};
211
212}
213#endif
This class makes a container out of any TQWidget.
Definition container.h:74
An item representing a widget Holds the properties of a widget (classname, name, parent,...
Definition objecttree.h:59
The base class for all widget Factories.
CreateWidgetOptions
Options used in createWidget().
This class holds properties of widget classes provided by a factory.
TQCString classNameForAlternate(const TQCString &classname)
ActionList createWidgetActions(KXMLGUIClient *client, TDEActionCollection *parent, TQObject *receiver, const char *slot)
creates actions for widget creating
TQWidget * createWidget(const TQCString &classname, TQWidget *parent, const char *name, Container *c, int options=WidgetFactory::DefaultOptions)
searches the right factory and creates a widget.
WidgetFactory::CreateWidgetOptions showOrientationSelectionPopup(const TQCString &classname, TQWidget *parent, const TQPoint &pos)
Shows orientation selection popup.
void setAdvancedPropertiesVisible(bool set)
void widgetCreated(TQWidget *widget)
TQString propertyDescForName(WidgetInfo *winfo, const TQCString &propertyName)
TQString propertyDescForValue(WidgetInfo *winfo, const TQCString &name)
WidgetLibrary(TQObject *parent=0, const TQStringList &supportedFactoryGroups=TQStringList())
void loadFactories()
Loads widget factories found in lookupFactories().
void lookupFactories()
Lookups widget factories list (note that this function get called once in ctor).
void setPropertyOptions(WidgetPropertySet &list, const WidgetInfo &winfo, TQWidget *w)
bool propertySetShouldBeReloadedAfterPropertyChange(const TQCString &classname, TQWidget *w, const TQCString &property)
void loadFactoryWidgets(WidgetFactory *f)
Adds a factory to the library, creates actions for widgets in the added factory.