kexi

widgetlibrary.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2003 Lucijan Busch <lucijan@gmx.at>
00003    Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>
00004    Copyright (C) 2004-2005 Jaroslaw Staniek <js@iidea.pl>
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public
00008    License as published by the Free Software Foundation; either
00009    version 2 of the License, or (at your option) any later version.
00010 
00011    This library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Library General Public License for more details.
00015 
00016    You should have received a copy of the GNU Library General Public License
00017    along with this library; see the file COPYING.LIB.  If not, write to
00018    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019  * Boston, MA 02110-1301, USA.
00020 */
00021 
00022 #ifndef KFORMDESIGNERWIDGETLIBRARY_H
00023 #define KFORMDESIGNERWIDGETLIBRARY_H
00024 
00025 #include <qobject.h>
00026 #include <qmap.h>
00027 #include <qdict.h>
00028 
00029 #include "widgetfactory.h"
00030 
00031 template<class type> class QPtrList;
00032 template<class type> class QValueVector;
00033 class KActionCollection;
00034 class KAction;
00035 class QWidget;
00036 class QPopupMenu;
00037 class QVariant;
00038 class QDomDocument;
00039 class QDomElement;
00040 
00041 namespace KFormDesigner {
00042 
00043 class Container;
00044 class ObjectTreeItem;
00045 class WidgetLibraryPrivate;
00046 class WidgetPropertySet;
00047 
00048 typedef QPtrList<KAction> ActionList;
00049 
00056 class KFORMEDITOR_EXPORT WidgetLibrary : public QObject
00057 {
00058     Q_OBJECT
00059 
00060     public:
00068         WidgetLibrary(QObject *parent=0, const QStringList& supportedFactoryGroups = QStringList());
00069 
00070         ~WidgetLibrary();
00071 
00075         ActionList addCreateWidgetActions(KActionCollection *parent, QObject *receiver, const char *slot);
00076 
00077         void addCustomWidgetActions(KActionCollection *parent);
00078 
00082         QString createXML();
00083 
00088         QWidget *createWidget(const QCString &classname, QWidget *parent, const char *name, Container *c,
00089             int options = WidgetFactory::DefaultOptions);
00090 
00091         bool createMenuActions(const QCString &c, QWidget *w, QPopupMenu *menu,
00092             KFormDesigner::Container *container);
00093 
00101         WidgetFactory::CreateWidgetOptions showOrientationSelectionPopup(
00102             const QCString &classname, QWidget* parent, const QPoint& pos);
00103 
00104         QString internalProperty(const QCString& classname, const QCString& property);
00105 
00106         QString displayName(const QCString &classname);
00107         QString namePrefix(const QCString &classname);
00108         QString textForWidgetName(const QCString &name, const QCString &className);
00109 
00113         QCString classNameForAlternate(const QCString &classname);
00114         QString iconName(const QCString &classname);
00115         QString includeFileName(const QCString &classname);
00116         QString savingName(const QCString &classname);
00117 
00118         bool startEditing(const QCString &classname, QWidget *w, Container *container);
00119         bool previewWidget(const QCString &classname, QWidget *widget, Container *container);
00120         bool clearWidgetContent(const QCString &classname, QWidget *w);
00121 
00122         bool saveSpecialProperty(const QCString &classname, const QString &name,
00123             const QVariant &value, QWidget *w, QDomElement &parentNode, QDomDocument &parent);
00124         bool readSpecialProperty(const QCString &classname, QDomElement &node, QWidget *w,
00125             ObjectTreeItem *item);
00126         bool isPropertyVisible(const QCString &classname, QWidget *w,
00127             const QCString &property, bool multiple = false, bool isTopLevel = false);
00128 
00129         QValueList<QCString> autoSaveProperties(const QCString &classname);
00130 
00131         WidgetInfo* widgetInfoForClassName(const char* classname);
00132 
00133         WidgetFactory* factoryForClassName(const char* className);
00134 
00135         WidgetFactory* factory(const char* factoryName) const;
00136 
00141         bool advancedPropertiesVisible() const;
00142 
00144         void setAdvancedPropertiesVisible(bool set);
00145 
00154         QString propertyDescForName(WidgetInfo *winfo, const QCString& propertyName);
00155 
00162         QString propertyDescForValue(WidgetInfo *winfo, const QCString& name);
00163 
00165         void setPropertyOptions( WidgetPropertySet &list, const WidgetInfo& winfo, QWidget* w );
00166 
00167     signals:
00168         void prepareInsert(const QCString &c);
00169 
00170     protected:
00175         void loadFactoryWidgets(WidgetFactory *f);
00176 
00177 #if 0 //UNIMPLEMENTED
00178 
00185         void setFilter(const QRegExp &expr);
00186 #endif
00187 
00191         void lookupFactories();
00192 
00196         void loadFactories();
00197 
00198         WidgetLibraryPrivate *d;
00199 };
00200 
00201 }
00202 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys