Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package

abstractformeditor.cpp

/****************************************************************************
**
** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
**
** This file is part of the Qt Designer of the Qt Toolkit.
**
** This file may be used under the terms of the GNU General Public
** License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file.  Alternatively you may (at
** your option) use any later version of the GNU General Public
** License if such license has been publicly approved by Trolltech ASA
** (or its successors, if any) and the KDE Free Qt Foundation. In
** addition, as a special exception, Trolltech gives you certain
** additional rights. These rights are described in the Trolltech GPL
** Exception version 1.1, which can be found at
** http://www.trolltech.com/products/qt/gplexception/ and in the file
** GPL_EXCEPTION.txt in this package.
**
** Please review the following information to ensure GNU General
** Public Licensing requirements will be met:
** http://trolltech.com/products/qt/licenses/licensing/opensource/. If
** you are unsure which license is appropriate for your use, please
** review the following information:
** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
** or contact the sales department at sales@trolltech.com.
**
** In addition, as a special exception, Trolltech, as the sole
** copyright holder for Qt Designer, grants users of the Qt/Eclipse
** Integration plug-in the right for the Qt/Eclipse Integration to
** link to functionality provided by Qt Designer and its related
** libraries.
**
** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE. Trolltech reserves all rights not expressly
** granted herein.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
****************************************************************************/

#include "abstractformeditor.h"
#include "private/qobject_p.h"

#include <QtDesigner/QDesignerWidgetBoxInterface>
#include <QtDesigner/QDesignerPropertyEditorInterface>
#include <QtDesigner/QDesignerFormWindowManagerInterface>
#include <QtDesigner/QExtensionManager>
#include <QtDesigner/QDesignerMetaDataBaseInterface>
#include <QtDesigner/QDesignerWidgetDataBaseInterface>
#include <QtDesigner/QDesignerWidgetFactoryInterface>
#include <QtDesigner/QDesignerObjectInspectorInterface>
#include <QtDesigner/QDesignerBrushManagerInterface>
#include <QtDesigner/QDesignerIntegrationInterface>
#include <QtDesigner/QDesignerIconCacheInterface>
#include <QtDesigner/QDesignerActionEditorInterface>
#include <pluginmanager_p.h>
#include <QtDesigner/QDesignerPromotionInterface>

class QDesignerFormEditorInterfacePrivate : public  QObjectPrivate {
public:
    QDesignerFormEditorInterfacePrivate() : m_pluginManager(0),m_promotion(0) {}

    QPointer<QWidget> m_topLevel;
    QPointer<QDesignerWidgetBoxInterface> m_widgetBox;
    QPointer<QDesignerPropertyEditorInterface> m_propertyEditor;
    QPointer<QDesignerFormWindowManagerInterface> m_formWindowManager;
    QPointer<QExtensionManager> m_extensionManager;
    QPointer<QDesignerMetaDataBaseInterface> m_metaDataBase;
    QPointer<QDesignerWidgetDataBaseInterface> m_widgetDataBase;
    QPointer<QDesignerWidgetFactoryInterface> m_widgetFactory;
    QPointer<QDesignerObjectInspectorInterface> m_objectInspector;
    QPointer<QDesignerBrushManagerInterface> m_brushManager;
    QPointer<QDesignerIntegrationInterface> m_integration;
    QPointer<QDesignerIconCacheInterface> m_iconCache;
    QPointer<QDesignerActionEditorInterface> m_actionEditor;
    QDesignerPluginManager *m_pluginManager;
    QDesignerPromotionInterface *m_promotion;
};

/*!
    \class QDesignerFormEditorInterface

    \brief The QDesignerFormEditorInterface class allows you to access
    Qt Designer's various components.

    \inmodule QtDesigner

    \QD's current QDesignerFormEditorInterface object holds
    information about all \QD's components: The action editor, the
    object inspector, the property editor, the widget box, and the
    extension and form window managers. QDesignerFormEditorInterface
    contains a collection of functions that provides interfaces to all
    these components. They are typically used to query (and
    manipulate) the respective component. For example:

    \code
        QDesignerObjectInspectorInterface *objectInspector = 0;
        objectInspector = formEditor->objectInspector();

        QDesignerFormWindowManagerInterface *manager = 0;
        manager = formEditor->formWindowManager();

        objectInspector->setFormWindow(manager->formWindow(0));
    \endcode

    QDesignerFormEditorInterface is not intended to be instantiated
    directly. A pointer to \QD's current QDesignerFormEditorInterface
    object (\c formEditor in the example above) is provided by the
    QDesignerCustomWidgetInterface::initialize() function's
    parameter. When implementing a custom widget plugin, you must
    subclass the QDesignerCustomWidgetInterface to expose your plugin
    to \QD.

    QDesignerFormEditorInterface also provides functions that can set
    the action editor, property editor, object inspector and widget
    box. These are only useful if you want to provide your own custom
    components.

    Finally, QDesignerFormEditorInterface provides the topLevel()
    function that returns \QD's top-level widget.

    \sa QDesignerCustomWidgetInterface
*/

/*!
    Constructs a QDesignerFormEditorInterface object with the given \a
    parent.
*/

00133 QDesignerFormEditorInterface::QDesignerFormEditorInterface(QObject *parent)
    : QObject(*(new QDesignerFormEditorInterfacePrivate), parent),
      m_pad13(0)
{
}

/*!
    Destroys the QDesignerFormEditorInterface object.
*/
00142 QDesignerFormEditorInterface::~QDesignerFormEditorInterface()
{
}

/*!
    Returns an interface to \QD's widget box.

    \sa setWidgetBox()
*/
00151 QDesignerWidgetBoxInterface *QDesignerFormEditorInterface::widgetBox() const
{ 
    Q_D(const QDesignerFormEditorInterface);
    return d->m_widgetBox; 
}

/*!
    Sets \QD's widget box to be the specified \a widgetBox.

    \sa widgetBox()
*/
00162 void QDesignerFormEditorInterface::setWidgetBox(QDesignerWidgetBoxInterface *widgetBox)
{ 
    Q_D(QDesignerFormEditorInterface);
    d->m_widgetBox = widgetBox; 
}

/*!
    Returns an interface to \QD's property editor.

    \sa setPropertyEditor()
*/
00173 QDesignerPropertyEditorInterface *QDesignerFormEditorInterface::propertyEditor() const
{ 
    Q_D(const QDesignerFormEditorInterface);
    return d->m_propertyEditor; 
}

/*!
    Sets \QD's property editor to be the specified \a propertyEditor.

    \sa propertyEditor()
*/
00184 void QDesignerFormEditorInterface::setPropertyEditor(QDesignerPropertyEditorInterface *propertyEditor)
{ 
    Q_D(QDesignerFormEditorInterface);
    d->m_propertyEditor = propertyEditor; 
}

/*!
    Returns an interface to \QD's action editor.

    \sa setActionEditor()
*/
00195 QDesignerActionEditorInterface *QDesignerFormEditorInterface::actionEditor() const
{ 
    Q_D(const QDesignerFormEditorInterface);
    return d->m_actionEditor; 
}

/*!
    Sets \QD's action editor to be the specified \a actionEditor.

    \sa actionEditor()
*/
00206 void QDesignerFormEditorInterface::setActionEditor(QDesignerActionEditorInterface *actionEditor)
{ 
    Q_D(QDesignerFormEditorInterface);
    d->m_actionEditor = actionEditor; 
}

/*!
    Returns \QD's top-level widget.
*/
00215 QWidget *QDesignerFormEditorInterface::topLevel() const
{ 
    Q_D(const QDesignerFormEditorInterface);
    return d->m_topLevel; 
}

/*!
    \internal
*/
00224 void QDesignerFormEditorInterface::setTopLevel(QWidget *topLevel)
{ 
    Q_D(QDesignerFormEditorInterface);
    d->m_topLevel = topLevel; 
}

/*!
    Returns an interface to \QD's form window manager.
*/
00233 QDesignerFormWindowManagerInterface *QDesignerFormEditorInterface::formWindowManager() const
{
    Q_D(const QDesignerFormEditorInterface);
    return d->m_formWindowManager; 
}

/*!
    \internal
*/
00242 void QDesignerFormEditorInterface::setFormManager(QDesignerFormWindowManagerInterface *formWindowManager)
{ 
    Q_D(QDesignerFormEditorInterface);
    d->m_formWindowManager = formWindowManager; 
}

/*!
    Returns an interface to \QD's extension manager.
*/
00251 QExtensionManager *QDesignerFormEditorInterface::extensionManager() const
{ 
    Q_D(const QDesignerFormEditorInterface);
    return d->m_extensionManager; 
}

/*!
    \internal
*/
00260 void QDesignerFormEditorInterface::setExtensionManager(QExtensionManager *extensionManager)
{ 
    Q_D(QDesignerFormEditorInterface);
    d->m_extensionManager = extensionManager; 
}

/*!
    \internal

    Returns an interface to the meta database used by the form editor.
*/
00271 QDesignerMetaDataBaseInterface *QDesignerFormEditorInterface::metaDataBase() const
{ 
    Q_D(const QDesignerFormEditorInterface);
    return d->m_metaDataBase; 
}

/*!
    \internal
*/
00280 void QDesignerFormEditorInterface::setMetaDataBase(QDesignerMetaDataBaseInterface *metaDataBase)
{ 
    Q_D(QDesignerFormEditorInterface);
    d->m_metaDataBase = metaDataBase; 
}

/*!
    \internal

    Returns an interface to the widget database used by the form editor.
*/
00291 QDesignerWidgetDataBaseInterface *QDesignerFormEditorInterface::widgetDataBase() const
{
    Q_D(const QDesignerFormEditorInterface);
    return d->m_widgetDataBase;
}

/*!
    \internal
*/
00300 void QDesignerFormEditorInterface::setWidgetDataBase(QDesignerWidgetDataBaseInterface *widgetDataBase)
{
    Q_D(QDesignerFormEditorInterface);
    d->m_widgetDataBase = widgetDataBase; 
}

/*!
    \internal

    Returns an interface to the designer promotion handler.
*/

00312 QDesignerPromotionInterface *QDesignerFormEditorInterface::promotion() const
{
    Q_D(const QDesignerFormEditorInterface);
    return d->m_promotion;
}

/*!
    \internal

    Sets the designer promotion handler.
*/

00324 void QDesignerFormEditorInterface::setPromotion(QDesignerPromotionInterface *promotion)
{
    Q_D(QDesignerFormEditorInterface);
    d->m_promotion = promotion;
}

/*!
    \internal

    Returns an interface to the widget factory used by the form editor
    to create widgets for the form.
*/
00336 QDesignerWidgetFactoryInterface *QDesignerFormEditorInterface::widgetFactory() const
{ 
    Q_D(const QDesignerFormEditorInterface);
    return d->m_widgetFactory;
}

/*!
    \internal
*/
00345 void QDesignerFormEditorInterface::setWidgetFactory(QDesignerWidgetFactoryInterface *widgetFactory)
{
    Q_D(QDesignerFormEditorInterface);
    d->m_widgetFactory = widgetFactory; 
}

/*!
    Returns an interface to \QD's object inspector.
*/
00354 QDesignerObjectInspectorInterface *QDesignerFormEditorInterface::objectInspector() const
{
    Q_D(const QDesignerFormEditorInterface);
    return d->m_objectInspector; 
}

/*!
    Sets \QD's object inspector to be the specified \a
    objectInspector.

    \sa objectInspector()
*/
00366 void QDesignerFormEditorInterface::setObjectInspector(QDesignerObjectInspectorInterface *objectInspector)
{ 
    Q_D(QDesignerFormEditorInterface);
    d->m_objectInspector = objectInspector;
}

/*!
    \internal

    Returns an interface to the brush manager used by the palette editor.
*/
00377 QDesignerBrushManagerInterface *QDesignerFormEditorInterface::brushManager() const
{ 
    Q_D(const QDesignerFormEditorInterface);
    return d->m_brushManager; 
}

/*!
    \internal
*/
00386 void QDesignerFormEditorInterface::setBrushManager(QDesignerBrushManagerInterface *brushManager)
{
    Q_D(QDesignerFormEditorInterface);
    d->m_brushManager = brushManager; 
}

/*!
    \internal

    Returns an interface to the integration.
*/
00397 QDesignerIntegrationInterface *QDesignerFormEditorInterface::integration() const
{ 
    Q_D(const QDesignerFormEditorInterface);
    return d->m_integration; 
}

/*!
    \internal
*/
00406 void QDesignerFormEditorInterface::setIntegration(QDesignerIntegrationInterface *integration)
{ 
    Q_D(QDesignerFormEditorInterface);
    d->m_integration = integration; 
}

/*!
    \internal

    Returns an interface to the icon cache used by the form editor to
    manage icons.
*/
00418 QDesignerIconCacheInterface *QDesignerFormEditorInterface::iconCache() const
{ 
    Q_D(const QDesignerFormEditorInterface);
    return d->m_iconCache; 
}

/*!
    \internal
*/
00427 void QDesignerFormEditorInterface::setIconCache(QDesignerIconCacheInterface *cache)
{ 
    Q_D(QDesignerFormEditorInterface);
    d->m_iconCache = cache; 
}

/*!
    \internal

    Returns the plugin manager used by the form editor.
*/
00438 QDesignerPluginManager *QDesignerFormEditorInterface::pluginManager() const
{ 
    Q_D(const QDesignerFormEditorInterface);
    return d->m_pluginManager; 
}

/*!
    \internal

    Sets the plugin manager used by the form editor to the specified
    \a pluginManager.
*/
00450 void QDesignerFormEditorInterface::setPluginManager(QDesignerPluginManager *pluginManager)
{ 
    Q_D(QDesignerFormEditorInterface);
    d->m_pluginManager = pluginManager; 
}

/*!
    \internal

    Returns the path to the resources used by the form editor.
*/
00461 QString QDesignerFormEditorInterface::resourceLocation() const
{
#ifdef Q_WS_MAC
    return QLatin1String(":/trolltech/formeditor/images/mac");
#else
    return QLatin1String(":/trolltech/formeditor/images/win");
#endif
}

Generated by  Doxygen 1.6.0   Back to index