tools/designer/src/lib/sdk/abstractformwindow.h
changeset 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the Qt Designer of the Qt Toolkit.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 
       
    42 #ifndef ABSTRACTFORMWINDOW_H
       
    43 #define ABSTRACTFORMWINDOW_H
       
    44 
       
    45 #include <QtDesigner/sdk_global.h>
       
    46 
       
    47 #include <QtGui/QWidget>
       
    48 
       
    49 QT_BEGIN_HEADER
       
    50 
       
    51 QT_BEGIN_NAMESPACE
       
    52 
       
    53 class QDesignerFormEditorInterface;
       
    54 class QDesignerFormWindowCursorInterface;
       
    55 class QDesignerFormWindowToolInterface;
       
    56 class DomUI;
       
    57 class QUndoStack;
       
    58 class QDir;
       
    59 
       
    60 class QDESIGNER_SDK_EXPORT QDesignerFormWindowInterface: public QWidget
       
    61 {
       
    62     Q_OBJECT
       
    63 public:
       
    64     enum FeatureFlag
       
    65     {
       
    66         EditFeature = 0x01,
       
    67         GridFeature = 0x02,
       
    68         TabOrderFeature = 0x04,
       
    69         DefaultFeature = EditFeature | GridFeature
       
    70     };
       
    71     Q_DECLARE_FLAGS(Feature, FeatureFlag)
       
    72 
       
    73 public:
       
    74     QDesignerFormWindowInterface(QWidget *parent = 0, Qt::WindowFlags flags = 0);
       
    75     virtual ~QDesignerFormWindowInterface();
       
    76 
       
    77     virtual QString fileName() const = 0;
       
    78     virtual QDir absoluteDir() const = 0;
       
    79 
       
    80     virtual QString contents() const = 0;
       
    81     virtual void setContents(QIODevice *dev) = 0;
       
    82 
       
    83     virtual Feature features() const = 0;
       
    84     virtual bool hasFeature(Feature f) const = 0;
       
    85 
       
    86     virtual QString author() const = 0;
       
    87     virtual void setAuthor(const QString &author) = 0;
       
    88 
       
    89     virtual QString comment() const = 0;
       
    90     virtual void setComment(const QString &comment) = 0;
       
    91 
       
    92     virtual void layoutDefault(int *margin, int *spacing) = 0;
       
    93     virtual void setLayoutDefault(int margin, int spacing) = 0;
       
    94 
       
    95     virtual void layoutFunction(QString *margin, QString *spacing) = 0;
       
    96     virtual void setLayoutFunction(const QString &margin, const QString &spacing) = 0;
       
    97 
       
    98     virtual QString pixmapFunction() const = 0;
       
    99     virtual void setPixmapFunction(const QString &pixmapFunction) = 0;
       
   100 
       
   101     virtual QString exportMacro() const = 0;
       
   102     virtual void setExportMacro(const QString &exportMacro) = 0;
       
   103 
       
   104     virtual QStringList includeHints() const = 0;
       
   105     virtual void setIncludeHints(const QStringList &includeHints) = 0;
       
   106 
       
   107     virtual QDesignerFormEditorInterface *core() const;
       
   108     virtual QDesignerFormWindowCursorInterface *cursor() const = 0;
       
   109 
       
   110     virtual int toolCount() const = 0;
       
   111 
       
   112     virtual int currentTool() const = 0;
       
   113     virtual void setCurrentTool(int index) = 0;
       
   114 
       
   115     virtual QDesignerFormWindowToolInterface *tool(int index) const = 0;
       
   116     virtual void registerTool(QDesignerFormWindowToolInterface *tool) = 0;
       
   117 
       
   118     virtual QPoint grid() const = 0;
       
   119 
       
   120     virtual QWidget *mainContainer() const = 0;
       
   121     virtual void setMainContainer(QWidget *mainContainer) = 0;
       
   122 
       
   123     virtual bool isManaged(QWidget *widget) const = 0;
       
   124 
       
   125     virtual bool isDirty() const = 0;
       
   126 
       
   127     static QDesignerFormWindowInterface *findFormWindow(QWidget *w);
       
   128     static QDesignerFormWindowInterface *findFormWindow(QObject *obj);
       
   129 
       
   130     virtual QUndoStack *commandHistory() const = 0;
       
   131     virtual void beginCommand(const QString &description) = 0;
       
   132     virtual void endCommand() = 0;
       
   133 
       
   134     virtual void simplifySelection(QList<QWidget*> *widgets) const = 0;
       
   135 
       
   136     // notifications
       
   137     virtual void emitSelectionChanged() = 0;
       
   138 
       
   139     virtual QStringList resourceFiles() const = 0;
       
   140     virtual void addResourceFile(const QString &path) = 0;
       
   141     virtual void removeResourceFile(const QString &path) = 0;
       
   142 
       
   143     virtual void ensureUniqueObjectName(QObject *object) = 0;
       
   144 
       
   145 public Q_SLOTS:
       
   146     virtual void manageWidget(QWidget *widget) = 0;
       
   147     virtual void unmanageWidget(QWidget *widget) = 0;
       
   148 
       
   149     virtual void setFeatures(Feature f) = 0;
       
   150     virtual void setDirty(bool dirty) = 0;
       
   151     virtual void clearSelection(bool changePropertyDisplay = true) = 0;
       
   152     virtual void selectWidget(QWidget *w, bool select = true) = 0;
       
   153     virtual void setGrid(const QPoint &grid) = 0;
       
   154     virtual void setFileName(const QString &fileName) = 0;
       
   155     virtual void setContents(const QString &contents) = 0;
       
   156 
       
   157     virtual void editWidgets() = 0;
       
   158 
       
   159 Q_SIGNALS:
       
   160     void mainContainerChanged(QWidget *mainContainer);
       
   161     void toolChanged(int toolIndex);
       
   162     void fileNameChanged(const QString &fileName);
       
   163     void featureChanged(Feature f);
       
   164     void selectionChanged();
       
   165     void geometryChanged();
       
   166 
       
   167     void resourceFilesChanged();
       
   168 
       
   169     void widgetManaged(QWidget *widget);
       
   170     void widgetUnmanaged(QWidget *widget);
       
   171     void aboutToUnmanageWidget(QWidget *widget);
       
   172     void activated(QWidget *widget);
       
   173 
       
   174     void changed();
       
   175     void widgetRemoved(QWidget *w);
       
   176     void objectRemoved(QObject *o);
       
   177 };
       
   178 
       
   179 QT_END_NAMESPACE
       
   180 
       
   181 QT_END_HEADER
       
   182 
       
   183 #endif // ABSTRACTFORMWINDOW_H