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-2007 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         virtual ~WidgetLibrary();
00071 
00075         ActionList createWidgetActions(KXMLGUIClient* client, KActionCollection *parent, 
00076             QObject *receiver, const char *slot);
00077 
00078         void addCustomWidgetActions(KActionCollection *col);
00079 
00080 //old       /**
00081 //old        * creates the XML for widget actions
00082 //old        */
00083 //old       QString createXML();
00084 
00089         QWidget *createWidget(const QCString &classname, QWidget *parent, const char *name, Container *c,
00090             int options = WidgetFactory::DefaultOptions);
00091 
00092         bool createMenuActions(const QCString &c, QWidget *w, QPopupMenu *menu,
00093             KFormDesigner::Container *container);
00094 
00102         WidgetFactory::CreateWidgetOptions showOrientationSelectionPopup(
00103             const QCString &classname, QWidget* parent, const QPoint& pos);
00104 
00105         QString internalProperty(const QCString& classname, const QCString& property);
00106 
00107         QString displayName(const QCString &classname);
00108         QString namePrefix(const QCString &classname);
00109         QString textForWidgetName(const QCString &name, const QCString &className);
00110 
00114         QCString classNameForAlternate(const QCString &classname);
00115         QString iconName(const QCString &classname);
00116         QString includeFileName(const QCString &classname);
00117         QString savingName(const QCString &classname);
00118 
00119         bool startEditing(const QCString &classname, QWidget *w, Container *container);
00120         bool previewWidget(const QCString &classname, QWidget *widget, Container *container);
00121         bool clearWidgetContent(const QCString &classname, QWidget *w);
00122 
00123         bool saveSpecialProperty(const QCString &classname, const QString &name,
00124             const QVariant &value, QWidget *w, QDomElement &parentNode, QDomDocument &parent);
00125         bool readSpecialProperty(const QCString &classname, QDomElement &node, QWidget *w,
00126             ObjectTreeItem *item);
00127         bool isPropertyVisible(const QCString &classname, QWidget *w,
00128             const QCString &property, bool multiple = false, bool isTopLevel = false);
00129 
00130         QValueList<QCString> autoSaveProperties(const QCString &classname);
00131 
00132         WidgetInfo* widgetInfoForClassName(const char* classname);
00133 
00134         WidgetFactory* factoryForClassName(const char* className);
00135 
00136         WidgetFactory* factory(const char* factoryName) const;
00137 
00142         bool advancedPropertiesVisible() const;
00143 
00145         void setAdvancedPropertiesVisible(bool set);
00146 
00155         QString propertyDescForName(WidgetInfo *winfo, const QCString& propertyName);
00156 
00163         QString propertyDescForValue(WidgetInfo *winfo, const QCString& name);
00164 
00166         void setPropertyOptions( WidgetPropertySet &list, const WidgetInfo& winfo, QWidget* w );
00167 
00170         bool propertySetShouldBeReloadedAfterPropertyChange(const QCString& classname, QWidget *w, 
00171             const QCString& property);
00172 
00173     signals:
00174         void prepareInsert(const QCString &c);
00175 
00178         void widgetCreated(QWidget *widget);
00179 
00180     protected:
00185         void loadFactoryWidgets(WidgetFactory *f);
00186 
00187 #if 0 //UNIMPLEMENTED
00188 
00195         void setFilter(const QRegExp &expr);
00196 #endif
00197 
00201         void lookupFactories();
00202 
00206         void loadFactories();
00207 
00208         WidgetLibraryPrivate *d;
00209 };
00210 
00211 }
00212 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys